@threadlabs/looma 0.42.0 → 0.43.1

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 (272) hide show
  1. package/components/ui-action-bar/ui-action-bar.html +1 -7
  2. package/components/ui-affordance-scope/ui-affordance-scope.html +4 -4
  3. package/components/ui-avatar/ui-avatar.html +0 -22
  4. package/components/ui-avatar-group/ui-avatar-group.html +1 -11
  5. package/components/ui-badge/ui-badge.html +57 -78
  6. package/components/ui-button/ui-button.html +36 -81
  7. package/components/ui-callout/ui-callout.html +30 -68
  8. package/components/ui-card/ui-card.html +47 -21
  9. package/components/ui-checkbox/ui-checkbox.html +1 -15
  10. package/components/ui-cluster/ui-cluster.html +1 -7
  11. package/components/ui-combobox/ui-combobox.html +7 -70
  12. package/components/ui-container/ui-container.html +2 -12
  13. package/components/ui-context-menu/ui-context-menu.html +1 -23
  14. package/components/ui-dialog/ui-dialog.html +1 -31
  15. package/components/ui-disclosure/ui-disclosure.html +1 -15
  16. package/components/ui-editor-mention-menu/ui-editor-mention-menu.js +3 -0
  17. package/components/ui-editor-slash-menu/ui-editor-slash-menu.js +4 -0
  18. package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +3 -2
  19. package/components/ui-floating-action-button/ui-floating-action-button.html +0 -14
  20. package/components/ui-form-field/ui-form-field.html +2 -32
  21. package/components/ui-grid/ui-grid.html +1 -11
  22. package/components/ui-icon/ui-icon.html +1 -12
  23. package/components/ui-icon-button/ui-icon-button.html +52 -87
  24. package/components/ui-input/ui-input.html +5 -55
  25. package/components/ui-input-group/ui-input-group.html +1 -13
  26. package/components/ui-list/ui-list.html +0 -10
  27. package/components/ui-list-item/ui-list-item.html +1 -19
  28. package/components/ui-listbox/ui-listbox.html +0 -21
  29. package/components/ui-menu/ui-menu.html +0 -22
  30. package/components/ui-menu-item/ui-menu-item.html +0 -26
  31. package/components/ui-meter/ui-meter.html +11 -6
  32. package/components/ui-nav-item/ui-nav-item.html +0 -18
  33. package/components/ui-popover/ui-popover.html +0 -30
  34. package/components/ui-radio/ui-radio.html +7 -13
  35. package/components/ui-radio-group/ui-radio-group.html +0 -5
  36. package/components/ui-reel/ui-reel.html +1 -11
  37. package/components/ui-search-result-row/ui-search-result-row.html +0 -34
  38. package/components/ui-search-shell/ui-search-shell.html +1 -43
  39. package/components/ui-select/ui-select.html +0 -42
  40. package/components/ui-separator/ui-separator.html +0 -6
  41. package/components/ui-sidebar/ui-sidebar.html +2 -24
  42. package/components/ui-site-header/ui-site-header.html +0 -25
  43. package/components/ui-skeleton/ui-skeleton.html +0 -9
  44. package/components/ui-stack/ui-stack.html +6 -11
  45. package/components/ui-swatch/ui-swatch.html +0 -5
  46. package/components/ui-switch/ui-switch.html +1 -15
  47. package/components/ui-switcher/ui-switcher.html +1 -11
  48. package/components/ui-tabs/ui-tabs.html +1 -19
  49. package/components/ui-text/ui-text.html +19 -6
  50. package/components/ui-textarea/ui-textarea.html +0 -50
  51. package/components/ui-toast/ui-toast.html +12 -27
  52. package/components/ui-toast-region/ui-toast-region.html +13 -34
  53. package/components/ui-tooltip/ui-tooltip.html +1 -43
  54. package/components/ui-top-bar/ui-top-bar.html +1 -31
  55. package/components/ui-tree/ui-tree.html +1 -16
  56. package/components/ui-tree-item/ui-tree-item.html +1 -23
  57. package/components/ui-tree-item/ui-tree-item.js +0 -1
  58. package/dist/index.js +1 -1
  59. package/docs/README.md +13 -11
  60. package/docs/card.html +2 -6
  61. package/docs/card.js +7 -37
  62. package/docs/catalog.json +821 -202
  63. package/docs/catalog.mjs +1 -1
  64. package/docs/customizer-render.mjs +27 -14
  65. package/docs/customizer.js +42 -9
  66. package/docs/documentation.css +3 -7
  67. package/docs/examples/ui-button/examples/08-loading.behavior.js +1 -1
  68. package/docs/examples/ui-checkbox/examples/02-checked-indeterminate-and-disabled.behavior.js +1 -1
  69. package/docs/examples/ui-editor-mention-menu/examples/00-preview.behavior.js +1 -0
  70. package/docs/examples/ui-editor-slash-menu/examples/00-preview.behavior.js +81 -0
  71. package/docs/examples/ui-editor-table-overlay/examples/00-preview.behavior.js +24 -0
  72. package/docs/examples/ui-search-shell/examples/00-preview.behavior.js +14 -0
  73. package/docs/examples/ui-search-shell/examples/02-label-dismissible-status-and-footer.behavior.js +7 -7
  74. package/docs/examples/ui-toast/examples/01-authored.behavior.js +2 -2
  75. package/docs/index.d.ts +1 -1
  76. package/docs/local-server.mjs +2 -5
  77. package/docs/palette.mjs +5 -4
  78. package/docs/pastoral.svg +54 -0
  79. package/docs/portrait.svg +15 -0
  80. package/docs/render.mjs +33 -3
  81. package/docs/site.mjs +22 -54
  82. package/docs/theme.mjs +97 -35
  83. package/docs/value-editors.mjs +2 -1
  84. package/package.json +2 -2
  85. package/styles/ui-action-bar.css +3 -11
  86. package/styles/ui-affordance-scope.css +4 -4
  87. package/styles/ui-avatar-group.css +3 -15
  88. package/styles/ui-avatar.css +2 -26
  89. package/styles/ui-badge.css +56 -80
  90. package/styles/ui-button.css +35 -83
  91. package/styles/ui-callout.css +32 -72
  92. package/styles/ui-card.css +42 -18
  93. package/styles/ui-checkbox.css +3 -19
  94. package/styles/ui-cluster.css +2 -10
  95. package/styles/ui-combobox.css +7 -140
  96. package/styles/ui-container.css +2 -14
  97. package/styles/ui-context-menu.css +3 -27
  98. package/styles/ui-dialog.css +5 -67
  99. package/styles/ui-disclosure.css +3 -19
  100. package/styles/ui-editor-table-overlay.css +2 -2
  101. package/styles/ui-floating-action-button.css +2 -18
  102. package/styles/ui-form-field.css +4 -36
  103. package/styles/ui-grid.css +2 -14
  104. package/styles/ui-icon-button.css +51 -89
  105. package/styles/ui-icon.css +3 -16
  106. package/styles/ui-input-group.css +2 -14
  107. package/styles/ui-input.css +6 -57
  108. package/styles/ui-list-item.css +3 -23
  109. package/styles/ui-list.css +2 -14
  110. package/styles/ui-listbox.css +2 -44
  111. package/styles/ui-menu-item.css +2 -30
  112. package/styles/ui-menu.css +2 -26
  113. package/styles/ui-meter.css +8 -4
  114. package/styles/ui-nav-item.css +2 -22
  115. package/styles/ui-popover.css +2 -34
  116. package/styles/ui-radio-group.css +1 -6
  117. package/styles/ui-radio.css +9 -17
  118. package/styles/ui-reel.css +2 -14
  119. package/styles/ui-search-result-row.css +2 -38
  120. package/styles/ui-search-shell.css +3 -47
  121. package/styles/ui-select.css +2 -46
  122. package/styles/ui-separator.css +2 -10
  123. package/styles/ui-sidebar.css +4 -28
  124. package/styles/ui-site-header.css +1 -26
  125. package/styles/ui-skeleton.css +2 -12
  126. package/styles/ui-stack.css +4 -12
  127. package/styles/ui-swatch.css +1 -6
  128. package/styles/ui-switch.css +3 -19
  129. package/styles/ui-switcher.css +2 -14
  130. package/styles/ui-tabs.css +3 -23
  131. package/styles/ui-text.css +10 -2
  132. package/styles/ui-textarea.css +2 -54
  133. package/styles/ui-toast-region.css +29 -73
  134. package/styles/ui-toast.css +24 -54
  135. package/styles/ui-tooltip.css +3 -47
  136. package/styles/ui-top-bar.css +3 -35
  137. package/styles/ui-tree-item.css +5 -51
  138. package/styles/ui-tree.css +3 -20
  139. package/theme-system.css +6 -2
  140. package/tokens.css +55 -21
  141. package/vanilla/UiBadge.d.ts +1 -1
  142. package/vanilla/UiBadge.js +1 -1
  143. package/vanilla/UiButton.d.ts +1 -1
  144. package/vanilla/UiButton.js +1 -1
  145. package/vanilla/UiCard.d.ts +1 -1
  146. package/vanilla/UiCard.js +1 -1
  147. package/vanilla/UiEditorTableOverlay.js +50 -36
  148. package/vanilla/UiIconButton.d.ts +1 -1
  149. package/vanilla/UiIconButton.js +1 -1
  150. package/vanilla/UiMeter.d.ts +1 -1
  151. package/vanilla/UiMeter.js +1 -1
  152. package/vanilla/UiStack.js +1 -1
  153. package/vanilla/UiText.d.ts +1 -1
  154. package/vanilla/UiText.js +1 -1
  155. package/vue/UiActionBar.vue +3 -9
  156. package/vue/UiAffordanceScope.vue +4 -4
  157. package/vue/UiAvatar.vue +1 -28
  158. package/vue/UiAvatarGroup.vue +1 -11
  159. package/vue/UiBadge.d.ts +2 -2
  160. package/vue/UiBadge.vue +84 -81
  161. package/vue/UiButton.d.ts +2 -2
  162. package/vue/UiButton.vue +78 -97
  163. package/vue/UiCallout.vue +30 -71
  164. package/vue/UiCard.d.ts +2 -2
  165. package/vue/UiCard.vue +77 -26
  166. package/vue/UiCheckbox.vue +1 -15
  167. package/vue/UiCluster.vue +1 -10
  168. package/vue/UiCombobox.vue +13 -72
  169. package/vue/UiContainer.vue +1 -13
  170. package/vue/UiContextMenu.vue +1 -30
  171. package/vue/UiDialog.vue +3 -33
  172. package/vue/UiDisclosure.vue +1 -15
  173. package/vue/UiEditorTableOverlay.d.ts +11 -1
  174. package/vue/UiEditorTableOverlay.vue +100 -65
  175. package/vue/UiFloatingActionButton.vue +0 -22
  176. package/vue/UiFormField.vue +6 -33
  177. package/vue/UiGrid.vue +1 -13
  178. package/vue/UiIcon.vue +1 -16
  179. package/vue/UiIconButton.d.ts +2 -2
  180. package/vue/UiIconButton.vue +103 -99
  181. package/vue/UiInput.vue +1 -54
  182. package/vue/UiInputGroup.vue +8 -20
  183. package/vue/UiList.vue +2 -12
  184. package/vue/UiListItem.vue +8 -26
  185. package/vue/UiListbox.vue +0 -23
  186. package/vue/UiMenu.vue +1 -23
  187. package/vue/UiMenuItem.vue +0 -26
  188. package/vue/UiMeter.d.ts +2 -2
  189. package/vue/UiMeter.vue +47 -12
  190. package/vue/UiNavItem.vue +3 -21
  191. package/vue/UiPopover.vue +1 -32
  192. package/vue/UiRadio.vue +1 -11
  193. package/vue/UiRadioGroup.vue +0 -11
  194. package/vue/UiReel.vue +1 -11
  195. package/vue/UiSearchResultRow.vue +0 -35
  196. package/vue/UiSearchShell.vue +1 -53
  197. package/vue/UiSelect.vue +0 -42
  198. package/vue/UiSeparator.vue +0 -7
  199. package/vue/UiSidebar.vue +3 -26
  200. package/vue/UiSiteHeader.vue +0 -24
  201. package/vue/UiSkeleton.vue +0 -9
  202. package/vue/UiStack.vue +6 -11
  203. package/vue/UiSwatch.vue +1 -6
  204. package/vue/UiSwitch.vue +1 -15
  205. package/vue/UiSwitcher.vue +1 -14
  206. package/vue/UiTabs.vue +1 -19
  207. package/vue/UiText.d.ts +2 -2
  208. package/vue/UiText.vue +29 -4
  209. package/vue/UiTextarea.vue +0 -50
  210. package/vue/UiToast.vue +26 -34
  211. package/vue/UiToastRegion.vue +26 -55
  212. package/vue/UiTooltip.vue +1 -43
  213. package/vue/UiTopBar.vue +1 -34
  214. package/vue/UiTree.vue +2 -17
  215. package/vue/UiTreeItem.vue +2 -28
  216. package/vue/chunks/UiActionBar.js +1 -1
  217. package/vue/chunks/UiAffordanceScope.js +1 -1
  218. package/vue/chunks/UiAvatar.js +1 -1
  219. package/vue/chunks/UiAvatarGroup.js +1 -1
  220. package/vue/chunks/UiBadge.js +4 -2
  221. package/vue/chunks/UiButton.js +4 -2
  222. package/vue/chunks/UiCallout.js +1 -1
  223. package/vue/chunks/UiCard.js +5 -3
  224. package/vue/chunks/UiCheckbox.js +1 -1
  225. package/vue/chunks/UiCluster.js +2 -2
  226. package/vue/chunks/UiCombobox.js +3 -3
  227. package/vue/chunks/UiContainer.js +2 -2
  228. package/vue/chunks/UiContextMenu.js +1 -1
  229. package/vue/chunks/UiDialog.js +1 -1
  230. package/vue/chunks/UiDisclosure.js +1 -1
  231. package/vue/chunks/UiEditorTableOverlay.js +41 -13
  232. package/vue/chunks/UiFloatingActionButton.js +1 -1
  233. package/vue/chunks/UiFormField.js +1 -1
  234. package/vue/chunks/UiGrid.js +2 -2
  235. package/vue/chunks/UiIcon.js +1 -1
  236. package/vue/chunks/UiIconButton.js +4 -2
  237. package/vue/chunks/UiInput.js +1 -1
  238. package/vue/chunks/UiInputGroup.js +1 -1
  239. package/vue/chunks/UiList.js +1 -1
  240. package/vue/chunks/UiListItem.js +1 -1
  241. package/vue/chunks/UiListbox.js +1 -1
  242. package/vue/chunks/UiMenu.js +1 -1
  243. package/vue/chunks/UiMenuItem.js +1 -1
  244. package/vue/chunks/UiMeter.js +4 -2
  245. package/vue/chunks/UiNavItem.js +1 -1
  246. package/vue/chunks/UiPopover.js +1 -1
  247. package/vue/chunks/UiRadio.js +1 -1
  248. package/vue/chunks/UiRadioGroup.js +1 -1
  249. package/vue/chunks/UiReel.js +2 -2
  250. package/vue/chunks/UiSearchResultRow.js +1 -1
  251. package/vue/chunks/UiSearchShell.js +1 -1
  252. package/vue/chunks/UiSelect.js +1 -1
  253. package/vue/chunks/UiSeparator.js +1 -1
  254. package/vue/chunks/UiSidebar.js +1 -1
  255. package/vue/chunks/UiSiteHeader.js +1 -1
  256. package/vue/chunks/UiSkeleton.js +1 -1
  257. package/vue/chunks/UiStack.js +3 -3
  258. package/vue/chunks/UiSwatch.js +1 -1
  259. package/vue/chunks/UiSwitch.js +1 -1
  260. package/vue/chunks/UiSwitcher.js +2 -2
  261. package/vue/chunks/UiTabs.js +1 -1
  262. package/vue/chunks/UiText.js +4 -2
  263. package/vue/chunks/UiTextarea.js +1 -1
  264. package/vue/chunks/UiToast.js +1 -1
  265. package/vue/chunks/UiToastRegion.js +1 -1
  266. package/vue/chunks/UiTooltip.js +1 -1
  267. package/vue/chunks/UiTopBar.js +1 -1
  268. package/vue/chunks/UiTree.js +1 -1
  269. package/vue/chunks/UiTreeItem.js +1 -1
  270. package/vue/components.css +633 -2068
  271. package/vue/editor/index.js +7 -1
  272. package/docs/preview.js +0 -22
package/docs/README.md CHANGED
@@ -12,12 +12,12 @@ In a project with a `package.json`, install Looma and its documentation tools:
12
12
 
13
13
  ```sh
14
14
  pnpm add @threadlabs/looma @nextwebwg/html-next@1.0.0-alpha.69
15
- pnpm add -D 'markupress@>=0.10.0 <1' '@threadlabs/markupkit@>=0.2.0 <1' vite
15
+ pnpm add -D 'markupress@>=0.10.2 <1' '@threadlabs/markupkit@>=0.2.0 <1' vite
16
16
  pnpm exec looma-docs init --title "The Fellowship"
17
17
  pnpm exec looma-docs dev
18
18
  ```
19
19
 
20
- Use the tool versions accepted by Looma's optional peer dependencies. Markupress 0.10 and later compatible 0.x releases supply the current documentation theme, including one appearance button that cycles Automatic, Light and Dark. Regular component imports do not load the documentation server. Vue and Tiptap remain optional; install them when your own authored documentation mounts the Vue editor.
20
+ Use the tool versions accepted by Looma's optional peer dependencies. Markupress 0.10.2 and later compatible 0.x releases supply the shared Looma site header, mobile home-page navigation, and one appearance button that cycles Automatic, Light and Dark. Regular component imports do not load the documentation server. Vue and Tiptap remain optional; install them when your own authored documentation mounts the Vue editor.
21
21
 
