diff --git a/sites/dev/docs/reference/store-methods/flag.error/readme.mdx b/sites/dev/docs/reference/store-methods/flag.error/readme.mdx index 215083ab38c..51456ac1bde 100644 --- a/sites/dev/docs/reference/store-methods/flag.error/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.error/readme.mdx @@ -11,7 +11,6 @@ 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 @@ -23,4 +22,8 @@ undefined Store.flag.error({ 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). +:::note RELATED +The above Signature contains abbreviated information. +For full details about this method's Signature, Configuration, and +Example usage, see [flag.info()](/reference/store-methods/flag.info). +::: diff --git a/sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx b/sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx index d64c09075d9..5ac66c00685 100644 --- a/sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.fixme/readme.mdx @@ -11,7 +11,6 @@ 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 @@ -23,4 +22,8 @@ undefined Store.flag.fixme({ 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). +:::note RELATED +The above Signature contains abbreviated information. +For full details about this method's Signature, Configuration, and +Example usage, see [flag.info()](/reference/store-methods/flag.info). +::: diff --git a/sites/dev/docs/reference/store-methods/flag.info/readme.mdx b/sites/dev/docs/reference/store-methods/flag.info/readme.mdx index 8ac3ffcfdaf..964adf23fd4 100644 --- a/sites/dev/docs/reference/store-methods/flag.info/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.info/readme.mdx @@ -11,17 +11,28 @@ 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. +:::tip +The Signature, Configuration, and Example information below applies to the +`flag.error()`, `flag.fixme()`, `flag.info()`, `flag.note()`, +`flag.tip()`, and `flag.warn()` methods. +::: ## Signature ```js undefined Store.flag.info({ + id: 'id_string', title: 'flag:expandIsOn.t', desc: 'flag:expandIsOn.d', + msg: 'flag:expandIsOn', notes: [ 'sorcha:moreInfo1', 'sorcha:moreInfo2', ], + replace: { + key1: //code for replacement value, + key2: //code for replacement value, + }, suggest: { text: 'flag:disable', icon: 'expand', @@ -37,29 +48,41 @@ The example above is from our implementation, which uses the following propertie ## 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)) | +| Property | Type | Description | +| ------------------------: | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | String | An ID for this flag message. If none is provided, `title` will be used | +| `title` | String | The translation key for the title of the message | +| `desc` | String | The translation key for the description of the message | +| `msg` | String | The translation key for the message | +| `notes` | String or Array of Strings | Translation keys for more information/notes (see [Notes](#notes)) | +| `replace` | Object | Key/values for text replacements (see [Replacement Values](#replacement-values)) | +| `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. +Unlike `title` or `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. +`notes` are also translation keys, and the translation strings will be +rendered as markdown. + +### Replacement Values + +The translation strings for `title`, `desc`, and `notes` can contain +variables that allow calculated values to be inserted into messages. + +The optional `replace` object holds key/value pair properties where +keys are variable names and values contain code that generates +the replacement text for that variable. ### 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: +An optional name of an icon. Or leave it out to not render an icon. +The idea is that the icon helps convey the message, with the following icon names supported: - `note` - `info` @@ -77,12 +100,12 @@ Any other name will be ignored. 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: +The `suggest.update` object has only two possible top-level keys: -- `settings` +- `settings` - `ui` -They both take the same parameter, an array with two elements: +They both take the same parameter, an array with two elements: ```mjs Array [`path`, `value`] @@ -129,4 +152,3 @@ So to set the `waistEase` option to `0.2`, it should look like this: return part } ``` - diff --git a/sites/dev/docs/reference/store-methods/flag.note/readme.mdx b/sites/dev/docs/reference/store-methods/flag.note/readme.mdx index 96237cf8a29..1af8ce08cb2 100644 --- a/sites/dev/docs/reference/store-methods/flag.note/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.note/readme.mdx @@ -11,7 +11,6 @@ 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 @@ -23,4 +22,8 @@ undefined Store.flag.note({ 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). +:::note RELATED +The above Signature contains abbreviated information. +For full details about this method's Signature, Configuration, and +Example usage, see [flag.info()](/reference/store-methods/flag.info). +::: diff --git a/sites/dev/docs/reference/store-methods/flag.preset/readme.mdx b/sites/dev/docs/reference/store-methods/flag.preset/readme.mdx index 1895122c4d4..e2c65b79490 100644 --- a/sites/dev/docs/reference/store-methods/flag.preset/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.preset/readme.mdx @@ -38,4 +38,3 @@ The example above is from our implementation, which uses the following propertie return part } ``` - diff --git a/sites/dev/docs/reference/store-methods/flag.tip/readme.mdx b/sites/dev/docs/reference/store-methods/flag.tip/readme.mdx index 44751b1e384..bdc84cf91da 100644 --- a/sites/dev/docs/reference/store-methods/flag.tip/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.tip/readme.mdx @@ -11,7 +11,6 @@ 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 @@ -23,4 +22,8 @@ undefined Store.flag.tip({ 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). +:::note RELATED +The above Signature contains abbreviated information. +For full details about this method's Signature, Configuration, and +Example usage, see [flag.info()](/reference/store-methods/flag.info). +::: diff --git a/sites/dev/docs/reference/store-methods/flag.warn/readme.mdx b/sites/dev/docs/reference/store-methods/flag.warn/readme.mdx index 6efc6fe595d..318b79389b4 100644 --- a/sites/dev/docs/reference/store-methods/flag.warn/readme.mdx +++ b/sites/dev/docs/reference/store-methods/flag.warn/readme.mdx @@ -11,7 +11,6 @@ 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 @@ -23,4 +22,8 @@ undefined Store.flag.warn({ 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). +:::note RELATED +The above Signature contains abbreviated information. +For full details about this method's Signature, Configuration, and +Example usage, see [flag.info()](/reference/store-methods/flag.info). +:::