chore: Linting for markdown and js
This commit is contained in:
parent
eca8199ed8
commit
1c92e0f655
6677 changed files with 24391 additions and 25987 deletions
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.draft()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.draft()
|
||||
|
||||
A pattern's `draft()` method will draft all the different pattern parts
|
||||
making sure to do so in the right order, handle dependencies, resolve
|
||||
|
@ -13,7 +13,7 @@ that are required for the pattern to be drafted.
|
|||
|
||||
```js
|
||||
Pattern pattern.draft()
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.draft() example
|
||||
|
||||
|
@ -29,5 +29,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
***
|
||||
|
||||
title: Pattern
|
||||
order: 15
|
||||
---
|
||||
---------
|
||||
|
||||
The `Pattern` object in FreeSewing's core library holds all data and logic of a pattern.
|
||||
The `Pattern` object in FreeSewing's core library holds all data and logic of a pattern.
|
||||
It is the parametric blueprint that when instantiated with a user's measurements and
|
||||
objects will generated a made-to-measure pattern.
|
||||
|
||||
|
@ -18,7 +19,6 @@ A pattern is instantiated by passing a [settings object](/reference/settings/) t
|
|||
This settings objects holds, amongst other things, the measurements and options chosen by the user.
|
||||
Refer to the [settings documentation](/reference/settings/) for an exhaustive list.
|
||||
|
||||
|
||||
## Pattern properties
|
||||
|
||||
| Property | Description |
|
||||
|
@ -32,15 +32,15 @@ Refer to the [settings documentation](/reference/settings/) for an exhaustive li
|
|||
| `store` | A [Store](/en/docs/developer/api/store) instance |
|
||||
| `svg` | An [Svg](/en/docs/developer/api/svg) instance |
|
||||
|
||||
- `settings` : The settings as set by the user
|
||||
- `options` : the options as set by the user
|
||||
- `config` : The pattern configuration
|
||||
- `parts` : A plain object to hold your parts
|
||||
- `Part` : The [Part](/en/docs/developer/api/part) constructor
|
||||
- `store` : A [Store](/en/docs/developer/api/store) instance
|
||||
- `svg` : An [Svg](/en/docs/developer/api/svg) instance
|
||||
- `is` : A string that will be set to `draft` or `sample` when you respectively draft or sample a pattern.
|
||||
This allows plugins that hook into your pattern to determine what to do in a given scenario.
|
||||
* `settings` : The settings as set by the user
|
||||
* `options` : the options as set by the user
|
||||
* `config` : The pattern configuration
|
||||
* `parts` : A plain object to hold your parts
|
||||
* `Part` : The [Part](/en/docs/developer/api/part) constructor
|
||||
* `store` : A [Store](/en/docs/developer/api/store) instance
|
||||
* `svg` : An [Svg](/en/docs/developer/api/svg) instance
|
||||
* `is` : A string that will be set to `draft` or `sample` when you respectively draft or sample a pattern.
|
||||
This allows plugins that hook into your pattern to determine what to do in a given scenario.
|
||||
|
||||
## Pattern methods
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: Pattern.getRenderProps()
|
||||
---
|
||||
***
|
||||
|
||||
A pattern's `getRenderProps()` method will return a set of properties
|
||||
## title: Pattern.getRenderProps()
|
||||
|
||||
A pattern's `getRenderProps()` method will return a set of properties
|
||||
that allow the pattern to be rendered be an external renderer such as
|
||||
a React component. It should only be called after calling `Pattern.draft()`.
|
||||
|
||||
|
@ -10,7 +10,7 @@ a React component. It should only be called after calling `Pattern.draft()`.
|
|||
|
||||
```js
|
||||
Object pattern.getRenderProps()
|
||||
```
|
||||
```
|
||||
|
||||
The object returned by this method contains the following properties:
|
||||
|
||||
|
@ -29,7 +29,6 @@ See [the Draft React component](/reference/packages/components/draft/) for more
|
|||
|
||||
</Tip>
|
||||
|
||||
|
||||
## Pattern.getRenderProps() example
|
||||
|
||||
```jsx
|
||||
|
@ -44,5 +43,4 @@ const MyReactComponent = ({ measurements }) => {
|
|||
}
|
||||
|
||||
export default MyReactComponent
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: Pattern.on()
|
||||
---
|
||||
***
|
||||
|
||||
A pattern's `on()` method allows you to attach a function to one of the
|
||||
## title: Pattern.on()
|
||||
|
||||
A pattern's `on()` method allows you to attach a function to one of the
|
||||
pattern's [lifecycle hooks](/reference/hooks/). It takes the
|
||||
lifecycle hook's name as the first argument and the function as the second.
|
||||
This method will then be triggered by the lifecycle hook.
|
||||
|
@ -13,7 +13,7 @@ This method will then be triggered by the lifecycle hook.
|
|||
|
||||
```js
|
||||
Pattern pattern.on(string hook, function method)
|
||||
```
|
||||
```
|
||||
|
||||
<Tip>
|
||||
|
||||
|
@ -38,4 +38,3 @@ Your pattern now has a yellow background.
|
|||
The [plugin guide](/guides/plugins/) contains more info on how you can use hooks
|
||||
|
||||
</Tip>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.render()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.render()
|
||||
|
||||
A pattern's `render()` method will render the pattern to SVG and return
|
||||
the SVG as a string. It should only ever be called after calling
|
||||
|
@ -10,7 +10,7 @@ the SVG as a string. It should only ever be called after calling
|
|||
|
||||
```js
|
||||
string pattern.render()
|
||||
```
|
||||
```
|
||||
|
||||
# Pattern.render() example
|
||||
|
||||
|
@ -26,5 +26,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
---
|
||||
title: Pattern.sample()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sample()
|
||||
|
||||
A pattern's `sample()` method will *sample* the pattern which means
|
||||
to draft it in different iterations while adjusting the input settings.
|
||||
Under the hood, this method will call one of
|
||||
Under the hood, this method will call one of
|
||||
[Pattern.sampleOption()](/reference/apu/pattern/sampleoption),
|
||||
[Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption), or
|
||||
[Pattern.sampleModels()](/reference/apu/pattern/sampleoption) to sample
|
||||
an option, a measurement, or a set of measurements respectively.
|
||||
|
||||
Unlike those three methods where you pass the relevant info to to the method,
|
||||
this `Pattern.sample()` will instead read the `pattern.settings.sample`
|
||||
Unlike those three methods where you pass the relevant info to to the method,
|
||||
this `Pattern.sample()` will instead read the `pattern.settings.sample`
|
||||
object to determine what to do.
|
||||
|
||||
The possiblities are:
|
||||
|
||||
- **type**: One of `option`, `measurement`, or `models`
|
||||
- **option**: An option name as defined in the pattern config file (only used when `type` is option).
|
||||
- **measurement**: A measurement name as defined in the pattern config file (only used when `type` is measurement).
|
||||
- **models**: An array of models with the required measurements for this pattern (only used when `type` is models).
|
||||
* **type**: One of `option`, `measurement`, or `models`
|
||||
* **option**: An option name as defined in the pattern config file (only used when `type` is option).
|
||||
* **measurement**: A measurement name as defined in the pattern config file (only used when `type` is measurement).
|
||||
* **models**: An array of models with the required measurements for this pattern (only used when `type` is models).
|
||||
|
||||
See the specific sample methods below for more details:
|
||||
|
||||
- [Pattern.sampleOption()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption)
|
||||
- [Pattern.sampleModels()](/reference/apu/pattern/sampleoption)
|
||||
* [Pattern.sampleOption()](/reference/apu/pattern/sampleoption)
|
||||
* [Pattern.sampleMeasurement()](/reference/apu/pattern/sampleoption)
|
||||
* [Pattern.sampleModels()](/reference/apu/pattern/sampleoption)
|
||||
|
||||
From a lifecycle point of view, the `Pattern.sample()` method is a substitute for
|
||||
`Pattern.draft()`. So you call it after instantiating the pattern, prior to
|
||||
|
@ -56,12 +56,11 @@ roadmap](https://github.com/freesewing/freesewing/discussions/1278) for details.
|
|||
|
||||
</Warning>
|
||||
|
||||
|
||||
## Pattern.sample() signature
|
||||
|
||||
```js
|
||||
Pattern pattern.sample()
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.sample() example
|
||||
|
||||
|
@ -77,5 +76,4 @@ const pattern = new Aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.sample().render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
---
|
||||
title: Pattern.sampleMeasurement()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleMeasurement()
|
||||
|
||||
A pattern's `sampleMeasurement()` method will *sample* a given measurement,
|
||||
which means to draft it in different iterations while adjusting the input value
|
||||
of the given measurement.
|
||||
In practice, it will draft 10 iterations of the pattern
|
||||
In practice, it will draft 10 iterations of the pattern
|
||||
while adapting the measurement between 90% and 110% of its original value.
|
||||
|
||||
<Tip>
|
||||
|
@ -34,5 +34,4 @@ import models from "@freesewing/models"
|
|||
const pattern = new Aaron({ measurements: models.manSize38 })
|
||||
|
||||
const svg = pattern.sampleMeasurement("chest").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.sampleModels()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleModels()
|
||||
|
||||
A pattern's `sampleModels()` method will *sample* a pattern for a list of
|
||||
models you pass to it. It will draft different iterations of the pattern,
|
||||
|
@ -27,7 +27,8 @@ In other words, for each sample, the anchor point will be kept in the same locat
|
|||
|
||||
```js
|
||||
Pattern pattern.sampleModels(object models, string focus)
|
||||
```
|
||||
```
|
||||
|
||||
The models object you pass as the first parameter should be structured as such:
|
||||
|
||||
```js
|
||||
|
@ -46,12 +47,12 @@ The models object you pass as the first parameter should be structured as such:
|
|||
}
|
||||
```
|
||||
|
||||
The (optional) string you can pass as the second parameter should hold the
|
||||
The (optional) string you can pass as the second parameter should hold the
|
||||
key of one of the models in the first parameter. In our example above, it
|
||||
could hold `modelName2` for example.
|
||||
|
||||
By passing this second parameter, you can put the *focus* on one of the models,
|
||||
which will influence the render style, and make it
|
||||
By passing this second parameter, you can put the *focus* on one of the models,
|
||||
which will influence the render style, and make it
|
||||
easier to see a comparison between a given set of measrurements, and the rest.
|
||||
|
||||
Alternatively, you can use the `Pattern.sample()` method and set `settings.sample.focus` to the key
|
||||
|
@ -66,5 +67,4 @@ import models from "@freesewing/models"
|
|||
const Aaron = new Aaron()
|
||||
|
||||
const svg = aaron.sampleModels(models, "manSize38").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Pattern.sampleOption()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.sampleOption()
|
||||
|
||||
A pattern's `sampleOption()` method will *sample* a given option,
|
||||
which means to draft it in different iterations while adjusting the input value
|
||||
of the given option.
|
||||
The practical implementation varies based on [the type of option](/config/options/):
|
||||
|
||||
- For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
|
||||
- For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
|
||||
- For options with a **list** of options, each option in the list will be sampled
|
||||
* For options that are an object with a **min** and **max** property, 10 steps will be sampled, between min and max
|
||||
* For options that are a numeric value (**constants**), 10 steps will be sampled between 90% and 110% of the value
|
||||
* For options with a **list** of options, each option in the list will be sampled
|
||||
|
||||
<Tip>
|
||||
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
|
||||
|
@ -33,12 +33,10 @@ In other words, for each sample, the anchor point will be kept in the same locat
|
|||
|
||||
```js
|
||||
Pattern pattern.sampleOption(string option)
|
||||
```
|
||||
```
|
||||
|
||||
## Pattern.sampleOption() example
|
||||
|
||||
|
||||
|
||||
```js
|
||||
import Aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
@ -48,5 +46,4 @@ const pattern = new aaron({
|
|||
})
|
||||
|
||||
const svg = pattern.sampleOption("necklineDrop").render()
|
||||
```
|
||||
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Pattern.use()
|
||||
---
|
||||
***
|
||||
|
||||
## title: Pattern.use()
|
||||
|
||||
A pattern's `use()` method will load a FreeSewing plugin.
|
||||
Plugins are a way to extend a pattern's functionality, and can be
|
||||
|
@ -13,7 +13,7 @@ to run-time plugins. For more details, refer to [the plugin guide](/guides/plugi
|
|||
|
||||
```js
|
||||
Pattern pattern.use(object plugin)
|
||||
```
|
||||
```
|
||||
|
||||
See [the plugin guide](/guides/plugins/) for details on how to structure
|
||||
you plugin object.
|
||||
|
@ -33,4 +33,4 @@ const pattern = new Aaron({
|
|||
}).use(theme)
|
||||
|
||||
const svg = pattern.draft().render()
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue