@muibook/components 20.0.0 → 20.1.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 (153) hide show
  1. package/AGENTS.md +67 -0
  2. package/DESIGN.md +358 -0
  3. package/README.md +52 -1
  4. package/dist/esm/agent/keywords/index.js +2 -204
  5. package/dist/esm/agent/prompts/index.js +6 -434
  6. package/dist/esm/components/mui-accordion/core/index.js +25 -17
  7. package/dist/esm/components/mui-avatar/index.js +99 -42
  8. package/dist/esm/components/mui-avatar-chip/index.js +158 -0
  9. package/dist/esm/components/mui-avatar-group/index.js +88 -0
  10. package/dist/esm/components/mui-badge/index.js +2 -2
  11. package/dist/esm/components/mui-body/index.js +20 -11
  12. package/dist/esm/components/mui-button/index.js +117 -65
  13. package/dist/esm/components/mui-calendar/index.js +199 -0
  14. package/dist/esm/components/mui-card/body/index.js +32 -17
  15. package/dist/esm/components/mui-card/footer/index.js +11 -9
  16. package/dist/esm/components/mui-carousel/controller/index.js +1 -1
  17. package/dist/esm/components/mui-checkbox/index.js +23 -18
  18. package/dist/esm/components/mui-chip/index.js +184 -68
  19. package/dist/esm/components/mui-chip-input/index.js +146 -137
  20. package/dist/esm/components/mui-chip-rail/index.js +154 -51
  21. package/dist/esm/components/mui-code/index.js +27 -8
  22. package/dist/esm/components/mui-container/index.js +68 -45
  23. package/dist/esm/components/mui-date-picker/index.js +169 -0
  24. package/dist/esm/components/mui-drawer/index.js +968 -100
  25. package/dist/esm/components/mui-dropdown/index.js +250 -63
  26. package/dist/esm/components/mui-field/index.js +1 -1
  27. package/dist/esm/components/mui-file-upload/index.js +13 -4
  28. package/dist/esm/components/mui-form-group/index.js +1 -2
  29. package/dist/esm/components/mui-form-message/index.js +4 -9
  30. package/dist/esm/components/mui-hint/index.js +178 -72
  31. package/dist/esm/components/mui-icons/copy/index.js +54 -0
  32. package/dist/esm/components/mui-icons/fullscreen/index.js +5 -0
  33. package/dist/esm/components/mui-icons/icon-helper/index.js +56 -0
  34. package/dist/esm/components/mui-icons/index.js +14 -1
  35. package/dist/esm/components/mui-icons/moon/index.js +3 -1
  36. package/dist/esm/components/mui-icons/{rectangle-bottom-panel → panel}/index.js +6 -6
  37. package/dist/esm/components/mui-icons/pause/index.js +5 -0
  38. package/dist/esm/components/mui-icons/picture-in-picture/index.js +5 -0
  39. package/dist/esm/components/mui-icons/play-fill/index.js +5 -0
  40. package/dist/esm/components/mui-icons/rectangle-right-drawer/index.js +56 -0
  41. package/dist/esm/components/mui-icons/reload/index.js +5 -0
  42. package/dist/esm/components/mui-icons/speaker-mute/index.js +5 -0
  43. package/dist/esm/components/mui-icons/speaker-one-wave/index.js +5 -0
  44. package/dist/esm/components/mui-icons/speaker-two-wave/index.js +5 -0
  45. package/dist/esm/components/mui-icons/spinner/index.js +7 -5
  46. package/dist/esm/components/mui-icons/stop-fill/index.js +5 -0
  47. package/dist/esm/components/mui-icons/sun/index.js +5 -5
  48. package/dist/esm/components/mui-icons/timer/index.js +54 -0
  49. package/dist/esm/components/mui-icons/toggle/index.js +16 -6
  50. package/dist/esm/components/mui-icons/vertical-ellipsis/index.js +5 -0
  51. package/dist/esm/components/mui-illustrations/trash/index.js +6 -5
  52. package/dist/esm/components/mui-input/index.js +87 -62
  53. package/dist/esm/components/mui-link/index.js +195 -83
  54. package/dist/esm/components/mui-media-player/index.js +1577 -83
  55. package/dist/esm/components/mui-model-viewer/index.js +258 -0
  56. package/dist/esm/components/mui-progress-ring/index.js +349 -0
  57. package/dist/esm/components/mui-prompt/index.js +99 -71
  58. package/dist/esm/components/mui-prompt-preview/index.js +11 -23
  59. package/dist/esm/components/mui-radio/index.js +38 -17
  60. package/dist/esm/components/mui-range-input/index.js +9 -4
  61. package/dist/esm/components/mui-responsive/index.js +60 -27
  62. package/dist/esm/components/mui-search-input/index.js +300 -0
  63. package/dist/esm/components/mui-select/index.js +231 -42
  64. package/dist/esm/components/mui-slat/slat/index.js +40 -12
  65. package/dist/esm/components/mui-spinner/index.js +11 -9
  66. package/dist/esm/components/mui-switch/index.js +23 -20
  67. package/dist/esm/components/mui-table/row/index.js +2 -6
  68. package/dist/esm/components/mui-table/table/index.js +157 -14
  69. package/dist/esm/components/mui-textarea/index.js +43 -26
  70. package/dist/esm/components/mui-time/index/index.js +336 -0
  71. package/dist/esm/components/mui-time-picker/index.js +126 -0
  72. package/dist/esm/components/mui-video-thumbnail/index.js +5 -5
  73. package/dist/esm/css/mui-brand.css +12 -8
  74. package/dist/esm/css/mui-tokens.css +417 -305
  75. package/dist/esm/css/readme.md +2 -2
  76. package/dist/esm/custom-elements.json +3678 -1553
  77. package/dist/esm/dynamic-attrs.json +263 -66
  78. package/dist/esm/index.js +30 -6
  79. package/dist/esm/knowledge/compositions/index.js +1560 -0
  80. package/dist/esm/knowledge/index.js +28 -0
  81. package/dist/esm/knowledge/keywords/index.js +306 -0
  82. package/dist/esm/knowledge/rules/index.js +199 -0
  83. package/dist/esm/tokens/js/index.js +143 -139
  84. package/dist/types/agent/keywords/index.d.ts +1 -1
  85. package/dist/types/components/mui-avatar-chip/api.d.ts +28 -0
  86. package/dist/types/components/mui-avatar-chip/index.d.ts +18 -0
  87. package/dist/types/components/mui-avatar-group/api.d.ts +28 -0
  88. package/dist/types/components/mui-avatar-group/doc.d.ts +2 -0
  89. package/dist/types/components/mui-avatar-group/index.d.ts +1 -0
  90. package/dist/types/components/mui-button/api.d.ts +2 -2
  91. package/dist/types/components/mui-calendar/api.d.ts +41 -0
  92. package/dist/types/components/mui-calendar/doc.d.ts +2 -0
  93. package/dist/types/components/mui-calendar/index.d.ts +3 -0
  94. package/dist/types/components/mui-checkbox/api.d.ts +4 -0
  95. package/dist/types/components/mui-chip-input/api.d.ts +4 -0
  96. package/dist/types/components/mui-chip-rail/index.d.ts +1 -0
  97. package/dist/types/components/mui-date-picker/api.d.ts +38 -0
  98. package/dist/types/components/mui-date-picker/doc.d.ts +2 -0
  99. package/dist/types/components/mui-date-picker/index.d.ts +6 -0
  100. package/dist/types/components/mui-drawer/api.d.ts +4 -0
  101. package/dist/types/components/mui-drawer/index.d.ts +2 -0
  102. package/dist/types/components/mui-file-upload/api.d.ts +4 -0
  103. package/dist/types/components/mui-icons/fullscreen.d.ts +1 -0
  104. package/dist/types/components/mui-icons/icon-helper.d.ts +1 -0
  105. package/dist/types/components/mui-icons/index.d.ts +14 -1
  106. package/dist/types/components/mui-icons/panel.d.ts +1 -0
  107. package/dist/types/components/mui-icons/pause.d.ts +1 -0
  108. package/dist/types/components/mui-icons/picture-in-picture.d.ts +1 -0
  109. package/dist/types/components/mui-icons/play-fill.d.ts +1 -0
  110. package/dist/types/components/mui-icons/rectangle-right-drawer.d.ts +1 -0
  111. package/dist/types/components/mui-icons/reload.d.ts +1 -0
  112. package/dist/types/components/mui-icons/speaker-mute.d.ts +1 -0
  113. package/dist/types/components/mui-icons/speaker-one-wave.d.ts +1 -0
  114. package/dist/types/components/mui-icons/speaker-two-wave.d.ts +1 -0
  115. package/dist/types/components/mui-icons/stop-fill.d.ts +1 -0
  116. package/dist/types/components/mui-icons/timer.d.ts +1 -0
  117. package/dist/types/components/mui-icons/vertical-ellipsis.d.ts +1 -0
  118. package/dist/types/components/mui-input/api.d.ts +12 -0
  119. package/dist/types/components/mui-media-player/api.d.ts +4 -0
  120. package/dist/types/components/mui-media-player/index.d.ts +13 -4
  121. package/dist/types/components/mui-model-viewer/api.d.ts +28 -0
  122. package/dist/types/components/mui-model-viewer/doc.d.ts +2 -0
  123. package/dist/types/components/mui-model-viewer/index.d.ts +17 -0
  124. package/dist/types/components/mui-progress-ring/api.d.ts +24 -0
  125. package/dist/types/components/mui-progress-ring/doc.d.ts +2 -0
  126. package/dist/types/components/mui-progress-ring/index.d.ts +1 -0
  127. package/dist/types/components/mui-radio/api.d.ts +12 -0
  128. package/dist/types/components/mui-range-input/api.d.ts +4 -0
  129. package/dist/types/components/mui-responsive/api.d.ts +10 -2
  130. package/dist/types/components/mui-search-input/api.d.ts +40 -0
  131. package/dist/types/components/mui-search-input/doc.d.ts +2 -0
  132. package/dist/types/components/mui-search-input/index.d.ts +3 -0
  133. package/dist/types/components/mui-select/api.d.ts +12 -0
  134. package/dist/types/components/mui-switch/api.d.ts +4 -0
  135. package/dist/types/components/mui-table/api.d.ts +15 -0
  136. package/dist/types/components/mui-textarea/api.d.ts +12 -0
  137. package/dist/types/components/mui-time/api.d.ts +41 -0
  138. package/dist/types/components/mui-time/doc.d.ts +2 -0
  139. package/dist/types/components/mui-time/index.d.ts +1 -0
  140. package/dist/types/components/mui-time-picker/api.d.ts +38 -0
  141. package/dist/types/components/mui-time-picker/doc.d.ts +2 -0
  142. package/dist/types/components/mui-time-picker/index.d.ts +4 -0
  143. package/dist/types/index.d.ts +24 -2
  144. package/dist/types/knowledge/compositions.d.ts +4644 -0
  145. package/dist/types/knowledge/index.d.ts +4657 -0
  146. package/dist/types/knowledge/keywords.d.ts +4 -0
  147. package/dist/types/knowledge/rules.d.ts +1 -0
  148. package/dist/types/tokens/js/index.d.ts +11 -7
  149. package/package.json +119 -12
  150. package/dist/esm/components/mui-form-hint/index.js +0 -1
  151. package/dist/types/components/mui-form-hint/index.d.ts +0 -1
  152. /package/dist/types/components/{mui-form-hint → mui-avatar-chip}/doc.d.ts +0 -0
  153. /package/dist/types/components/mui-icons/{rectangle-bottom-panel.d.ts → copy.d.ts} +0 -0