22
22
  Initialization creates three project-owned files:
23
23
 
@@ -82,11 +82,13 @@ under `theme`; changing a site title does not require renaming those files.
82
82
 
83
83
  The authoring model groups shared decisions as Colour, Type, Size & spacing, Material and Motion. The controls expose shared intent: control roominess relative to text, rhythm, spacing, corners, inner and outer depth, and response pace.
84
84
 
85
- The generated values follow rules. The medium control height is base text size times control roominess; small and large heights follow the size ratio. Touch does not inflate the visible size ladder. Hit-area guidance is contextual and adjustable; 44px is a comfort preference for expanded targets, not a mandatory visible height. Invisible targets must not steal neighbouring controls. Rhythm coordinates gaps and unitless line-height multipliers. Spacing fine-tunes gaps independently of text ratios. Spacing derives from base text independently of control roominess and follows its own curve: linear at 1, increasingly curved toward 2, with stable endpoints so the largest gaps do not grow without bound. Depth generates families of shadows; it does not add motion amplitude. Fields and buttons with the same size setting use the same box height, while content can still grow when it needs more room.
85
+ The generated values follow rules. The medium control height is base text size times control roominess; small and large heights follow the size ratio. Touch does not inflate the visible size ladder. Hit-area guidance is contextual and adjustable; 44px is a comfort preference for expanded targets, not a mandatory visible height. Invisible targets must not steal neighbouring controls. Rhythm coordinates vertical Stack gaps and unitless line-height multipliers. It leaves horizontal navigation and control-row gaps alone. Spacing adjusts gaps and padding independently of text ratios. Spacing derives from base text independently of control roominess and follows its own curve: linear at 1, increasingly curved toward 2, with stable endpoints so the largest gaps do not grow without bound. Depth generates families of shadows; it does not add motion amplitude. Fields and buttons with the same size setting use the same box height, while content can still grow when it needs more room.
86
86
 
