@gunkin/uiify 0.0.26-alpha → 0.0.27-alpha

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 (62) hide show
  1. package/README.md +59 -0
  2. package/agents/components.md +2 -0
  3. package/agents/index.md +1 -0
  4. package/dist/ai/UiDocument.d.ts +16 -0
  5. package/dist/ai/UiDocument.d.ts.map +1 -0
  6. package/dist/ai/UiDocument.js +33 -0
  7. package/dist/ai/UiDocument.js.map +1 -0
  8. package/dist/ai/catalog.generated.d.ts +2766 -0
  9. package/dist/ai/catalog.generated.d.ts.map +1 -0
  10. package/dist/ai/catalog.generated.js +214 -0
  11. package/dist/ai/catalog.generated.js.map +1 -0
  12. package/dist/ai/index.d.ts +9 -0
  13. package/dist/ai/index.d.ts.map +1 -0
  14. package/dist/ai/index.js +13 -0
  15. package/dist/ai/index.js.map +1 -0
  16. package/dist/ai/issues.d.ts +10 -0
  17. package/dist/ai/issues.d.ts.map +1 -0
  18. package/dist/ai/issues.js +178 -0
  19. package/dist/ai/issues.js.map +1 -0
  20. package/dist/ai/layout.d.ts +26 -0
  21. package/dist/ai/layout.d.ts.map +1 -0
  22. package/dist/ai/layout.js +46 -0
  23. package/dist/ai/layout.js.map +1 -0
  24. package/dist/ai/limits.d.ts +16 -0
  25. package/dist/ai/limits.d.ts.map +1 -0
  26. package/dist/ai/limits.js +99 -0
  27. package/dist/ai/limits.js.map +1 -0
  28. package/dist/ai/load.d.ts +16 -0
  29. package/dist/ai/load.d.ts.map +1 -0
  30. package/dist/ai/load.js +69 -0
  31. package/dist/ai/load.js.map +1 -0
  32. package/dist/ai/loaders.generated.d.ts +5 -0
  33. package/dist/ai/loaders.generated.d.ts.map +1 -0
  34. package/dist/ai/loaders.generated.js +122 -0
  35. package/dist/ai/loaders.generated.js.map +1 -0
  36. package/dist/ai/rules.d.ts +11 -0
  37. package/dist/ai/rules.d.ts.map +1 -0
  38. package/dist/ai/rules.js +126 -0
  39. package/dist/ai/rules.js.map +1 -0
  40. package/dist/ai/schema.generated.d.ts +8 -0
  41. package/dist/ai/schema.generated.d.ts.map +1 -0
  42. package/dist/ai/schema.generated.js +3316 -0
  43. package/dist/ai/schema.generated.js.map +1 -0
  44. package/dist/ai/types.d.ts +33 -0
  45. package/dist/ai/types.d.ts.map +1 -0
  46. package/dist/ai/types.js +14 -0
  47. package/dist/ai/types.js.map +1 -0
  48. package/dist/ai/validate.d.ts +15 -0
  49. package/dist/ai/validate.d.ts.map +1 -0
  50. package/dist/ai/validate.js +32 -0
  51. package/dist/ai/validate.js.map +1 -0
  52. package/dist/ai/validator.generated.d.ts +13 -0
  53. package/dist/ai/validator.generated.d.ts.map +1 -0
  54. package/dist/ai/validator.generated.js +49133 -0
  55. package/dist/ai/validator.generated.js.map +1 -0
  56. package/dist/components/virtual-scroll/VirtualScroll.d.ts.map +1 -1
  57. package/dist/components/virtual-scroll/VirtualScroll.js +1 -1
  58. package/dist/components/virtual-scroll/VirtualScroll.js.map +1 -1
  59. package/dist/styles/index.css +1 -1
  60. package/package.json +10 -1
  61. package/skills/uiify/SKILL.md +14 -10
  62. package/skills/uiify/references/guides/verification.md +13 -2
@@ -30,23 +30,27 @@ Keep + UI: existing routes/theme; Field email, Select frequency, Checkbox market
30
30
  Flow + proof: invalid → inline error; valid → demo confirmation + retained values; keyboard, narrow layout.