package/AGENTS.md ADDED
@@ -0,0 +1,67 @@
1
+ # AGENTS.md — Muibook (@muibook/components)
2
+
3
+ This repo builds the Muibook component library: framework-agnostic, accessible Web Components for the Mui (MichaelUI) Design System, plus supporting docs/builds.
4
+
5
+ ## MCP Usage
6
+
7
+ - When working in this repo and the Muibook MCP is available, call its `start_here` tool before answering questions or doing work about Muibook components, markup, styling, wrappers, dynamic attrs, knowledge, skills, or component documentation.
8
+
9
+ ## Quick Context
10
+
11
+ - Package: `@muibook/components`
12
+ - Components live in `src/components/*`
13
+ - Central exports: `src/index.ts`
14
+ - Demo site: `src/muibook/index.ts`
15
+ - Build outputs: `dist/` (published)
16
+ - Generated component metadata: `public/custom-elements.json`
17
+ - Runtime/destination attrs: `public/dynamic-attrs.json`
18
+ - Authored knowledge: `src/knowledge/*`
19
+ - Knowledge export target: sibling repo `../muibook-knowledge`
20
+
21
+ ## Common Commands
22
+
23
+ - `npm run dev` — Vite dev server
24
+ - `npm run build` — production build
25
+ - `npm run build:muibook` — docs build
26
+ - `npm run preview:muibook` — preview docs build
27
+ - `npm run build:create-mui-app` — scaffold build
28
+ - `npm run preview:create-mui-app` — preview scaffold build
29
+ - `npm run token-build` — Style Dictionary tokens
30
+ - `npm run cem` — generate `public/custom-elements.json`
31
+ - `npm run copy-knowledge` — copy CEM, dynamic attrs, root docs, and `src/knowledge/*` into `../muibook-knowledge`
32
+
33
+ ## Adding A New Component
34
+
35
+ 1. Add entry to `vite.config.ts` so it’s bundled.
36
+ 2. Add export to `package.json` `exports` (and `files` if used).
37
+ 3. Export from `src/index.ts`.
38
+ 4. If needed for demos, import into `src/muibook/index.ts`.
39
+
40
+ ## Slot Styling Pattern
41
+
42
+ When a component uses slots:
43
+
44
+ - Child: add class `[parent-component]-slot` to slotted element.
45
+ - Slotted child styles itself with `:host(.parent-component-slot)` (or matching class).
46
+ - Parent: if it needs to react to a slotted child, add `has-[slottedName]` to host.
47
+ - Parent styles with `:host([has-slottedName])`.
48
+
49
+ ## Notes For Agents
50
+
51
+ - If the user states something is wrong, give a short sense check before editing. If they explicitly ask for a fix, proceed after that short acknowledgement.
52
+ - Prefer touching source under `src/`; `dist/` is generated.
53
+ - Keep changes small and aligned with existing component patterns.
54
+ - If unsure about behavior, search for sibling components in `src/components/` for examples.
55
+ - When using `mui-code` inside body copy or list text, add the `inline` attr; otherwise it renders as a block code surface.
56
+ - Keep `AGENTS.md` and `DESIGN.md` at the repo root. They are copied to the knowledge repo for agent/plugin context.
57
+ - Keep `src/knowledge` for authored knowledge sources: global rules, keyword mappings, composition examples, skill files, and MCP/front-door docs.
58
+ - Component API and UX guidance should live in component `api.ts` and `doc.ts` files so the CEM stays current.
59
+ - Story props panels are often defined locally in the Muibook story page via `propItems` arrays. Do not add or reshape component `doc.ts` files just to populate a props panel unless the user explicitly wants that information added to the docs/CEM layer too.
60
+ - Treat `dynamic-attrs.json` as a separate concern from story props. It documents destination/runtime structural attrs (often destination-only) for builder/runtime integration and should not be merged conceptually with the story `propItems` API surface.
61
+ - When documenting dynamic attrs, prefer destination-only output: list where the attrs appear, not where they originate, unless the user explicitly asks for the source relationship.
62
+ - Avoid persisting internal runtime state as public attributes (for example `multi-line`, `has-*`, or similar UI state flags).
63
+ - Prefer CSS-first layout behavior over JS-driven state attrs when a stable visual result can be achieved without runtime attribute toggling.
64
+ - Exported/component-consumed HTML should only include public API attrs; strip internal runtime attrs in export paths.
65
+ - Do not add token escape hatches by default. Use existing semantic or component tokens unless there is a clear public customization need.
66
+ - Do not add semantic, theme, or component tokens to the brand token JSON/source. Brand tokens are primitives only. Put semantic aliases, theme mappings, and component-level decisions in the semantic/theme/component token layer instead.
67
+ - Do not add generated files by hand unless the build or copy script intentionally owns that output.
package/DESIGN.md ADDED
@@ -0,0 +1,358 @@
1
+ # Muibook Design
2
+
3
+ Mui is a token-led, theme-aware interface system. This portable guide contains the foundations, semantic decisions, and component mappings needed to create a recognizably Mui experience without access to other files.
4
+
5
+ ## Design Direction
6
+
7
+ - Neutral, practical, and content-led.
8
+ - Dense and scannable, with strong type hierarchy and stable spacing.
9
+ - Depth comes from surface tone, borders, spacing, and restrained shadow.
10
+ - Saturated colour is reserved for focus, feedback, categorical distinction, and urgent actions.
11
+ - Light and dark themes preserve the same meaning and hierarchy; dark mode is not a simple inversion.
12
+ - Controls use direct labels, familiar behavior, and explicit interaction states.
13
+
14
+ ## 1. Base Foundations
15
+
16
+ Base tokens are raw values without usage meaning. Semantic and component layers select from these foundations.
17
+
18
+ ### Colour
19
+
20
+ Mui uses OKLCH for perceptually consistent ramps. Lower-numbered steps are lighter; higher-numbered steps are darker.
21
+
22
+ | Token | Value |
23
+ | --- | --- |
24
+ | `--black` | `#000000` |
25
+ | `--white` | `#ffffff` |
26
+
27
+ Black alpha tokens use suffixes 0, 5, 10, 20…100. White alpha tokens use 0, 10, 20…100. The suffix is the opacity percentage.
28
+
29
+ #### Grey
30
+
31
+ | Token | Value |
32
+ | --- | --- |
33
+ | `--grey-50` | `oklch(97.015% 0.00011 271.152)` |
34
+ | `--grey-100` | `oklch(94.047% 0.00009 271.152)` |
35
+ | `--grey-200` | `oklch(92.191% 0.0001 271.152)` |
36
+ | `--grey-300` | `oklch(84.522% 0.0001 271.152)` |
37
+ | `--grey-400` | `oklch(73.802% 0.00008 271.152)` |
38
+ | `--grey-500` | `oklch(62.675% 0.00007 271.152)` |
39
+ | `--grey-600` | `oklch(51.028% 0.00006 271.152)` |
40
+ | `--grey-700` | `oklch(44.953% 0.00005 271.152)` |
41
+ | `--grey-800` | `oklch(38.666% 0.00004 271.152)` |
42
+ | `--grey-900` | `oklch(32.109% 0.00004 271.152)` |
43
+ | `--grey-1000` | `oklch(28.5% 0.00003 271.152)` |
44
+ | `--grey-1100` | `oklch(25.197% 0.00003 271.152)` |
45
+ | `--grey-1200` | `oklch(21.4% 0.00002 271.152)` |
46
+ | `--grey-1300` | `oklch(17.764% 0.00002 271.152)` |
47
+ | `--grey-1400` | `oklch(11.492% 0.00001 271.152)` |
48
+
49
+ #### Feedback ramps
50
+
51
+ Each cell maps to `--{colour}-{step}`.
52
+
53
+ | Step | Red | Orange | Green | Blue |
54
+ | --- | --- | --- | --- | --- |
55
+ | 100 | `oklch(98% 0.03 25.0)` | `oklch(98% 0.03 71)` | `oklch(96.2% 0.034 145)` | `oklch(95.6% 0.022 250)` |
56
+ | 200 | `oklch(95% 0.10 25.0)` | `oklch(94% 0.07 71)` | `oklch(92% 0.075 145)` | `oklch(91% 0.045 250)` |
57
+ | 300 | `oklch(82% 0.14 25.0)` | `oklch(90% 0.11 71)` | `oklch(88% 0.120 145)` | `oklch(82% 0.091 250)` |
58
+ | 400 | `oklch(72% 0.17 25.0)` | `oklch(85% 0.14 71)` | `oklch(84.5% 0.160 145)` | `oklch(78.8% 0.105 250)` |
59
+ | 500 | `oklch(62% 0.19 25.0)` | `oklch(78% 0.16 71)` | `oklch(70% 0.220 145)` | `oklch(73% 0.130 245)` |
60
+ | 600 | `oklch(52% 0.19 25.0)` | `oklch(70% 0.16 71)` | `oklch(63% 0.200 145)` | `oklch(67% 0.150 249)` |
61
+ | 700 | `oklch(46% 0.19 25.0)` | `oklch(64% 0.16 71)` | `oklch(57% 0.180 145)` | `oklch(63% 0.155 249)` |
62
+ | 800 | `oklch(40% 0.19 25.0)` | `oklch(57% 0.16 71)` | `oklch(52% 0.160 145)` | `oklch(57% 0.167 251)` |
63
+ | 900 | `oklch(34% 0.19 25.0)` | `oklch(51% 0.16 71)` | `oklch(46% 0.140 145)` | `oklch(52% 0.178 253)` |
64
+ | 1000 | `oklch(28% 0.19 25.0)` | `oklch(45% 0.16 71)` | `oklch(42% 0.120 145)` | `oklch(48% 0.151 253)` |
65
+
66
+ #### Categorical colours
67
+
68
+ Categorical colours distinguish peers without implying success, warning, or error. Each hue provides `--categorical-{hue}-200`, `--categorical-{hue}-800`, and the theme-aware alias `--categorical-{hue}`. For example, `--categorical-purple` resolves to `--categorical-purple-200` in light mode and `--categorical-purple-800` in dark mode.
69
+
70
+ | Hue | Light foundation (`200`) | Dark foundation (`800`) |
71
+ | --- | --- | --- |
72
+ | Purple | `oklch(69.998% 0.12881 306.598)` | `oklch(39.825% 0.15525 302.768)` |
73
+ | Violet | `oklch(68.7% 0.11278 294.579)` | `oklch(37.751% 0.1414 289.195)` |
74
+ | Pink | `oklch(75% 0.12171 349.037)` | `oklch(49.567% 0.17587 355.522)` |
75
+ | Magenta | `oklch(73.607% 0.1553 324.203)` | `oklch(46.026% 0.18151 324.267)` |
76
+ | Red | `oklch(69.219% 0.13185 21.008)` | `oklch(43.588% 0.15193 26.224)` |
77
+ | Orange | `oklch(78.978% 0.10803 55.747)` | `oklch(51.737% 0.12922 49.443)` |
78
+ | Amber | `oklch(88.238% 0.11573 91.663)` | `oklch(65.465% 0.13065 86.837)` |
79
+ | Yellow | `oklch(92.328% 0.116 104.198)` | `oklch(72.736% 0.14925 103.38)` |
80
+ | Lime | `oklch(84.773% 0.11998 130.068)` | `oklch(57.802% 0.13829 132.375)` |
81
+ | Green | `oklch(82.146% 0.10519 154.481)` | `oklch(55.196% 0.1248 150.768)` |
82
+ | Teal | `oklch(83.949% 0.08537 182.617)` | `oklch(57.358% 0.092 179.632)` |
83
+ | Cyan | `oklch(81.649% 0.07802 211.528)` | `oklch(54.656% 0.08505 214.39)` |
84
+ | Blue | `oklch(74.949% 0.09578 248.783)` | `oklch(45.925% 0.11981 252.499)` |
85
+ | Indigo | `oklch(69.039% 0.10593 274.775)` | `oklch(38.197% 0.13614 269.807)` |
86
+
87
+ ### Typography
88
+
89
+ Family: `system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"`. The root font size is 62.5%, so 1rem is approximately 10px.
90
+
91
+ | Token | Value | Approx px |
92
+ | --- | --- | --- |
93
+ | `--font-size-15` | `1.1rem` | 11px |
94
+ | `--font-size-25` | `1.2rem` | 12px |
95
+ | `--font-size-50` | `1.4rem` | 14px |
96
+ | `--font-size-100` | `1.6rem` | 16px |
97
+ | `--font-size-200` | `1.8rem` | 18px |
98
+ | `--font-size-300` | `2.1rem` | 21px |
99
+ | `--font-size-400` | `2.4rem` | 24px |
100
+ | `--font-size-500` | `3.6rem` | 36px |
101
+ | `--font-size-600` | `4.8rem` | 48px |
102
+ | `--font-size-700` | `6rem` | 60px |
103
+ | `--font-size-800` | `7.2rem` | 72px |
104
+ | `--font-size-900` | `8.4rem` | 84px |
105
+ | `--font-size-1000` | `9.6rem` | 96px |
106
+
107
+ | Token | Value | Use |
108
+ | --- | --- | --- |
109
+ | `--font-weight-400` | 400 | Regular body copy |
110
+ | `--font-weight-500` | 500 | Actions and medium emphasis |
111
+ | `--font-weight-600` | 600 | Strong labels |
112
+ | `--font-weight-700` | 700 | Headings and high emphasis |
113
+
114
+ Line-height tokens pair with the corresponding font-size step: `--line-height-15` `1.63636364`, `--line-height-25` `1.5`, `--line-height-50` `1.5`, `--line-height-100` `1.5`, `--line-height-200` `1.33333333`, `--line-height-225` `1.66666667`, `--line-height-300` `1.14285714`, `--line-height-400` `1.5`, `--line-height-500` `1.33333333`, `--line-height-600` `1.25`, `--line-height-700` `1.2`, `--line-height-800` `1.16666667`, `--line-height-900` `1.14285714`, `--line-height-1000` `1.125`.
115
+
116
+ ### Spacing
117
+
118
+ | Token | Value | Approx px |
119
+ | --- | --- | --- |
120
+ | `--space-000` | `0` | 0px |
121
+ | `--space-025` | `0.2rem` | 2px |
122
+ | `--space-050` | `0.4rem` | 4px |
123
+ | `--space-100` | `0.6rem` | 6px |
124
+ | `--space-200` | `0.8rem` | 8px |
125
+ | `--space-300` | `1.2rem` | 12px |
126
+ | `--space-400` | `1.6rem` | 16px |
127
+ | `--space-500` | `2.4rem` | 24px |
128
+ | `--space-600` | `3.6rem` | 36px |
129
+ | `--space-700` | `4.8rem` | 48px |
130
+ | `--space-800` | `6rem` | 60px |
131
+
132
+ Use the nearest established step; do not invent intermediate spacing values.
133
+
134
+ ### Radius And Stroke
135
+
136
+ | Radius token | Value |
137
+ | --- | --- |
138
+ | `--radius-000` | `0` |
139
+ | `--radius-100` | `4px` |
140
+ | `--radius-150` | `6px` |
141
+ | `--radius-200` | `8px` |
142
+ | `--radius-300` | `16px` |
143
+ | `--radius-400` | `24px` |
144
+ | `--radius-500` | `36px` |
145
+ | `--radius-600` | `48px` |
146
+
147
+ | Stroke token | Value |
148
+ | --- | --- |
149
+ | `--stroke-size-050` | `0.5px` |
150
+ | `--stroke-size-100` | `1px` |
151
+ | `--stroke-size-200` | `2px` |
152
+ | `--stroke-size-300` | `3px` |
153
+ | `--stroke-size-400` | `4px` |
154
+ | `--stroke-size-500` | `5px` |
155
+
156
+ ### Motion
157
+
158
+ | Token | Duration | Use |
159
+ | --- | --- | --- |
160
+ | `--speed-100` | 100ms | Press, colour, and opacity response |
161
+ | `--speed-200` | 200ms | Default hover, focus, and small state change |
162
+ | `--speed-300` | 300ms | Disclosure and panel transition |
163
+ | `--speed-400` | 400ms | Larger entrance or exit |
164
+
165
+ Motion is short and purposeful. Prefer opacity, colour, and transform; respect reduced-motion preferences.
166
+
167
+ ## 2. Semantic Tokens
168
+
169
+ Semantic tokens assign meaning and resolve raw foundations differently in light and dark themes.
170
+
171
+ ### Text
172
+
173
+ | Semantic token | Light | Dark | Use |
174
+ | --- | --- | --- | --- |
175
+ | `--text-color` | `--grey-900` | `--grey-200` | Body, label, and UI text |
176
+ | `--heading-text-color` | `--grey-1000` | `--grey-50` | Headings |
177
+ | `--text-color-optional` | `--grey-500` | `--grey-400` | Secondary and optional text |
178
+ | `--text-color-info` | `--blue-600` | `--blue-400` | Information |
179
+ | `--text-color-success` | `--green-600` | `--green-400` | Positive confirmation |
180
+ | `--text-color-warning` | `--orange-600` | `--orange-400` | Warning |
181
+ | `--text-color-error` | `--red-600` | `--red-400` | Error and urgent attention |
182
+
183
+ Body colour variants change meaning, not size or weight.
184
+
185
+ ### Surface
186
+
187
+ | Semantic token | Light | Dark | Use |
188
+ | --- | --- | --- | --- |
189
+ | `--surface` | `--grey-200` | `--grey-1100` | Base page |
190
+ | `--surface-elevated-100` | `--white` | `--grey-800` | Highest elevation |
191
+ | `--surface-elevated-200` | `--grey-50` | `--grey-900` | Secondary elevation |
192
+ | `--surface-elevated-300` | `--grey-200` | `--grey-1000` | Low-contrast elevation |
193
+ | `--surface-recessed-100` | `--grey-300` | `--grey-1200` | Subtle recess |
194
+ | `--surface-recessed-200` | `--grey-400` | `--grey-1300` | Deeper recess |
195
+ | `--surface-recessed-300` | `--grey-500` | `--grey-1400` | Deepest recess |
196
+ | `--backdrop-overlay` | `--black-opacity-70` | `--black-opacity-70` | Modal and drawer scrim |
197
+
198
+ ### Border, Focus, And Shadow
199
+
200
+ | Token | Construction | Use |
201
+ | --- | --- | --- |
202
+ | `--border-color` | black 20% / white 20% | Theme-aware separation |
203
+ | `--outline-color` | `--blue-500` / `--blue-300` | Focus-visible signal |
204
+ | `--border-thin` | 1px solid border colour | Default separation |
205
+ | `--border-thick` | 2px solid border colour | Strong separation |
206
+ | `--outline-medium` | 3px outset outline colour | Default prominent focus |
207
+ | `--shadow-thin` | 0 4px 6px | Small lift |
208
+ | `--shadow-medium` | 0 6px 8px | Cards and floating panels |
209
+ | `--shadow-thick` | 0 24px 48px | Dialogs and major overlays |
210
+
211
+ Prefer surface contrast and borders before shadow.
212
+
213
+ ### Feedback
214
+
215
+ The value order below is background / border / text.
216
+
217
+ | Intent | Light | Dark |
218
+ | --- | --- | --- |
219
+ | Neutral (`--feedback-neutral-*`) | white / black 20% / grey 900 | grey 800 / white 20% / grey 100 |
220
+ | Positive (`--feedback-positive-*`) | green 100 / 600 / 900 | green 800 / 400 / 100 |
221
+ | Info (`--feedback-info-*`) | blue 100 / 600 / 900 | blue 800 / 400 / 100 |
222
+ | Warning (`--feedback-warning-*`) | orange 100 / 600 / 900 | orange 800 / 400 / 100 |
223
+ | Attention (`--feedback-attention-*`) | red 100 / 600 / 900 | red 800 / 400 / 100 |
224
+
225
+ Icons use step 600 in light mode and 200 in dark mode; neutral uses grey 600/200.
226
+
227
+ ### Action
228
+
229
+ | Variant | Light | Dark | Use |
230
+ | --- | --- | --- | --- |
231
+ | Primary (`--action-primary-*`) | grey 900 background, white text | grey 200 background, grey 900 text | Main action |
232
+ | Secondary (`--action-secondary-*`) | transparent, grey 800 border, grey 900 text | transparent, grey 200 border, grey 100 text | Alternate action |
233
+ | Tertiary (`--action-tertiary-*`) | transparent, grey 900 text | transparent, grey 100 text | Low emphasis |
234
+ | Overlay (`--action-overlay-*`) | black 60% background, white text | same fixed overlay | Controls over media |
235
+ | Attention (`--action-attention-*`) | red 500 background, white text | red 600 background, white text | Destructive or urgent action |
236
+
237
+ ### Form
238
+
239
+ Inputs, textareas, selects, prompts, checkboxes, and radios share `--form-default-*`, `--form-success-*`, `--form-warning-*`, and `--form-error-*` text and border roles. Every control needs default, hover, focus-visible, disabled, and validation states.
240
+
241
+ ## 3. Component Tokens And Mappings
242
+
243
+ Components consume semantic systems or apply component-specific mappings:
244
+
245
+ `base value → semantic intent → component token → rendered state`
246
+
247
+ ### Typography Components
248
+
249
+ | Component role | Token mapping | Result |
250
+ | --- | --- | --- |
251
+ | Body xx-small | `--text-font-size-xxs` → 11px / 1.5 | Dense supporting text |
252
+ | Body x-small | `--text-font-size-xs` → 12px / 1.5 | Small supporting text |
253
+ | Body small | `--text-font-size-s` → 14px / 1.5 | Compact body |
254
+ | Body medium | `--text-font-size-m` → 16px / 1.5 | Default body |
255
+ | Body large | `--text-font-size-l` → 18px / 1.667 | Large body |
256
+ | H1 | `--heading-font-size-100` → 48px / 1.25 | Major page title |
257
+ | H2 | `--heading-font-size-200` → 36px / 1.333 | Page title |
258
+ | H3 | `--heading-font-size-300` → 24px / 1.5 | Section title |
259
+ | H4 | `--heading-font-size-400` → 21px / 1.143 | Subsection |
260
+ | H5 | `--heading-font-size-500` → 18px / 1.333 | Component heading |
261
+ | H6 | `--heading-font-size-600` → 16px / 1.5 | Compact heading |
262
+
263
+ Headings use weight 700. Preserve semantic H1–H6 order even when a different visual size is applied.
264
+
265
+ ### Identity, Metadata, And Feedback
266
+
267
+ | Component mapping | Light | Dark | Meaning |
268
+ | --- | --- | --- | --- |
269
+ | `--avatar-background-{hue}` | `--categorical-{hue}` → 200 | `--categorical-{hue}` → 800 | Single-fill identity colour |
270
+ | Avatar state | Grey/green/orange/red 200 | Grey/green/orange/red 900 | Neutral/positive/warning/attention fill |
271
+ | `--badge-background-neutral` | Grey 200 | Grey 400 | Low-emphasis metadata |
272
+ | Badge semantic | Lightened green/orange/red 300 | Bright green/orange/red 400 | Semantic metadata |
273
+ | `--badge-background-{hue}` | Tuned categorical 200 tint | Bright categorical 200 with dark text | Categorical metadata remains light |
274
+ | `--status-{intent}-*` | 100 background, 500 border, 1000 text | 900 background, 300 border, 100 text; warning uses orange 1000 | Structured semantic state |
275
+ | `--status-{hue}-*` | Pale 200-derived background, 200 border, 800-derived text | Dark 800-derived background, 200 border/text | Structured categorical state |
276
+ | Alert and Message | Direct Feedback mapping | Direct Feedback mapping | Full contextual feedback |
277
+
278
+ Avatar is identity, Badge is metadata, and Status is structured state. Do not render them as interchangeable coloured pills.
279
+
280
+ ### Controls And Selection
281
+
282
+ | Component mapping | Light | Dark | Meaning |
283
+ | --- | --- | --- | --- |
284
+ | `--input-background` | White; disabled grey 100 | Grey 900; disabled grey 800 | Field surface |
285
+ | `--checkbox-*` | White; checked grey 900 with grey 200 icon | Grey 900; checked grey 200 with grey 900 icon | Neutral multiple selection |
286
+ | `--radio-*` | White; checked grey 900 | Grey 900; checked grey 200 | Neutral single selection |
287
+ | `--switch-*` | Grey 300 track, green 500 checked, white thumb | Grey 600 track, green 500 checked, black thumb | Binary off/on state |
288
+ | `--link-text-color-default*` | Grey 900; hover/focus 1000 | Grey 200; hover/focus 100 | Inline action |
289
+ | `--tab-*` | Grey 200 inactive, white active, dark active text | Grey 1100 inactive, grey 700 active, white text | Selected navigation |
290
+ | `--chip-*` | White, grey 200–300 borders, dark active edge | Grey 800, grey 600–700 borders, pale active edge | Interactive compact object |
291
+ | `--addon-background` | Grey 100 | Grey 1000 | Attached control surface |
292
+
293
+ Shared action heights are 22px, 28px, 36px, 44px, and 56px for xx-small through large. Buttons and links use Action variants; tabs and compact controls reuse the same dimensions and focus language where appropriate.
294
+
295
+ ### Surfaces And Content
296
+
297
+ | Component mapping | Light | Dark | Meaning |
298
+ | --- | --- | --- | --- |
299
+ | Card and Accordion | Elevated Surface and Border | Same semantic roles | Structured content group |
300
+ | `--dialog-background / --drawer-background` | White | Grey 800 | Highest overlay surface |
301
+ | `--dropdown-*` | Grey 100, black-alpha border/shadow, white hover | Grey 1000, black-alpha border/shadow, grey 900 hover | Floating menu |
302
+ | `--carousel-background` | White | Grey 700 | Carousel frame |
303
+ | `--slat-*` | Translucent white/elevated surfaces | Black-alpha/elevated surfaces | Row and card treatments |
304
+ | `--slide-frame-*` | Elevated 100 and semantic border | Same semantic roles | Presentation frame |
305
+ | `--code-background` | Elevated 200 | Elevated 200 | Code field |
306
+ | `--skeleton-*` | Elevated 200, white 70% highlight | Elevated 200, white 30% highlight | Loading placeholder |
307
+ | Icon / Illustration | Black default, white inverted | White default, black inverted | Theme-aware marks |
308
+
309
+ ### Progress, Media, And Rich Interaction
310
+
311
+ | Component mapping | Light | Dark | Meaning |
312
+ | --- | --- | --- | --- |
313
+ | `--progress-*` | Blue 600 bar, grey 200 track | Blue 500 bar, grey 700 track | Progress |
314
+ | `--stepper-*` | Grey 700 active, white inactive; orange 700 warning | White active, black inactive; orange/red 300 warning/error | Ordered progress |
315
+ | `--range-input-*` | Light Media Player roles | Dark Media Player roles | Range interaction |
316
+ | `--media-player-*` | Theme Surface and Text | Dark theme Surface and Text | Plain media controls |
317
+ | `--media-player-dark-*` | Fixed black/white overlays | Same fixed values | Controls over imagery/video |
318
+ | Video Thumbnail | Surface/Border plus fixed dark overlay action | Dark Surface plus fixed overlay action | Media preview |
319
+ | Prompt / Preview | Form, blue focus, elevated Surface, supplied accent | Dark equivalents, supplied accent | Rich input; accent is product-provided |
320
+
321
+ Geometry-only component tokens—Avatar sizes, Badge/Card/Dialog radius, Alert/Message padding, Chip/Tab sizing, Illustration sizes, Table row actions, and carousel offsets—map directly to Base foundations and do not require separate theme values.
322
+
323
+ ## 4. Composition And Usage
324
+
325
+ ### Layout
326
+
327
+ - Use vertical stacks for reading order and section rhythm.
328
+ - Use horizontal stacks for related controls, metadata, and short action groups.
329
+ - Use grids for repeated peers such as cards or metrics.
330
+ - Align content to shared edges; avoid isolated offsets.
331
+ - Start with whitespace before adding borders, surfaces, or shadows.
332
+ - Typical section spacing is 24–48px; component padding 12–24px; related-content gaps 8–12px.
333
+
334
+ ### Responsive Behavior
335
+
336
+ - Collapse columns into a clear reading order.
337
+ - Let controls wrap before reducing text or target size.
338
+ - Keep primary actions visible and stable.
339
+ - Avoid overlap, clipped labels, horizontal page scrolling, and unexpected reordering.
340
+
341
+ ### Accessibility And Interaction
342
+
343
+ - Use visible labels; placeholders do not replace labels.
344
+ - Never rely on colour, iconography, or motion alone.
345
+ - Keep focus-visible states prominent.
346
+ - Preserve control dimensions during loading.
347
+ - Keep overlay text and controls readable over varied imagery.
348
+ - Use tabular numerals for changing numeric values.
349
+
350
+ ### Anti-patterns
351
+
352
+ - Do not introduce off-palette colours when an existing semantic or categorical role fits.
353
+ - Do not use categorical colour to imply success, warning, or error.
354
+ - Do not flatten hierarchy with one text size or weight.
355
+ - Do not overuse cards, borders, shadows, or rounded containers.
356
+ - Do not use optional text colour for essential content.
357
+ - Do not shrink controls or body text to force desktop layouts into narrow viewports.
358
+ - Do not mix unrelated visual treatments or add decoration without purpose.
package/README.md CHANGED
@@ -37,6 +37,32 @@ import "@muibook/components/agent/prompts";
37
37
  import "@muibook/components/agent/keywords";
