feat: Flat import of markdown repo
This is a flat (without history) import of (some of) the content from our markdown module. We've imported this without history because the repo contains our blog posts and showcases posts content prior to porting them to strapi. Since this contains many images, it would balloon the size of this repo to import the full history. Instead, please refer to the history of the (archived) markdown repo at: https://github.com/freesewing/markdown
This commit is contained in:
parent
1671a896b5
commit
b34a2ee2ed
6132 changed files with 244167 additions and 0 deletions
11
markdown/dev/reference/api/pattern/apply/en.md
Normal file
11
markdown/dev/reference/api/pattern/apply/en.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
title: apply()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.apply(object settings)
|
||||
```
|
||||
|
||||
Merges the settings passed to it with the current pattern settings.
|
||||
|
||||
<Fixme>Code example</Fixme>
|
27
markdown/dev/reference/api/pattern/draft/en.md
Normal file
27
markdown/dev/reference/api/pattern/draft/en.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
title: draft()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.draft()
|
||||
```
|
||||
|
||||
Does the actual work of drafting the pattern.
|
||||
|
||||
Your draft method should return the pattern object, thus making it chainable.
|
||||
|
||||
```js
|
||||
import freesewing from "@freesewing/core"
|
||||
import aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
let pattern = new aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
measurements: models.manSize38
|
||||
}
|
||||
})
|
||||
|
||||
let svg = pattern.draft().render()
|
||||
```
|
||||
|
20
markdown/dev/reference/api/pattern/en.md
Normal file
20
markdown/dev/reference/api/pattern/en.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
title: Pattern
|
||||
order: 15
|
||||
---
|
||||
|
||||
A Pattern object comes wih the following properties:
|
||||
|
||||
- `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.
|
||||
|
||||
In addition, a Pattern object has the following methods:
|
||||
|
||||
<ReadMore list />
|
15
markdown/dev/reference/api/pattern/getrenderprops/en.md
Normal file
15
markdown/dev/reference/api/pattern/getrenderprops/en.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: getRenderProps()
|
||||
---
|
||||
|
||||
```js
|
||||
Object pattern.getRenderProps()
|
||||
```
|
||||
|
||||
Returns the *props* that allow a pattern to be rendered as a React component.
|
||||
|
||||
<Tip>
|
||||
|
||||
See [the Draft React component](/reference/packages/components/draft/) for details.
|
||||
|
||||
</Tip>
|
25
markdown/dev/reference/api/pattern/needs/en.md
Normal file
25
markdown/dev/reference/api/pattern/needs/en.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: needs()
|
||||
---
|
||||
|
||||
```js
|
||||
bool pattern.needs(string partName)
|
||||
```
|
||||
|
||||
Returns `true` or `false` depending on whether a pattern part is *needed*, based
|
||||
on the value of [pattern.settings.only](/reference/settings/only/) and the
|
||||
part dependencies listed in the configuration file.
|
||||
|
||||
A part is needed if:
|
||||
|
||||
- it is requested by the user in the `only` setting
|
||||
- it is a dependency of a part requested by the user in the `only` setting
|
||||
- the `only` setting is not set or is `false`, and the part is not hidden
|
||||
|
||||
<Note>
|
||||
|
||||
You don't typically use this method. Instead, configure part
|
||||
dependencies in your [configuration file](/reference/config/).
|
||||
|
||||
</Note>
|
||||
|
15
markdown/dev/reference/api/pattern/on/en.md
Normal file
15
markdown/dev/reference/api/pattern/on/en.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: on()
|
||||
---
|
||||
|
||||
```js
|
||||
void pattern.on(string hook, function method)
|
||||
```
|
||||
|
||||
Allows you to attach a method to one of our hooks.
|
||||
|
||||
Takes the hook name as a first argument, and your method as a second.
|
||||
|
||||
See [extending freesewing](/extend/) for details about extending freesewing with hooks.
|
||||
|
||||
<Fixme>Code example</Fixme>
|
10
markdown/dev/reference/api/pattern/render/en.md
Normal file
10
markdown/dev/reference/api/pattern/render/en.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
title: render()
|
||||
---
|
||||
|
||||
```js
|
||||
string pattern.render()
|
||||
```
|
||||
|
||||
Returns your drafted pattern as SVG.
|
||||
|
36
markdown/dev/reference/api/pattern/sample/en.md
Normal file
36
markdown/dev/reference/api/pattern/sample/en.md
Normal file
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
title: sample()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.sample()
|
||||
```
|
||||
|
||||
This method calls either [sampleOption()](#sampleoption),
|
||||
[sampleMeasurement()](#samplemeasurement),
|
||||
or [sampleModels()](#samplemodels).
|
||||
|
||||
Unlike those three methods who you need to pass the relevant info to,
|
||||
[sample()](#pattern-sample) will 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).
|
||||
|
||||
See the specific sample methods below for more details.
|
||||
|
||||
<Tip>
|
||||
|
||||
###### Anchor your samples
|
||||
|
||||
If you add a point named `anchor` to your pattern part, the different samples
|
||||
will be anchored on this point.
|
||||
|
||||
In other words, for each sample, the anchor point will be kept in the same location.
|
||||
|
||||
</Tip>
|
||||
|
28
markdown/dev/reference/api/pattern/samplemeasurement/en.md
Normal file
28
markdown/dev/reference/api/pattern/samplemeasurement/en.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
title: sampleMeasurement
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.sampleMeasurement(string measurement)
|
||||
```
|
||||
|
||||
Samples a measurement by drafting 10 variations of the pattern
|
||||
while adapting the measurement between 90% and 110% of its original value.
|
||||
|
||||
The goal of measurement sampling is to understand the impact of a given measurement on a pattern.
|
||||
|
||||
```js
|
||||
import freesewing from "@freesewing/core"
|
||||
import aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
let pattern = new aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
measurements: models.manSize38
|
||||
},
|
||||
})
|
||||
|
||||
let svg = pattern.sampleMeasurement("chestCircumference").render()
|
||||
```
|
||||
|
42
markdown/dev/reference/api/pattern/samplemodels/en.md
Normal file
42
markdown/dev/reference/api/pattern/samplemodels/en.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: sampleModels()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.sampleModels(object models, string focus)
|
||||
```
|
||||
|
||||
Samples a pattern for a number of models you pass to it.
|
||||
|
||||
The goal of model sampling is to verify that a pattern grades correctly up and down as sizes change.
|
||||
|
||||
```js
|
||||
import freesewing from "@freesewing/core"
|
||||
import Aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
let aaron = new Aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
measurements: models.manSize38
|
||||
},
|
||||
})
|
||||
|
||||
let svg = aaron.sampleModels(models, "manSize38").render()
|
||||
```
|
||||
|
||||
<Tip>
|
||||
|
||||
###### Model focus: Making a comparison
|
||||
|
||||
When sampling models, you can put the *focus* on one of the models, thereby making it
|
||||
easier to see a comparison between a given set of measrurements, and the rest.
|
||||
|
||||
To do so, pass a second parameter to the `sampleModels()` method. This should be
|
||||
the key of the model in the models object for that model you want the focus to be on.
|
||||
|
||||
Alternatively, you can use the `sample()` method and set `settings.sample.focus` to the key
|
||||
identifying your model in the models object.
|
||||
|
||||
</Tip>
|
||||
|
34
markdown/dev/reference/api/pattern/sampleoption/en.md
Normal file
34
markdown/dev/reference/api/pattern/sampleoption/en.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: sampleOption()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.sampleOption(string option)
|
||||
```
|
||||
|
||||
Samples an option by drafting variations of the pattern while adapting the option's value.
|
||||
|
||||
The exact behavior depends on [the type of option](/config#options):
|
||||
|
||||
The goal of option sampling is to verify the impact of an option on the pattern, and verify that
|
||||
its min and max boundaries are correct and its default value is sensible.
|
||||
|
||||
- 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
|
||||
|
||||
```js
|
||||
import freesewing from "@freesewing/core"
|
||||
import aaron from "@freesewing/aaron"
|
||||
import models from "@freesewing/models"
|
||||
|
||||
let pattern = new aaron({
|
||||
settings: {
|
||||
embed: true,
|
||||
measurements: models.manSize38
|
||||
},
|
||||
})
|
||||
|
||||
let svg = pattern.sampleOption("necklineDrop").render()
|
||||
```
|
||||
|
6
markdown/dev/reference/api/pattern/svg/attributes/en.md
Normal file
6
markdown/dev/reference/api/pattern/svg/attributes/en.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: attributes
|
||||
---
|
||||
|
||||
An [Attributes](/reference/api/attributes) instance that controls the attributes of the SVG tag.
|
||||
|
33
markdown/dev/reference/api/pattern/svg/defs/en.md
Normal file
33
markdown/dev/reference/api/pattern/svg/defs/en.md
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
title: defs
|
||||
---
|
||||
|
||||
A string that will be rendered
|
||||
as [the defs section](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs) of
|
||||
the SVG document.
|
||||
|
||||
The defs attribute is where plugins will add additional snippets.
|
||||
|
||||
```svg
|
||||
<defs>
|
||||
/* svg.defs will be inserted */
|
||||
</defs>
|
||||
```
|
||||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
When adding your own defs, it's important not to
|
||||
overwrite this property, but rather add your own.
|
||||
|
||||
In other words, do this:
|
||||
|
||||
```js
|
||||
svg.defs += myDefs;
|
||||
```
|
||||
and don't do this:
|
||||
|
||||
```js
|
||||
svg.defs = myDefs;
|
||||
```
|
||||
|
||||
</Warning>
|
15
markdown/dev/reference/api/pattern/svg/en.md
Normal file
15
markdown/dev/reference/api/pattern/svg/en.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: svg
|
||||
components: true
|
||||
order: 80
|
||||
---
|
||||
|
||||
The **svg** attribute of the [Pattern](/en/docs/developer/api/pattern) holds
|
||||
an object that represents an SVG document.
|
||||
|
||||
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:
|
||||
|
||||
<ReadMore list />
|
||||
|
35
markdown/dev/reference/api/pattern/svg/head/en.md
Normal file
35
markdown/dev/reference/api/pattern/svg/head/en.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
title: head
|
||||
---
|
||||
|
||||
A string that combines the `style`, `script`,
|
||||
and `defs` sections and an opening tag for an SVG group.
|
||||
|
||||
```svg
|
||||
<style type="text/css">
|
||||
/* svg.style will be inserted */
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
/* svg.script will be inserted */
|
||||
</scripts>
|
||||
|
||||
<defs>
|
||||
/* svg.defs will be inserted */
|
||||
</defs>
|
||||
|
||||
<!-- Start of group #fs-container -->
|
||||
<g id="fs-container">
|
||||
```
|
||||
|
||||
<Note>
|
||||
|
||||
###### This does not include the opening SVG tag
|
||||
|
||||
Note that while [Pattern.svg.tail](/reference/api/pattern/svg/tail/) closes the SVG tag,
|
||||
[Pattern.svg.head](/reference/api/pattern/head/) does not open it.
|
||||
That's because the `width`, `height` and `viewBox` attributes will
|
||||
depend on the main body of the SVG document.
|
||||
|
||||
</Note>
|
||||
|
17
markdown/dev/reference/api/pattern/svg/layout/en.md
Normal file
17
markdown/dev/reference/api/pattern/svg/layout/en.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: layout
|
||||
---
|
||||
|
||||
An object that holds rendered SVG for all parts, and a list of their transforms.
|
||||
It is structured as follows:
|
||||
|
||||
```js
|
||||
{
|
||||
back: {
|
||||
svg: "( Holds rendered SVG for this part )",
|
||||
transforms: [ "translate(2, 2)" ]
|
||||
},
|
||||
// Other parts follow
|
||||
}
|
||||
```
|
||||
|
8
markdown/dev/reference/api/pattern/svg/pattern/en.md
Normal file
8
markdown/dev/reference/api/pattern/svg/pattern/en.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
title: pattern
|
||||
---
|
||||
|
||||
A reference to [the Pattern object](/reference/api/pattern/).
|
||||
|
||||
This allows hooks that only receive the SVG object (such as the preRender and postRender hooks)
|
||||
to still access the pattern object.
|
14
markdown/dev/reference/api/pattern/svg/prefix/en.md
Normal file
14
markdown/dev/reference/api/pattern/svg/prefix/en.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
title: prefix
|
||||
---
|
||||
|
||||
A string that will be rendered before the opening SVG tag.
|
||||
|
||||
Its default value is:
|
||||
|
||||
```svg
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
```
|
||||
|
||||
<Note>This only applies when rendering to SVG, not what
|
||||
rendering a React component</Note>
|
32
markdown/dev/reference/api/pattern/svg/script/en.md
Normal file
32
markdown/dev/reference/api/pattern/svg/script/en.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: script
|
||||
---
|
||||
|
||||
A string that will be rendered as the script section of the SVG document.
|
||||
|
||||
We don't use this ourselves, but it's there if you need it.
|
||||
|
||||
```svg
|
||||
<script type="text/javascript">
|
||||
/* svg.script will be inserted */
|
||||
</scripts>
|
||||
```
|
||||
|
||||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
When adding your own script, it's important not to
|
||||
overwrite this property, but rather add your own.
|
||||
|
||||
In other words, do this:
|
||||
|
||||
```js
|
||||
svg.script += myScript;
|
||||
```
|
||||
and don't do this:
|
||||
|
||||
```js
|
||||
svg.script = myScript;
|
||||
```
|
||||
|
||||
</Warning>
|
32
markdown/dev/reference/api/pattern/svg/style/en.md
Normal file
32
markdown/dev/reference/api/pattern/svg/style/en.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
title: style
|
||||
---
|
||||
|
||||
A string that will be rendered as the style section of the SVG document.
|
||||
|
||||
The style attribute is where plugins will add additional snippets.
|
||||
|
||||
```svg
|
||||
<style type="text/css">
|
||||
/* svg.style will be inserted */
|
||||
</style>
|
||||
```
|
||||
|
||||
<Warning>
|
||||
|
||||
###### Add, but don't overwrite
|
||||
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;
|
||||
```
|
||||
|
||||
</Warning>
|
12
markdown/dev/reference/api/pattern/svg/tail/en.md
Normal file
12
markdown/dev/reference/api/pattern/svg/tail/en.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
---
|
||||
title: tail
|
||||
---
|
||||
|
||||
A string that closes both the group opened by [Pattern.svg.head](/reference/api/pattern/svg/head/) and the SVG tag.
|
||||
|
||||
```svg
|
||||
</g>
|
||||
<!-- end of group #fs-container -->
|
||||
</svg>
|
||||
```
|
||||
|
19
markdown/dev/reference/api/pattern/use/en.md
Normal file
19
markdown/dev/reference/api/pattern/use/en.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: use()
|
||||
---
|
||||
|
||||
```js
|
||||
Pattern pattern.use(object plugin)
|
||||
```
|
||||
Loads a freesewing plugin. This method is chainable.
|
||||
|
||||
See [extending freesewing](/extend) for details about extending
|
||||
freesewing with plugins.
|
||||
|
||||
<Fixme>
|
||||
|
||||
- Add code example
|
||||
- Explain difference between run and build-time plugins
|
||||
|
||||
</Fixme>
|
||||
|
19
markdown/dev/reference/api/pattern/wants/en.md
Normal file
19
markdown/dev/reference/api/pattern/wants/en.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
title: wants()
|
||||
---
|
||||
|
||||
```js
|
||||
bool pattern.wants(string partName)
|
||||
```
|
||||
|
||||
Returns `true` or `false` depending on whether a pattern part is *wanted*, based
|
||||
on the value of [pattern.settings.only](/settings#only).
|
||||
|
||||
A part is wanted if:
|
||||
|
||||
- it is requested by the user in the `only` setting
|
||||
- the `only` setting is not set or is `false`, and the part is not hidden
|
||||
|
||||
> You don't typically use this method. Instead, configure part
|
||||
> dependencies in your [configuration file](/config).
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue