@nextop-os/ui-system 0.0.17 → 0.0.19

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 (40) hide show
  1. package/AGENTS.md +30 -8
  2. package/README.md +11 -14
  3. package/agent/install-skill.mjs +65 -5
  4. package/agent/nextop-ui-system/SKILL.md +119 -8
  5. package/agent/nextop-ui-system/references/extract-base-component.md +50 -6
  6. package/agent/nextop-ui-system/references/maintain-inventory.md +5 -0
  7. package/agent/nextop-ui-system/references/promote-business-component.md +94 -208
  8. package/dist/chunk-GE5YVRTV.js +859 -0
  9. package/dist/chunk-GE5YVRTV.js.map +1 -0
  10. package/dist/chunk-KJQ366TA.js +70 -0
  11. package/dist/chunk-KJQ366TA.js.map +1 -0
  12. package/dist/chunk-LVHEV755.js +2553 -0
  13. package/dist/chunk-LVHEV755.js.map +1 -0
  14. package/dist/components/index.d.ts +162 -11
  15. package/dist/components/index.js +62 -2
  16. package/dist/date-format.d.ts +6 -0
  17. package/dist/date-format.js +11 -0
  18. package/dist/date-format.js.map +1 -0
  19. package/dist/dev-vite.js +12 -5
  20. package/dist/dev-vite.js.map +1 -1
  21. package/dist/icons/index.d.ts +90 -47
  22. package/dist/icons/index.js +91 -11
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.js +159 -11
  25. package/dist/metadata/components.json +1320 -265
  26. package/dist/metadata/components.schema.json +4 -0
  27. package/dist/metadata/index.d.ts +3 -1
  28. package/dist/metadata/index.js +1320 -265
  29. package/dist/metadata/index.js.map +1 -1
  30. package/dist/styles/base.css +85 -0
  31. package/dist/styles/index.css +1 -0
  32. package/dist/styles/semantic.css +7 -0
  33. package/dist/styles/theme.css +82 -1
  34. package/package.json +10 -3
  35. package/ui-system.md +640 -0
  36. package/UI_SYSTEM_GUIDELINES.md +0 -148
  37. package/dist/chunk-FT633NLJ.js +0 -1159
  38. package/dist/chunk-FT633NLJ.js.map +0 -1
  39. package/dist/chunk-NFSMZKML.js +0 -208
  40. package/dist/chunk-NFSMZKML.js.map +0 -1
@@ -31,18 +31,22 @@ Build a state matrix from that evidence. For each candidate state, record:
31
31
  - state name
32
32
  - source file or branch proving the state
33
33
  - props or data needed to render it
34
+ - variation axes and whether each axis is visual, structural, behavioral, or
35
+ host-owned
34
36
  - host-owned behavior that must stay outside the shared component
35
37
  - whether the state belongs in the shared component contract
36
38
 
37
39
  ## Agent-Owned Boundary Decision
38
40
 
39
- The agent decides the proposed component boundary before asking for preview
40
- review:
41
+ The agent decides the proposed component boundary before implementation:
41
42
 
42
43
  - component `id` and `layer: "business"`
43
44
  - source usage being replaced
44
45
  - intended reuse surfaces
45
46
  - public props and callbacks
47
+ - API shape decision: variants, discriminated unions, slots, children, explicit
48
+ component variants, compound subcomponents, provider state, and host-owned
49
+ caller logic
46
50
  - host-owned state and side effects that remain outside
47
51
  - states that will appear in storyboard
48
52
  - stable export path and metadata entry
@@ -50,174 +54,57 @@ review:
50
54
  If the candidate is not reusable or cannot stay host-agnostic, do not promote
51
55
  it. Prefer using existing components or keeping the UI local.
52
56
 
53
- ## Temporary Preview Gate
54
-
55
- Before writing the component into `packages/ui/system`, generate a temporary
56
- preview outside the repository.
57
-
58
- The preview is an early confirmation of the component that will be promoted,
59
- not a loose mockup. Build it from three inputs:
57
+ ## API Composition Gate
58
+
59
+ Before writing the promoted component, convert the state matrix into a public
60
+ API deliberately:
61
+
62
+ 1. List every visual, structural, and behavioral variation found in source
63
+ evidence.
64
+ 2. Keep only standard state booleans such as `disabled`, `loading`, `selected`,
65
+ `open`, `required`, or `invalid` when they represent real states and do not
66
+ create impossible combinations.
67
+ 3. Replace mode booleans such as `isFoo`, `showBar`, and `withBaz` with a
68
+ finite variant, discriminated union, explicit component variant, slot, or
69
+ composed child.
70
+ 4. Prefer `children` or named slots for caller-owned visual regions. Use render
71
+ props only when the shared component needs to pass data back to the caller.
72
+ 5. Use compound components and context only when consumers need to assemble
73
+ subparts while sharing state. A simple row, card, badge, toolbar, or display
74
+ panel should stay as a direct props-driven component.
75
+ 6. If shared state is necessary, define a narrow injectable context contract as
76
+ `state`, `actions`, and `meta`. Providers may adapt caller state, but daemon,
77
+ Electron, router, store, query, persistence, filesystem, i18n lookup, and
78
+ workflow orchestration remain outside `@nextop-os/ui-system`.
79
+ 7. For new React components, use the repository's React 19 baseline, including
80
+ `ref` as a prop when needed. Do not rewrite shadcn or Radix-acquired
81
+ internals solely to normalize API style.
82
+
83
+ Stop promotion if the only way to represent the source states is a broad bag of
84
+ unrelated boolean props or leaked host state. Narrow the boundary, create
85
+ explicit variants, or keep the UI local.
86
+
87
+ ## Implementation Blueprint
88
+
89
+ Implement the promoted component directly from three inputs:
60
90
 
61
91
  - the code-evidence state matrix
62
92
  - the proposed public props and callback boundary
63
- - the existing candidate UI source or visual surface being extracted
64
-
65
- The draft component inside the preview should be a props-driven version of the
66
- candidate source with host-owned behavior removed. Once the user confirms the
67
- preview, the promoted component should be copied from the confirmed draft with
68
- only package integration edits such as final file placement, exports, metadata,
69
- storyboard wiring, and type tightening. Do not confirm a placeholder preview and
70
- then reimplement a materially different component in `packages/ui/system`.
71
-
72
- 1. Create the preview under
73
- `$TMPDIR/nextop-ui-system-preview-<component-id>/`.
74
- 2. Start the UI-system dev server:
75
-
76
- ```bash
77
- pnpm --filter @nextop-os/ui-system dev:server
78
- ```
79
-
80
- If a server may already be running, probe `/health` first.
81
-
82
- 3. Configure the temporary Vite app with
83
- `nextopUISystemDev({ serverUrl })` from
84
- `@nextop-os/ui-system/dev-vite`.
85
- 4. Import UI-system components, icons, styles, and utilities through stable
86
- public entrypoints.
87
- 5. Render every accepted state from the state matrix using the props-driven
88
- draft component adapted from the candidate source.
89
- 6. Start the preview app and give the user a local URL.
90
- 7. Wait for the user to confirm the state set, visual behavior, and props
91
- boundary before promoting the component into `packages/ui/system`.
92
-
93
- The preview is a review gate, not package source. Do not put draft preview
94
- files in the Nextop checkout.
95
-
96
- ## Preview Scaffold Script
97
-
98
- Prefer the bundled script when creating the temporary preview scaffold:
99
-
100
- ```bash
101
- node packages/ui/system/agent/nextop-ui-system/scripts/create-business-preview.mjs \
102
- --component-id <component-id> \
103
- --component-name <ComponentName> \
104
- --state-matrix /path/to/state-matrix.json
105
- ```
106
-
107
- The state matrix JSON may be either an array or an object with a `states` array:
108
-
109
- ```json
110
- {
111
- "states": [
112
- {
113
- "name": "normal",
114
- "description": "Installed agents with status and actions.",
115
- "evidence": ["apps/desktop/src/.../AgentSettings.tsx normal branch"],
116
- "propsData": ["rows", "status labels", "action labels"],
117
- "hostOwnedBehavior": ["install queue", "i18n lookup"],
118
- "boundaryNotes": ["callbacks are host-provided"],
119
- "includedInContract": true
120
- }
121
- ]
122
- }
123
- ```
124
-
125
- The script writes a Vite React app scaffold to
126
- `$TMPDIR/nextop-ui-system-preview-<component-id>/` by default. The generated
127
- app includes:
128
-
129
- - `vite.config.ts` with `nextopUISystemDev({ serverUrl })`
130
- - `src/stateMatrix.ts` from the code-evidence state matrix
131
- - `src/Preview.tsx` with a draft component and state cards
132
- - `src/style.css` with Tailwind source hints for the dev cache and installed
133
- package
134
-
135
- Treat the generated `src/Preview.tsx` as a scaffold. Replace the generic draft
136
- component with a props-driven adaptation of the candidate source before asking
137
- for user confirmation. The confirmed preview component is the implementation
138
- blueprint for `packages/ui/system`.
139
-
140
- After generation, run the printed commands from the preview directory:
141
-
142
- ```bash
143
- pnpm install
144
- pnpm dev -- --host 127.0.0.1
145
- ```
93
+ - the existing candidate source UI or visual surface being extracted
146
94
 
