division-ds 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 (97) hide show
  1. package/AGENTS.md +16 -2
  2. package/README.md +11 -0
  3. package/division-ds-0.2.0.tgz +0 -0
  4. package/package.json +2 -2
  5. package/public/docs/components/accordion.md +205 -0
  6. package/public/docs/components/ai-label.md +88 -0
  7. package/public/docs/components/alert-dialog.md +290 -0
  8. package/public/docs/components/alert.md +173 -0
  9. package/public/docs/components/approval-request.md +146 -0
  10. package/public/docs/components/auth-form.md +130 -0
  11. package/public/docs/components/avatar-group.md +150 -0
  12. package/public/docs/components/avatar.md +177 -0
  13. package/public/docs/components/badge.md +176 -0
  14. package/public/docs/components/breadcrumbs.md +110 -0
  15. package/public/docs/components/button.md +202 -0
  16. package/public/docs/components/card.md +255 -0
  17. package/public/docs/components/carousel.md +128 -0
  18. package/public/docs/components/cart.md +170 -0
  19. package/public/docs/components/chart-panel.md +356 -0
  20. package/public/docs/components/chat-message.md +154 -0
  21. package/public/docs/components/chat-thread.md +242 -0
  22. package/public/docs/components/checkbox.md +147 -0
  23. package/public/docs/components/checkout-form.md +126 -0
  24. package/public/docs/components/command-palette.md +145 -0
  25. package/public/docs/components/data-table.md +399 -0
  26. package/public/docs/components/description-list.md +101 -0
  27. package/public/docs/components/dialog.md +195 -0
  28. package/public/docs/components/divider.md +95 -0
  29. package/public/docs/components/dropdown-menu.md +220 -0
  30. package/public/docs/components/empty-state.md +143 -0
  31. package/public/docs/components/footer.md +395 -0
  32. package/public/docs/components/form-field.md +213 -0
  33. package/public/docs/components/icon-button.md +125 -0
  34. package/public/docs/components/input.md +198 -0
  35. package/public/docs/components/kanban-board.md +298 -0
  36. package/public/docs/components/kbd.md +70 -0
  37. package/public/docs/components/link.md +96 -0
  38. package/public/docs/components/list-item.md +238 -0
  39. package/public/docs/components/loading-animation.md +70 -0
  40. package/public/docs/components/multi-select.md +200 -0
  41. package/public/docs/components/navbar.md +142 -0
  42. package/public/docs/components/newsletter-form.md +110 -0
  43. package/public/docs/components/page-header.md +149 -0
  44. package/public/docs/components/pagination.md +210 -0
  45. package/public/docs/components/product-card.md +169 -0
  46. package/public/docs/components/progress.md +99 -0
  47. package/public/docs/components/prompt-input.md +149 -0
  48. package/public/docs/components/quantity-stepper.md +138 -0
  49. package/public/docs/components/radio.md +140 -0
  50. package/public/docs/components/rating.md +104 -0
  51. package/public/docs/components/score-ring.md +93 -0
  52. package/public/docs/components/search.md +114 -0
  53. package/public/docs/components/section-heading.md +111 -0
  54. package/public/docs/components/segmented-control.md +124 -0
  55. package/public/docs/components/select.md +222 -0
  56. package/public/docs/components/sheet.md +143 -0
  57. package/public/docs/components/sidebar.md +191 -0
  58. package/public/docs/components/skeleton.md +133 -0
  59. package/public/docs/components/slider.md +112 -0
  60. package/public/docs/components/sparkline.md +126 -0
  61. package/public/docs/components/spinner.md +96 -0
  62. package/public/docs/components/stat.md +104 -0
  63. package/public/docs/components/status-tracker.md +143 -0
  64. package/public/docs/components/stepper.md +145 -0
  65. package/public/docs/components/switch.md +151 -0
  66. package/public/docs/components/tabs.md +178 -0
  67. package/public/docs/components/tag.md +103 -0
  68. package/public/docs/components/textarea.md +146 -0
  69. package/public/docs/components/timeline.md +150 -0
  70. package/public/docs/components/toast.md +192 -0
  71. package/public/docs/components/tool-call.md +105 -0
  72. package/public/docs/components/tooltip.md +106 -0
  73. package/public/manifest/components.json +182 -6
  74. package/public/manifest/tokens.json +39 -0
  75. package/scripts/division-ds.mjs +74 -38
  76. package/scripts/lib/agent-docs.mjs +53 -1
  77. package/scripts/lib/ai-copy.mjs +106 -0
  78. package/scripts/lib/button-spacing.mjs +5 -5
  79. package/scripts/lib/check-text.mjs +44 -0
  80. package/scripts/lib/contrast.mjs +111 -0
  81. package/scripts/lib/host-inline.mjs +59 -0
  82. package/scripts/lib/mcp-server.mjs +115 -0
  83. package/scripts/lib/mcp-tools.mjs +241 -0
  84. package/scripts/lib/props-validator.mjs +1 -1
  85. package/scripts/lib/rules-installer.mjs +42 -4
  86. package/skills/division-ds/SKILL.md +90 -0
  87. package/skills/division-ds/commands/add.md +25 -0
  88. package/skills/division-ds/commands/build.md +46 -0
  89. package/skills/division-ds/commands/fix.md +28 -0
  90. package/skills/division-ds/commands/review.md +25 -0
  91. package/skills/division-ds/topics/ai.md +7 -0
  92. package/skills/division-ds/topics/colour.md +11 -0
  93. package/skills/division-ds/topics/feedback.md +9 -0
  94. package/skills/division-ds/topics/forms.md +19 -0
  95. package/skills/division-ds/topics/layout.md +34 -0
  96. package/skills/division-ds/topics/motion.md +10 -0
  97. package/skills/division-ds/topics/overlays.md +9 -0
