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,14 @@
---
title: Stack.addPart()
---
The `Stack.addPart()` method adds a part to the stack and returns the
original stack.
## Stack.addPart() signature
```js
Stack stack.addPart(Part part)
```
:::noteThis method is chainable as it returns the Stack object:::

View file

@ -0,0 +1,26 @@
---
title: Stack.asRenderProps()
---
The `Stack.asRenderProps()` method returns a stack object suitable for renderprops.
## Stack.asProps() signature
```js
Object stack.asProps()
```
## Stack.asProps() returned object
The `Stack.asProps()` method returns an object with the following properties:
| Property | Description |
| --------:| ----------- |
| `attributes` | An `Attributes` instance holding the stack's attributes |
| `bottomRight` | A `Point` that is the bottom right of the stack's bounding box |
| `height` | Height of the bounding box of the stack in `mm` |
| `name` | The name of the stack |
| `parts` | An `Array` of the `Part`s in the stack |
| `topLeft` | A `Point` that is the top left of the stack's bounding box |
| `width` | Width of the bounding box of the stack in `mm` |

View file

@ -0,0 +1,23 @@
---
title: Stack.attr()
---
The `Stack.attr()` method adds an attribute to the stack
and returns the original stack.
Setting the third parameter to `true` will replace the value of the
attribute instead of adding it.
## Stack.attr() signature
```js
Stack stack.attr(
string name,
mixed value,
bool overwrite = false
```
If the third parameter is set to `true` it will call
`this.attributes.set()` instead,
thereby overwriting the value of the attribute.
:::noteThis method is chainable as it returns the Stack object:::

View file

@ -0,0 +1,26 @@
---
title: Stack.generateTransform()
---
The `Stack.generateTransform()` method generates SVG transforms for the stack,
sets them as attributes, and returns the original stack.
## Stack.generateTransform() signature
```js
Stack stack.generateTransforms(Object transforms)
```
The `Stack.generateTransforms()` method takes a single argument,
an object with the following properties containing the transforms
to apply:
| Property | Type |Description |
|----------|------|------------|
| `move` | Object | `move.x` and `move.y` are coordinates to which the stack should be translated
| `rotate` | Number | The number of degrees to rate the stack around its center |
| `flipX` | Boolean | Whether to flip the stack along the X axis |
| `flipY` | Boolean | Whether to flip the stack along the Y axis |
:::noteThis method is chainable as it returns the Stack object:::

View file

@ -0,0 +1,13 @@
---
title: Stack.getAnchor()
---
The `Stack.getAnchor()` method returns the Point which is the anchor
to align parts in the stack.
## Stack.getAnchor() signature
```js
Point stack.getAnchor()
```

View file

@ -0,0 +1,12 @@
---
title: Stack.getPartList()
---
The `Stack.getPartList()` method returns an Array containing the parts
in this stack.
## Stack.getPartList() signature
```js
Part[] stack.getPartList()
```

View file

@ -0,0 +1,12 @@
---
title: Stack.getPartNames()
---
The `Stack.getPartNames()` method returns an Array containing the names
of the parts in the stack.
## Stack.getPartNames() signature
```js
String[] stack.getPartNames()
```

View file

@ -0,0 +1,22 @@
---
title: Stack.home()
---
The `Stack.home()` method calculates the stack's bounding box,
setting the `width`, `height`, `topLeft`, and `bottomRight` properties,
and returns the original stack.
## Stack.home() signature
```js
Stack stack.home()
```
:::noteThis method is chainable as it returns the Stack object:::
## Notes
The bounding box is calculated taking into consideration the `margin` setting.
`Stack.home()` caches its calculations by checking whether the stack's
`topLeft` property has been set.
If `topLeft` has a truthy value, it will not re-calculate.

View file

@ -0,0 +1,42 @@
---
title: Stack
---
A Stack object represents a collection of parts within a pattern.
Stacks are used when laying out the pattern.
:::note RELATED
See [Stacks](/guides/designs/stacks)
for information about how stacks are used in a pattern.
:::
## Signature
```js
Stack new Stack(String name)
```
The stack constructor takes a single argument, a String containing the name
of the stack.
## Properties
Stack objects come with the following properties:
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the stack's attributes
- `parts` : A set of parts in the stack
- `name` : The name of the stack
- `topleft` : A [Point](/reference/api/point) that is the top left of the stack's bounding box
- `bottomRight` : A [Point](/reference/api/point) that is the bottom right of the stack's bounding box
- `width` : The width of the stack in mm
- `height` : The height of the stack in mm
- `anchor` : A [Point](/reference/api/point) that is used as the anchor to align parts in the stack
## Methods
A Stack object exposes the following methods:
<ReadMore />