147
- Use `--out-dir`, `--server-url`, or `--force` only when the default temporary
148
- directory or server URL is unsuitable.
95
+ The promoted component should be a props-driven version of the candidate source
96
+ with host-owned behavior removed. Preserve the real visual structure, component
97
+ composition, class names, spacing, icons, and state-specific branches unless
98
+ they depend on host-owned behavior. Replace host-owned behavior with public
99
+ props, callbacks, caller-owned slots, or explicit variants. Add storyboard
100
+ examples for every accepted public state in the same change so the review can
101
+ inspect the finished implementation instead of a preflight draft.
149
102
 
150
- ## Preview Code Generation Prompt
103
+ If the draft still needs app state, navigation, fetching, persistence, i18n key
104
+ lookup, or host adapters to render, stop and revise the component boundary
105
+ instead of promoting it.
151
106
 
152
- Use a prompt like this to turn the candidate source into the high-fidelity draft
153
- inside the temporary preview. Fill the inputs from code evidence and the
154
- proposed boundary; do not ask the user to write the preview code.
155
-
156
- ```text
157
- Generate a temporary Vite React preview for a proposed Nextop UI-system business
158
- component promotion.
159
-
160
- Inputs:
161
- - Component id: <component-id>
162
- - Proposed export name: <ComponentName>
163
- - Proposed layer: business
164
- - Source usage being replaced: <source file paths and call sites>
165
- - Candidate source excerpt or file paths: <component/helper files to adapt>
166
- - Proposed props and callbacks: <TypeScript interface or bullet list>
167
- - Host-owned behavior to exclude: <daemon/router/store/i18n/data loading/etc.>
168
- - State matrix:
169
- <state name | source evidence | required props/data | host-owned behavior |
170
- included in component contract>
171
-
172
- Requirements:
173
- 1. Create all preview files under
174
- `$TMPDIR/nextop-ui-system-preview-<component-id>/`; do not write draft
175
- preview files inside the Nextop checkout.
176
- 2. Start from the generated files produced by
177
- `scripts/create-business-preview.mjs` unless there is a specific reason to
178
- hand-author the preview.
179
- 3. Adapt the candidate UI source into a props-driven draft component. Preserve
180
- the real visual structure, component composition, class names, spacing,
181
- icons, and state-specific branches unless they depend on host-owned
182
- behavior.
183
- 4. Replace host-owned behavior with props, static sample data, no-op handlers,
184
- or console logging. Do not keep daemon, Electron, router, store, query,
185
- filesystem, polling, i18n key lookup, or workflow orchestration in the
186
- preview component.
187
- 5. Create or update a minimal Vite React app with `package.json`,
188
- `index.html`, `src/main.tsx`, `src/Preview.tsx`, `src/stateMatrix.ts`, and
189
- `src/style.css`.
190
- 6. Configure `vite.config.ts` with
191
- `nextopUISystemDev({ serverUrl: "http://127.0.0.1:4100" })` from
192
- `@nextop-os/ui-system/dev-vite`.
193
- 7. Import UI-system components, icons, utilities, and styles only through
194
- stable public entrypoints:
195
- `@nextop-os/ui-system`, `@nextop-os/ui-system/components`,
196
- `@nextop-os/ui-system/icons`, `@nextop-os/ui-system/styles.css`, and
197
- `@nextop-os/ui-system/utils`.
198
- 8. Render every accepted state from the state matrix in one screen. Each state
199
- card must show the state name, source evidence, included/excluded boundary
200
- notes, and the rendered draft component.
201
- 9. Keep copy, labels, permissions, statuses, and formatting as props in the
202
- preview so the component boundary is reviewable.
203
- 10. Do not import from `@nextop-os/ui-system/src/*`, app internals, daemon,
204
- Electron, router, stores, query clients, or checkout-relative paths.
205
- 11. Print the commands needed to run the preview and the expected local URL.
206
-
207
- Output:
208
- - File list with complete contents.
209
- - Run commands.
210
- - Short review checklist for the user: state coverage, visual behavior, props
211
- boundary, and host-owned behavior.
212
- - A note identifying which preview component file should be copied into
213
- `packages/ui/system` after user confirmation.
214
- ```
215
-
216
- The generated preview should make boundary mistakes visible. If the draft needs
217
- app state, navigation, fetching, or host adapters to render, stop and revise the
218
- component boundary instead of promoting it.
219
-
220
- ## Preview Chain Demo
107
+ ## Promotion Chain Demo
221
108
 
222
109
  Example request:
223
110
 
@@ -260,7 +147,7 @@ Expected chain:
260
147
  - Contract: yes.
261
148
  ```
262
149
 
263
- 3. **Decide the boundary before preview**
150
+ 3. **Decide the boundary before implementation**
264
151
  - `id`: a stable kebab-case business component id, for example
265
152
  `example-business-component`
266
153
  - `layer`: `business`
@@ -268,67 +155,59 @@ Expected chain:
268
155
  `ExampleBusinessComponent`
269
156
  - Public props: rows, labels, icon render slots, action callbacks, disabled
270
157
  flags, status/tone fields, empty-state copy.
158
+ - API shape: row status as finite tone values, callbacks as host-provided
159
+ actions, empty state copy as labels, and no install/uninstall mode
160
+ booleans. If the table later needs caller-owned row adornments, prefer a
161
+ named slot or composed child over a broad render prop.
271
162
  - Host-owned behavior: i18n lookup, daemon calls, install queue,
272
163
  confirmation dialogs, persistence, routing, and state derivation.
273
- 4. **Generate a high-fidelity preview component**
274
- - Write the state matrix to a temporary JSON file.
275
- - Generate the preview scaffold:
276
-
277
- ```bash
278
- node packages/ui/system/agent/nextop-ui-system/scripts/create-business-preview.mjs \
279
- --component-id example-business-component \
280
- --component-name ExampleBusinessComponent \
281
- --state-matrix /tmp/example-business-component-state-matrix.json \
282
- --force
283
- ```
284
-
285
- - Adapt the current candidate source into `src/Preview.tsx` as a props-driven
286
- business component draft.
164
+ 4. **Implement the promoted component**
165
+ - Adapt the current candidate source into the final
166
+ `packages/ui/system/src/components/<component-file>.tsx` component.
287
167
  - Keep the real table layout, status cells, action affordances, icon
288
168
  placement, empty state, and disabled/error branches.
289
169
  - Replace host behavior with props and local callback stubs: i18n-resolved
290
170
  labels, queue state, confirmation dialog decisions, daemon calls, and
291
- install orchestration stay outside the draft.
292
- - Start or verify the UI-system dev server:
293
-
294
- ```bash
295
- pnpm --filter @nextop-os/ui-system dev:server
296
- curl http://127.0.0.1:4100/health
297
- ```
298
-
299
- - Start the preview app and give the user the local URL.
300
-
301
- 5. **User review gate**
302
- - Ask the user to review state coverage, visual behavior, and props
303
- boundary in the preview.
304
- - If the user finds a missing state or boundary leak, update the state
305
- matrix and regenerate the temporary preview.
306
- - Only proceed after the user confirms the preview.
307
- 6. **Promote after confirmation**
308
- - Copy the confirmed preview draft into
309
- `packages/ui/system/src/components/<component-file>.tsx`.
171
+ install orchestration stay outside the component.
310
172
  - Make only package integration edits: final exported prop types, imports,
311
173
  class cleanup, and package-local helpers.
312
174
  - Export it from stable barrels.
313
175
  - Add metadata with `layer: "business"` and storyboard coverage for the
314
- confirmed states.
176
+ accepted states.
315
177
  - Replace the original app UI with `@nextop-os/ui-system` imports while
316
178
  leaving host-owned behavior in the caller.
317
- 7. **Validate and report**
179
+ 5. **Validate and report**
180
+ - Review the finished implementation through the storyboard states and the
181
+ migrated consumer surface.
182
+ - Start an independent design-foundation review subagent. Give it the
183
+ promoted files, original source usage, selected state matrix, storyboard
184
+ entry, metadata entry, and `ui-system.md`.
185
+ - Include the API shape review in the handoff: accepted booleans, variants,
186
+ slots or children, explicit variants, provider state if any, and
187
+ host-owned behavior kept in the caller.
188
+ - Resolve any subagent-reported design drift before reporting completion.
189
+ - Run the promotion review gate: Frictionless task path and action hierarchy,
190
+ Quality Craft visual parity and token/state coverage, and Trustworthy
191
+ labels, recovery, policy, and provenance behavior.
318
192
  - Run metadata, boundary, storyboard, and relevant package checks.
319
- - Report the state matrix summary, reviewed preview URL, final boundary,
320
- validation results, and uncovered risks.
193
+ - Report the state matrix summary, final boundary, promotion review result,
194
+ subagent design-foundation result, validation results, and uncovered
195
+ risks.
321
196
 
322
197
  ## Implementation
323
198
 
324
- After preview confirmation:
325
-
326
199
  1. Implement the business component by composing `base` primitives.
327
200
  2. Keep all host-owned behavior in the caller.
328
- 3. Add stable exports and metadata with `layer: "business"`.
329
- 4. Add storyboard examples for normal, empty, disabled, loading, and error-like
201
+ 3. Preserve the API composition decision. Do not add new mode booleans or
202
+ host-owned state while moving the candidate UI into the shared package.
203
+ 4. Add stable exports and metadata with `layer: "business"`.
204
+ 5. Add storyboard examples for normal, empty, disabled, loading, and error-like
330
205
  states when those states exist in the public contract.
331
- 5. Migrate callers by replacing only the visual surface.
206
+ 6. Migrate callers by replacing only the visual surface.
207
+ 7. Run the promotion review gate from
208
+ `ui-system.md` against the promoted component
209
+ and migrated consumer.
210
+ 8. Start the design-foundation review subagent and resolve any reported drift.
332
211
 
333
212
  ## Validation
334
213
 
@@ -346,7 +225,14 @@ If a consumer was migrated, also run that consumer's typecheck or build.
346
225
  Report:
347
226
 
348
227
  - state matrix summary
349
- - preview URL reviewed by the user
350
228
  - component boundary decision
229
+ - API composition decision and any rejected boolean or state combinations
230
+ - promotion review result with Frictionless / Quality Craft / Trustworthy
231
+ pillar status and blocking/major/minor issues
232
+ - design-foundation subagent result
351
233
  - validation commands and results
352
234
  - remaining risks or uncovered states
235
+
236
+ Do not report full design-foundation compliance unless the subagent review ran
237
+ and found no unresolved drift. If subagents are unavailable, report the
238
+ verification as blocked.