@@ -0,0 +1,25 @@
1
+ # Division DS: review
2
+
3
+ > Load when a screen is written and you are about to say it is done. The checklist to run over it. Generated by `npm run agent-docs`; the procedure lives in scripts/lib/agent-docs.mjs.
4
+
5
+ Paths starting `public/` are in the Division DS repository. In a project that uses the components, read them online: `public/llms.txt` is `https://victor-ilioiu.vercel.app/systems/division-ds/llms.txt`, and so on.
6
+
7
+ Go through every line. A line that does not hold is a change to make, not a note to leave.
8
+
9
+ - [ ] **States.** Every region has its empty, loading, error, success and disabled or no-permission state, as planned in `commands/build.md`. An empty list says what is empty and offers the action that fills it.
10
+ - [ ] **Headings.** One `PageHeader`, so one `h1`. Section headings continue the outline: `h2` under the `h1`, `h3` inside an `h2`, no level skipped. `SectionHeading` is given the level.
11
+ - [ ] **Tokens only.** No hex, `rgb()`, palette class or invented token name. `division-ds check` passes.
12
+ - [ ] **Buttons.** Two or more side by side share a parent with a gap. One primary button per view. A busy button takes `loading`; a disabled one says why nearby. Icon-only actions are `IconButton` with a `label`.
13
+ - [ ] **Forms.** Every `Input`, `Textarea`, `Select`, `MultiSelect` and `QuantityStepper` is inside a `FormField`; `Switch`, `Checkbox` and `Radio` have an `id` and a `<label htmlFor>`. A failed submit shows `ErrorSummary` and focuses it.
14
+ - [ ] **Status.** Every status has a word, not only a colour.
15
+ - [ ] **Focus.** Everything interactive is reached by Tab in reading order and shows the focus ring; anything styled by hand has the `focus-visible:outline-*` classes. An overlay hands focus back to what opened it. A button that removes its own row or item (Acknowledge, Delete, Dismiss) moves focus to the next one, else the previous one, else the empty state; focus never drops to the page.
16
+ - [ ] **Text size.** Secondary text is 14px or larger; 11 to 12px only for uppercase mono labels.
17
+ - [ ] **320px.** At 320px wide nothing scrolls sideways (`document.documentElement.scrollWidth <= 320`) and button rows wrap.
18
+ - [ ] **Both themes.** It reads in dark and in light (`data-theme="light"` on `<html>`).
19
+ - [ ] **Motion.** Anything animated by hand stops under reduced motion; nothing moves on its own.
20
+ - [ ] **Live data.** Values that update on their own change in place, with no announcement for each number; a change of status (good to unhealthy) is announced once, through one polite live region (`role="status"`). Charts animate only their first draw, so new data every few seconds is fine.
21
+
22
+ ## Check
23
+
24
+ - In a project that uses the components: `npx division-ds check <files or dirs>` (the checker is on npm; Node 22 or newer). It flags a raw colour, an invented token, touching buttons, an unknown prop and a value outside a prop's union.
25
+ - In the Division DS repository itself: `npm run verify` (type-check, every gate, the unit tests).
@@ -0,0 +1,7 @@
1
+ # Division DS: assistant copy
2
+
3
+ > Load when wording a chat. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Assistant copy.** A button names the action ("Summarize"), never "AI". Say "response", not
6
+ "answer". No "please" or "!" in assistant labels. The interface says "Assistant"; only its own
7
+ messages say "I".
@@ -0,0 +1,11 @@
1
+ # Division DS: colour roles
2
+
3
+ > Load when choosing an accent, the text on a fill, or a status colour. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Fill, text, ink.** Each accent has three roles. `accent.<state>.fill` is a solid block;
6
+ `accent.<state>.ink` is the text on that block; `accent.<state>.text` is coloured text on a
7
+ normal surface. Never put `text.primary` on a fill.
8
+
9
+ **Status tones.** `ok` done or healthy; `warning` degraded or needs attention; `hostile` failed
10
+ or destructive; `info` in progress or neutral news; `signal` brand emphasis (a sale, the
11
+ selected thing); `neutral` inactive. Always with a word: colour alone is not a status.
@@ -0,0 +1,9 @@
1
+ # Division DS: feedback
2
+
3
+ > Load when a screen reports a result or a wait: a toast, an alert, progress, a spinner. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Feedback.** A `Toast` confirms something the person just did and then leaves, so it never holds
6
+ the only copy of anything; a message that must stay is an `Alert` in the page. A failed load is
7
+ an `Alert` in the `hostile` tone with a retry, not an `EmptyState`. Measurable work is
8
+ `Progress`; a short wait inside a control or a line of text is `Spinner`; a busy `Button` takes
9
+ `loading`.
@@ -0,0 +1,19 @@
1
+ # Division DS: forms and actions
2
+
3
+ > Load when a screen has a field, a form or more than one button. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Forms.** In a form, `Input`, `Textarea`, `Select`, `MultiSelect` and `QuantityStepper` go inside a `FormField`,
6
+ which supplies the label, help and error and keeps an `id` you pass to the control. The one
7
+ exception is a control repeated per row of a list (a role `Select` on each member): leave it
8
+ bare and name it through its own `label` prop ("Role for Ilse Varga"). `Switch`, `Checkbox` and
9
+ `Radio` are not `FormField` children: give them an `id` and a `<label htmlFor>`. A failed submit
10
+ renders `ErrorSummary` at the top and focuses it; `useFieldErrors` holds the state (signature in
11
+ `public/docs/helpers.md`).
12
+
13
+ **Buttons.** Two or more buttons side by side need a parent with a gap
14
+ (`flex flex-wrap gap-3`); `DialogFooter` and `CardFooter` already are one. A `Button` is
15
+ `type="button"` unless you say `type="submit"`. A busy button takes `loading`, not `disabled`.
16
+ `disabled` is for an action that is not available; say why in text nearby.
17
+
18
+ **Icon-only buttons** are `IconButton` with a required `label`. A `Tooltip` adds detail; it does
19
+ not replace the label.
@@ -0,0 +1,34 @@
1
+ # Division DS: layout and type
2
+
3
+ > Load when laying out a page: the shell, background, width, type sizes, cards, links. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Themes.** The theme is `data-theme="light"` or `"dark"` on `<html>` (`src/lib/theme.ts`); dark
6
+ is the default. Tokens switch on their own, so a screen built from tokens needs no theme logic.
7
+ The shell paints the page background (`surface.base`) and supplies the gutter; a screen sets its
8
+ own `max-w-*` and vertical spacing, and no page background. A form or an overlay is the
9
+ exception: it paints `surface.base` on itself, so its field colours never depend on what is
10
+ behind it. In a project that uses the components, your own root does this
11
+ (step 4 of `install.md`).
12
+
13
+ **Type.** Three families, as utilities: `font-display` (headings, figures), `font-body` (the
14
+ default, set by the shell), `font-mono` (labels, code, tabular numbers). A page title is
15
+ `<h1 className="font-display font-semibold text-2xl">`; body is `text-base` or `text-sm`; a label
16
+ is `font-mono text-xs font-semibold uppercase tracking-[0.18em]`. Tailwind's own size, weight
17
+ and spacing utilities are fine; only colour is restricted to tokens.
18
+
19
+ **Text size.** Secondary text is 14px or larger. 11 to 12px is for uppercase mono labels only.
20
+
21
+ **Cards.** To highlight or select a `Card`, set the border inline with a token:
22
+ `style={{ border: '2px solid var(--color-accent-signal-fill)' }}`. A border utility class does
23
+ not win against the panel's own border. `interactive` is only for a card that holds one link or
24
+ button; give that link `className={cardLinkClass}` (from `Card`) to stretch it over the card.
25
+
26
+ **Links.** Components that render links take `renderLink`, defaulting to a plain `<a>`. Under a
27
+ router, pass an adapter: `({ href, ...rest }) => <Link to={href} {...rest} />`. No component
28
+ imports a router.
29
+
30
+ **Charts and bundle size.** `ChartPanel` and `Sparkline` bring in recharts, a few hundred kB.
31
+ Load the route or screen that uses them with `React.lazy` and a `<Suspense>` fallback, so recharts
32
+ lands in its own chunk and screens without a chart never download it. Without that, Vite warns
33
+ about a chunk over 500 kB; the warning is about load time only, and the build is fine. On a
34
+ live page, data may change as often as you like: a chart animates its first draw only.
@@ -0,0 +1,10 @@
1
+ # Division DS: motion
2
+
3
+ > Load when animating anything yourself. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Motion.** The components animate themselves, and the shell animates a route change. A screen
6
+ adds no keyframes of its own: use the classes in `src/styles/motion.css` (`anim-snap-in` for an
7
+ element arriving, `anim-draw-on` for a hairline) and the motion tokens (`--duration-fast` for
8
+ hover, `--duration-base` by default, `--duration-slow` for a larger change, `--ease-snap`).
9
+ Anything you animate yourself stops under `prefers-reduced-motion` (`motion-reduce:` in
10
+ Tailwind), and nothing moves on its own: no autoplay.
@@ -0,0 +1,9 @@
1
+ # Division DS: overlays
2
+
3
+ > Load when adding a Dialog, an AlertDialog or a Sheet. Generated from AGENTS.md by `npm run agent-docs`. Edit the rules there, not here.
4
+
5
+ **Overlays.** A task on top of the page is a `Dialog`; a destructive confirm is `AlertDialog`,
6
+ not `Dialog`; filters, navigation on a narrow screen or one item's detail beside a list is a
7
+ `Sheet`. Never open a dialog from a dialog or a sheet from a sheet. Never open one from a
8
+ `DropdownMenu` item: the item is gone by the time the overlay closes, so focus has nowhere to go.
9
+ Put a dialog's actions in `DialogFooter`.