38
38
  ```
39
39
 
40
+ For MCP-based agent context, use the exported knowledge repo at [michaeltrilford/muibook-knowledge](https://github.com/michaeltrilford/muibook-knowledge). After installing the Muibook knowledge MCP in a project that uses Muibook components, add an instruction like this to that project's `AGENTS.md` or equivalent agent guidance file:
41
+
42
+ ```md
43
+ When the Muibook MCP is available, call its `start_here` tool before answering questions or doing work about Muibook components, markup, styling, wrappers, dynamic attrs, knowledge, skills, or component documentation.
44
+ ```
45
+
46
+ #### Knowledge Usage
47
+
48
+ The package also exposes Muibook knowledge for AI tooling and plugins:
49
+
50
+ ```javascript
51
+ import { knowledge } from "@muibook/components/knowledge";
52
+ import { rules } from "@muibook/components/knowledge/rules";
53
+ import { compositions } from "@muibook/components/knowledge/compositions";
54
+ import { keywords } from "@muibook/components/knowledge/keywords";
55
+ ```
56
+
57
+ Generated metadata is published alongside the package:
58
+
59
+ ```txt
60
+ @muibook/components/custom-elements.json
61
+ @muibook/components/dynamic-attrs.json
62
+ @muibook/components/AGENTS.md
63
+ @muibook/components/DESIGN.md
64
+ ```
65
+
40
66
  Links •
41
67
  [npmjs.com](https://www.npmjs.com/package/@muibook/components?activeTab=readme) •
42
68
  [Docs](https://muibook.com) •
@@ -55,7 +81,7 @@ Kickstart your project with a lightweight scaffold built on Vite. It comes prelo
55
81
  - 📱 Responsive foundation: Mobile-first CSS resets and utilities
56
82
  - 🔧 Customisable: Easy to adapt for your brand and requirements
57
83
 
58
- Learn more at [Muibook.com](https://muibook.com/#/create-mui-app)
84
+ Learn more at [Muibook.com](https://muibook.com/create-mui-app)
59
85
 
60
86
  ---
61
87
 
@@ -182,6 +208,31 @@ Install [es6-string-html](https://marketplace.visualstudio.com/items?itemName=To
182
208
 
183
209
  ---
184
210
 
211
+ ## Knowledge Build
212
+
213
+ Muibook keeps authored AI knowledge in `src/knowledge`:
214
+
215
+ - `rules.ts` contains global component-tree generation rules.
216
+ - `keywords.ts` contains full keyword mappings and the curated local-agent keyword subset.
217
+ - `compositions.ts` contains full composition examples, curation metadata, and the generated local-agent composition subset.
218
+ - `index.ts` exports the combined `knowledge` object.
219
+
220
+ The full package build also generates and copies related knowledge files:
221
+
222
+ - `public/custom-elements.json` from component `api.ts` and `doc.ts` files.
223
+ - `public/dynamic-attrs.json` for runtime/destination structural attrs.
224
+ - root `AGENTS.md` and `DESIGN.md`.
225
+
226
+ `npm run build` runs `npm run copy-knowledge`, which syncs the exported bundle into the sibling `../muibook-knowledge` repo used for [michaeltrilford/muibook-knowledge](https://github.com/michaeltrilford/muibook-knowledge):
227
+
228
+ ```bash
229
+ npm run build
230
+ ```
231
+
232
+ Use `includeInAgent: true` in `compositionConfig` only for compact examples that should be bundled into `@muibook/components/agent/prompts`. Keep richer examples in the full knowledge export with `includeInAgent: false`.
233
+
234
+ ---
235
+
185
236
  ### Publishing
186
237
 
187
238
  #### Version Management