87
- Choose a coordinated palette, then refine surface warmth, color intensity and palette relationship. Warmth runs from cool to warm paper and ink, with 0.5 neutral; intensity runs from quiet to vivid, with 0.5 retaining original seed intensity. Keep my colors preserves the base hues; Related colors and Contrasting colors tint quiet surfaces toward neighboring and opposite hues. These decisions regenerate paired light/dark colors through Oklab/OKLCH operations, gamut repair and readability checks. They do not transform existing CSS colors live. Four Base colors remain visible for precise edits; the light/dark range previews and resolved values explain adjustments.
87
+ Choose a coordinated palette, then refine surface warmth, color intensity and palette relationship. Warmth runs from cool to warm paper and ink, with 0.5 neutral; intensity runs from quiet to vivid, with 0.5 retaining original seed intensity. Keep my colors preserves the base hues; Related colors and Contrasting colors tint quiet surfaces toward neighboring and opposite hues. These decisions regenerate paired light/dark colors through Oklab/OKLCH operations, gamut repair and readability checks. They do not transform existing CSS colors live. Four base colors remain visible for precise edits. Supporting accents optionally adds second and third brand seeds. They feed `tone="accent-secondary"` and `tone="accent-tertiary"` on Button, IconButton, Badge, Card, Meter and Text, with the same derived readable text, states and material response as the primary. Unset supporting accents follow primary; the primary remains the normal action voice.
88
88
 
