@kiosko/sdk 0.2.9 → 0.2.11
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/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -1
- package/dist/schema.d.ts +6 -0
- package/dist/schema.js +1 -1
- package/package.json +1 -1
- package/src/plugin.ts +1 -1
- package/src/schema.ts +7 -1
package/dist/plugin.d.ts
CHANGED
|
@@ -571,7 +571,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
|
|
|
571
571
|
* package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
|
|
572
572
|
* it runs); the registry compares them with `satisfies`.
|
|
573
573
|
*/
|
|
574
|
-
export declare const SDK_VERSION = "0.2.
|
|
574
|
+
export declare const SDK_VERSION = "0.2.11";
|
|
575
575
|
/**
|
|
576
576
|
* What a plugin does on the machine, declared for the person who installs
|
|
577
577
|
* it: the Plugins page and the plugin store show it next to the plugin. It
|
package/dist/plugin.js
CHANGED
|
@@ -18,7 +18,7 @@ export const PAD_KEYS = ['up', 'down', 'left', 'right', 'a', 'b', 'x', 'y', 'l',
|
|
|
18
18
|
* package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
|
|
19
19
|
* it runs); the registry compares them with `satisfies`.
|
|
20
20
|
*/
|
|
21
|
-
export const SDK_VERSION = '0.2.
|
|
21
|
+
export const SDK_VERSION = '0.2.11';
|
|
22
22
|
/* Identity helpers: they only exist so TypeScript infers option and data types. */
|
|
23
23
|
export function defineWidget(w) {
|
|
24
24
|
return w;
|
package/dist/schema.d.ts
CHANGED
|
@@ -100,6 +100,12 @@ export interface MapField extends Common<Record<string, string>> {
|
|
|
100
100
|
kind: 'map';
|
|
101
101
|
keyLabel?: Localized;
|
|
102
102
|
valueLabel?: Localized;
|
|
103
|
+
/**
|
|
104
|
+
* Keys to offer, from a source's live data (see `ChoicesRef`): the editor
|
|
105
|
+
* shows each key's label next to it (a device's last reading, say) and
|
|
106
|
+
* offers the ones not in the map yet. Keys stay free text.
|
|
107
|
+
*/
|
|
108
|
+
keyChoices?: ChoicesRef;
|
|
103
109
|
}
|
|
104
110
|
export type Field = StringField | NumberField | BooleanField | EnumField<string> | ColorField | ListField<any> | ObjectField<any> | MapField;
|
|
105
111
|
/** The TypeScript type a field validates to. */
|
package/dist/schema.js
CHANGED
|
@@ -159,7 +159,7 @@ export function toJsonSchema(f) {
|
|
|
159
159
|
case 'list':
|
|
160
160
|
return { ...base, type: 'array', items: toJsonSchema(f.item), maxItems: f.max, ...(f.filter ? { 'x-ui': { ...ui, widget: 'filter', choices: f.item.kind === 'string' ? f.item.choices : undefined }, 'x-filter': true } : {}) };
|
|
161
161
|
case 'map':
|
|
162
|
-
return { ...base, type: 'object', additionalProperties: { type: 'string' } };
|
|
162
|
+
return { ...base, type: 'object', additionalProperties: { type: 'string' }, ...(f.keyChoices ? { 'x-ui': { ...ui, keyChoices: f.keyChoices } } : {}) };
|
|
163
163
|
case 'object':
|
|
164
164
|
return { ...base, type: 'object', properties: Object.fromEntries(Object.entries(f.props).map(([k, sub]) => [k, toJsonSchema(sub)])) };
|
|
165
165
|
}
|
package/package.json
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -566,7 +566,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
|
|
|
566
566
|
* package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
|
|
567
567
|
* it runs); the registry compares them with `satisfies`.
|
|
568
568
|
*/
|
|
569
|
-
export const SDK_VERSION = '0.2.
|
|
569
|
+
export const SDK_VERSION = '0.2.11';
|
|
570
570
|
|
|
571
571
|
/**
|
|
572
572
|
* What a plugin does on the machine, declared for the person who installs
|
package/src/schema.ts
CHANGED
|
@@ -102,6 +102,12 @@ export interface MapField extends Common<Record<string, string>> {
|
|
|
102
102
|
kind: 'map';
|
|
103
103
|
keyLabel?: Localized;
|
|
104
104
|
valueLabel?: Localized;
|
|
105
|
+
/**
|
|
106
|
+
* Keys to offer, from a source's live data (see `ChoicesRef`): the editor
|
|
107
|
+
* shows each key's label next to it (a device's last reading, say) and
|
|
108
|
+
* offers the ones not in the map yet. Keys stay free text.
|
|
109
|
+
*/
|
|
110
|
+
keyChoices?: ChoicesRef;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
export type Field = StringField | NumberField | BooleanField | EnumField<string> | ColorField | ListField<any> | ObjectField<any> | MapField;
|
|
@@ -268,7 +274,7 @@ export function toJsonSchema(f: Field): Record<string, unknown> {
|
|
|
268
274
|
case 'list':
|
|
269
275
|
return { ...base, type: 'array', items: toJsonSchema(f.item), maxItems: f.max, ...(f.filter ? { 'x-ui': { ...ui, widget: 'filter', choices: f.item.kind === 'string' ? f.item.choices : undefined }, 'x-filter': true } : {}) };
|
|
270
276
|
case 'map':
|
|
271
|
-
return { ...base, type: 'object', additionalProperties: { type: 'string' } };
|
|
277
|
+
return { ...base, type: 'object', additionalProperties: { type: 'string' }, ...(f.keyChoices ? { 'x-ui': { ...ui, keyChoices: f.keyChoices } } : {}) };
|
|
272
278
|
case 'object':
|
|
273
279
|
return { ...base, type: 'object', properties: Object.fromEntries(Object.entries(f.props as Record<string, Field>).map(([k, sub]) => [k, toJsonSchema(sub)])) };
|
|
274
280
|
}
|