|
@@ -125,35 +125,37 @@ function renderLongNumberValue(val: string, maximumFractionDigits = 0) {
|
|
* Contains all possible features with their default values and other configuration.
|
|
* Contains all possible features with their default values and other configuration.
|
|
*
|
|
*
|
|
* **Required props:**
|
|
* **Required props:**
|
|
- * <!-------------------------------------------------------------------------------------------------------------------------------------------------------->
|
|
|
|
- * | Property | Description |
|
|
|
|
- * | :------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
- * | `type` | type of the feature configuration element - use autocomplete or check `FeatureTypeProps` in `src/types.ts` |
|
|
|
|
- * | `category` | category of the feature - use autocomplete or check `FeatureCategory` in `src/types.ts` |
|
|
|
|
- * | `default` | default value of the feature - type of the value depends on the given `type` |
|
|
|
|
- * | `enable(value: any)` | (required if reloadRequired = false) - function that will be called when the feature is enabled / initialized for the first time |
|
|
|
|
|
|
+ * <!------------------------------------------------------------------------------------------------------------------------------------------------------------------>
|
|
|
|
+ * | Property | Description |
|
|
|
|
+ * | :----------------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
+ * | `type: string` | Type of the feature configuration element - use autocomplete or check `FeatureTypeProps` in `src/types.ts` |
|
|
|
|
+ * | `category: string` | Category of the feature - use autocomplete or check `FeatureCategory` in `src/types.ts` |
|
|
|
|
+ * | `default: unknown` | Default value of the feature - type of the value depends on the given `type` |
|
|
|
|
+ * | `enable(value: unknown): void` | (required if reloadRequired = false) - function that will be called when the feature is enabled / initialized for the first time |
|
|
|
|
+ * <!------------------------------------------------------------------------------------------------------------------------------------------------------------------>
|
|
*
|
|
*
|
|
*
|
|
*
|
|
* **Optional props:**
|
|
* **Optional props:**
|
|
- * <!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
|
|
|
|
- * | Property | Description |
|
|
|
|
- * | :------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
- * | `disable: (newValue: any) => void` | for type `toggle` only - function that will be called when the feature is disabled - can be a synchronous or asynchronous function |
|
|
|
|
- * | `change: (key: string, prevValue: any, newValue: any)` => void | for types `number`, `select`, `slider` and `hotkey` only - function that will be called when the value is changed |
|
|
|
|
- * | `click: () => void` | for type `button` only - function that will be called when the button is clicked |
|
|
|
|
- * | `helpText: string / () => string` | function that returns an HTML string or the literal string itself that will be the help text for this feature - writing as function is useful for pluralizing or inserting values into the translation at runtime - if not set, translation with key `feature_helptext_featureKey` will be used instead, if available |
|
|
|
|
- * | `textAdornment: () => string / Promise<string>` | function that returns an HTML string that will be appended to the text in the config menu as an adornment element |
|
|
|
|
- * | `unit: string / (val: number) => string` | Only if type is `number` or `slider` - The unit text that is displayed next to the input element, i.e. " px" - a leading space need to be added too! |
|
|
|
|
- * | `min: number` | Only if type is `number` or `slider` - Overwrites the default of the `min` property of the HTML input element |
|
|
|
|
- * | `max: number` | Only if type is `number` or `slider` - Overwrites the default of the `max` property of the HTML input element |
|
|
|
|
- * | `step: number` | Only if type is `number` or `slider` - Overwrites the default of the `step` property of the HTML input element |
|
|
|
|
- * | `options: SelectOption[] / () => SelectOption[]` | Only if type is `select` - function that returns an array of objects with `value` and `label` properties |
|
|
|
|
- * | `reloadRequired: boolean` | if true (default), the page needs to be reloaded for the changes to take effect - if false, `enable()` needs to be provided |
|
|
|
|
- * | `advanced: boolean` | if true, the feature will only be shown if the advanced mode feature has been turned on |
|
|
|
|
- * | `hidden: boolean` | if true, the feature will not be shown in the settings - default is undefined (false) |
|
|
|
|
- * | `valueHidden: boolean` | If true, the value of the feature will be hidden in the settings and via the plugin interface - default is undefined (false) |
|
|
|
|
- * | `normalize: (val: any) => any` | Function that will be called to normalize the value before it is saved - useful for trimming strings or other simple operations |
|
|
|
|
- * | `renderValue: (val: string) => string` | If provided, is used to render the value's label in the config menu |
|
|
|
|
|
|
+ * <!------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
|
|
|
|
+ * | Property | Description |
|
|
|
|
+ * | :----------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
|
|
+ * | `disable(newValue: unknown): void` | For type `toggle` only - function that will be called when the feature is disabled - can be a synchronous or asynchronous function |
|
|
|
|
+ * | `change(key: string, prevValue: unknown, newValue: unknown): void` | For types `number`, `select`, `slider` and `hotkey` only - function that will be called when the value is changed |
|
|
|
|
+ * | `click(): void` | For type `button` only - function that will be called when the button is clicked |
|
|
|
|
+ * | `helpText: string \| () => string` | Function that returns an HTML string or the literal string itself that will be the help text for this feature - writing as function is useful for pluralizing or inserting values into the translation at runtime - if not set, translation with key `feature_helptext_featureKey` will be used instead, if available |
|
|
|
|
+ * | `textAdornment(): string \| Promise<string>` | Function that returns an HTML string that will be appended to the text in the config menu as an adornment element |
|
|
|
|
+ * | `unit: string \| (val: number) => string` | For types `number` or `slider` only - The unit text that is displayed next to the input element, i.e. " px" - a leading space need to be added too! |
|
|
|
|
+ * | `min: number` | For types `number` or `slider` only - Overwrites the default of the `min` property of the HTML input element |
|
|
|
|
+ * | `max: number` | For types `number` or `slider` only - Overwrites the default of the `max` property of the HTML input element |
|
|
|
|
+ * | `step: number` | For types `number` or `slider` only - Overwrites the default of the `step` property of the HTML input element |
|
|
|
|
+ * | `options: SelectOption[] \| () => SelectOption[]` | For type `select` only - function that returns an array of objects with `value` and `label` properties |
|
|
|
|
+ * | `reloadRequired: boolean` | If true (default), the page needs to be reloaded for the changes to take effect - if false, `enable()` needs to be provided |
|
|
|
|
+ * | `advanced: boolean` | If true, the feature will only be shown if the advanced mode feature has been turned on |
|
|
|
|
+ * | `hidden: boolean` | If true, the feature will not be shown in the settings - default is undefined (false) |
|
|
|
|
+ * | `valueHidden: boolean` | If true, the value of the feature will be hidden in the settings and via the plugin interface - default is undefined (false) |
|
|
|
|
+ * | `normalize(val: unknown): unknown` | Function that will be called to normalize the value before it is saved - useful for trimming strings or other simple operations |
|
|
|
|
+ * | `renderValue(val: string): string` | If provided, is used to render the value's label in the config menu |
|
|
|
|
+ * <!------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
|
|
*
|
|
*
|
|
* TODO: go through all features and set as many as possible to reloadRequired = false
|
|
* TODO: go through all features and set as many as possible to reloadRequired = false
|
|
*/
|
|
*/
|