89
- Documentation navigation stays out of the customization workspace. **Material & light** opens a movable light source, real component samples and bounded surface controls. **Palette** opens the coordinated light/dark ranges and their four Base colors. Each editor changes the same persistent theme. Returning to the overview, navigating to a component, or reloading keeps the result.
89
+ Palette details expose relationships rather than arbitrary status colors. **Neutrals & shared borders** derives restrained neutrals from text, an accent family or untinted gray, with fill strength and a shared minimum boundary contrast (default 2:1). Neutral solid/outline actions and form fields all consume `--ui-control-border` and its hover role. **Status colors** lets each role retain its semantic hue, harmonize toward the primary hue by at most 15 degrees, or use one of the three brand families. Perceptual saturation is coordinated with the primary; readability and material stops are resolved for both modes. Dark derivation separates canvas and content elevations, compensates quiet neutral fills and borders, and derives selection washes from readable contextual pigment. Subtle badges, toned cards, callouts, toasts and generated notifications share semantic background, foreground and border roles. Composed Text inherits the containing foreground; the document root supplies the normal body color. These roles provide paler light fills and visible dark tints. Optional overlay group overrides remain explicit choices instead of masking semantic defaults. There are no per-status color pickers. Words and icons preserve meaning when all statuses use one family. **Accent assignments** selects families for links, focus rings and selected rows. Light/dark specimens show these roles together, including an actual field beside the shared neutral actions.
90
+
91
+ Documentation navigation stays out of the customization workspace. **Material & light** opens a movable light source, real component samples and bounded surface controls. **Palette** opens light/dark specimens, base seeds and advanced relationship controls. Each editor changes the same persistent theme. Returning to the overview, navigating to a component, or reloading keeps the result.
90
92
 
91
93
  Material starts with Finish, Transparency and Frosting. Advanced material contains the light source and its color, edge light, glow, depth and decorative rim extent. The quiet grid stays fixed across the customizer while the page scrolls; content plates remain opaque.
92
94
 
@@ -101,7 +103,7 @@ material, typography, spacing and motion. Open a summary to edit that subject; u
101
103
  **Overview** to return to the same dashboard position. Only the active editor shows