31
31
  ```
32
32
 
33
- Adapt or reuse the brief in the user's language; no parser, required file or output. Keep exact API names; expand ambiguity before coding.
33
+ Adapt the brief to the user's language. Keep exact API names; expand ambiguity before coding.
34
34
 
35
35
  Use this precedence: explicit brief or reference → existing project → selected recipes → aesthetic guidance.
36
36
 
37
37
  When images or typography shape the composition, read `references/guides/assets.md` before choosing material.
38
38
 
39
- ## Select knowledge for the page
39
+ ## Write the page as a UI document
40
40
 
41
- `references/` paths are relative to this skill directory; `agents/` paths are relative to the resolved package root. Read each distinct file once, reusing it across selected elements.
41
+ `references/` paths are relative to this skill directory; `dist/` and `agents/` paths to the package root. Read each distinct file once.
42
42
 
43
- Match the needed elements to the Index by name or alias. Use the listed component binding; never invent a binding. A `gap` or an unlisted element needs custom UI composed from available UIify controls or semantic native HTML, not a guessed UIify API.
43
+ 1. Match the needed elements to the Index by name or alias; never invent a binding. A `gap` or an unlisted element needs the catalog's native elements (`p`, `ul`, `a`, `label`, headings…) or other available parts. For each selected element with a reference path, read that file once and carry its structure and ids over to nodes; its JSX is a recipe, not code to paste. From the Composition index, read only relationships where both elements are needed. Follow linked laws.
44
+ 2. Next, read the part types and TSDoc in the package's `dist/ai/catalog.generated.d.ts`, but only `UiType` and the selected parts' `<Name>Props`, not the whole file. Use nothing it lacks.
45
+ 3. Next, write the page as a UI document with `satisfies UiNodeInput`: nodes are `{ type, props, children }`; children are nodes or strings. Values and `.map` over data are plain TypeScript; annotate callbacks `(row): UiNodeInput => …`. Import types from `@gunkin/uiify/ai`.
46
+ 4. Then render it with `UiDocument` from `@gunkin/uiify/ai`: `<Suspense><UiDocument node={page} /></Suspense>`.
47
+ 5. Last, run the project's typecheck, then validate and check the rendered HTML (Verification guidance).
44
48
 
45
- For each selected element with a fourth-column reference path, read that file once. A blank path means no curated recipe. Read and adapt its linked example for part wiring. From the Composition index, read only relationships where both elements are needed. Follow each selected reference and linked law, including laws named by element recipes. Do not load unrelated references or the complete catalog.
49
+ Label a control with a native `{ type: "label", props: { htmlFor } }` node and the control's `id`. No component part takes `as`; `Field.Label` labels only `Field.Control` (a `div`); inputs and selects need a native label. Interactivity is native only: `href`, form `method`/`action`, invoker `commandfor`/`command` (for example `ModalTrigger`); `popoverTarget` is not available on parts.
46
50
 
47
- For mapped components, read the package's `agents/index.md` and `agents/reference/components/<name>.md`. Related knowledge links locate selected packaged recipes/examples. Check Runtime exports: use the explicit `NameRoot` export when available. A namespace export is not itself a JSX component; use its `.Root` or an explicit root export. Import from `@gunkin/uiify/components/<name>`. If the reference leaves an export, required prop or part wiring ambiguous, inspect its listed Types/declaration file and runtime exports. Prefer version-matched references over memory.
51
+ Not available to documents yet: Tier 2 components and the parts, with reasons, in `uiUnavailableParts` in `dist/ai/catalog.generated.d.ts` (Tabs, charts, Toast, Breadcrumb.Ellipsis…). When a page needs one, write ordinary JSX for that piece outside the document, imported from `@gunkin/uiify/components/<name>` (see `agents/components.md`), and say so.
48
52
 
49
- Reuse documented UIify components, including controls inside custom gaps. Check `agents/components.md` for controls absent from recipes. Do not replace an available Button, Input, Checkbox or AlertModal with a raw-tag lookalike. Keep native HTML when no component fits, the page demonstrates native semantics, or layer rules prohibit the import; preserve semantic structures such as `fieldset`, `dl` and forms.
53
+ Use a part, not a raw-tag lookalike of `Button`, `Input`, `Checkbox` or `AlertModal`. Keep native elements when no part fits or the page demonstrates native semantics; keep `fieldset`, `dl` and forms.
50
54
 
51
55
  ## Design guidance
52
56
 
@@ -64,7 +68,7 @@ After the page renders, review it with a guide only when its question applies:
64
68
 
65
69
  Ground visual direction in the subject, audience and primary job. Use clear typography, hierarchy, grouping, purposeful copy, responsive layout and existing semantic color roles. Choose one signature detail; keep the rest restrained. Avoid automatic gradient heroes, equal cards or decorative numbering. Preserve visible focus, keyboard-sized targets and reduced-motion behavior.
66
70
 
67
- For a settings page, group fields by decision and give one `Button` the save action. Adapt the Field example in `agents/index.md`: Root gets `id`, Label/Control/Description/Error get the same `fieldId`. Pass `invalid`/`required` to both Root and Control. `Field.Control as="input"` supplies UIify Input and its ID. Keep Field's ID/ARIA wiring and Description mounted when showing Error. Wrap standalone `Select.Root` in a native `<label>`; Field.Label wires only Field.Control.
71
+ For a settings page, group fields by decision and give one `Button` the save action.
68
72
 
69
73
  Wire each requested action through its outcome: a dialog closing is not a mutation. Keep cancel/error paths safe; if an action removes its opener, focus a surviving target, including the empty state. Describe in-memory demos as demos; claim persistence only when implemented.
70
74
 
@@ -72,9 +76,9 @@ Do not add an unrelated marketing hero or make every field group an equally prom
72
76
 
73
77
  ## Verification guidance
74
78
 
75
- Finish the edits before running applicable project build, typecheck and test commands. Run relevant verification once against the stable result. On failure, fix related findings together, diagnose with focused checks, then rerun the required final gate. For the optional static lint and its limits, read `references/guides/verification.md`.
79
+ Finish the edits first, then verify the stable result once: the project's typecheck (`tsc`), `validateDocument` on the document, then html-validate and axe-core on its rendered HTML, using the project's tooling. On failure, fix related findings together, diagnose with focused checks, then rerun the required gate. For these steps and the optional static lint and its limits, read `references/guides/verification.md`.
76
80
 
77
- Reuse existing browser and accessibility tooling for responsive layouts, keyboard access and requested interactions. Before installing missing Playwright or axe-core tooling or browser binaries, notify the user what is needed and why. This is a notification, not a confirmation question; follow project rules, its package manager and development dependencies. Use Playwright for browser checks and axe-core for accessibility.
81
+ Reuse existing browser and accessibility tooling for responsive layouts, keyboard access and requested interactions. Before installing missing Playwright or axe-core tooling, html-validate or browser binaries, notify the user what is needed and why. This is a notification, not a confirmation question; follow project rules, its package manager and development dependencies. Use Playwright for browser checks.
78
82
 
79
83
  Repair findings within scope and rerun affected checks. Report unavailable or prohibited checks as not run, with the reason; never claim a check passed without running it.
80
84
 
@@ -1,9 +1,20 @@
1
- # Optional static lint
1
+ # Verify a UI document
2
+
3
+ Run in this order, with the project's own tooling, after the document and its route are written. Fix findings, then rerun from the failing step.
4
+
5
+ 1. **`tsc`** (the project's typecheck script): `satisfies UiNodeInput` reports an unknown part, prop or value at the offending node. Run it before the other checks, which assume a typed document.
6
+ 2. **`validateDocument`**: call it from `@gunkin/uiify/ai` on the document object, in a test or one-off script the project can run (for example vitest or `tsx`). It must return `ok: true`; otherwise each issue has a breadcrumb such as `form › Field.Root › Button.props.variant` and the allowed values. It also enforces rules `tsc` cannot: a part sits inside its root, a `fieldId` names the enclosing root's `id`, ids are unique, nesting stays as the HTML parser keeps it (no block or component inside `p`, headings, `a` or `label`; no form inside a form; only items in lists), and depth, node count and string length stay within limits. It does not check `htmlFor`: a dangling `htmlFor` or a missing label is caught by html-validate and axe-core.
7
+ 3. **html-validate** on the rendered HTML: render the route or document to a string (for example `renderToReadableStream` from `react-dom/server`, inside `Suspense`), place it in a page with `lang`, `title` and `main`, and run html-validate with the project's configuration.
8
+ 4. **axe-core** on the same HTML, in jsdom or a Playwright page. Disable `color-contrast` in jsdom, which has no layout; check contrast in a real browser.
9
+
10
+ A passing run proves valid markup and no detectable axe violations, not good design: review the page with the design guides, and test keyboard use and responsive layout in a browser. Report any check you could not run, and why.
11
+
12
+ ## Optional static lint
2
13
 
3
14
  Run `node <resolved-skill-directory>/scripts/lint.mjs <project-root>` when the project's existing checks do not cover the relevant JSX attributes. Resolve the script from this skill directory, not the project root.
4
15
 
5
16
  It runs the static checks compiled from the published laws when this skill was built and prints their names. It does not read `DESIGN.md` or other design files.
6
17
 
7
- It inspects literal attributes of lowercase intrinsic JSX tags and of parts imported from `@gunkin/uiify/components` or `@gunkin/uiify/elements` (for example `Button` or `Field.Control`). Other custom components and computed attribute values are not analyzed.
18
+ It does not analyze UI documents, which are object literals; it inspects literal attributes of lowercase intrinsic JSX tags and of parts imported from `@gunkin/uiify/components` or `@gunkin/uiify/elements` (for example `Button` or `Field.Control`). Other custom components and computed attribute values are not analyzed.
8
19
 
9
20
  No findings is not proof of accessibility. Missing parsers or execution failures mean unavailable, never a pass. Reuse project build, typecheck and tests, browser interaction checks, and axe coverage for the requested page; this lint does not replace them.