@nimiplatform/app-tools 0.1.2 → 0.2.0

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.
Files changed (120) hide show
  1. package/LICENSE +198 -6
  2. package/README.md +83 -27
  3. package/bin/nimi-app.mjs +328 -45
  4. package/lib/app-access-declaration.mjs +49 -0
  5. package/lib/app-doctor-update.mjs +411 -149
  6. package/lib/app-pack.mjs +401 -0
  7. package/lib/app-project-lifecycle.mjs +1141 -0
  8. package/lib/app-scaffold-capabilities.mjs +769 -0
  9. package/lib/app-scaffold-default-source.mjs +21 -0
  10. package/lib/app-scaffold-profiles.mjs +1093 -0
  11. package/lib/app-scaffold.mjs +1266 -813
  12. package/lib/index.mjs +194 -42
  13. package/lib/simulator-conformance-ast.mjs +498 -0
  14. package/lib/simulator-conformance-css.mjs +116 -0
  15. package/lib/simulator-conformance-graph.mjs +757 -0
  16. package/lib/simulator-conformance.d.mts +14 -0
  17. package/lib/simulator-conformance.mjs +203 -0
  18. package/lib/simulator-css-profile.d.mts +27 -0
  19. package/lib/simulator-css-profile.mjs +531 -0
  20. package/lib/simulator-kit-export-resolution.mjs +70 -0
  21. package/lib/simulator-manifest.mjs +334 -0
  22. package/package.json +66 -3
  23. package/scripts/dev-shell.mjs +465 -0
  24. package/scripts/sync-app-source.mjs +300 -0
  25. package/scripts/sync-scaffold-versions.mjs +91 -0
  26. package/templates/app-source/LICENSE +21 -0
  27. package/templates/app-source/src/ai-studio-core/ai-config.ts +100 -0
  28. package/templates/app-source/src/ai-studio-core/ai-studio-core.css +338 -0
  29. package/templates/app-source/src/ai-studio-core/contexts.tsx +61 -0
  30. package/templates/app-source/src/ai-studio-core/history-policy.ts +447 -0
  31. package/templates/app-source/src/ai-studio-core/history.ts +824 -0
  32. package/templates/app-source/src/ai-studio-core/host-context.tsx +79 -0
  33. package/templates/app-source/src/ai-studio-core/index.ts +214 -0
  34. package/templates/app-source/src/ai-studio-core/messages/en.json +310 -0
  35. package/templates/app-source/src/ai-studio-core/messages/index.ts +47 -0
  36. package/templates/app-source/src/ai-studio-core/messages/zh.json +310 -0
  37. package/templates/app-source/src/ai-studio-core/module-registration.ts +109 -0
  38. package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +65 -0
  39. package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +247 -0
  40. package/templates/app-source/src/ai-studio-core/parameters.ts +110 -0
  41. package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +69 -0
  42. package/templates/app-source/src/ai-studio-core/run-target.ts +123 -0
  43. package/templates/app-source/src/ai-studio-core/runtime-dispatcher.ts +35 -0
  44. package/templates/app-source/src/ai-studio-core/runtime-types.ts +86 -0
  45. package/templates/app-source/src/ai-studio-core/runtime.ts +306 -0
  46. package/templates/app-source/src/ai-studio-core/section-ai-testing-admission.ts +38 -0
  47. package/templates/app-source/src/ai-studio-core/section-ai-testing-ai-config.tsx +30 -0
  48. package/templates/app-source/src/ai-studio-core/section-ai-testing-artifact-preview.ts +40 -0
  49. package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +257 -0
  50. package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +676 -0
  51. package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +19 -0
  52. package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +291 -0
  53. package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +413 -0
  54. package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +174 -0
  55. package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +449 -0
  56. package/templates/app-source/src/ai-studio-core/section-ai-testing-surface.tsx +45 -0
  57. package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +494 -0
  58. package/templates/app-source/src/ai-studio-core/studio-directives.ts +33 -0
  59. package/templates/app-source/src/ai-studio-core/workspace.tsx +381 -0
  60. package/templates/app-source/src/product-modules/agent-center/index.tsx +27 -0
  61. package/templates/app-source/src/product-modules/agent-conversation/index.tsx +19 -0
  62. package/templates/app-source/src/product-modules/agent-realtime/index.tsx +29 -0
  63. package/templates/app-source/src/product-modules/kit-recipes/gallery.tsx +142 -0
  64. package/templates/app-source/src/product-modules/kit-recipes/index.tsx +19 -0
  65. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-data-recipes.tsx +336 -0
  66. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-demos.tsx +165 -0
  67. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-recipes.tsx +682 -0
  68. package/templates/app-source/src/product-modules/kit-recipes/kit-component-gallery-surface.tsx +341 -0
  69. package/templates/app-source/src/studio-modules/studio-create/descriptors.ts +26 -0
  70. package/templates/app-source/src/studio-modules/studio-create/index.ts +14 -0
  71. package/templates/app-source/src/studio-modules/studio-create/messages/en.json +67 -0
  72. package/templates/app-source/src/studio-modules/studio-create/messages/index.ts +5 -0
  73. package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +67 -0
  74. package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +153 -0
  75. package/templates/app-source/src/studio-modules/studio-create/parameters.ts +70 -0
  76. package/templates/app-source/src/studio-modules/studio-create/registration.ts +46 -0
  77. package/templates/app-source/src/studio-modules/studio-create/runtime.ts +339 -0
  78. package/templates/app-source/src/studio-modules/studio-media/descriptors.ts +22 -0
  79. package/templates/app-source/src/studio-modules/studio-media/index.ts +12 -0
  80. package/templates/app-source/src/studio-modules/studio-media/messages/en.json +82 -0
  81. package/templates/app-source/src/studio-modules/studio-media/messages/index.ts +5 -0
  82. package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +82 -0
  83. package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +283 -0
  84. package/templates/app-source/src/studio-modules/studio-media/parameters.ts +94 -0
  85. package/templates/app-source/src/studio-modules/studio-media/registration.ts +44 -0
  86. package/templates/app-source/src/studio-modules/studio-media/runtime.ts +113 -0
  87. package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +28 -0
  88. package/templates/app-source/src/studio-modules/studio-voice/index.ts +16 -0
  89. package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +99 -0
  90. package/templates/app-source/src/studio-modules/studio-voice/messages/index.ts +5 -0
  91. package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +99 -0
  92. package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +284 -0
  93. package/templates/app-source/src/studio-modules/studio-voice/parameters.ts +116 -0
  94. package/templates/app-source/src/studio-modules/studio-voice/registration.ts +59 -0
  95. package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +347 -0
  96. package/templates/app-source/src/workbench-core/empty-state.tsx +31 -0
  97. package/templates/app-source/src/workbench-core/index.ts +17 -0
  98. package/templates/app-source/src/workbench-core/runtime-gate.tsx +131 -0
  99. package/templates/app-source/src/workbench-core/workbench-core.css +255 -0
  100. package/templates/app-source/src/workbench-core/workbench-core.tsx +140 -0
  101. package/templates/app-source.manifest.json +333 -0
  102. package/templates/default-starter/AGENTS.md +33 -0
  103. package/templates/default-starter/LICENSE +21 -0
  104. package/templates/default-starter/README.md +41 -0
  105. package/templates/default-starter/SECURITY.md +5 -0
  106. package/templates/default-starter/index.html +12 -0
  107. package/templates/default-starter/scripts/validate.mjs +26 -0
  108. package/templates/default-starter/src/shell/App.tsx +27 -0
  109. package/templates/default-starter/src/shell/auth/app-identity.ts +3 -0
  110. package/templates/default-starter/src/shell/auth/local-app-client.ts +18 -0
  111. package/templates/default-starter/src/shell/auth/runtime-platform.ts +110 -0
  112. package/templates/default-starter/src/shell/authenticated-shell.tsx +20 -0
  113. package/templates/default-starter/src/shell/workbench-target-adapter.ts +40 -0
  114. package/templates/default-starter/src/styles.css +26 -0
  115. package/templates/default-starter/src-tauri/Cargo.toml +17 -0
  116. package/templates/default-starter/src-tauri/build.rs +5 -0
  117. package/templates/default-starter/src-tauri/capabilities/default.json +7 -0
  118. package/templates/default-starter/src-tauri/tauri.conf.json +26 -0
  119. package/templates/default-starter/tsconfig.json +18 -0
  120. package/templates/default-starter.manifest.json +99 -0
