@kosdev-code/kos-ddk-cli 0.0.0-stage → 0.1.0-dev.55
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/README.md +165 -2
- package/agent-plugin/.claude-plugin/marketplace.json +13 -0
- package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +8 -0
- package/agent-plugin/kos-ddk-tools/.mcp.json +11 -0
- package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-planner.md +40 -0
- package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-reviewer.md +33 -0
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +877 -0
- package/agent-plugin/kos-ddk-tools/mcp.json +12 -0
- package/agent-plugin/kos-ddk-tools/plugin.json +7 -0
- package/agent-plugin/kos-ddk-tools/reference/reference.json +19339 -0
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48633 -0
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +74 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-content-component/SKILL.md +49 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-storybook/SKILL.md +39 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +35 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.tsx__template__ +27 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +113 -0
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/registration.ts.template +6 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +33 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/component.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/generic.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/semantic.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +37 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
- package/catalog/contributions.json +877 -0
- package/guides/ddk-dev.md +47 -0
- package/guides/getting-started.md +117 -0
- package/guides/storybook.md +104 -0
- package/package.json +33 -3
- package/reference/reference.json +19339 -0
- package/src/build-paths.mjs +20 -0
- package/src/codegen/contribution.mjs +425 -0
- package/src/codegen/descriptor.mjs +210 -0
- package/src/codegen/ncui-descriptor.mjs +134 -0
- package/src/codegen/overrides.mjs +263 -0
- package/src/codegen/project.mjs +242 -0
- package/src/extension.mjs +32 -0
- package/src/generators/agent-install.mjs +80 -0
- package/src/generators/catalog.mjs +81 -0
- package/src/generators/contributions.mjs +151 -0
- package/src/generators/dashboard.mjs +241 -0
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +79 -0
- package/src/generators/dev.mjs +231 -0
- package/src/generators/override-prompts.mjs +27 -0
- package/src/generators/plugin-project.mjs +66 -0
- package/src/generators/theme-project.mjs +45 -0
- package/src/handlers.mjs +315 -0
- package/src/mcp/pkg-info.mjs +7 -0
- package/src/mcp/plugin-inspect.mjs +292 -0
- package/src/mcp/reference.mjs +264 -0
- package/src/mcp/server.mjs +12 -0
- package/src/mcp/tools.mjs +575 -0
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/cui/__nameDashCase__.tsx__template__ +35 -0
- package/templates/cui/index.ts__template__ +1 -0
- package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
- package/templates/dashboard-detail/detail/index.ts__template__ +1 -0
- package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
- package/templates/dashboard-summary/summary/index.ts__template__ +1 -0
- package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
- package/templates/macro-summary/index.ts__template__ +1 -0
- package/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/nav/__nameDashCase__.tsx__template__ +27 -0
- package/templates/nav/index.ts__template__ +1 -0
- package/templates/plugin-project/.storybook/preview.tsx.template +113 -0
- package/templates/plugin-project/.storybook/registration.ts.template +6 -0
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
- package/templates/pump-detail/index.ts__template__ +1 -0
- package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
- package/templates/pump-summary/index.ts__template__ +1 -0
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/setup/__nameDashCase__.tsx__template__ +33 -0
- package/templates/setup/index.ts__template__ +1 -0
- package/templates/theme-project/theme/assets/component.css.template +2 -0
- package/templates/theme-project/theme/assets/generic.css.template +2 -0
- package/templates/theme-project/theme/assets/semantic.css.template +2 -0
- package/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
- package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
- package/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
- package/templates/trouble-action/index.ts__template__ +1 -0
- package/templates/utility/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/utility/__nameDashCase__.tsx__template__ +37 -0
- package/templates/utility/index.ts__template__ +1 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-ddk-plugin
|
|
3
|
+
description: >-
|
|
4
|
+
Build or extend a DDK plugin with the kos-ddk MCP server: find the extension point
|
|
5
|
+
for a need, write the contribution with its tool (including overrides of standard
|
|
6
|
+
contributions), build its component from DDK components, develop it in Storybook or
|
|
7
|
+
against a running DDK, and validate it. Use when adding a utility, setup step, nav
|
|
8
|
+
view (including a Settings tab), CUI configuration, dashboard card, pump detail, macro summary or
|
|
9
|
+
trouble action to a DDK plugin, or replacing a standard one.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Build a DDK plugin
|
|
13
|
+
|
|
14
|
+
A DDK plugin contributes to extension points in its `.kos.json` and renders DDK
|
|
15
|
+
components inside them. The `kos-ddk` tools write the contributions; you write the
|
|
16
|
+
component content. Never hand-edit the contributions or experiences the tools write.
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. **Ground yourself.** Read `ddk://index`. Ask `find_ddk_capability` in plain words
|
|
21
|
+
("replace the carb tank card", "a utility that downloads logs"): it names the
|
|
22
|
+
extension point, the standard contribution to replace, the components and the tool.
|
|
23
|
+
|
|
24
|
+
2. **The plugin project.** For an existing project, `describe_ddk_plugin` shows what it
|
|
25
|
+
already contributes. For a new one, `scaffold_ddk_plugin_project` (dry run, then
|
|
26
|
+
`dryRun: false`). Project names are dash-case.
|
|
27
|
+
|
|
28
|
+
3. **The extension point.** Read `ddk://extension-point/{id}`: its contribution fields,
|
|
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.
|
|
31
|
+
|
|
32
|
+
4. **Replacing a standard contribution.** `list_ddk_contributions` lists the ones an
|
|
33
|
+
override can replace. Pass the id as `override`: the tool takes its slot and gives
|
|
34
|
+
the contribution a winning rank. The framework resolves the slot by rank (lowest wins;
|
|
35
|
+
an unranked contribution loses to any ranked one), so never add precedence logic of
|
|
36
|
+
your own.
|
|
37
|
+
|
|
38
|
+
5. **Write the contribution** with the point's tool, dry run first, then
|
|
39
|
+
`dryRun: false`. It writes the component, its story, the `.kos.json` contribution
|
|
40
|
+
and experience, and the i18n title.
|
|
41
|
+
|
|
42
|
+
Pump cards are keyed by pump type: the backend assembly assigns it to the holder's
|
|
43
|
+
first pump, and the default dashboard key factory returns it. A new pump type is
|
|
44
|
+
`add_pump_card` with `dashboardKey` set to that type (the card body and the pump
|
|
45
|
+
detail); no factory is needed. A dashboard key factory is only for nonstandard
|
|
46
|
+
cards keyed from another part of the assembly.
|
|
47
|
+
|
|
48
|
+
6. **The NCUI descriptor.** A utility, setup step or nav view appears only if the
|
|
49
|
+
device's NCUI descriptor lists its descriptor (`kondra.ncui` `utilities`,
|
|
50
|
+
`setup.steps`, `navigations`). An override reuses a slot the descriptor already
|
|
51
|
+
lists; a new slot goes in an NCUI descriptor project (a `ddk.ncui.descriptor` KAB
|
|
52
|
+
installed beside the DDK app, which replaces the system app's descriptor): create one
|
|
53
|
+
with `scaffold_ddk_descriptor_project` (layout `standard` or `compact`, and `carb`, `ice`,
|
|
54
|
+
`beveragePourTest` for the dispenser) if the workspace
|
|
55
|
+
has none, and pass `descriptorProject` to `add_utility`, `add_setup_step` or
|
|
56
|
+
`add_nav_view`. `ddk://guide/descriptor-project` lists each layout's entries and what each option adds.
|
|
57
|
+
|
|
58
|
+
7. **Build the component** with the `ddk-content-component` skill.
|
|
59
|
+
|
|
60
|
+
8. **Develop it.** In Storybook with the `ddk-storybook` skill. Against a running device
|
|
61
|
+
or simulator with `kosui ddk:dev` (`ddk://guide/ddk-dev`); that is where an override
|
|
62
|
+
is seen replacing the standard contribution.
|
|
63
|
+
|
|
64
|
+
9. **Validate.** `validate_ddk_plugin` checks the fields against each point's schema,
|
|
65
|
+
ranks, experiences and their component files, overrides that do not win and tokens
|
|
66
|
+
set in plugin code. Then delegate to the `kos-ddk-plugin-reviewer` subagent and act
|
|
67
|
+
on its findings here. Not sure of the plan before step 5? The
|
|
68
|
+
`kos-ddk-plugin-planner` subagent returns the tool calls without writing anything.
|
|
69
|
+
|
|
70
|
+
## Rules
|
|
71
|
+
|
|
72
|
+
- Plugins compose DDK components; the design tokens belong to the DDK app and its
|
|
73
|
+
themes. A plugin never sets or overrides a token.
|
|
74
|
+
- Every write goes through a tool, dry run first.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ddk-content-component
|
|
3
|
+
description: >-
|
|
4
|
+
Build the component a DDK contribution renders by composing components from
|
|
5
|
+
kos-ddk-components and kos-ddk-model-components, using the props its extension point
|
|
6
|
+
passes in and leaving styling to the DDK design system. Use after a kos-ddk tool has
|
|
7
|
+
written a contribution's component file, or when changing what a contribution shows.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Build a DDK content component
|
|
11
|
+
|
|
12
|
+
The component a contribution renders sits inside a DDK surface (a utility frame, a
|
|
13
|
+
dashboard card, a trouble screen). It is built from DDK components, so it takes the
|
|
14
|
+
look of whichever theme the DDK app applies.
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
1. **Its inputs.** The extension point resource (`ddk://extension-point/{id}`, "Props
|
|
19
|
+
your component receives") lists what the component is given: `assembly` and
|
|
20
|
+
`cardModel` for dashboard cards, `holder` for pump details and macro summaries,
|
|
21
|
+
`trouble` for trouble actions. Read data from those props.
|
|
22
|
+
|
|
23
|
+
2. **Find the components.** `find_ddk_capability` with what the component must show,
|
|
24
|
+
then `list_ddk_components` with a query. Two libraries:
|
|
25
|
+
|
|
26
|
+
- `@kosdev-code/kos-ddk-model-components`: components bound to DDK models (a carb
|
|
27
|
+
tank summary, config property cards, pump cards). When one exists for the model,
|
|
28
|
+
render it, as the standard carb tank summary renders `CarbTankSummary`.
|
|
29
|
+
- `@kosdev-code/kos-ddk-components`: cards, buttons, toggles, pickers, modals and
|
|
30
|
+
the typography components.
|
|
31
|
+
|
|
32
|
+
3. **Read each component before using it.** `describe_ddk_component` gives its props as
|
|
33
|
+
typed, the components and hooks it uses (for example
|
|
34
|
+
`useComponentConfigurationContext`, which switches it to compact mode), and the
|
|
35
|
+
tokens it reads. Pass props; never guess them.
|
|
36
|
+
|
|
37
|
+
4. **Text** through the typography components (`Heading`, `Subheading`, `BodyMedium`,
|
|
38
|
+
`LabelSmall` and the rest) rather than styled text of your own.
|
|
39
|
+
|
|
40
|
+
5. **Check it** in Storybook (the `ddk-storybook` skill), in both render modes.
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
- Compose; do not restyle. Do not set or override `--ddk-*` tokens, and do not
|
|
45
|
+
re-create a component the libraries already have.
|
|
46
|
+
- `ddk://design/{theme}` describes the themes for reference. Tokens change only to
|
|
47
|
+
create a new component (component tokens pointing at semantic tokens), which belongs
|
|
48
|
+
in the DDK libraries, or a theme (semantic tokens), which belongs in a theme project
|
|
49
|
+
(`scaffold_ddk_theme_project`). Never in a plugin.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ddk-storybook
|
|
3
|
+
description: >-
|
|
4
|
+
Develop a DDK contribution in its plugin's Storybook against a running simulator:
|
|
5
|
+
start it, point it at the right KOS host, read what the story container needs from the
|
|
6
|
+
simulator, check both render modes, and know when to move to kosui ddk:dev. Use when
|
|
7
|
+
developing or checking a contribution's component in isolation.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Develop a DDK contribution in Storybook
|
|
11
|
+
|
|
12
|
+
Every contribution tool writes a story beside the component. `ddk://guide/storybook`
|
|
13
|
+
is the reference; this is the order to work in.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. **Start the simulator first.** Stories render live models; there is no mock data by
|
|
18
|
+
default.
|
|
19
|
+
|
|
20
|
+
2. **Start Storybook:** `npx nx run <plugin>:storybook` (port 4400). The plugin's
|
|
21
|
+
`serve` target is the module federation dev server for `kosui ddk:dev`, not
|
|
22
|
+
Storybook.
|
|
23
|
+
|
|
24
|
+
3. **The KOS host.** KosCore connects to the `?host=` query parameter on the Storybook
|
|
25
|
+
URL, else `KOS_HOST` and `KOS_PORT` in the plugin's `.env` (the generated `.env`
|
|
26
|
+
sets `KOS_PORT=8081`), else the page's origin.
|
|
27
|
+
|
|
28
|
+
4. **What the story needs.** Each story renders inside its extension point's story
|
|
29
|
+
container (the table in the guide). A dashboard card needs an active model at its
|
|
30
|
+
`dashboardKey`, a pump detail or macro summary a holder with it, a trouble action an
|
|
31
|
+
active trouble of its `troubleType`. When the simulator has none, the container says
|
|
32
|
+
so in place of the story: change the simulator's state, not the story.
|
|
33
|
+
|
|
34
|
+
5. **Both render modes.** The Render Mode toolbar switches between `standard` and
|
|
35
|
+
`compact`; in `compact`, modals render full screen.
|
|
36
|
+
|
|
37
|
+
6. **Overrides.** The story renders the override on its own. To see it replace the
|
|
38
|
+
standard contribution, load the plugin into a running DDK with `kosui ddk:dev`
|
|
39
|
+
(`ddk://guide/ddk-dev`).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
5
|
+
*/
|
|
6
|
+
import { CUIStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<CUIStoryContainer>
|
|
16
|
+
<Story args={{ ...context.args }} />
|
|
17
|
+
</CUIStoryContainer>
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
tags: ["!autodocs"],
|
|
21
|
+
title: "CUI/<%= namePascalCase %>",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
30
|
+
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Footer,
|
|
5
|
+
type Experience,
|
|
6
|
+
} from '@kosdev-code/kos-ddk-components';
|
|
7
|
+
import {
|
|
8
|
+
KosLog,
|
|
9
|
+
kosComponent,
|
|
10
|
+
useKosTranslation,
|
|
11
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
12
|
+
|
|
13
|
+
const log = KosLog.createLogger({name: "<%= nameDashCase %>"})
|
|
14
|
+
log.debug("<%= nameDashCase %> component loaded");
|
|
15
|
+
|
|
16
|
+
const <%= namePascalCase %>Container = styled.div`
|
|
17
|
+
align-items: center;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
24
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
25
|
+
return (
|
|
26
|
+
<<%= namePascalCase %>Container>
|
|
27
|
+
Hello from <%= namePascalCase %> CUI Configuration
|
|
28
|
+
<Footer>
|
|
29
|
+
<Button onClick={onComplete}>{t('proceed')}</Button>
|
|
30
|
+
</Footer>
|
|
31
|
+
</<%= namePascalCase %>Container>
|
|
32
|
+
);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default <%= namePascalCase %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
5
|
+
*/
|
|
6
|
+
import { DashboardDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %>Detail } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>Detail> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>Detail,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<DashboardDetailStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</DashboardDetailStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "dashboard/<%= namePascalCase %>/Detail",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof <%= namePascalCase %>Detail>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
33
|
+
render: (props) => <<%= namePascalCase %>Detail {...props} />,
|
|
34
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Content,
|
|
5
|
+
Footer,
|
|
6
|
+
LabelSmall,
|
|
7
|
+
} from '@kosdev-code/kos-ddk-components';
|
|
8
|
+
import type { AssemblyModel } from '@kosdev-code/kos-dispense-sdk';
|
|
9
|
+
import {
|
|
10
|
+
KosLog,
|
|
11
|
+
kosComponent,
|
|
12
|
+
useKosTranslation,
|
|
13
|
+
type IKosDataModel,
|
|
14
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
15
|
+
|
|
16
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>-detail" });
|
|
17
|
+
log.debug("<%= nameDashCase %> detail component loaded");
|
|
18
|
+
|
|
19
|
+
const <%= namePascalCase %>DetailContainer = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
height: 100%;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
interface <%= namePascalCase %>DetailProps {
|
|
26
|
+
dashboardKey?: string;
|
|
27
|
+
assembly?: AssemblyModel;
|
|
28
|
+
/** The assembly's "<%= dashboardKey %>" model whose card was selected. */
|
|
29
|
+
cardModel?: IKosDataModel;
|
|
30
|
+
/** Closes the modal the host shows this detail in. */
|
|
31
|
+
onComplete?: () => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Detail for the "<%= dashboardKey %>" dashboard card, shown in the host's modal. */
|
|
35
|
+
export const <%= namePascalCase %>Detail: React.FunctionComponent<<%= namePascalCase %>DetailProps> =
|
|
36
|
+
kosComponent(({ cardModel, onComplete }) => {
|
|
37
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
38
|
+
return (
|
|
39
|
+
<<%= namePascalCase %>DetailContainer>
|
|
40
|
+
<Content>
|
|
41
|
+
<LabelSmall>{cardModel?.id}</LabelSmall>
|
|
42
|
+
</Content>
|
|
43
|
+
<Footer>
|
|
44
|
+
<Button onClick={onComplete}>{t('close')}</Button>
|
|
45
|
+
</Footer>
|
|
46
|
+
</<%= namePascalCase %>DetailContainer>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
<%= namePascalCase %>Detail.displayName = "<%= namePascalCase %>Detail";
|
|
51
|
+
|
|
52
|
+
export default <%= namePascalCase %>Detail;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
5
|
+
*/
|
|
6
|
+
import { DashboardSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %>Summary } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>Summary> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>Summary,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<DashboardSummaryStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</DashboardSummaryStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "dashboard/<%= namePascalCase %>/Summary",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof <%= namePascalCase %>Summary>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
33
|
+
render: (props) => <<%= namePascalCase %>Summary {...props} />,
|
|
34
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { LabelSmall } from '@kosdev-code/kos-ddk-components';
|
|
3
|
+
import type { AssemblyModel } from '@kosdev-code/kos-dispense-sdk';
|
|
4
|
+
import {
|
|
5
|
+
KosLog,
|
|
6
|
+
kosComponent,
|
|
7
|
+
type IKosDataModel,
|
|
8
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
9
|
+
|
|
10
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>-summary" });
|
|
11
|
+
log.debug("<%= nameDashCase %> summary component loaded");
|
|
12
|
+
|
|
13
|
+
const <%= namePascalCase %>SummaryContainer = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: var(--ddk-generic-padding-small);
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
interface <%= namePascalCase %>SummaryProps {
|
|
20
|
+
dashboardKey?: string;
|
|
21
|
+
assembly?: AssemblyModel;
|
|
22
|
+
/** The assembly's "<%= dashboardKey %>" model this card renders for. */
|
|
23
|
+
cardModel?: IKosDataModel;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Body of the "<%= dashboardKey %>" dashboard card. The host draws one card per
|
|
28
|
+
* active "<%= dashboardKey %>" model and opens the detail when a technician selects it.
|
|
29
|
+
*/
|
|
30
|
+
export const <%= namePascalCase %>Summary: React.FunctionComponent<<%= namePascalCase %>SummaryProps> =
|
|
31
|
+
kosComponent(({ cardModel }) => {
|
|
32
|
+
return (
|
|
33
|
+
<<%= namePascalCase %>SummaryContainer>
|
|
34
|
+
<LabelSmall>{cardModel?.id}</LabelSmall>
|
|
35
|
+
</<%= namePascalCase %>SummaryContainer>
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
<%= namePascalCase %>Summary.displayName = "<%= namePascalCase %>Summary";
|
|
40
|
+
|
|
41
|
+
export default <%= namePascalCase %>Summary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
5
|
+
*/
|
|
6
|
+
import { MacroSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<MacroSummaryStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</MacroSummaryStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "macroSummary/<%= namePascalCase %>",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
33
|
+
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
34
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LabelSmall } from '@kosdev-code/kos-ddk-components';
|
|
2
|
+
import type { HolderModel } from '@kosdev-code/kos-dispense-sdk';
|
|
3
|
+
import { KosLog, kosComponent } from '@kosdev-code/kos-ui-sdk';
|
|
4
|
+
|
|
5
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>" });
|
|
6
|
+
log.debug("<%= nameDashCase %> component loaded");
|
|
7
|
+
|
|
8
|
+
interface <%= namePascalCase %>Props {
|
|
9
|
+
/** The macro holder this summary renders for. */
|
|
10
|
+
holder: HolderModel;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Body of the macro holder card for "<%= dashboardKey %>": the host matches
|
|
15
|
+
* holder.name first, then the dashboard key factory.
|
|
16
|
+
*/
|
|
17
|
+
export const <%= namePascalCase %>: React.FunctionComponent<<%= namePascalCase %>Props> =
|
|
18
|
+
kosComponent(({ holder }) => {
|
|
19
|
+
return <LabelSmall>{holder.name}</LabelSmall>;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
<%= namePascalCase %>.displayName = "<%= namePascalCase %>";
|
|
23
|
+
|
|
24
|
+
export default <%= namePascalCase %>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
5
|
+
*/
|
|
6
|
+
import { NavStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<NavStoryContainer>
|
|
16
|
+
<Story args={{ ...context.args }} />
|
|
17
|
+
</NavStoryContainer>
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
tags: ["!autodocs"],
|
|
21
|
+
title: "nav/<%= namePascalCase %>",
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
30
|
+
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { type Experience } from '@kosdev-code/kos-ddk-components';
|
|
3
|
+
import {
|
|
4
|
+
KosLog,
|
|
5
|
+
kosComponent,
|
|
6
|
+
useKosTranslation,
|
|
7
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
8
|
+
|
|
9
|
+
const log = KosLog.createLogger({name: "<%= nameDashCase %>"})
|
|
10
|
+
log.debug("<%= nameDashCase %> component loaded");
|
|
11
|
+
|
|
12
|
+
const <%= namePascalCase %>Container = styled.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
width: 100%;
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const <%= namePascalCase %>: Experience = kosComponent(({}) => {
|
|
19
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
20
|
+
return (
|
|
21
|
+
<<%= namePascalCase %>Container>Hello from <%= namePascalCase %> Navigation View</<%= namePascalCase %>Container>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
<%= namePascalCase %>.displayName = "<%= namePascalCase %>"
|
|
26
|
+
|
|
27
|
+
export default <%= namePascalCase %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { Global } from "@emotion/react";
|
|
3
|
+
import { Preview, Meta } from "@storybook/react";
|
|
4
|
+
import { getStyles } from "@kosdev-code/kos-ddk-styles";
|
|
5
|
+
import {
|
|
6
|
+
ErrorBoundaryWithFallback,
|
|
7
|
+
KosTranslationProvider,
|
|
8
|
+
ensureKosMockBoot,
|
|
9
|
+
LoadingMessage,
|
|
10
|
+
} from "@kosdev-code/kos-ui-sdk";
|
|
11
|
+
import { ElementType, Suspense } from "react";
|
|
12
|
+
import { MemoryRouter } from "react-router";
|
|
13
|
+
import { KosCoreContextProvider } from "./registration";
|
|
14
|
+
import {
|
|
15
|
+
ApplicationProvider,
|
|
16
|
+
ApplicationComponentConfigurationProvider,
|
|
17
|
+
} from "@kosdev-code/kos-ddk-model-components";
|
|
18
|
+
import { AssemblyProvider } from "@kosdev-code/kos-dispense-sdk";
|
|
19
|
+
|
|
20
|
+
export const globalTypes = {
|
|
21
|
+
mode: {
|
|
22
|
+
description: "DDK Render Mode",
|
|
23
|
+
defaultValue: "standard",
|
|
24
|
+
toolbar: {
|
|
25
|
+
title: "Render Mode",
|
|
26
|
+
icon: "circlehollow",
|
|
27
|
+
items: ["standard", "compact"],
|
|
28
|
+
dynamicTitle: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Translation files load over HTTP from the device KosCore connects to (KOS_HOST and
|
|
34
|
+
// KOS_PORT in .env), not from Storybook's own origin; ?host= on the URL still wins.
|
|
35
|
+
const translationRoot =
|
|
36
|
+
!new URLSearchParams(window.location.search).get("host") &&
|
|
37
|
+
process.env.KOS_PORT
|
|
38
|
+
? `${window.location.protocol}//${
|
|
39
|
+
process.env.KOS_HOST || window.location.hostname
|
|
40
|
+
}:${process.env.KOS_PORT}`
|
|
41
|
+
: undefined;
|
|
42
|
+
|
|
43
|
+
// The plugin's own namespaces load from its locale files: the device lists them only
|
|
44
|
+
// once its KAB is installed.
|
|
45
|
+
const pluginLocales = (import.meta as any).webpackContext(
|
|
46
|
+
"../src/assets/locales",
|
|
47
|
+
{ recursive: true, regExp: /\.json$/ }
|
|
48
|
+
);
|
|
49
|
+
const bundleResolver = async (namespace: string, locale: string) => {
|
|
50
|
+
const file = `./${locale}/${namespace}.json`;
|
|
51
|
+
if (!pluginLocales.keys().includes(file)) return { fallback: true as const };
|
|
52
|
+
const bundle = pluginLocales(file);
|
|
53
|
+
return bundle.default ?? bundle;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const decorators = [
|
|
57
|
+
(Story: ElementType, context: Meta) => (
|
|
58
|
+
<MemoryRouter initialEntries={["/"]}>
|
|
59
|
+
<Global
|
|
60
|
+
styles={getStyles(
|
|
61
|
+
context.globals.mode === "compact" ? "compact" : "flex-eu"
|
|
62
|
+
)}
|
|
63
|
+
/>
|
|
64
|
+
<ErrorBoundaryWithFallback>
|
|
65
|
+
<Suspense fallback={<LoadingMessage />}>
|
|
66
|
+
<KosCoreContextProvider>
|
|
67
|
+
<KosTranslationProvider
|
|
68
|
+
appContext={["app/system", "app/kosdev.ddk"]}
|
|
69
|
+
bundleResolver={bundleResolver}
|
|
70
|
+
rootUrl={translationRoot}
|
|
71
|
+
locale="en"
|
|
72
|
+
>
|
|
73
|
+
<AssemblyProvider>
|
|
74
|
+
<ApplicationProvider>
|
|
75
|
+
<ApplicationComponentConfigurationProvider
|
|
76
|
+
modalModeOverride={
|
|
77
|
+
context.globals.mode === "compact"
|
|
78
|
+
? "fullscreen"
|
|
79
|
+
: undefined
|
|
80
|
+
}
|
|
81
|
+
componentModeOverride={context.globals.mode}
|
|
82
|
+
>
|
|
83
|
+
<Suspense>
|
|
84
|
+
<Story />
|
|
85
|
+
</Suspense>
|
|
86
|
+
</ApplicationComponentConfigurationProvider>
|
|
87
|
+
</ApplicationProvider>
|
|
88
|
+
</AssemblyProvider>
|
|
89
|
+
</KosTranslationProvider>
|
|
90
|
+
</KosCoreContextProvider>
|
|
91
|
+
</Suspense>
|
|
92
|
+
</ErrorBoundaryWithFallback>
|
|
93
|
+
</MemoryRouter>
|
|
94
|
+
),
|
|
95
|
+
// Outermost: reloads into a story's parameters.kosMock boot switches.
|
|
96
|
+
(Story: ElementType, context: Meta) =>
|
|
97
|
+
ensureKosMockBoot(context.parameters?.kosMock) ? null : <Story />,
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const preview: Preview = {
|
|
101
|
+
parameters: {
|
|
102
|
+
backgrounds: {
|
|
103
|
+
options: {
|
|
104
|
+
dark: {
|
|
105
|
+
name: "dark",
|
|
106
|
+
value: "var(--ncui-generic-color-grey-70)",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export default preview;
|