@kosdev-code/kos-ddk-cli 0.1.0-dev.69 → 0.1.0-dev.72

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kos-ddk-tools",
3
- "version": "0.1.0-dev.69",
3
+ "version": "0.1.0-dev.72",
4
4
  "description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones.",
5
5
  "author": {
6
6
  "name": "kosdev-code"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "kos-ddk-tools",
4
- "version": "0.1.0-dev.69",
4
+ "version": "0.1.0-dev.72",
5
5
  "description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones.",
6
6
  "license": "MIT"
7
7
  }
@@ -19219,7 +19219,14 @@
19219
19219
  "name": "ddk-index",
19220
19220
  "title": "KOS DDK reference index",
19221
19221
  "description": "Start here: the DDK extension points, component libraries and design system, and which tool or resource covers each.",
19222
- "body": "# KOS DDK reference\n\nA DDK plugin contributes to extension points in its `.kos.json` and renders DDK components inside them. Plugins compose components; the design tokens belong to the DDK app and its themes.\n\n## Extension points\n\n- ddk://extension-point/ddk.cui — CUI (Consumer User Interface), `contributes.cui`\n- ddk://extension-point/ddk.dashboard.detail — Dashboard Detail, `contributes.dashboardDetail`\n- ddk://extension-point/ddk.dashboard.macro-summary — Dashboard Macro Summary, `contributes.dashboardMacroSummary`\n- ddk://extension-point/ddk.dashboard.pump-detail — Dashboard Pump Detail, `contributes.dashboardPumpDetail`\n- ddk://extension-point/ddk.dashboard.pump-summary — Dashboard Pump Summary, `contributes.dashboardPumpSummary`\n- ddk://extension-point/ddk.dashboard.summary — Dashboard Summary, `contributes.dashboardSummary`\n- ddk://extension-point/ddk.nav.view — Navigation Views, `contributes.navViews`\n- ddk://extension-point/ddk.ncui.utilities — Utilities, `contributes.utilities`\n- ddk://extension-point/ddk.setup — Setup Steps, `contributes.setupStep`\n- ddk://extension-point/ddk.trouble.action — Trouble Actions, `contributes.troubleActions`\n\n## Components\n\n- `@kosdev-code/kos-ddk-components`: 161 components and styled parts\n- `@kosdev-code/kos-ddk-model-components`: 89 components and styled parts\n\nlist_ddk_components finds them; describe_ddk_component gives one's props, the components and hooks it uses, and every token it reads.\n\n## Design system\n\n- ddk://design/base — DDK DESIGN.md\n- ddk://design/flex-eu — DDK Flex EU DESIGN.md\n- ddk://design/compact — DDK Compact DESIGN.md\n\nChange tokens only to create a new component (component tokens) or a theme (semantic tokens).\n\n## Guides\n\n- ddk://guide/ddk-dev — Testing plugins against a running DDK\n- ddk://guide/getting-started — Getting started with the DDK CLI\n- ddk://guide/storybook — Developing DDK contributions in Storybook\n- ddk://guide/descriptor-project — NCUI descriptor projects\n\nfind_ddk_capability maps a need to the extension point, the component and the tool."
19222
+ "body": "# KOS DDK reference\n\nA DDK plugin contributes to extension points in its `.kos.json` and renders DDK components inside them. Plugins compose components; the design tokens belong to the DDK app and its themes.\n\n## Extension points\n\n- ddk://extension-point/ddk.cui — CUI (Consumer User Interface), `contributes.cui`\n- ddk://extension-point/ddk.dashboard.detail — Dashboard Detail, `contributes.dashboardDetail`\n- ddk://extension-point/ddk.dashboard.macro-summary — Dashboard Macro Summary, `contributes.dashboardMacroSummary`\n- ddk://extension-point/ddk.dashboard.pump-detail — Dashboard Pump Detail, `contributes.dashboardPumpDetail`\n- ddk://extension-point/ddk.dashboard.pump-summary — Dashboard Pump Summary, `contributes.dashboardPumpSummary`\n- ddk://extension-point/ddk.dashboard.summary — Dashboard Summary, `contributes.dashboardSummary`\n- ddk://extension-point/ddk.nav.view — Navigation Views, `contributes.navViews`\n- ddk://extension-point/ddk.ncui.utilities — Utilities, `contributes.utilities`\n- ddk://extension-point/ddk.setup — Setup Steps, `contributes.setupStep`\n- ddk://extension-point/ddk.trouble.action — Trouble Actions, `contributes.troubleActions`\n\n## Components\n\n- `@kosdev-code/kos-ddk-components`: 161 components and styled parts\n- `@kosdev-code/kos-ddk-model-components`: 89 components and styled parts\n\nlist_ddk_components finds them; describe_ddk_component gives one's props, the components and hooks it uses, and every token it reads.\n\n## Design system\n\n- ddk://design/base — DDK DESIGN.md\n- ddk://design/flex-eu — DDK Flex EU DESIGN.md\n- ddk://design/compact — DDK Compact DESIGN.md\n\nChange tokens only to create a new component (component tokens) or a theme (semantic tokens).\n\n## Guides\n\n- ddk://guide/config-property-cards — Configuration property cards\n- ddk://guide/ddk-dev — Testing plugins against a running DDK\n- ddk://guide/getting-started — Getting started with the DDK CLI\n- ddk://guide/storybook — Developing DDK contributions in Storybook\n- ddk://guide/descriptor-project — NCUI descriptor projects\n\nfind_ddk_capability maps a need to the extension point, the component and the tool."
19223
+ },
19224
+ {
19225
+ "uri": "ddk://guide/config-property-cards",
19226
+ "name": "ddk-guide-config-property-cards",
19227
+ "title": "Configuration property cards",
19228
+ "description": "The ConfigProp* cards in kos-ddk-model-components that show and edit a KosConfigProperty, ConfigPropertyInput choosing a card from the schema type, and when cards write (immediately, or batched with StagedChangesProvider).",
19229
+ "body": "# Configuration property cards\n\n`@kosdev-code/kos-ddk-model-components` has one card per kind of configuration value.\nEach takes a `configProperty` (a `KosConfigProperty`), reads its value with\n`useConfigProperty`, and writes it back with `configProperty.updateProperty`.\n\n| Card | Property | Renders |\n| ---- | -------- | ------- |\n| `ConfigPropToggleCard` | boolean | a toggle, Enabled / Disabled |\n| `ConfigPropSwitchCard` | string | a segmented switch (`SwitchCard`) over the `options` you pass |\n| `ConfigPropPickerCard` | enum, or a property with options | a picker (`PickerCard`) of the property's options |\n| `ConfigPropInputCard` | string or number | a text input with the property's unit; `displayOptions` `min`/`max` validate it |\n| `ConfigPropInputRangeCard` | int or double | a number input within its range |\n| `ConfigPropTimePickerCard` | a time of day, in seconds | a time picker |\n| `ConfigPropInfoCard` | string | the value, read-only |\n| `ConfigPropSingleInputEnableCard` | any, plus a boolean | one input that a toggle (`enabledConfigProperty`) enables |\n| `ConfigPropMultiInputEnableCard` | several, plus a boolean | several inputs behind one enabling toggle |\n\nThe cards take the props of the DDK card they wrap (`label`, `float`, `collapse` and so\non). Lay them out in a `TabContainer`, with a `SettingsSubheading` per group.\n\n## Letting the schema choose: ConfigPropertyInput\n\n`ConfigPropertyInput` renders the card for the property's `schemaType`: boolean → toggle,\nint and double → input range, String → input, enum → picker. Without a `label` it\ntranslates the property id in the `config-properties` namespace. In compact mode the input\nand picker cards take the compact style. Pass `factory` to map types to other cards.\n\n## When a card writes\n\nEach card writes its property as soon as it changes.\n\nFor an interaction whose edits must be applied together, wrap the page in\n`StagedChangesProvider` (or `withStagedChanges`). Cards that support staging then keep\nthe new value instead of writing it; `useStagedChanges()` gives `saveChanges()` to write\nevery staged value and `clearStagedChanges()` to drop them. `ConfigPropToggleCard` and\n`ConfigPropTimePickerCard` stage; the other cards write straight away even inside the\nprovider."
19223
19230
  },
