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,27 @@
---
title: Svg.asRenderProps()
---
The `Svg.asRenderProps()` method will return the data stored in the
svg as a serializable JavaScript object. This method is typically
not invoked directly but rather called under the hood as a result of
calling [`Pattern.getRenderProps()`](/reference/api/pattern/getrenderprops).
## Signature
```js
Object svg.asRenderProps()
```
## Returned object properties
The returned JavaScript object has the following properties:
| Name | Description |
| ----:| ----------- |
| `attributes` | The result of [Path.attributes.asRenderProps()](/reference/api/attributes/asrenderprops) |
| `layout` | A plain object describing the layout of the SVG |
| `body` | A string holding the SVG body |
| `style` | A string holding the SVG style |
| `defs` | A string holding the SVG defs |

View file

@ -0,0 +1,6 @@
---
title: Svg.attributes
---
The `Svg.attributes` property holds an [Attributes](/reference/api/attributes)
instance to control the attributes of the SVG document.

View file

@ -0,0 +1,16 @@
---
title: Svg.defs
---
The `Svg.defs` property holds a [Defs object](/reference/api/defs) that holds
the contents of [the defs
section](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) of the
SVG document.
## Signature
```svg
<defs>
/* svg.defs will be inserted */
</defs>
```

View file

@ -0,0 +1,18 @@
---
title: Svg.layout
---
The `Svg.layout` property holds an object that holds rendered SVG for all
parts, and a list of their transforms.
## Signature
```js
{
back: {
svg: "( Holds rendered SVG for this part )",
transforms: [ "translate(2, 2)" ]
},
// Other parts follow
}
```

View file

@ -0,0 +1,11 @@
---
title: Svg.pattern
---
The `Svg.pattern` property holds a reference to [the Pattern
object](/reference/api/pattern/) itself.
## Notes
This allows hooks that only receive the SVG object (such as the preRender and
postRender hooks) to still access the pattern object.

View file

@ -0,0 +1,15 @@
---
title: Svg
---
The `Svg` object in FreeSewing's core library represents an SVG document.
It is not directly exposed, but it is available as the `svg` attribute
of a [Pattern object](/reference/api/pattern/).
While the methods exposed by this object are only used internally,
its attributes are useful for situations where you
want to develop a plugin, or use a custom layout.
## Svg methods & properties
<ReadMore />

View file

@ -0,0 +1,21 @@
---
title: Svg.render()
---
The `Svg.render()` method will render a drafted
[Pattern](/reference/api/pattern) as SVG.
## Signature
```js
string svg.render()
```
:::warning
This method is mostly internal and should not be used directly.
Instead, it is intended that the
[Pattern.render()](/reference/api/pattern/render)
method be used to render patterns as SVG.
:::

View file

@ -0,0 +1,33 @@
---
title: Svg.style
---
The `Svg.style` property holds a string that will be rendered as the style
section of the SVG document.
## Signature
```svg
<style type="text/css">
/* svg.style will be inserted */
</style>
```
## Notes
The style property is where plugins will add additional styling.
When adding your own styles, it's important not to
overwrite this property, but rather add your own.
In other words, do this:
```js
svg.style += myStyles
```
and don't do this:
```js
svg.style = myStyles
```