@kosdev-code/kos-ddk-cli 0.0.0-stage → 0.1.0-dev.107
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 +181 -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 +45 -0
- package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-reviewer.md +43 -0
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +965 -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 +21161 -0
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48656 -0
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +110 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-config-page/SKILL.md +130 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-content-component/SKILL.md +59 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-storybook/SKILL.md +45 -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-region/__nameDashCase__.stories.tsx__template__ +38 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-region/__nameDashCase__.tsx__template__ +28 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-region/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__ +60 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +88 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
- package/catalog/contributions.json +965 -0
- package/guides/config-property-cards.md +77 -0
- package/guides/ddk-dev.md +59 -0
- package/guides/getting-started.md +126 -0
- package/guides/storybook.md +127 -0
- package/package.json +33 -3
- package/reference/reference.json +21161 -0
- package/src/build-paths.mjs +20 -0
- package/src/codegen/contribution.mjs +530 -0
- package/src/codegen/descriptor.mjs +422 -0
- package/src/codegen/json-preserve.mjs +137 -0
- package/src/codegen/ncui-descriptor.mjs +167 -0
- package/src/codegen/overrides.mjs +263 -0
- package/src/codegen/project.mjs +271 -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 +164 -0
- package/src/generators/dashboard.mjs +282 -0
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +84 -0
- package/src/generators/dev.mjs +231 -0
- package/src/generators/override-prompts.mjs +27 -0
- package/src/generators/plugin-project.mjs +71 -0
- package/src/generators/theme-project.mjs +53 -0
- package/src/handlers.mjs +335 -0
- package/src/mcp/pkg-info.mjs +7 -0
- package/src/mcp/plugin-inspect.mjs +328 -0
- package/src/mcp/reference.mjs +315 -0
- package/src/mcp/server.mjs +12 -0
- package/src/mcp/tools.mjs +619 -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-region/__nameDashCase__.stories.tsx__template__ +38 -0
- package/templates/dashboard-region/__nameDashCase__.tsx__template__ +28 -0
- package/templates/dashboard-region/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__ +60 -0
- package/templates/utility/__nameDashCase__.tsx__template__ +88 -0
- package/templates/utility/index.ts__template__ +1 -0
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;
|
package/agent-plugin/kos-ddk-tools/templates/pump-detail/__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 { PumpDetailStoryContainer } 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
|
+
<PumpDetailStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</PumpDetailStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "pumpDetail/<%= 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,38 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { Content, LabelSmall } from '@kosdev-code/kos-ddk-components';
|
|
3
|
+
import type { HolderModel } from '@kosdev-code/kos-dispense-sdk';
|
|
4
|
+
import { KosLog, kosComponent } from '@kosdev-code/kos-ui-sdk';
|
|
5
|
+
|
|
6
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>" });
|
|
7
|
+
log.debug("<%= nameDashCase %> component loaded");
|
|
8
|
+
|
|
9
|
+
const <%= namePascalCase %>Container = styled.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
height: 100%;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
interface <%= namePascalCase %>Props {
|
|
16
|
+
/** The holder whose dashboard key is "<%= dashboardKey %>". */
|
|
17
|
+
holder: HolderModel;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Pump detail for holders keyed "<%= dashboardKey %>", shown in the host's holder
|
|
22
|
+
* modal. The key comes from the dashboard key factory (default: the holder's
|
|
23
|
+
* first pump type).
|
|
24
|
+
*/
|
|
25
|
+
export const <%= namePascalCase %>: React.FunctionComponent<<%= namePascalCase %>Props> =
|
|
26
|
+
kosComponent(({ holder }) => {
|
|
27
|
+
return (
|
|
28
|
+
<<%= namePascalCase %>Container>
|
|
29
|
+
<Content>
|
|
30
|
+
<LabelSmall>{holder.name}</LabelSmall>
|
|
31
|
+
</Content>
|
|
32
|
+
</<%= namePascalCase %>Container>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
<%= namePascalCase %>.displayName = "<%= namePascalCase %>";
|
|
37
|
+
|
|
38
|
+
export default <%= namePascalCase %>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
package/agent-plugin/kos-ddk-tools/templates/pump-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 { PumpSummaryStoryContainer } 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
|
+
<PumpSummaryStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</PumpSummaryStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "pumpSummary/<%= namePascalCase %>",
|
|
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,25 @@
|
|
|
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 %>-summary" });
|
|
6
|
+
log.debug("<%= nameDashCase %>-summary component loaded");
|
|
7
|
+
|
|
8
|
+
interface <%= namePascalCase %>SummaryProps {
|
|
9
|
+
/** The holder whose dashboard key is "<%= dashboardKey %>". */
|
|
10
|
+
holder: HolderModel;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Body of the dashboard card for holders keyed "<%= dashboardKey %>", in place of
|
|
15
|
+
* the fuel gauge. The key comes from the dashboard key factory (default: the
|
|
16
|
+
* holder's first pump type).
|
|
17
|
+
*/
|
|
18
|
+
export const <%= namePascalCase %>Summary: React.FunctionComponent<<%= namePascalCase %>SummaryProps> =
|
|
19
|
+
kosComponent(({ holder }) => {
|
|
20
|
+
return <LabelSmall>{holder.name}</LabelSmall>;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
<%= namePascalCase %>Summary.displayName = "<%= namePascalCase %>Summary";
|
|
24
|
+
|
|
25
|
+
export default <%= namePascalCase %>Summary;
|
|
@@ -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 { SetupStepStoryContainer } 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
|
+
<SetupStepStoryContainer>
|
|
16
|
+
<Story args={{ ...context.args }} />
|
|
17
|
+
</SetupStepStoryContainer>
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
tags: ["!autodocs"],
|
|
21
|
+
title: "setup/<%= 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,33 @@
|
|
|
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
|
+
height: 100%;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
21
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
22
|
+
return (
|
|
23
|
+
<<%= namePascalCase %>Container>
|
|
24
|
+
Hello from <%= namePascalCase %> Setup Step
|
|
25
|
+
<Footer>
|
|
26
|
+
<Button onClick={onComplete}>{t('proceed')}</Button>
|
|
27
|
+
</Footer>
|
|
28
|
+
</<%= namePascalCase %>Container>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
<%= namePascalCase %>.displayName = "<%= namePascalCase %>"
|
|
32
|
+
|
|
33
|
+
export default <%= namePascalCase %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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 { TroubleActionStoryContainer } 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
|
+
<TroubleActionStoryContainer troubleType="<%= troubleType %>">
|
|
16
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
17
|
+
</TroubleActionStoryContainer>
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
tags: ["!autodocs"],
|
|
21
|
+
title: "troubleAction/<%= 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
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
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 {
|
|
9
|
+
KosLog,
|
|
10
|
+
kosComponent,
|
|
11
|
+
useKosTranslation,
|
|
12
|
+
type TroubleModel,
|
|
13
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
14
|
+
import { useCallback } from 'react';
|
|
15
|
+
|
|
16
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>" });
|
|
17
|
+
log.debug("<%= nameDashCase %> component loaded");
|
|
18
|
+
|
|
19
|
+
const <%= namePascalCase %>Container = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
height: 100%;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
interface <%= namePascalCase %>Props {
|
|
26
|
+
/** The active "<%= troubleType %>" trouble. */
|
|
27
|
+
trouble: TroubleModel;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Shown while the device has an active "<%= troubleType %>" trouble. Resolving
|
|
32
|
+
* the trouble clears it on the device, which removes this experience.
|
|
33
|
+
*/
|
|
34
|
+
export const <%= namePascalCase %>: React.FunctionComponent<<%= namePascalCase %>Props> =
|
|
35
|
+
kosComponent(({ trouble }) => {
|
|
36
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
37
|
+
const resolve = useCallback(() => {
|
|
38
|
+
trouble.resolve().catch((error) => log.error(`resolve failed: ${error}`));
|
|
39
|
+
}, [trouble]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<<%= namePascalCase %>Container>
|
|
43
|
+
<Content>
|
|
44
|
+
<LabelSmall>{trouble.reason ?? trouble.type}</LabelSmall>
|
|
45
|
+
</Content>
|
|
46
|
+
<Footer>
|
|
47
|
+
<Button disabled={!trouble.resolvable} onClick={resolve}>
|
|
48
|
+
{t('resolve')}
|
|
49
|
+
</Button>
|
|
50
|
+
</Footer>
|
|
51
|
+
</<%= namePascalCase %>Container>
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
<%= namePascalCase %>.displayName = "<%= namePascalCase %>";
|
|
56
|
+
|
|
57
|
+
export default <%= namePascalCase %>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -0,0 +1,60 @@
|
|
|
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 { Button } from "@kosdev-code/kos-ddk-components";
|
|
7
|
+
import { UtilityStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
8
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
9
|
+
import { Suspense, type ComponentProps } from "react";
|
|
10
|
+
import { useArgs } from "storybook/preview-api";
|
|
11
|
+
import { fn } from "storybook/test";
|
|
12
|
+
import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
|
|
13
|
+
|
|
14
|
+
/** `open` shows the utility; it turns off when the utility closes. */
|
|
15
|
+
type StoryArgs = ComponentProps<typeof <%= namePascalCase %>> & { open: boolean };
|
|
16
|
+
|
|
17
|
+
const meta: Meta<StoryArgs> = {
|
|
18
|
+
args: { onComplete: fn(), open: true },
|
|
19
|
+
component: <%= namePascalCase %>,
|
|
20
|
+
decorators: [
|
|
21
|
+
(Story, context) => (
|
|
22
|
+
<UtilityStoryContainer>
|
|
23
|
+
<Story args={{ ...context.args }} />
|
|
24
|
+
</UtilityStoryContainer>
|
|
25
|
+
),
|
|
26
|
+
],
|
|
27
|
+
tags: ["!autodocs"],
|
|
28
|
+
title: "utility/<%= namePascalCase %>",
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
|
|
33
|
+
type Story = StoryObj<StoryArgs>;
|
|
34
|
+
|
|
35
|
+
export const Default: Story = {
|
|
36
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
37
|
+
render: function Render({ open, onComplete, ...props }) {
|
|
38
|
+
const [, updateArgs] = useArgs<StoryArgs>();
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
{/* Behind the modal: reopens the utility after it closes. */}
|
|
42
|
+
<Button onPointerDown={() => updateArgs({ open: true })}>
|
|
43
|
+
Open <%= namePascalCase %>
|
|
44
|
+
</Button>
|
|
45
|
+
{/* A utility that loads a model suspends; keep that out of this render. */}
|
|
46
|
+
{open && (
|
|
47
|
+
<Suspense>
|
|
48
|
+
<<%= namePascalCase %>
|
|
49
|
+
{...props}
|
|
50
|
+
onComplete={() => {
|
|
51
|
+
onComplete();
|
|
52
|
+
updateArgs({ open: false });
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</Suspense>
|
|
56
|
+
)}
|
|
57
|
+
</>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
};
|