19224
19231
  {
19225
19232
  "uri": "ddk://guide/ddk-dev",
@@ -27,7 +27,8 @@ component content. Never hand-edit the contributions or experiences the tools wr
27
27
 
28
28
  3. **The extension point.** Read `ddk://extension-point/{id}`: its contribution fields,
29
29
  the props your component receives and the standard contributions. A Settings tab
30
- is a navigation view: `add_nav_view` with a `settings.<name>` descriptor.
30
+ is a navigation view: `add_nav_view` with a `settings.<name>` descriptor. A page that
31
+ edits device configuration (most Settings tabs) follows the `ddk-config-page` skill.
31
32
 
32
33
  4. **Replacing a standard contribution.** `list_ddk_contributions` lists the ones an
33
34
  override can replace. Pass the id as `override`: the tool takes its slot and gives
@@ -59,7 +60,17 @@ component content. Never hand-edit the contributions or experiences the tools wr
59
60
 
60
61
  8. **Develop it.** In Storybook with the `ddk-storybook` skill. Against a running device
61
62
  or simulator with `kosui ddk:dev` (`ddk://guide/ddk-dev`); that is where an override
62
- is seen replacing the standard contribution.
63
+ is seen replacing the standard contribution. In `ddk:dev`:
64
+ - Serve the descriptor project before opening the URL, unless its KAB is installed:
65
+ `kosui fixtures serve` in the workspace, and add
66
+ `&kosMock=on&kosFixtureServer=&kosSetup=<descriptor-project>` to the printed URL.
67
+ A new slot shows only once the descriptor lists it, and so does an override of a
68
+ slot only the descriptor project adds (`carbTank` with `carb`).
69
+ - Log in with a role the slot lists: Utilities and Settings are technician-only in
70
+ the standard descriptor.
71
+ - Show pump cards and pump details on a holder with no active troubles; a holder's
72
+ troubles take the place of its card body and detail. Storybook's container picks a
73
+ holder with the `dashboardKey`.
63
74
 
64
75
  9. **Validate.** `validate_ddk_plugin` checks the fields against each point's schema,
65
76
  ranks, experiences and their component files, overrides that do not win and tokens
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: ddk-config-page
3
+ description: >-
4
+ Build a DDK Settings tab or any DDK page that shows or edits device configuration:
5
+ model the configuration (SettingsModel, the plugin's own @kosConfigProperty fields,
6
+ one model per repeated entry such as cup sizes with prop keys, or a whole
7
+ @kosConfigBean for batched edits), hand the model to the page, and render the
8
+ ConfigProp* cards. Use when asked about DDK configuration input components, config
9
+ property cards, cup sizes, or a page that changes dispenser settings.
10
+ ---
11
+
12
+ # Build a DDK page on configuration properties
13
+
14
+ The page renders configuration that lives on a model; the model binds it to the device.
15
+ The cards are described in `ddk://guide/config-property-cards`.
16
+
17
+ ## Steps
18
+
19
+ 1. **Contribute the page.** A Settings tab is a navigation view: `add_nav_view` with a
20
+ `settings.<name>` descriptor (build-ddk-plugin skill).
21
+
22
+ 2. **Choose the mode.**
23
+ - **Config properties** (the usual case): the model has one `@kosConfigProperty` per
24
+ value. Each is a typed `KosConfigProperty` with unit conversion, formatting and
25
+ `options`, and each card writes its own property.
26
+ - **A config bean**: the model holds the whole bean at a path with `@kosConfigBean`
27
+ (`kos://decorator/kosConfigBean`): `values`, the schema, and `updateProperty(key,
28
+ value)`, which posts the whole bean. Use it when the page edits a set of values and
29
+ applies them together, or walks the schema. No unit conversion.
30
+
31
+ 3. **Model the configuration.**
32
+ - DDK settings (date and time formats, water and beverage visibility) are already on
33
+ `SettingsModel`.
34
+ - Your own values: find the config path and attribute on a live device with the
35
+ kos-device tools, then add each with `add_config_property` (build-kos-model skill).
36
+ Never hand-write the decorator.
37
+ - **Repeated entries** (cup sizes and the like: `cups.0.*` … `cups.4.*` in one bean):
38
+ one model type whose attributes carry a prop key, and a container that creates an
39
+ instance per entry (`kos://guide/prop-keys`):
40
+
41
+ ```typescript
42
+ const PROP_INDEX = createPropKey<CupModel>("index");
43
+
44
+ @kosConfigProperty({ path: PATH, attribute: `cups.${PROP_INDEX}.volume` })
45
+ volume!: KosConfigProperty<number>;
46
+
47
+ constructor(modelId: string, options: CupOptions) {
48
+ this.id = modelId;
49
+ this.index = options.index.toString(); // set before the properties resolve
50
+ }
51
+ ```
52
+
53
+ The container (`add_container_support`, singleton) builds the instances in `init`
54
+ (`Cup.instance(id).options({ index }).build()`, then `addModel`), registers `Cup`
55
+ with `addRelatedModel`, and adds the views the UI needs (enabled cups sorted by
56
+ volume, the largest cup).
57
+ - A bean: add `@kosConfigBean` by hand; no codegen tool writes it.
58
+
59
+ 4. **Give the page the model.** Wrap it in a `with…` higher-order component or call a
60
+ `use…` hook that loads the model: `withSettings` from kos-ddk-model-components for
61
+ `SettingsModel`, and the same pair for your own model (`withCupContainer` /
62
+ `useCupContainer`).
63
+
64
+ 5. **Render it.** One card per property (`ddk://guide/config-property-cards`), or
65
+ `ConfigPropertyInput` to let the schema choose. For repeated entries, one card group
66
+ per instance:
67
+
68
+ ```tsx
69
+ const { model: cupContainer } = useCupContainer();
70
+ return cupContainer?.allCups.map((cup) => (
71
+ <Card key={cup.id}>
72
+ <ConfigPropInputCard configProperty={cup.name} label={t("portion")} />
73
+ <ConfigPropInputCard configProperty={cup.volume} label={t("portion-size")} />
74
+ <ConfigPropToggleCard configProperty={cup.enabled} />
75
+ </Card>
76
+ ));
77
+ ```
78
+
79
+ For a bean, build the form from `values` and `getSchemaForProperty(key)`, keep the
80
+ edits in the page until Save, then write them with `updateProperty`.
81
+
82
+ 6. **Decide when edits are written.** Cards write as each value changes. To apply a
83
+ page's edits together, wrap it in `StagedChangesProvider` and call `saveChanges()`
84
+ from its Save action; only the toggle and time-picker cards stage
85
+ (`ddk://guide/config-property-cards`).
86
+
87
+ 7. **Develop and check it.** In Storybook the page reads and writes the simulator's real
88
+ configuration (ddk-storybook skill). In `kosui ddk:dev`, log in as technician: Settings
89
+ is technician-only in the standard descriptor.
@@ -1,6 +1,6 @@
1
1
  import styled from '@emotion/styled';
2
2
  import {
3
- <% if (layout !== "fullscreen") { -%>
3
+ <% if (locals.layout !== "fullscreen") { -%>
4
4
  Button,
5
5
  Content,
6
6
  Footer,
@@ -29,7 +29,7 @@ const <%= namePascalCase %>Container = styled.section`
29
29
  width: 100%;
30
30
  `;
31
31
 
32
- <% if (layout === "fullscreen") { -%>
32
+ <% if (locals.layout === "fullscreen") { -%>
33
33
  /** A fullscreen utility: it covers the display and closes from its header. */
34
34
  export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
35
35
  const { t } = useKosTranslation('<%= appProject %>');
@@ -0,0 +1,45 @@
1
+ ---
2
+ uri: ddk://guide/config-property-cards
3
+ name: ddk-guide-config-property-cards
4
+ title: Configuration property cards
5
+ description: The ConfigProp* cards in kos-ddk-model-components that show and edit a KosConfigProperty, ConfigPropertyInput choosing a card from the schema type, and when cards write (immediately, or batched with StagedChangesProvider).
6
+ ---
7
+
8
+ # Configuration property cards
9
+
10
+ `@kosdev-code/kos-ddk-model-components` has one card per kind of configuration value.
11
+ Each takes a `configProperty` (a `KosConfigProperty`), reads its value with
12
+ `useConfigProperty`, and writes it back with `configProperty.updateProperty`.
13
+
14
+ | Card | Property | Renders |
15
+ | ---- | -------- | ------- |
16
+ | `ConfigPropToggleCard` | boolean | a toggle, Enabled / Disabled |
17
+ | `ConfigPropSwitchCard` | string | a segmented switch (`SwitchCard`) over the `options` you pass |
18
+ | `ConfigPropPickerCard` | enum, or a property with options | a picker (`PickerCard`) of the property's options |
19
+ | `ConfigPropInputCard` | string or number | a text input with the property's unit; `displayOptions` `min`/`max` validate it |
20
+ | `ConfigPropInputRangeCard` | int or double | a number input within its range |
21
+ | `ConfigPropTimePickerCard` | a time of day, in seconds | a time picker |
22
+ | `ConfigPropInfoCard` | string | the value, read-only |
23
+ | `ConfigPropSingleInputEnableCard` | any, plus a boolean | one input that a toggle (`enabledConfigProperty`) enables |
24
+ | `ConfigPropMultiInputEnableCard` | several, plus a boolean | several inputs behind one enabling toggle |
25
+
26
+ The cards take the props of the DDK card they wrap (`label`, `float`, `collapse` and so
27
+ on). Lay them out in a `TabContainer`, with a `SettingsSubheading` per group.
28
+
29
+ ## Letting the schema choose: ConfigPropertyInput
30
+
31
+ `ConfigPropertyInput` renders the card for the property's `schemaType`: boolean → toggle,
32
+ int and double → input range, String → input, enum → picker. Without a `label` it
33
+ translates the property id in the `config-properties` namespace. In compact mode the input
34
+ and picker cards take the compact style. Pass `factory` to map types to other cards.
35
+
36
+ ## When a card writes
37
+
38
+ Each card writes its property as soon as it changes.
39
+
40
+ For an interaction whose edits must be applied together, wrap the page in
41
+ `StagedChangesProvider` (or `withStagedChanges`). Cards that support staging then keep
42
+ the new value instead of writing it; `useStagedChanges()` gives `saveChanges()` to write
43
+ every staged value and `clearStagedChanges()` to drop them. `ConfigPropToggleCard` and
44
+ `ConfigPropTimePickerCard` stage; the other cards write straight away even inside the
45
+ provider.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ddk-cli",
3
- "version": "0.1.0-dev.69",
3
+ "version": "0.1.0-dev.72",
4
4
  "description": "DDK commands for kosui: plugin projects and DDK extension-point contributions.",
5
5
  "type": "module",
6
6
  "kosui": {
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "kos": {
29
29
  "build": {
30
- "gitHash": "e4be4b5b919ad4e33d184bab6290440c3af5f239"
30
+ "gitHash": "7b6007fe34bf59d0ca34fd94b151869b4c29d5c6"
31
31
  }
32
32
  },
33
33
  "publishConfig": {
@@ -19219,7 +19219,14 @@
19219
19219
  "name": "ddk-index",
19220
19220
  "title": "KOS DDK reference index",
19221
19221
  "description": "Start here: the DDK extension points, component libraries and design system, and which tool or resource covers each.",
19222
- "body": "# KOS DDK reference\n\nA DDK plugin contributes to extension points in its `.kos.json` and renders DDK components inside them. Plugins compose components; the design tokens belong to the DDK app and its themes.\n\n## Extension points\n\n- ddk://extension-point/ddk.cui — CUI (Consumer User Interface), `contributes.cui`\n- ddk://extension-point/ddk.dashboard.detail — Dashboard Detail, `contributes.dashboardDetail`\n- ddk://extension-point/ddk.dashboard.macro-summary — Dashboard Macro Summary, `contributes.dashboardMacroSummary`\n- ddk://extension-point/ddk.dashboard.pump-detail — Dashboard Pump Detail, `contributes.dashboardPumpDetail`\n- ddk://extension-point/ddk.dashboard.pump-summary — Dashboard Pump Summary, `contributes.dashboardPumpSummary`\n- ddk://extension-point/ddk.dashboard.summary — Dashboard Summary, `contributes.dashboardSummary`\n- ddk://extension-point/ddk.nav.view — Navigation Views, `contributes.navViews`\n- ddk://extension-point/ddk.ncui.utilities — Utilities, `contributes.utilities`\n- ddk://extension-point/ddk.setup — Setup Steps, `contributes.setupStep`\n- ddk://extension-point/ddk.trouble.action — Trouble Actions, `contributes.troubleActions`\n\n## Components\n\n- `@kosdev-code/kos-ddk-components`: 161 components and styled parts\n- `@kosdev-code/kos-ddk-model-components`: 89 components and styled parts\n\nlist_ddk_components finds them; describe_ddk_component gives one's props, the components and hooks it uses, and every token it reads.\n\n## Design system\n\n- ddk://design/base — DDK DESIGN.md\n- ddk://design/flex-eu — DDK Flex EU DESIGN.md\n- ddk://design/compact — DDK Compact DESIGN.md\n\nChange tokens only to create a new component (component tokens) or a theme (semantic tokens).\n\n## Guides\n\n- ddk://guide/ddk-dev — Testing plugins against a running DDK\n- ddk://guide/getting-started — Getting started with the DDK CLI\n- ddk://guide/storybook — Developing DDK contributions in Storybook\n- ddk://guide/descriptor-project — NCUI descriptor projects\n\nfind_ddk_capability maps a need to the extension point, the component and the tool."
19222
+ "body": "# KOS DDK reference\n\nA DDK plugin contributes to extension points in its `.kos.json` and renders DDK components inside them. Plugins compose components; the design tokens belong to the DDK app and its themes.\n\n## Extension points\n\n- ddk://extension-point/ddk.cui — CUI (Consumer User Interface), `contributes.cui`\n- ddk://extension-point/ddk.dashboard.detail — Dashboard Detail, `contributes.dashboardDetail`\n- ddk://extension-point/ddk.dashboard.macro-summary — Dashboard Macro Summary, `contributes.dashboardMacroSummary`\n- ddk://extension-point/ddk.dashboard.pump-detail — Dashboard Pump Detail, `contributes.dashboardPumpDetail`\n- ddk://extension-point/ddk.dashboard.pump-summary — Dashboard Pump Summary, `contributes.dashboardPumpSummary`\n- ddk://extension-point/ddk.dashboard.summary — Dashboard Summary, `contributes.dashboardSummary`\n- ddk://extension-point/ddk.nav.view — Navigation Views, `contributes.navViews`\n- ddk://extension-point/ddk.ncui.utilities — Utilities, `contributes.utilities`\n- ddk://extension-point/ddk.setup — Setup Steps, `contributes.setupStep`\n- ddk://extension-point/ddk.trouble.action — Trouble Actions, `contributes.troubleActions`\n\n## Components\n\n- `@kosdev-code/kos-ddk-components`: 161 components and styled parts\n- `@kosdev-code/kos-ddk-model-components`: 89 components and styled parts\n\nlist_ddk_components finds them; describe_ddk_component gives one's props, the components and hooks it uses, and every token it reads.\n\n## Design system\n\n- ddk://design/base — DDK DESIGN.md\n- ddk://design/flex-eu — DDK Flex EU DESIGN.md\n- ddk://design/compact — DDK Compact DESIGN.md\n\nChange tokens only to create a new component (component tokens) or a theme (semantic tokens).\n\n## Guides\n\n- ddk://guide/config-property-cards — Configuration property cards\n- ddk://guide/ddk-dev — Testing plugins against a running DDK\n- ddk://guide/getting-started — Getting started with the DDK CLI\n- ddk://guide/storybook — Developing DDK contributions in Storybook\n- ddk://guide/descriptor-project — NCUI descriptor projects\n\nfind_ddk_capability maps a need to the extension point, the component and the tool."
19223
+ },
19224
+ {
19225
+ "uri": "ddk://guide/config-property-cards",
19226
+ "name": "ddk-guide-config-property-cards",
19227
+ "title": "Configuration property cards",
19228
+ "description": "The ConfigProp* cards in kos-ddk-model-components that show and edit a KosConfigProperty, ConfigPropertyInput choosing a card from the schema type, and when cards write (immediately, or batched with StagedChangesProvider).",
19229
+ "body": "# Configuration property cards\n\n`@kosdev-code/kos-ddk-model-components` has one card per kind of configuration value.\nEach takes a `configProperty` (a `KosConfigProperty`), reads its value with\n`useConfigProperty`, and writes it back with `configProperty.updateProperty`.\n\n| Card | Property | Renders |\n| ---- | -------- | ------- |\n| `ConfigPropToggleCard` | boolean | a toggle, Enabled / Disabled |\n| `ConfigPropSwitchCard` | string | a segmented switch (`SwitchCard`) over the `options` you pass |\n| `ConfigPropPickerCard` | enum, or a property with options | a picker (`PickerCard`) of the property's options |\n| `ConfigPropInputCard` | string or number | a text input with the property's unit; `displayOptions` `min`/`max` validate it |\n| `ConfigPropInputRangeCard` | int or double | a number input within its range |\n| `ConfigPropTimePickerCard` | a time of day, in seconds | a time picker |\n| `ConfigPropInfoCard` | string | the value, read-only |\n| `ConfigPropSingleInputEnableCard` | any, plus a boolean | one input that a toggle (`enabledConfigProperty`) enables |\n| `ConfigPropMultiInputEnableCard` | several, plus a boolean | several inputs behind one enabling toggle |\n\nThe cards take the props of the DDK card they wrap (`label`, `float`, `collapse` and so\non). Lay them out in a `TabContainer`, with a `SettingsSubheading` per group.\n\n## Letting the schema choose: ConfigPropertyInput\n\n`ConfigPropertyInput` renders the card for the property's `schemaType`: boolean → toggle,\nint and double → input range, String → input, enum → picker. Without a `label` it\ntranslates the property id in the `config-properties` namespace. In compact mode the input\nand picker cards take the compact style. Pass `factory` to map types to other cards.\n\n## When a card writes\n\nEach card writes its property as soon as it changes.\n\nFor an interaction whose edits must be applied together, wrap the page in\n`StagedChangesProvider` (or `withStagedChanges`). Cards that support staging then keep\nthe new value instead of writing it; `useStagedChanges()` gives `saveChanges()` to write\nevery staged value and `clearStagedChanges()` to drop them. `ConfigPropToggleCard` and\n`ConfigPropTimePickerCard` stage; the other cards write straight away even inside the\nprovider."
19223
19230
  },
19224
19231
  {
19225
19232
  "uri": "ddk://guide/ddk-dev",
@@ -1,6 +1,6 @@
1
1
  import styled from '@emotion/styled';
2
2
  import {
3
- <% if (layout !== "fullscreen") { -%>
3
+ <% if (locals.layout !== "fullscreen") { -%>
4
4
  Button,
5
5
  Content,
6
6
  Footer,
@@ -29,7 +29,7 @@ const <%= namePascalCase %>Container = styled.section`
29
29
  width: 100%;
30
30
  `;
31
31
 
32
- <% if (layout === "fullscreen") { -%>
32
+ <% if (locals.layout === "fullscreen") { -%>
33
33
  /** A fullscreen utility: it covers the display and closes from its header. */
34
34
  export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
35
35
  const { t } = useKosTranslation('<%= appProject %>');