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:
parent
497633d1d3
commit
ab3204f9f1
692 changed files with 11037 additions and 20674 deletions
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
title: cutlist.addCut()
|
||||
---
|
||||
|
||||
The `cutlist.addCut()` store method will add a set of cutting instructions for the part.
|
||||
This information is not use by the core library, it is merely stored.
|
||||
|
||||
#### Signature
|
||||
```js
|
||||
undefined store.cutlist.addCut({
|
||||
Number cut,
|
||||
String from,
|
||||
Bool identical = false,
|
||||
Bool onBias = false,
|
||||
Bool onFold = false,
|
||||
})
|
||||
````
|
||||
|
||||
Pass an object to the `store.cutlist.addCut` method with any of the following keys; any you don't provide will be filled with the defaults:
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
| :-- | :--- | :------ | :---------- |
|
||||
| `cut` | Number\|false | 2 | The number of parts to cut from the specified material. Pass `false` to clear cutting instructions for the material |
|
||||
| `from` | String | 'fabric' | The (translation key of the) material to cut from |
|
||||
| `identical` | Boolean | false | Should even numbers of parts be cut in the same direction? The default (`false`) is to mirror them |
|
||||
| `onBias` | Boolean | false | Should the parts be cut on the bias? |
|
||||
| `onFold` | Boolean | false | Should the parts be cut on the fold? |
|
||||
|
||||
:::note
|
||||
|
||||
You can use any `string` you want for your material, but here are some standard ones we provide translations for:
|
||||
|
||||
| Key | Translation |
|
||||
|:--|:--|
|
||||
| fabric | Main Fabric |
|
||||
| lining | Lining |
|
||||
| canvas | Canvas |
|
||||
| interfacing | Interfacing |
|
||||
| ribbing | Ribbing |
|
||||
|
||||
:::
|
||||
|
||||
#### Example
|
||||
|
||||
<Example caption="An example of the title macro">
|
||||
```js
|
||||
({ Point, Path, paths, macro, store, part }) => {
|
||||
|
||||
store.cutlist.addCut({cut: 2, from: 'fabric' })
|
||||
store.cutlist.addCut({cut: 2, from: 'lining' })
|
||||
|
||||
macro('title', {
|
||||
nr: 9,
|
||||
title: 'The title',
|
||||
at: new Point(0,0)
|
||||
})
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(-20,-50))
|
||||
.move(new Point(80,35))
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
</Example>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: cutlist.removeCut()
|
||||
---
|
||||
|
||||
The `store.cutlist.removeCut()` method will remove cutting instructions from the part for a given material.
|
||||
|
||||
|
||||
#### Signature
|
||||
|
||||
```js
|
||||
undefined cutlist.removeCut(String from)
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```mjs
|
||||
cutlist.removeCut('fabric')
|
||||
```
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: cutlist.setCutOnFold()
|
||||
---
|
||||
The `cutlist.setCutOnFold()` method will take two points to determine the cut on fold line.
|
||||
|
||||
This method is called internally by [the `cutonfold` macro](/reference/macros/cutonfold) to store information for cutting layout tools.
|
||||
In other words, you typically have no reason to call this method manually.
|
||||
|
||||
#### Signature
|
||||
|
||||
```js
|
||||
undefined cutlist.setCutOnFold(Point p1, Point p2)
|
||||
```
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: cutlist.setGrain()
|
||||
---
|
||||
|
||||
The `store.cutlist.setGrain()` method will take an angle to determine the grainline.
|
||||
|
||||
This method is called internally by [the `grainline` macro](/reference/macros/grainline).
|
||||
to store information for cutting layout tools.
|
||||
In other words, you typically have no reason to call this method manually.
|
||||
|
||||
#### Signature
|
||||
|
||||
```js
|
||||
undefined store.cutlist.setGrain(Number grainAngle)
|
||||
```
|
26
sites/dev/docs/reference/store-methods/flag.error/readme.mdx
Normal file
26
sites/dev/docs/reference/store-methods/flag.error/readme.mdx
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: flag.error()
|
||||
---
|
||||
|
||||
This flags information at the `error` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.error`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.error({
|
||||
title: 'Oh no',
|
||||
desc: 'Something went very wrong'
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
26
sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx
Normal file
26
sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: flag.fixme()
|
||||
---
|
||||
|
||||
This flags information at the `fixme` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.fixme`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.fixme({
|
||||
title: 'Not yet implemented',
|
||||
desc: 'Something is unfinished'
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
132
sites/dev/docs/reference/store-methods/flag.info/readme.mdx
Normal file
132
sites/dev/docs/reference/store-methods/flag.info/readme.mdx
Normal file
|
@ -0,0 +1,132 @@
|
|||
---
|
||||
title: flag.info()
|
||||
---
|
||||
|
||||
This flags information at the `info` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.info`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.info({
|
||||
title: 'flag:expandIsOn.t',
|
||||
desc: 'flag:expandIsOn.d',
|
||||
notes: [
|
||||
'sorcha:moreInfo1',
|
||||
'sorcha:moreInfo2',
|
||||
],
|
||||
suggest: {
|
||||
text: 'flag:disable',
|
||||
icon: 'expand',
|
||||
update: {
|
||||
settings: ['expand', null],
|
||||
},
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
The example above is from our implementation, which uses the following properties:
|
||||
|
||||
## Configuration
|
||||
|
||||
| Property | Type | Description |
|
||||
| ----------:| ------------------- | ----------- |
|
||||
| `id` | String | An ID for this flag message. If none is provided, `title` will be used |
|
||||
| `title` | String | The title of the message |
|
||||
| `desc` | String | The description of the message |
|
||||
| `notes` | String or Array of Strings | More information/notes (see [Notes](#notes))|
|
||||
| `suggest.text` | String | Text to go on the button to implement the suggested configuration change |
|
||||
| `suggest.icon` | String | Icon name to go on the button to implement the suggested configuration change. (see [suggest.icon](#suggesticon)) |
|
||||
| `suggest.update.settings` | Array | An array describing the changes to apply to the `settings` if the user accepts the suggestion. (see [suggest.update](#suggestupdate)) |
|
||||
| `suggest.update.ui` | Array | An array describing the changes to apply to the `ui` if the user accepts the suggestion. (see [suggest.update](#suggestupdate)) |
|
||||
|
||||
### Notes
|
||||
|
||||
Notes are optional, but allow you to add more text/content to the flag message.
|
||||
|
||||
Unlike `desc` which can only hold a string, `notes` can hold either a string or an array of strings.
|
||||
|
||||
Both `desc` and `notes` will be rendered as markdown.
|
||||
|
||||
### suggest.icon
|
||||
|
||||
An optional name of an icon. Or leave it out to not render and icon.
|
||||
The idea is that the icon helps convey the message, the following icon names are supported:
|
||||
|
||||
- `note`
|
||||
- `info`
|
||||
- `tip`
|
||||
- `warn`
|
||||
- `error`
|
||||
- `fixme`
|
||||
- `expand`
|
||||
- `options`
|
||||
|
||||
Any other name will be ignored.
|
||||
|
||||
### suggest.update
|
||||
|
||||
Note that the `suggest` object is optional. Without it, it will merely display a message to the user.
|
||||
However, when a suggest key is present, a button will be created that the user can click to accept the suggested changes.
|
||||
|
||||
The `suggest.update` object has only two possible top-level keys:
|
||||
|
||||
- `settings`
|
||||
- `ui`
|
||||
|
||||
They both take the same parameter, an array with two elements:
|
||||
|
||||
```mjs
|
||||
Array [`path`, `value`]
|
||||
```
|
||||
|
||||
This will be used to update the `settings` of the pattern, or the `ui` settings on FreeSewing.org.
|
||||
|
||||
The way they are updated is by invoking [lodash.set](https://lodash.com/docs/4.17.15#set) on either the settings object or the ui object.
|
||||
Which means:
|
||||
|
||||
- `path` describes the path to the value to change in dot-notation
|
||||
- `value` is the value to set
|
||||
|
||||
So to set the `waistEase` option to `0.2`, it should look like this:
|
||||
|
||||
```mjs
|
||||
{
|
||||
update: {
|
||||
settings: ['options.waistEase', 0.2]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ store, part }) => {
|
||||
store.flag.info({
|
||||
msg: `aaron:cutNeckBinding`,
|
||||
notes: ['flag:saUnused', 'flag:partHiddenByExpand'],
|
||||
replace: {
|
||||
width: units(w),
|
||||
length: units(l),
|
||||
},
|
||||
suggest: {
|
||||
text: 'flag:show',
|
||||
icon: 'expand',
|
||||
update: {
|
||||
settings: ['expand', 1],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
26
sites/dev/docs/reference/store-methods/flag.note/readme.mdx
Normal file
26
sites/dev/docs/reference/store-methods/flag.note/readme.mdx
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: flag.note()
|
||||
---
|
||||
|
||||
This flags information at the `note` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.note`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.note({
|
||||
title: 'Something good to know',
|
||||
desc: 'Longer message here'
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: flag.preset()
|
||||
---
|
||||
|
||||
The `flag.preset()` method is a way to flag a pre-defined flag object.
|
||||
There are currently two such pre-defined flags provided by the annotations-plugin:
|
||||
|
||||
- `expandIsOn`
|
||||
- `expandIsOff`
|
||||
|
||||
They inform the user about the effect of the `expand` setting on the pattern, when `expand`
|
||||
is on or off respectively.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.preset(string preset)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
The example above is from our implementation, which uses the following properties:
|
||||
|
||||
## Configuration
|
||||
|
||||
| Property | Type | Description |
|
||||
| ----------:| ------------------- | ----------- |
|
||||
| `preset` | String | The ID of an existing preset |
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ store, expand, part }) => {
|
||||
store.flag.preset(expand
|
||||
? 'expandIsOn'
|
||||
: 'expandIsOff'
|
||||
)
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
26
sites/dev/docs/reference/store-methods/flag.tip/readme.mdx
Normal file
26
sites/dev/docs/reference/store-methods/flag.tip/readme.mdx
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: flag.tip()
|
||||
---
|
||||
|
||||
This flags information at the `tip` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.tip`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.tip({
|
||||
title: 'Something good to know',
|
||||
desc: 'Longer message here'
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
26
sites/dev/docs/reference/store-methods/flag.warn/readme.mdx
Normal file
26
sites/dev/docs/reference/store-methods/flag.warn/readme.mdx
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: flag.warn()
|
||||
---
|
||||
|
||||
This flags information at the `warn` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.warn`.
|
||||
The core library does nothing with this info, it is merely stored, much like logs are.
|
||||
|
||||
However, in our own UI on FreeSewing.org, we use this mechanism to allow
|
||||
designer to flag information to the user, and even suggest changes to the
|
||||
pattern configuration.
|
||||
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.flag.warn({
|
||||
title: 'Something to be mindful of',
|
||||
desc: 'Longer message here'
|
||||
})
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: generateMacroIds()
|
||||
---
|
||||
|
||||
The `generateMacroIds()` store method generates IDs to be used in macros.
|
||||
It is the recommended way for macros that add nodes to the pattern (by nodes we
|
||||
mean points, paths and so on) to avoid naming clashes.
|
||||
|
||||
## Signature
|
||||
|
||||
```mjs
|
||||
Object store.generateMacroIds(
|
||||
Array keys,
|
||||
String id,
|
||||
macro = store.activeMacro
|
||||
)
|
||||
```
|
||||
|
||||
The method takes a list of strings, and an ID which is typically the ID passed
|
||||
to the macro. You can optionally specify the macro name via `macro` although
|
||||
you almost certainly want to rely on the default behavior which is to load the
|
||||
active macro name from the store.
|
||||
|
||||
## Example
|
||||
|
||||
```mjs
|
||||
const ids = store.generateMacroIds(
|
||||
[
|
||||
'start',
|
||||
'end',
|
||||
'middle'
|
||||
],
|
||||
'macroId'
|
||||
)
|
||||
```
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
title: getMacroIds()
|
||||
---
|
||||
|
||||
Retrieve data for macro IDs generated via [`generateMacroIds()`](/reference/store-methods/generatemacroids) and stored
|
||||
via [`storeMacroIds()`](/reference/store-methods/storemacroids).
|
||||
|
||||
## Signature
|
||||
|
||||
```mjs
|
||||
Object store.getMacroIds(
|
||||
String id,
|
||||
macro = store.activeMacro,
|
||||
part = store.activePart,
|
||||
)
|
||||
```
|
||||
|
||||
The method takes an id and retrieves the data stored under the macro IDs for the active macro and active part.
|
||||
|
||||
Or, if you want to, you can pass in `macro` and `part` to not use the active macro or part.
|
||||
|
||||
## Example
|
||||
|
||||
```mjs
|
||||
const ids = store.getMacroIds('macroId')
|
||||
```
|
||||
|
||||
It is a best practice to return the result of this method from your macro.
|
||||
|
||||
|
32
sites/dev/docs/reference/store-methods/log.debug/readme.mdx
Normal file
32
sites/dev/docs/reference/store-methods/log.debug/readme.mdx
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: log.debug()
|
||||
---
|
||||
|
||||
This is the logging method for logs of `debug` level.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.log.debug(...data)
|
||||
```
|
||||
|
||||
Like all logging methods, this method is _variadic_.
|
||||
It will add logs to the array at `store.logs.debug`.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ log, part }) => {
|
||||
log.debug('Hey, I am logging')
|
||||
log.debug(
|
||||
'I am logging too',
|
||||
"But you don't see me make a big deal out if it"
|
||||
)
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can override the default logging methods in the store with a plugin.
|
37
sites/dev/docs/reference/store-methods/log.error/readme.mdx
Normal file
37
sites/dev/docs/reference/store-methods/log.error/readme.mdx
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: log.error()
|
||||
---
|
||||
|
||||
This is the logging method for logs of `error` level.
|
||||
|
||||
|
||||
:::note
|
||||
Logging something at the `error` level will stop FreeSewing from completing the draft of the pattern.
|
||||
:::
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.log.error(...data)
|
||||
```
|
||||
|
||||
Like all logging methods, this method is _variadic_.
|
||||
It will add logs to the array at `store.logs.error`.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ log, part }) => {
|
||||
log.error('Hey, I am logging')
|
||||
log.error(
|
||||
'I am logging too',
|
||||
"But you don't see me make a big deal out if it"
|
||||
)
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can override the default logging methods in the store with a plugin.
|
32
sites/dev/docs/reference/store-methods/log.info/readme.mdx
Normal file
32
sites/dev/docs/reference/store-methods/log.info/readme.mdx
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: log.info()
|
||||
---
|
||||
|
||||
This is the logging method for logs of `info` level.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.log.info(...data)
|
||||
```
|
||||
|
||||
Like all logging methods, this method is _variadic_.
|
||||
It will add logs to the array at `store.logs.info`.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ log, part }) => {
|
||||
log.info('Hey, I am logging')
|
||||
log.info(
|
||||
'I am logging too',
|
||||
"But you don't see me make a big deal out if it"
|
||||
)
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can override the default logging methods in the store with a plugin.
|
32
sites/dev/docs/reference/store-methods/log.warn/readme.mdx
Normal file
32
sites/dev/docs/reference/store-methods/log.warn/readme.mdx
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: log.warn()
|
||||
---
|
||||
|
||||
This is the logging method for logs of `warn` level (warning).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.log.warn(...data)
|
||||
```
|
||||
|
||||
Like all logging methods, this method is _variadic_.
|
||||
It will add logs to the array at `store.logs.warn`.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
({ log, part }) => {
|
||||
log.warn('Hey, I am logging')
|
||||
log.warn(
|
||||
'I am logging too',
|
||||
"But you don't see me make a big deal out if it"
|
||||
)
|
||||
|
||||
return part
|
||||
}
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You can override the default logging methods in the store with a plugin.
|
39
sites/dev/docs/reference/store-methods/pack/readme.mdx
Normal file
39
sites/dev/docs/reference/store-methods/pack/readme.mdx
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: pack()
|
||||
---
|
||||
|
||||
The `pack()` store method is used to arrange items into a
|
||||
pattern layout.
|
||||
The core library uses this method to arrange stacks of parts to
|
||||
generate layouts for drafted patterns.
|
||||
|
||||
`pack()` is implemented as a store method to allow you to override this
|
||||
method and implement your own algorithm to generate the layout.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Object store.pack(
|
||||
Array items,
|
||||
Pattern pattern,
|
||||
)
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const result = store.pack(parts, pattern)
|
||||
|
||||
const layout_width = result.width
|
||||
const layout_height = result.height
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
An optimized `pack()` store method is provided by
|
||||
[plugin-bin-pack](/reference/plugins/bin-pack)
|
||||
which is part of [core-plugins](/reference/plugins/core) and loaded
|
||||
by the core library by default.
|
||||
|
||||
The core library also provides a basic, unoptimized `pack()` store method
|
||||
that is used if core plugins are not loaded.
|
27
sites/dev/docs/reference/store-methods/readme.mdx
Normal file
27
sites/dev/docs/reference/store-methods/readme.mdx
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: Store Methods
|
||||
---
|
||||
|
||||
Store methods are typically provided by plugins and attached to
|
||||
the store to make them available during the drafting process.
|
||||
|
||||
Some of FreeSewing's core library functionality is implemented
|
||||
as store methods to allow plugins to override this functionality.
|
||||
Examples include log handling and pattern layout algorithm.
|
||||
|
||||
All store methods below are either provided by plugins we maintain,
|
||||
or are the default store methods as provided by the core library.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
null method(object Store, object config)
|
||||
```
|
||||
|
||||
A store method receives as its first parameter [the Store object](/reference/api/store), and
|
||||
as second parameter a single configuration object for the method.
|
||||
|
||||
## Store methods we maintain
|
||||
|
||||
<ReadMore />
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
title: removeMacroNodes()
|
||||
---
|
||||
|
||||
Removes nodes generated by macro `id`.
|
||||
By nodes, we mean paths, points, and so on that have been created by the macro.
|
||||
|
||||
When a macro properly uses a combination of `generateMacroIds()` and
|
||||
`storeMacroIds()`, this method will fully handle its removal.
|
||||
|
||||
## Signature
|
||||
|
||||
```mjs
|
||||
Object store.removeMacroNodes(
|
||||
String id,
|
||||
macro = store.activeMacro,
|
||||
part = store.activePart,
|
||||
)
|
||||
```
|
||||
|
||||
The method takes a (macro) id and removes all nodes created by this macro,
|
||||
It uses the active macro and part from the store, Or you can pass in `macro` and `part` to not use the active macro or part.
|
||||
|
||||
## Example
|
||||
|
||||
```mjs
|
||||
undefined store.removeMacroNodes('macroId')
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: storeMacroIds()
|
||||
---
|
||||
|
||||
Stores data for macro IDs generated via [`generateMacroIds()`](/reference/store-methods/generatemacroids).
|
||||
|
||||
## Signature
|
||||
|
||||
```mjs
|
||||
Object store.storeMacroIds(
|
||||
String id,
|
||||
Array ids,
|
||||
macro = store.activeMacro,
|
||||
part = store.activePart,
|
||||
)
|
||||
```
|
||||
|
||||
The method takes a (macro) id and an object of ids and stores it in the store under the active macro and part.
|
||||
|
||||
Or, if you want to, you can pass in `macro` and `part` to not use the active macro or part.
|
||||
|
||||
## Example
|
||||
|
||||
```mjs
|
||||
const ids = store.getMacroIds('macroId', ids)
|
||||
```
|
||||
|
||||
Storing this data is a requirement to allow removal of macros.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.error()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `error` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.error`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.error(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.fixme()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `fixme` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.fixme`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.fixme(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.info()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `info` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.info`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.info(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.note()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `note` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.note`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.note(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: unflag.preset()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged through the [`flag.preset()`](/reference/store-methods/flag.preset) method.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.preset(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
See [flag.preset()](/reference/store-methods/flag.preset) for a list of available presets.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
19
sites/dev/docs/reference/store-methods/unflag.tip/readme.mdx
Normal file
19
sites/dev/docs/reference/store-methods/unflag.tip/readme.mdx
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.tip()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `tip` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.tip`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.tip(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: unflag.warn()
|
||||
---
|
||||
|
||||
This removes a specific piece of information flagged at the `warn` level.
|
||||
|
||||
Info that is flagged is stored in the store under `plugins.plugin-annotations.flags.warn`.
|
||||
When doing so, you can pass an `id` or -- if no `id` is used, the `title` field will be used as the `id`.
|
||||
This methods allows you to remove this flagged info by passing said `id` (or `title`).
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
undefined Store.unflag.warn(string id)
|
||||
```
|
||||
|
||||
Since these methods are not part of FreeSewing's core API, what you pass to this method does depend on your own implementation.
|
||||
|
||||
For a more detailed example of how we use this, see [flag.info()](/reference/store-methods/flag.info).
|
Loading…
Add table
Add a link
Reference in a new issue