102
104
  its controls. Precise adjustments sit inside the relevant editor's detail sections.
103
105
 
104
- Typography pairs font selection with headings and body text. Size & spacing shows
106
+ Typography pairs font selection with headings and body text. Field labels follow body size by default; choose a separate label size to keep labels independent while help stays smaller. Size & spacing shows
105
107
  the shared control ladder and grouped content. Motion keeps a replayable study and
106
108
  a real popover beside duration and curve editing; the study follows the shared
107
109
  curve, travels at three times the feedback duration, and respects reduced motion.
@@ -127,8 +129,8 @@ The [public token reference](https://github.com/threadlabs-studio/looma/blob/mai
127
129
  | Family | Recipe decisions → CSS properties |
128
130
  | --- | --- |
129
131
  | Base colors | `action` → `--ui-accent`; `canvas` → `--ui-surface`; `surface` → `--ui-surface-raised`; `text` → `--ui-text` |
130
- | Palette generation (recipe only) | `warmth`, `color-intensity`, `palette-relationship`; compiled into resolved color roles, with no matching CSS custom properties |
131
- | Type | `body-font` → `--ui-font-sans`; `display-font` → `--ui-font-display`; `text-size` → `--ui-font-size`; `text-weight` → `--ui-font-medium` |
132
+ | Palette generation (recipe only) | `warmth`, `color-intensity`, `palette-relationship`, optional `secondary-action`/`tertiary-action`, `neutral-source`, `neutral-strength`, `neutral-border-contrast`, `status-chroma`, each status’s `*-source`, and `selection-accent`/`focus-accent`/`link-accent`; compiled into resolved color roles, with no matching CSS custom properties |
133
+ | Type | `body-font` → `--ui-font-sans`; `display-font` → `--ui-font-display`; `text-size` → `--ui-font-size`; `label-size` → `--ui-field-label-font-size` (`inherit` follows body); `text-weight` → `--ui-font-medium` |
132
134
  | Rhythm & spacing | `rhythm` → `--ui-rhythm`; `control-roominess` → `--ui-control-roominess`; `spacing` → `--ui-spacing`; `scale-contrast` → `--ui-scale-ratio`; `space-curve` → `--ui-space-curve`; `corner-roundness` → `--ui-radius-md`; `line-weight` → `--ui-border-width` |
133
135
  | Depth and transmission | `outer-depth` → `--ui-outer-depth`; `inner-depth` → `--ui-inner-depth`; `glassiness` → `--ui-glassiness`; `surface-separation` → `--ui-surface-separation`; `translucency` → `--ui-overlay-translucency` |
134
136
  | Finish and illumination | `finish` → `--ui-finish`; `edge-light` → `--ui-edge-light`; `glow` → `--ui-glow`; `light-x` → `--ui-light-x`; `light-y` → `--ui-light-y`; `light-spread` → `--ui-light-spread`; `light-strength` → `--ui-light-strength` |
@@ -244,7 +246,7 @@ description: Sam has finished the morning checklist.
244
246
  <office-status label="Ready for second breakfast"></office-status>
245
247
  ```
246
248
 
247
- The example appears in both the reference and the customizer's selection list. Optional `.behavior.js` or `.behavior.ts` companions export a default setup function receiving the example root; return a cleanup function when needed. Add `preview: resizable` to expose the shared card's width control. Framework-specific `.snippet.html` and `.vue` companions provide literal source views.
249
+ The first example also appears in the component directory, so keep it representative at a narrow card width. Full variations belong in the later reference examples. Optional `.behavior.js` or `.behavior.ts` companions export a default setup function receiving the example root; return a cleanup function when needed. Select controls through example-local data attributes: generated IDs and their label, trigger and command references are namespaced for each instance. Add `preview: resizable` to expose the shared card's width control, or `preview: stretch` when the sample needs the available inline width, such as percentage-based loading placeholders. Framework-specific `.snippet.html` and `.vue` companions provide literal source views.
248
250
 
249
251
  Discovery reads definitions and descriptions without executing their controllers. New resources under a selected root appear after the local server rebuilds. External components keep their own contracts and supported token hooks; discovery does not make arbitrary components respond to Looma's tokens.
250
252
 
@@ -258,10 +260,10 @@ Use the `@threadlabs/looma/docs` entrypoint for programmatic discovery, catalog
258
260
 
259
261
  ## Saving and recovery
260
262
 
261
- The local editor writes only the configured recipe and CSS inside the project. It rejects symlink paths, generated or dependency directories, cross-origin save requests and stale file revisions. A competing edit leaves your unsaved preview in place; reload and reconcile it before saving again. Examples run in isolated frames and receive theme CSS, never the local editing capability. Each preview's compiled runtime is embedded after its content and authorized by an exact content hash in the generated content policy. This keeps previews interactive in Safari while retaining their opaque origin and parent-page isolation.
263
+ The local editor writes only the configured recipe and CSS inside the project. It rejects symlink paths, generated or dependency directories, cross-origin save requests and stale file revisions. A competing edit leaves your unsaved preview in place; reload and reconcile it before saving again. Examples are pre-rendered directly in the documentation page and share its styles and HTML Next runtime. Project component roots and example companions are trusted application code, so opt in only to sources you would run in your application. Example IDs and their label, trigger and command relationships are namespaced per specimen; companions can select stable authored hooks such as data-example-id. Width controls resize the inline stage; viewport media queries follow the documentation window.
262
264
 
263
265
  The writer stages complete files, serializes saves with a project lock, and rolls back the recipe if replacing the CSS fails. If a process stops during a save or build, close the old editor before removing its `.looma/theme-write.lock` or `.looma/docs-build.lock`; restart and save the loaded recipe to regenerate a consistent pair. Change the server base, output directory or theme-file paths by restarting `dev`.
264
266
 
265
267
  Preset choices use the styled, searchable dropdown already used for fonts and component examples. Palette choices include four color swatches for the accent, neutral fill, canvas and text; the selected field previews the current theme. An inherited default keeps muted text while its options remain readable.
266
268
 
267
- Filled-action colors keep their supplied pigment. Readable on-fill ink is chosen independently from contextual text, outlines and focus. Primary and secondary action fills and edges are derived together from their separation against the declared surfaces; secondary actions occupy a quieter share of the same family range in both modes. Reflection preserves chromatic light and shade within that chosen foreground’s readability bounds.
269
+ Filled-action colors keep their supplied pigment. Readable on-fill ink is chosen independently from contextual text, outlines and focus. Neutral action and field boundaries derive from one contrast decision against their surfaces; their quiet fills are independent of primary pigment. Supporting brand families are separate from neutral secondary actions. Reflection preserves chromatic light and shade within that chosen foreground’s readability bounds.
package/docs/card.html CHANGED
@@ -10,7 +10,6 @@
10
10
  <prop name="exampleTitle" type="string" default="">The selected authored example.</prop>
11
11
  <prop name="previewOnly" type="boolean" default="false">Show only the live example, for compact theme samplers whose host supplies the heading.</prop>
12
12
  <prop name="reference" type="boolean" default="false">Use the spacious full-reference example presentation.</prop>
13
- <prop name="src" type="string" default="">The compiled isolated example page.</prop>
14
13
  <prop name="resizable" type="boolean" default="false">Expose a width control for responsive examples.</prop>
15
14
  <prop name="category" type="string" default="forms">The shared category identity.</prop>
16
15
  <prop name="tag" type="string" default="">The component's authored tag.</prop>
@@ -18,11 +17,10 @@
18
17
  <prop name="nativeRoot" type="string" default="">The component's semantic native root.</prop>
19
18
  <prop name="href" type="string" default="">The component reference page.</prop>
20
19
  <prop name="removable" type="boolean" default="false">Offer removal when this card is selected in the customizer.</prop>
21
- <prop name="loading" type="keyword" values="lazy, eager" default="lazy">Load visible catalog cards lazily; selected customizer cards eagerly.</prop>
22
20
  </defs>
23
21
  <article from:data-example-card="$identity" from:data-component-card="$tag" from:data-category="$category">
24
22
  <header $if="$reference" class="example-heading"><slot name="heading"><h3>{$exampleTitle}</h3><p>{$description}</p></slot></header>
25
- <div class="preview"><iframe $ref="frame" from:title="$title" from:src="$src" sandbox="allow-scripts" from:loading="$loading" width="100%" height="208"></iframe></div>
23
+ <div class="preview"><div class="stage" $ref="stage"><slot name="preview"></slot></div></div>
26
24
  <section $if="$reference" class="example-code"><h4>Code</h4><slot name="code"></slot></section>
27
25
  <div $if="$resizable" class="preview-width"> <ui-form-field><label slot="label">Preview width</label><span slot="help">Explore the example at a narrower width.</span><ui-input $ref="width" type="number" min="240" max="1600" value="720" aria-label="Preview width in pixels" size="sm"></ui-input></ui-form-field></div>
28
26
  <div $if="not $reference and not $previewOnly" class="body"><ui-stack gap="xs">
@@ -58,12 +56,10 @@
58
56
  .example-code h4 { margin: 0 0 var(--ui-space-3) !important; font-size: var(--ui-font-size-md); }
59
57
  .example-heading p { margin: var(--ui-space-2) 0 0 !important; color: var(--ui-text-secondary); font-size: var(--ui-font-size-sm); }
60
58
  :host([reference]) .preview { min-block-size: 11rem; display: grid !important; align-items: center !important; border-block-end: 0; }
61
- :host([reference]) iframe { min-block-size: 11rem; }
62
- :host([reference][category="overlay"]) iframe { min-block-size: 26rem; }
63
59
  :host([reference]) .preview::before { display: none; }
64
60
  .preview { position: relative; min-block-size: 13rem; overflow: hidden; border-block-end: var(--ui-border-width) solid var(--ui-border); background: color-mix(in srgb, var(--_card-accent) 5%, var(--ui-surface)); }
65
61
  .preview::before { position: absolute; inset-block-start: 0; inset-inline-start: 0; inline-size: 3.5rem; block-size: 3px; background: var(--_card-accent); content: ""; z-index: 1; }
66
- iframe { display: block !important; max-inline-size: 100%; border: 0; }
62
+ .stage { inline-size: var(--_preview-width, 100%); max-inline-size: 100%; min-inline-size: 0; }
67
63
  footer { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: var(--ui-space-2) !important; }
68
64
  .preview-width { padding: var(--ui-space-4) !important; }
69
65
  .body { padding: var(--ui-space-5) !important; }
package/docs/card.js CHANGED
@@ -1,48 +1,18 @@
1
- import { documentationTheme, themeEvent } from './theme-session.mjs';
2
- /** Only theme data and measured height cross the opaque preview boundary. */
1
+ import { exampleBehaviors } from './example-behaviors.js';
2
+ /** Cards share their document's theme and runtime; width controls size only this stage. */
3
3
  export function connect(host) {
4
- const frame = host.refs.frame;
5
- const width = host.refs.width;
6
- const remove = host.refs.remove;
7
- const removeCard = () => host.element.dispatchEvent(new CustomEvent("looma-example-remove", { bubbles: true, detail: { id: host.props.identity.value } }));
8
- const view = frame.ownerDocument.defaultView;
9
- let theme = documentationTheme(view)?.css ?? '';
10
- const documentTheme = () => { theme = documentationTheme(view)?.css ?? ''; send(); };
11
- const preference = view.matchMedia('(prefers-color-scheme: dark)');
12
- const send = () => {
13
- if (!host.element.getClientRects().length) return;
14
- const scheme = view.getComputedStyle(host.element).colorScheme;
15
- const mode = scheme === 'dark' || (scheme.includes('dark') && scheme.includes('light') && preference.matches) ? 'dark' : 'light';
16
- frame.contentWindow?.postMessage({ type: 'looma-theme', css: theme, mode, reference: Boolean(host.props.reference.value) }, '*');
17
- };
18
- // Observe only this card's ancestors: an opposite-mode boundary belongs to its own subtree.
19
- const modes = new view.MutationObserver(send);
20
- for (let ancestor = host.element; ancestor; ancestor = ancestor.parentElement) modes.observe(ancestor, { attributes: true, attributeFilter: ['data-theme', 'style', 'class'] });
21
- const message = event => {
22
- if (event.source !== frame.contentWindow) return;
23
- if (event.data?.type === 'looma-preview-ready') send();
24
- if (event.data?.type === 'looma-preview-height' && Number.isFinite(event.data.height)) frame.height = String(Math.max(120, Math.min(2400, Math.ceil(event.data.height))));
25
- };
26
- const update = event => { theme = event.detail.css; send(); };
4
+ const { stage, width, remove } = host.refs;
5
+ const stopExample = exampleBehaviors[host.props.identity.value]?.(host.element.querySelector('[data-preview]'));
6
+ const removeCard = () => host.element.dispatchEvent(new CustomEvent('looma-example-remove', { bubbles: true, detail: { id: host.props.identity.value } }));
27
7
  const resize = event => {
28
8
  const value = Number(event.detail?.value ?? event.target.value);
29
- if (value >= 240 && value <= 1600) frame.width = String(value);
9
+ if (value >= 240 && value <= 1600) stage.style.setProperty('--_preview-width', `${value}px`);
30
10
  };
31
- host.element.addEventListener('looma-theme-preview', update);
32
11
  width?.addEventListener('input', resize);
33
12
  remove?.addEventListener('click', removeCard);
34
- view.addEventListener('message', message);
35
- view.addEventListener(themeEvent, documentTheme);
36
- frame.addEventListener('load', send);
37
- preference.addEventListener('change', send);
38
13
  return () => {
39
- host.element.removeEventListener('looma-theme-preview', update);
14
+ stopExample?.();
40
15
  width?.removeEventListener('input', resize);
41
16
  remove?.removeEventListener('click', removeCard);
42
- view.removeEventListener('message', message);
43
- view.removeEventListener(themeEvent, documentTheme);
44
- frame.removeEventListener('load', send);
45
- preference.removeEventListener('change', send);
46
- modes.disconnect();
47
17
  };
48
18
  }