avtc-pi-settings-ui 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/type-definitions.ts +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "avtc-pi-settings-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "A schema-driven settings UI for pi extensions — define your settings, get a tabbed modal, a /<name>:settings command, and layered persistence.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
package/src/type-definitions.ts
CHANGED
|
@@ -221,6 +221,18 @@ const stringType: TypeDefinition<string> = {
|
|
|
221
221
|
errorMessage: "Select a value",
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* The boolean choices, as `[label, value]` preset pairs (label equals value). The default
|
|
226
|
+
* `presets` for the `boolean` type — a consumer writes only `{ type: "boolean" }` and gets
|
|
227
|
+
* these without declaring `presets` (overridable per-setting: replace, not merge). Without
|
|
228
|
+
* them a boolean resolves to no presets, so the value picker would surface only the current
|
|
229
|
+
* value (e.g. just "False") with nothing to toggle to.
|
|
230
|
+
*/
|
|
231
|
+
export const BOOLEAN_PRESETS = [
|
|
232
|
+
["true", true],
|
|
233
|
+
["false", false],
|
|
234
|
+
] as const satisfies readonly PresetPair[];
|
|
235
|
+
|
|
224
236
|
const booleanType: TypeDefinition<boolean> = {
|
|
225
237
|
id: "boolean",
|
|
226
238
|
valueType: "boolean",
|
|
@@ -230,6 +242,7 @@ const booleanType: TypeDefinition<boolean> = {
|
|
|
230
242
|
return undefined;
|
|
231
243
|
},
|
|
232
244
|
format: (value) => String(value),
|
|
245
|
+
presets: BOOLEAN_PRESETS,
|
|
233
246
|
supportsCustomValues: false,
|
|
234
247
|
errorMessage: "Select true or false",
|
|
235
248
|
};
|