1
0
Fork 0

fix(dev): One-liner admonitions

This commit is contained in:
Joost De Cock 2024-09-29 07:14:59 +02:00
parent a6d656c19e
commit da41cc0fc9
60 changed files with 860 additions and 659 deletions

View file

@ -5,7 +5,9 @@ title: Pattern.addPart()
The `Pattern.addPart()` method allows you to add a part to a pattern.
It has the same effect as passing a part to the Design constructor.
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.addPart() signature
@ -16,30 +18,27 @@ Pattern pattern.addPart(object part)
## Pattern.addPart() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
const extra = {
name: 'aaron.extra',
draft: ({ points, Point, paths, Path, part }) => {
points.msg = new Point(50,15)
.attr('data-text', "I am an extra part")
points.msg = new Point(50, 15).attr('data-text', 'I am an extra part')
paths.box = new Path()
.move(new Point(0,0))
.line(new Point(0,30))
.line(new Point(100,30))
.line(new Point(100,0))
.close(new Point(100,0))
.move(new Point(0, 0))
.line(new Point(0, 30))
.line(new Point(100, 30))
.line(new Point(100, 0))
.close(new Point(100, 0))
.addClass('note')
return part
}
},
}
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({ measurements }).addPart(extra)

View file

@ -7,7 +7,9 @@ making sure to do so in the right order, handle dependencies, resolve
options to their absolute values and a number of other housekeeping things
that are required for the pattern to be drafted.
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.draft() signature
@ -18,13 +20,11 @@ Pattern pattern.draft()
## Pattern.draft() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({ measurements })

View file

@ -5,7 +5,9 @@ title: Pattern.draftPartForSet()
A pattern's `draftPartForSet()` method will draft a part using a
given set of settings.
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.draftPartForSet() signature
@ -16,14 +18,10 @@ Pattern pattern.draftPartForSet(part, set)
## Pattern.draftPartForSet() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
// Load a public test settings set from the FreeSewing backend
const set = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
)
const set = await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
const pattern = new Aaron()

View file

@ -7,7 +7,9 @@ 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.
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.on() signature
@ -26,8 +28,8 @@ should pass it.
## Pattern.on() example
```js
pattern.on('preRender', function(svg) {
svg.style += "svg { background: yellow;}";
pattern.on('preRender', function (svg) {
svg.style += 'svg { background: yellow;}'
})
```

View file

@ -6,7 +6,9 @@ The `Pattern.sample()` method will _sample_ the pattern which means
to draft multiple variants of the same pattern, and stack them on
top of each other.
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
Under the hood, this method will call one of
[Pattern.sampleOption()](/reference/api/pattern/sampleoption),
@ -34,19 +36,17 @@ Pattern pattern.sample()
## Pattern.sample() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({
sample: {
models: measurements
}
models: measurements,
},
})
const svg = pattern.sample().render()

View file

@ -13,7 +13,9 @@ the measurement of your choice between 90% and 110% if the value in the settings
The goal of measurement sampling is to understand the impact of a given measurement on a pattern.
:::
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.sampleMeasurement() signature
@ -24,13 +26,11 @@ Pattern pattern.sampleMeasurement(string measurement)
## Pattern.sampleMeasurement() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({ measurements })

View file

@ -12,7 +12,9 @@ In this particular case, it will draft a variants for each of the models you pas
The goal of model sampling is to verify that a pattern grades correctly up and down as sizes change.
:::
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.sampleModels() signature
@ -52,16 +54,14 @@ identifying your model in the models object.
## Pattern.sampleModels() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
const Aaron = new Aaron()
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const svg = aaron.sampleModels(measurements, "34").render()
const svg = aaron.sampleModels(measurements, '34').render()
```

View file

@ -7,7 +7,7 @@ to draft multiple variants of the same pattern, and stack them on
top of each other.
In this particular case, the variants it drafts depend
on [the type of option](/reference/api/part/config/options/):
on [the type of option](/reference/api/part/config/options/):
- For a Percentage or Degree option, 10 steps will be sampled, between min and max
- For a Counter or Millimeter option, a maximum of 10 steps will be sampled, between min and max
@ -20,7 +20,9 @@ The goal of option sampling is to verify the impact of an option on the pattern,
its min and max boundaries are correct and its default value is sensible.
:::
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.sampleOption() signature
@ -31,13 +33,11 @@ Pattern pattern.sampleOption(string option)
## Pattern.sampleOption() example
```js
import { Aaron } from "@freesewing/aaron"
import { Aaron } from '@freesewing/aaron'
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({ measurements })

View file

@ -6,7 +6,9 @@ The `Pattern.use()` method will load a FreeSewing plugin.
Plugins are a way to extend a pattern's functionality.
For more details, refer to [the plugin guide](/guides/plugins/).
:::noteThis method is chainable as it returns the Pattern object:::
:::note
This method is chainable as it returns the Pattern object
:::
## Pattern.use() signature
@ -22,14 +24,12 @@ you plugin object.
## Pattern.use() example
```js
import { Aaron } from "@freesewing/aaron"
import { pluginTheme } from "@freesewing/plugin-theme"
import { Aaron } from '@freesewing/aaron'
import { pluginTheme } from '@freesewing/plugin-theme'
// Load some public test measurements from the FreeSewing backend
const measurements = (
await (
await fetch("https://backend3.freesewing.org/curated-sets/1.json")
).json()
await (await fetch('https://backend3.freesewing.org/curated-sets/1.json')).json()
).measurements
const pattern = new Aaron({ measurements }).use(pluginTheme)