1
0
Fork 0

fix(docs): Update and correct Part Options docs

This commit is contained in:
Benjamin F 2022-12-07 17:30:51 -08:00
parent 3a15f7a730
commit a687ca43d8
10 changed files with 44 additions and 69 deletions

View file

@ -10,7 +10,7 @@ Counters are for integers only. Things like number of buttons and so on.
Your counter option should be a plain object with these properties:
- `count` : The default integer value
- `min` : The minimal integer value that's allowed
- `min` : The minimum integer value that's allowed
- `max` : The maximum integer value that's allowed
<Tip>

View file

@ -9,7 +9,7 @@ For angles, use a degree option.
Your degree option should be a plain object with these properties:
- `deg` : The default value in degrees
- `min` : The minimul that's allowed
- `min` : The minimum that's allowed
- `max` : The maximum that's allowed
<Tip>
@ -28,9 +28,10 @@ more details.
```js
options: {
collarAngle: {
deg: 85,
min: 60
max: 130
deg: 85,
min: 60,
max: 130,
menu: 'fit'
}
}
```

View file

@ -9,7 +9,7 @@ list the part's options:
const part = {
name: 'example.front',
options: {
chestEase: { pct: 12, min: 0, max: 25 },
chestEase: { pct: 12, min: 0, max: 25, menu: 'fit' },
},
draft: ({ part }) => part
}
@ -61,6 +61,14 @@ percentage options][snapped] instead.
</Warning>
## Specifying the menu
The `menu` property is used to specify what menu name the option should be listed under in the Design Options section.
- Any arbitrary string can be used, and these names are used to organize options into logical sections. Examples of menu names that might be used include `fit`, `style`, and `advanced`.
- The menu property is optional. An option without a menu property will still exist but be hidden, not shown or accessible to the user in Design Options.
- Additional levels of submenus can be specified by using a menu name with text separated by "`.`" period characters. For example, `style.sleeves` can be used to have the option appear in the "Sleeves" submenu under the "Style" menu.
- Menus and options will be appear to the user in alphabetical order. The exception is the `advanced` menu which, if present, will be displayed at the end of all other menus.
[bool]: /reference/api/part/config/options/bool
[const]: /reference/api/part/config/options/const
[count]: /reference/api/part/config/options/counter
@ -68,4 +76,4 @@ percentage options][snapped] instead.
[list]: /reference/api/part/config/options/list
[pct]: /reference/api/part/config/options/pct
[snapped]: /reference/api/part/config/options/pct/snap
[mm]: /reference/api/part/config/options/pct/mm
[mm]: /reference/api/part/config/options/mm

View file

@ -1,15 +1,18 @@
---
title: Extending options
title: Extending options and suppressing translation
---
<Fixme>
## Extending and overriding inherited options
Explain extending options here
Parts automatically inherit options from the parts they are based on.
However, parts can also extend their options.
</Fixme>
- A part can define new options. These new options are added to the ones inherited.
- Options can be redefined to override/extend an inherited option.
- For example, an inherited percentage option can be redefined to have different min, max, and/or default values.
- A different menu can be specified for an inherited option, or the menu property can be ommitted or set to `null` to prevent the option from appearing in the menus.
## Suppress translation
## Suppressing translation
In the example above, you want the different `list` options to be translated.
But sometimes, there is no need for that, like in this example from Breanna:
@ -41,49 +44,7 @@ options: {
}
```
As you can see above, you can set the `doNotTranslate` property to `true` and to indicate this.
<Note>
##### This is not a core feature
To be clear, setting this here does not do anything in core. It's merely extra
metadata you can add on the option to facilitate frontend integration.
</Note>
## Suppress translation
In the example above, you want the different `list` options to be translated.
But sometimes, there is no need for that, like in this example from Breanna:
```js
options: {
primaryBustDart: {
list: [
'06:00',
'07:00',
'08:00',
'09:00',
'10:00',
'11:00',
'11:30',
'12:00',
'12:30',
'13:00',
'13:30',
'14:00',
'15:00',
'16:00',
'17:00',
],
dflt: '06:00',
doNotTranslate: true,
},
// More here
}
```
As you can see above, you can set the `doNotTranslate` property to `true` and to indicate this.
As you can see above, you can set the `doNotTranslate` property to `true` to indicate this.
<Note>

View file

@ -30,12 +30,13 @@ options: {
dflt: "angledBarrelCuff",
list: [
"roundedBarrelCuff",
"angledBarrelCuff"
"straightBarrelCuff"
"roundedFrenchCuff"
"angledFrenchCuff"
"angledBarrelCuff",
"straightBarrelCuff",
"roundedFrenchCuff",
"angledFrenchCuff",
"straightFrenchCuff"
]
],
menu: 'style'
}
}
```

View file

@ -2,16 +2,20 @@
title: Millimeter options
---
<Warning>
While FreeSewing supports millimeter options, we recommend
using [percentage options][1] and will not accept
contributions that use millimeter options.
</Warning>
## Structure
A millimeter option should be a plain object with these properties:
- `mm` : The default value in millimeter
- `min` : The minimul that's allowed
- `mm` : The default value in millimeters
- `min` : The minimum that's allowed
- `max` : The maximum that's allowed
## Example

View file

@ -64,9 +64,9 @@ You can unlock those features by adding the following properties to your option:
- `toAbs`: A method to [return the option value in millimeter][toabs]
- `snap`: The configuration to control [snapping of percentage options][snap]
[fromabs]: /reference/api/config/options/pct/fromabs
[toabs]: /reference/api/config/options/pct/toabs
[snap]: /reference/api/config/options/pct/snap
[fromabs]: /reference/api/part/config/options/pct/fromabs
[toabs]: /reference/api/part/config/options/pct/toabs
[snap]: /reference/api/part/config/options/pct/snap
Refer to the relevant documentation for more details:

View file

@ -91,4 +91,4 @@ it will also add a `toAbs()` method that does the inverse: return the
value in millimeter of whatever percentage the option is set to.
See [Reporting a percentage option value in
millimeter](/reference/api/config/options/pct/toabs) for details.
millimeter](/reference/api/part/config/options/pct/toabs) for details.

View file

@ -90,7 +90,7 @@ of numbers.
The difference is that this allows you to supply a different list of snap values
for users using metric or imperial units.
In the example below, the value of [settings.units](/api/settings/units) will
In the example below, the value of [settings.units](/reference/settings/units) will
determine which list of snap values gets used.
Then, if the absolute value returned by `toAbs()` is in the

View file

@ -81,4 +81,4 @@ also add a `fromAbs()` method that does the inverse: return the percentage of
any millimeter value passed into it.
See [Setting a value in millimeter as a
percentage option](/api/config/options/pct/fromabs) for details.
percentage option](/reference/api/part/config/options/pct/fromabs) for details.