1
0
Fork 0

chore: Port FreeSewing.dev to docusaurus

The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
This commit is contained in:
Joost De Cock 2024-09-28 13:13:48 +02:00
parent 497633d1d3
commit ab3204f9f1
692 changed files with 11037 additions and 20674 deletions

View file

@ -0,0 +1,44 @@
---
title: Defs.asRenderProps()
---
Returns the Defs as render props, suitable for front-end rendering.
## Signature
```js
Object defs.asRenderProps()
```
The object returned by this method will have a `list` property that
holds all the defs, as well as a `asSvg` property that holds the result
of [Defs.render()](/reference/api/defs/render):
```js
{
list: {
button: `<g id="button" transform="scale(1)">
<circle cx="0" cy="0" r="3.4" class="mark"></circle>
<circle cx="-1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="-1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
</g>`,
buttonhole: `<g id="buttonhole" transform="scale(1)">
<path class="mark" d="M -1,-5 L 1,-5 L 1,5 L -1,5 z"></path>
</g>`,
},
forSvg: `
<g id="button" transform="scale(1)">
<circle cx="0" cy="0" r="3.4" class="mark"></circle>
<circle cx="-1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="-1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
</g>
<g id="buttonhole" transform="scale(1)">
<path class="mark" d="M -1,-5 L 1,-5 L 1,5 L -1,5 z"></path>
</g>
`
}
```

View file

@ -0,0 +1,11 @@
---
title: Defs.clone()
---
Returns a Defs object that is a deep copy of this one.
## Signature
```js
Defs defs.clone()
```

View file

@ -0,0 +1,12 @@
---
title: Defs.get()
---
Returns the value of a defs entry stored under _name_.
## Signature
```js
String defs.get(string name)
```

View file

@ -0,0 +1,22 @@
---
title: Defs
---
The `Defs` object in FreeSewing's core library represents an SVG document's
[`defs` element](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs).
It is not directly exposed, but it is available as the `defs` attribute
of an [Svg object](/reference/api/svg/defs).
While the properties and methods exposed by this object are typically only used internally,
they are documented here to facilitate development of plugins.
## Properties
A Defs object comes with the following property:
- `list` : Holds the internal object in which entries of the `defs` element are stored
## Defs methods
<ReadMore />

View file

@ -0,0 +1,15 @@
---
title: Defs.remove()
---
Removes the defs entry stored under _name_.
## Signature
```js
Defs defs.remove(string name)
```
This object is chainable as it returns the `Defs` object.

View file

@ -0,0 +1,27 @@
---
title: Defs.render()
---
Renders the added Defs as a string suitable for inclusion in an SVG document `defs` element.
## Signature
```js
String defs.render()
```
This function is called by [svg.render()](/reference/api/svg/render) internally.
Its output will look something like this:
```()
<g id="button" transform="scale(1)">
<circle cx="0" cy="0" r="3.4" class="mark"></circle>
<circle cx="-1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="-1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
<circle cx="-1" cy="1" r="0.5" class="no-stroke fill-mark"></circle>
</g>
<g id="buttonhole" transform="scale(1)">
<path class="mark" d="M -1,-5 L 1,-5 L 1,5 L -1,5 z"></path>
</g>
```

View file

@ -0,0 +1,17 @@
---
title: Defs.set()
---
Sets the defs entry stored under _name_ to _value_.
## Signature
```js
Defs defs.set(
String name,
String value
)
```
This object is chainable as it returns the `Defs` object.

View file

@ -0,0 +1,17 @@
---
title: Defs.setIfUnset()
---
Sets the defs entry stored under _name_ to _value_, but only if it
is not currently set to any value (if it is undefined).
## Signature
```js
Defs defs.setIfUnset(
String name,
String value
)
```
This object is chainable as it returns the `Defs` object.