@@ -0,0 +1,336 @@
1
+ import {
2
+ Avatar,
3
+ Button,
4
+ DataList,
5
+ DataTable,
6
+ EmptyState,
7
+ InlineAlert,
8
+ LoadingSkeleton,
9
+ nimiToast,
10
+ ProgressIndicator,
11
+ Statistic,
12
+ StatisticGroup,
13
+ StatusBadge,
14
+ Timeline,
15
+ TimelineGroup,
16
+ } from '@nimiplatform/kit/ui';
17
+ import { Boxes, RefreshCw } from 'lucide-react';
18
+ import type { Recipe } from './kit-component-gallery-recipes.js';
19
+
20
+ export const DATA_RECIPES: Recipe[] = [
21
+ {
22
+ id: 'statistic',
23
+ category: 'data',
24
+ name: 'Statistic summary',
25
+ exportsLabel: 'Statistic, StatisticGroup',
26
+ importNames: ['Statistic', 'StatisticGroup'],
27
+ badge: { label: 'metrics', tone: 'success' },
28
+ wide: true,
29
+ stage: (
30
+ <StatisticGroup className="w-full">
31
+ <Statistic label="Capabilities admitted" value="18" suffix="/ 24" trend="up" tone="success" />
32
+ <Statistic label="Blocked lanes" value="2" trend="down" tone="warning" />
33
+ <Statistic label="Coverage" value="92" suffix="%" tone="primary" />
34
+ </StatisticGroup>
35
+ ),
36
+ snippet: `<StatisticGroup>
37
+ <Statistic label="Capabilities admitted" value="18" suffix="/ 24" trend="up" tone="success" />
38
+ <Statistic label="Blocked lanes" value="2" trend="down" tone="warning" />
39
+ <Statistic label="Coverage" value="92" suffix="%" tone="primary" />
40
+ </StatisticGroup>`,
41
+ props: [
42
+ { name: 'label / value', desc: 'metric identity and value content' },
43
+ { name: 'prefix / suffix', desc: 'optional value chrome' },
44
+ { name: 'trend / tone', desc: 'semantic metric direction and status color' },
45
+ ],
46
+ },
47
+ {
48
+ id: 'data-list',
49
+ category: 'data',
50
+ name: 'DataList',
51
+ exportsLabel: 'DataList',
52
+ importNames: ['DataList'],
53
+ badge: { label: 'records', tone: 'info' },
54
+ wide: true,
55
+ stage: (
56
+ <DataList
57
+ ariaLabel="Capability lane records"
58
+ items={[
59
+ { id: 'text', title: 'text.generate', meta: 'Runtime-owned execution', trailing: <StatusBadge tone="success">admitted</StatusBadge> },
60
+ { id: 'image', title: 'image.generate', meta: 'Runtime admission required', trailing: <StatusBadge tone="warning">review</StatusBadge> },
61
+ ]}
62
+ />
63
+ ),
64
+ snippet: `<DataList
65
+ ariaLabel="Capability lane records"
66
+ items={[
67
+ {
68
+ id: 'text',
69
+ title: 'text.generate',
70
+ meta: 'Runtime-owned execution',
71
+ trailing: <StatusBadge tone="success">admitted</StatusBadge>,
72
+ },
73
+ ]}
74
+ />`,
75
+ props: [
76
+ { name: 'items', desc: 'record list with title, description, meta, leading, trailing, actions' },
77
+ { name: 'ariaLabel', desc: 'required list label for assistive tech' },
78
+ { name: 'empty', desc: 'consumer-owned empty state node' },
79
+ ],
80
+ },
81
+ {
82
+ id: 'data-table',
83
+ category: 'data',
84
+ name: 'DataTable',
85
+ exportsLabel: 'DataTable',
86
+ importNames: ['DataTable'],
87
+ badge: { label: 'matrix', tone: 'info' },
88
+ wide: true,
89
+ stage: (
90
+ <DataTable
91
+ ariaLabel="Kit capability matrix"
92
+ rows={[
93
+ { id: 'chat', capability: 'chat.stream', owner: 'runtime', status: 'ready' },
94
+ { id: 'embed', capability: 'text.embed', owner: 'runtime', status: 'ready' },
95
+ ]}
96
+ rowKey={(row) => row.id}
97
+ columns={[
98
+ { key: 'capability', title: 'Capability', render: (row) => <code>{row.capability}</code> },
99
+ { key: 'owner', title: 'Owner', render: (row) => row.owner },
100
+ { key: 'status', title: 'Status', align: 'right', render: (row) => <StatusBadge tone={row.status === 'ready' ? 'success' : 'warning'}>{row.status}</StatusBadge> },
101
+ ]}
102
+ />
103
+ ),
104
+ snippet: `<DataTable
105
+ ariaLabel="Kit capability matrix"
106
+ rows={[{ id: 'chat', capability: 'chat.stream', owner: 'runtime', status: 'ready' }]}
107
+ rowKey={(row) => row.id}
108
+ columns={[
109
+ { key: 'capability', title: 'Capability', render: (row) => <code>{row.capability}</code> },
110
+ { key: 'owner', title: 'Owner', render: (row) => row.owner },
111
+ { key: 'status', title: 'Status', align: 'right', render: (row) => row.status },
112
+ ]}
113
+ />`,
114
+ props: [
115
+ { name: 'rows / columns', desc: 'typed rows and render callbacks' },
116
+ { name: 'rowKey', desc: 'stable key resolver' },
117
+ { name: 'empty', desc: 'table body empty row content' },
118
+ ],
119
+ },
120
+ {
121
+ id: 'status',
122
+ category: 'data',
123
+ name: 'StatusBadge',
124
+ exportsLabel: 'StatusBadge',
125
+ importNames: ['StatusBadge'],
126
+ badge: { label: 'signals', tone: 'success' },
127
+ stage: (
128
+ <>
129
+ <StatusBadge tone="success" shape="dot">ready</StatusBadge>
130
+ <StatusBadge tone="warning" shape="dot">attention</StatusBadge>
131
+ <StatusBadge tone="danger" shape="dot">blocked</StatusBadge>
132
+ <StatusBadge tone="info" shape="soft">info</StatusBadge>
133
+ <StatusBadge tone="neutral" shape="outline">neutral</StatusBadge>
134
+ </>
135
+ ),
136
+ snippet: `<>
137
+ <StatusBadge tone="success" shape="dot">ready</StatusBadge>
138
+ <StatusBadge tone="warning" shape="dot">attention</StatusBadge>
139
+ <StatusBadge tone="danger" shape="dot">blocked</StatusBadge>
140
+ <StatusBadge tone="info" shape="soft">info</StatusBadge>
141
+ <StatusBadge tone="neutral" shape="outline">neutral</StatusBadge>
142
+ </>`,
143
+ props: [
144
+ { name: 'tone', desc: 'neutral | success | warning | danger | info' },
145
+ { name: 'shape', desc: 'soft | outline | dot' },
146
+ ],
147
+ },
148
+ {
149
+ id: 'alert',
150
+ category: 'data',
151
+ name: 'InlineAlert',
152
+ exportsLabel: 'InlineAlert',
153
+ importNames: ['InlineAlert'],
154
+ badge: { label: 'signals', tone: 'warning' },
155
+ wide: true,
156
+ stage: (
157
+ <div className="kit-inline-alert-recipe grid w-full min-w-0 gap-6">
158
+ <InlineAlert tone="info">Runtime session is ready for this capability.</InlineAlert>
159
+ <InlineAlert tone="warning">Configure capability intent before running this lane.</InlineAlert>
160
+ </div>
161
+ ),
162
+ snippet: `<div className="kit-inline-alert-recipe grid w-full min-w-0 gap-6">
163
+ <InlineAlert tone="info">Runtime session is ready for this capability.</InlineAlert>
164
+ <InlineAlert tone="warning">Configure capability intent before running this lane.</InlineAlert>
165
+ </div>`,
166
+ props: [
167
+ { name: 'tone', desc: 'neutral | success | warning | danger | info' },
168
+ { name: 'icon', desc: 'optional leading icon node' },
169
+ ],
170
+ },
171
+ {
172
+ id: 'toast',
173
+ category: 'data',
174
+ name: 'Toast',
175
+ exportsLabel: 'nimiToast, NimiToaster',
176
+ importNames: ['nimiToast', 'NimiToaster'],
177
+ badge: { label: 'signals', tone: 'info' },
178
+ wide: true,
179
+ stage: (
180
+ <div className="flex w-full min-w-0 flex-wrap items-center gap-3">
181
+ <Button size="sm" tone="secondary" onClick={() => nimiToast.success('Export finished.')}>Success</Button>
182
+ <Button size="sm" tone="secondary" onClick={() => nimiToast.info('Runtime check scheduled.')}>Info</Button>
183
+ <Button size="sm" tone="secondary" onClick={() => nimiToast.warning('Local AI asset cache is almost full.')}>Warning</Button>
184
+ <Button size="sm" tone="secondary" onClick={() => nimiToast.danger('Bridge connection lost.')}>Danger</Button>
185
+ <Button
186
+ size="sm"
187
+ tone="secondary"
188
+ onClick={() => nimiToast.info('Update ready to install.', {
189
+ action: { label: 'Restart', onClick: () => nimiToast.success('Restart scheduled.') },
190
+ })}
191
+ >
192
+ With action
193
+ </Button>
194
+ </div>
195
+ ),
196
+ snippet: `<NimiToaster /> // mount once near the app root
197
+
198
+ <Button onClick={() => nimiToast.success('Export finished.')}>Success</Button>
199
+ <Button onClick={() => nimiToast.info('Runtime check scheduled.')}>Info</Button>
200
+ <Button onClick={() => nimiToast.warning('Local AI asset cache is almost full.')}>Warning</Button>
201
+ <Button onClick={() => nimiToast.danger('Bridge connection lost.')}>Danger</Button>
202
+ <Button
203
+ onClick={() =>
204
+ nimiToast.info('Update ready to install.', {
205
+ action: { label: 'Restart', onClick: () => nimiToast.success('Restart scheduled.') },
206
+ })
207
+ }
208
+ >
209
+ With action
210
+ </Button>`,
211
+ props: [
212
+ { name: 'nimiToast.{tone}', desc: 'success | info | warning | danger | neutral imperative helpers' },
213
+ { name: 'action', desc: 'optional { label, onClick } trailing action' },
214
+ { name: 'durationMs / sticky', desc: 'auto-dismiss delay; sticky keeps the toast until dismissed' },
215
+ { name: 'NimiToaster', desc: 'viewport host mounted once near the app root' },
216
+ ],
217
+ },
218
+ {
219
+ id: 'progress',
220
+ category: 'data',
221
+ name: 'Progress / Skeleton',
222
+ exportsLabel: 'ProgressIndicator, LoadingSkeleton',
223
+ importNames: ['ProgressIndicator', 'LoadingSkeleton'],
224
+ badge: { label: 'loading', tone: 'info' },
225
+ stage: (
226
+ <div className="kit-stack" style={{ width: '100%' }}>
227
+ <ProgressIndicator value={72} showValue />
228
+ <LoadingSkeleton lines={3} label="Loading content…" />
229
+ </div>
230
+ ),
231
+ snippet: `<div className="kit-stack" style={{ width: '100%' }}>
232
+ <ProgressIndicator value={72} showValue />
233
+ <LoadingSkeleton lines={3} label="Loading content…" />
234
+ </div>`,
235
+ props: [
236
+ { name: 'value', desc: '0-100 progress percentage' },
237
+ { name: 'lines', desc: 'LoadingSkeleton row count' },
238
+ { name: 'label', desc: 'localized loading text announced to assistive technology' },
239
+ ],
240
+ },
241
+ {
242
+ id: 'avatar',
243
+ category: 'data',
244
+ name: 'Avatar',
245
+ exportsLabel: 'Avatar',
246
+ importNames: ['Avatar'],
247
+ badge: { label: 'identity', tone: 'neutral' },
248
+ stage: (
249
+ <>
250
+ <Avatar alt="Nimi" fallback="N" />
251
+ <Avatar alt="Lab" fallback="T" shape="rounded" tone="accent" />
252
+ <Avatar alt="Agent" fallback="A" size="lg" />
253
+ </>
254
+ ),
255
+ snippet: `<>
256
+ <Avatar alt="Nimi" fallback="N" />
257
+ <Avatar alt="Lab" fallback="T" shape="rounded" tone="accent" />
258
+ <Avatar alt="Agent" fallback="A" size="lg" />
259
+ </>`,
260
+ props: [
261
+ { name: 'src / alt', desc: 'image + accessible name' },
262
+ { name: 'shape', desc: 'circle | rounded | square' },
263
+ { name: 'size', desc: 'sm | md | lg' },
264
+ ],
265
+ },
266
+ {
267
+ id: 'empty',
268
+ category: 'data',
269
+ name: 'EmptyState',
270
+ exportsLabel: 'EmptyState',
271
+ importNames: ['EmptyState', 'Button'],
272
+ badge: { label: 'empty', tone: 'neutral' },
273
+ wide: true,
274
+ stage: (
275
+ <EmptyState
276
+ icon={<Boxes size={18} />}
277
+ title="No captured artifacts"
278
+ description="Run a real capability or resolve a typed blocker before this list fills."
279
+ action={<Button size="sm" tone="secondary" leadingIcon={<RefreshCw size={13} />}>Refresh</Button>}
280
+ />
281
+ ),
282
+ extraImports: ["import { Boxes, RefreshCw } from 'lucide-react';"],
283
+ snippet: `<EmptyState
284
+ icon={<Boxes size={18} />}
285
+ title="No captured artifacts"
286
+ description="Run a real capability or resolve a typed blocker before this list fills."
287
+ action={
288
+ <Button size="sm" tone="secondary" leadingIcon={<RefreshCw size={13} />}>
289
+ Refresh
290
+ </Button>
291
+ }
292
+ />`,
293
+ props: [
294
+ { name: 'title / description', desc: 'empty-state copy' },
295
+ { name: 'action', desc: 'the action that populates the surface' },
296
+ ],
297
+ },
298
+ {
299
+ id: 'timeline',
300
+ category: 'data',
301
+ name: 'Timeline',
302
+ exportsLabel: 'Timeline, TimelineGroup',
303
+ importNames: ['Timeline', 'TimelineGroup'],
304
+ badge: { label: 'evidence', tone: 'info' },
305
+ wide: true,
306
+ stage: (
307
+ <Timeline>
308
+ <TimelineGroup date="Today" secondaryLabel="21:51">
309
+ <div className="kit-tl-item"><strong>Runtime session ready</strong><span>SDK admission surface available</span></div>
310
+ </TimelineGroup>
311
+ <TimelineGroup date="Earlier" secondaryLabel="21:40" isLast>
312
+ <div className="kit-tl-item"><strong>Capability blocked</strong><span>App AIConfig intent required</span></div>
313
+ </TimelineGroup>
314
+ </Timeline>
315
+ ),
316
+ snippet: `<Timeline>
317
+ <TimelineGroup date="Today" secondaryLabel="21:51">
318
+ <div className="kit-tl-item">
319
+ <strong>Runtime session ready</strong>
320
+ <span>SDK admission surface available</span>
321
+ </div>
322
+ </TimelineGroup>
323
+ <TimelineGroup date="Earlier" secondaryLabel="21:40" isLast>
324
+ <div className="kit-tl-item">
325
+ <strong>Capability blocked</strong>
326
+ <span>App AIConfig intent required</span>
327
+ </div>
328
+ </TimelineGroup>
329
+ </Timeline>`,
330
+ props: [
331
+ { name: 'date', desc: 'TimelineGroup heading' },
332
+ { name: 'secondaryLabel', desc: 'right-aligned meta' },
333
+ { name: 'isLast', desc: 'omit the trailing connector' },
334
+ ],
335
+ },
336
+ ];
@@ -0,0 +1,165 @@
1
+ import { useState, type ChangeEvent } from 'react';
2
+ import {
3
+ Button,
4
+ Checkbox,
5
+ ConfirmDialog,
6
+ Dialog,
7
+ DialogBody,
8
+ DialogContent,
9
+ DialogHeader,
10
+ DialogTitle,
11
+ NimiTabs,
12
+ NumberStepper,
13
+ OverlayShell,
14
+ Pagination,
15
+ PillTabs,
16
+ Popover,
17
+ PopoverContent,
18
+ PopoverTrigger,
19
+ SegmentedControl,
20
+ Slider,
21
+ Toggle,
22
+ Tooltip,
23
+ TooltipProvider,
24
+ } from '@nimiplatform/kit/ui';
25
+ import { SlidersHorizontal } from 'lucide-react';
26
+
27
+ // ---- Interactive demo wrappers ----
28
+
29
+ export function ToggleDemo() {
30
+ const [on, setOn] = useState(true);
31
+ return <Toggle checked={on} onChange={setOn} />;
32
+ }
33
+ export function CheckboxDemo() {
34
+ const [on, setOn] = useState(true);
35
+ return <Checkbox checked={on} onChange={(event: ChangeEvent<HTMLInputElement>) => setOn(event.currentTarget.checked)} label="Fail closed on missing SDK" />;
36
+ }
37
+ export function SliderDemo() {
38
+ const [value, setValue] = useState(62);
39
+ return <Slider min={1} max={100} value={value} onChange={(event: ChangeEvent<HTMLInputElement>) => setValue(Number(event.currentTarget.value))} showValue aria-label="Batch size" />;
40
+ }
41
+ export function SegmentedDemo() {
42
+ const [value, setValue] = useState('single');
43
+ return (
44
+ <SegmentedControl
45
+ items={[{ value: 'single', label: 'Single' }, { value: 'stream', label: 'Stream' }, { value: 'batch', label: 'Batch' }]}
46
+ value={value}
47
+ onValueChange={setValue}
48
+ ariaLabel="Run mode"
49
+ size="sm"
50
+ />
51
+ );
52
+ }
53
+ export function NumberStepperDemo() {
54
+ const [value, setValue] = useState(4);
55
+ return <NumberStepper value={value} onValueChange={setValue} min={1} max={16} ariaLabel="Batch count" />;
56
+ }
57
+ export function TabsDemo() {
58
+ const [value, setValue] = useState('overview');
59
+ return (
60
+ <NimiTabs
61
+ items={[
62
+ { value: 'overview', label: 'Overview' },
63
+ { value: 'key-props', label: 'Key props' },
64
+ { value: 'design-tokens', label: 'Design tokens' },
65
+ ]}
66
+ value={value}
67
+ onValueChange={setValue}
68
+ ariaLabel="Recipe view"
69
+ />
70
+ );
71
+ }
72
+ export function PillTabsDemo() {
73
+ const [value, setValue] = useState('preview');
74
+ return (
75
+ <PillTabs
76
+ items={[
77
+ { value: 'preview', label: 'Preview' },
78
+ { value: 'use', label: 'Use' },
79
+ { value: 'access', label: 'Access' },
80
+ ]}
81
+ value={value}
82
+ onValueChange={setValue}
83
+ ariaLabel="Preview mode"
84
+ />
85
+ );
86
+ }
87
+ export function PaginationDemo() {
88
+ const [page, setPage] = useState(2);
89
+ return <Pagination page={page} pageCount={7} onPageChange={setPage} ariaLabel="Capability result pages" />;
90
+ }
91
+ export function DialogDemo() {
92
+ const [open, setOpen] = useState(false);
93
+ return (
94
+ <>
95
+ <Button tone="secondary" size="sm" onClick={() => setOpen(true)}>Open dialog</Button>
96
+ <Dialog open={open} onOpenChange={setOpen}>
97
+ <DialogContent onClose={() => setOpen(false)}>
98
+ <DialogHeader><DialogTitle>Apply AIProfile</DialogTitle></DialogHeader>
99
+ <DialogBody>Review the AIConfig intent diff before applying it to this capability.</DialogBody>
100
+ </DialogContent>
101
+ </Dialog>
102
+ </>
103
+ );
104
+ }
105
+ export function OverlayShellDemo() {
106
+ const [open, setOpen] = useState(false);
107
+ return (
108
+ <>
109
+ <Button tone="secondary" size="sm" onClick={() => setOpen(true)}>Open drawer</Button>
110
+ <OverlayShell
111
+ open={open}
112
+ kind="drawer"
113
+ size="M"
114
+ title="SDK projection detail"
115
+ footer={<Button tone="primary" size="sm" onClick={() => setOpen(false)}>Done</Button>}
116
+ onClose={() => setOpen(false)}
117
+ >
118
+ <div className="kit-pop">
119
+ <strong>Consumer-owned content</strong>
120
+ <span>Overlay chrome comes from Kit UI.</span>
121
+ </div>
122
+ </OverlayShell>
123
+ </>
124
+ );
125
+ }
126
+ export function PopoverDemo() {
127
+ return (
128
+ <Popover>
129
+ <PopoverTrigger asChild>
130
+ <Button tone="secondary" size="sm" leadingIcon={<SlidersHorizontal size={13} />}>Open popover</Button>
131
+ </PopoverTrigger>
132
+ <PopoverContent>
133
+ <div className="kit-pop">
134
+ <strong>Capability detail</strong>
135
+ <span>Local runtime · text.generate</span>
136
+ </div>
137
+ </PopoverContent>
138
+ </Popover>
139
+ );
140
+ }
141
+ export function TooltipDemo() {
142
+ return (
143
+ <TooltipProvider>
144
+ <Tooltip content="Runs through the admitted SDK surface">
145
+ <Button tone="ghost" size="sm">Hover for tooltip</Button>
146
+ </Tooltip>
147
+ </TooltipProvider>
148
+ );
149
+ }
150
+ export function ConfirmDemo() {
151
+ const [open, setOpen] = useState(false);
152
+ return (
153
+ <>
154
+ <Button tone="danger" size="sm" onClick={() => setOpen(true)}>Delete draft…</Button>
155
+ <ConfirmDialog
156
+ open={open}
157
+ title="Delete prompt draft?"
158
+ message="This removes the local draft for this capability. It cannot be undone."
159
+ confirmLabel="Delete"
160
+ onConfirm={() => setOpen(false)}
161
+ onClose={() => setOpen(false)}
162
+ />
163
+ </>
164
+ );
165
+ }