@rubenlangeweg/mero-ui 0.8.0 → 0.9.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 (198) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +24 -3
  3. package/agent-docs/components/accordion.md +1 -1
  4. package/agent-docs/components/action-bar.md +1 -1
  5. package/agent-docs/components/action-button.md +1 -1
  6. package/agent-docs/components/agenda.md +1 -1
  7. package/agent-docs/components/alert-dialog.md +1 -1
  8. package/agent-docs/components/alert.md +1 -1
  9. package/agent-docs/components/app-layout.md +1 -1
  10. package/agent-docs/components/area-chart.md +1 -1
  11. package/agent-docs/components/aura.md +1 -1
  12. package/agent-docs/components/autocomplete.md +1 -1
  13. package/agent-docs/components/avatar-group.md +1 -1
  14. package/agent-docs/components/avatar.md +1 -1
  15. package/agent-docs/components/badge.md +1 -1
  16. package/agent-docs/components/bar-chart.md +1 -1
  17. package/agent-docs/components/breadcrumbs.md +1 -1
  18. package/agent-docs/components/browser-mockup.md +1 -1
  19. package/agent-docs/components/button-group.md +1 -1
  20. package/agent-docs/components/button.md +1 -1
  21. package/agent-docs/components/calendar.md +3 -3
  22. package/agent-docs/components/card.md +1 -1
  23. package/agent-docs/components/carousel.md +1 -1
  24. package/agent-docs/components/cell-color-picker.md +1 -1
  25. package/agent-docs/components/cell-select.md +1 -1
  26. package/agent-docs/components/cell-slider.md +1 -1
  27. package/agent-docs/components/cell-switch.md +1 -1
  28. package/agent-docs/components/chain-of-thought.md +1 -1
  29. package/agent-docs/components/chart-tooltip.md +1 -1
  30. package/agent-docs/components/chat-attachment.md +1 -1
  31. package/agent-docs/components/chat-conversation.md +1 -1
  32. package/agent-docs/components/chat-list-view.md +1 -1
  33. package/agent-docs/components/chat-loader.md +1 -1
  34. package/agent-docs/components/chat-message-actions.md +1 -1
  35. package/agent-docs/components/chat-message.md +1 -1
  36. package/agent-docs/components/chat-source.md +1 -1
  37. package/agent-docs/components/chat-tool.md +1 -1
  38. package/agent-docs/components/checkbox-button-group.md +1 -1
  39. package/agent-docs/components/checkbox-group.md +1 -1
  40. package/agent-docs/components/checkbox.md +1 -1
  41. package/agent-docs/components/chip.md +1 -1
  42. package/agent-docs/components/close-button.md +1 -1
  43. package/agent-docs/components/code-block.md +1 -1
  44. package/agent-docs/components/code-mockup.md +1 -1
  45. package/agent-docs/components/color-area.md +1 -1
  46. package/agent-docs/components/color-field.md +1 -1
  47. package/agent-docs/components/color-picker.md +1 -1
  48. package/agent-docs/components/color-slider.md +1 -1
  49. package/agent-docs/components/color-swatch.md +1 -1
  50. package/agent-docs/components/combo-box.md +1 -1
  51. package/agent-docs/components/command-menu.md +1 -1
  52. package/agent-docs/components/command.md +1 -1
  53. package/agent-docs/components/composed-chart.md +1 -1
  54. package/agent-docs/components/context-menu.md +1 -1
  55. package/agent-docs/components/countdown.md +1 -1
  56. package/agent-docs/components/data-grid.md +1 -1
  57. package/agent-docs/components/date-field.md +1 -1
  58. package/agent-docs/components/date-picker.md +1 -1
  59. package/agent-docs/components/date-range-picker.md +1 -1
  60. package/agent-docs/components/description-list.md +1 -1
  61. package/agent-docs/components/description.md +1 -1
  62. package/agent-docs/components/diff.md +1 -1
  63. package/agent-docs/components/disclosure-group.md +1 -1
  64. package/agent-docs/components/disclosure.md +1 -1
  65. package/agent-docs/components/dock.md +1 -1
  66. package/agent-docs/components/drawer.md +1 -1
  67. package/agent-docs/components/drop-zone.md +1 -1
  68. package/agent-docs/components/dropdown.md +1 -1
  69. package/agent-docs/components/emoji-picker.md +1 -1
  70. package/agent-docs/components/emoji-reaction-button.md +1 -1
  71. package/agent-docs/components/empty-state.md +1 -1
  72. package/agent-docs/components/error-message.md +1 -1
  73. package/agent-docs/components/fab.md +1 -1
  74. package/agent-docs/components/field-error.md +1 -1
  75. package/agent-docs/components/fieldset.md +1 -1
  76. package/agent-docs/components/file-input.md +1 -1
  77. package/agent-docs/components/file-tree.md +1 -1
  78. package/agent-docs/components/filter-chips.md +1 -1
  79. package/agent-docs/components/floating-toc.md +1 -1
  80. package/agent-docs/components/footer.md +1 -1
  81. package/agent-docs/components/form.md +1 -1
  82. package/agent-docs/components/hero.md +1 -1
  83. package/agent-docs/components/holo-card.md +1 -1
  84. package/agent-docs/components/hover-card.md +1 -1
  85. package/agent-docs/components/hover-gallery.md +1 -1
  86. package/agent-docs/components/indicator.md +1 -1
  87. package/agent-docs/components/inline-select.md +1 -1
  88. package/agent-docs/components/input-group.md +1 -1
  89. package/agent-docs/components/input-otp.md +1 -1
  90. package/agent-docs/components/input.md +1 -1
  91. package/agent-docs/components/item-card-group.md +1 -1
  92. package/agent-docs/components/item-card.md +1 -1
  93. package/agent-docs/components/join.md +1 -1
  94. package/agent-docs/components/joined-filter.md +1 -1
  95. package/agent-docs/components/kanban.md +1 -1
  96. package/agent-docs/components/kbd.md +1 -1
  97. package/agent-docs/components/kpi-group.md +1 -1
  98. package/agent-docs/components/kpi.md +1 -1
  99. package/agent-docs/components/label.md +1 -1
  100. package/agent-docs/components/line-chart.md +1 -1
  101. package/agent-docs/components/link.md +1 -1
  102. package/agent-docs/components/list-box.md +1 -1
  103. package/agent-docs/components/list-view.md +1 -1
  104. package/agent-docs/components/live-progress.md +1 -1
  105. package/agent-docs/components/map.md +1 -1
  106. package/agent-docs/components/markdown.md +1 -1
  107. package/agent-docs/components/mask.md +1 -1
  108. package/agent-docs/components/megamenu.md +1 -1
  109. package/agent-docs/components/menu-button.md +1 -1
  110. package/agent-docs/components/menu.md +1 -1
  111. package/agent-docs/components/meter.md +1 -1
  112. package/agent-docs/components/modal.md +1 -1
  113. package/agent-docs/components/native-select.md +1 -1
  114. package/agent-docs/components/navbar.md +1 -1
  115. package/agent-docs/components/number-field.md +1 -1
  116. package/agent-docs/components/number-stepper.md +1 -1
  117. package/agent-docs/components/number-value.md +1 -1
  118. package/agent-docs/components/page-header.md +1 -1
  119. package/agent-docs/components/pagination.md +1 -1
  120. package/agent-docs/components/phone-mockup.md +1 -1
  121. package/agent-docs/components/pie-chart.md +1 -1
  122. package/agent-docs/components/popover.md +1 -1
  123. package/agent-docs/components/pressable-feedback.md +1 -1
  124. package/agent-docs/components/progress-bar.md +1 -1
  125. package/agent-docs/components/progress-circle.md +1 -1
  126. package/agent-docs/components/prompt-input.md +1 -1
  127. package/agent-docs/components/prompt-suggestion.md +1 -1
  128. package/agent-docs/components/radar-chart.md +1 -1
  129. package/agent-docs/components/radial-chart.md +1 -1
  130. package/agent-docs/components/radio-button-group.md +1 -1
  131. package/agent-docs/components/radio-group.md +1 -1
  132. package/agent-docs/components/range-calendar.md +1 -1
  133. package/agent-docs/components/rating.md +1 -1
  134. package/agent-docs/components/resizable.md +1 -1
  135. package/agent-docs/components/rich-text-editor.md +1 -1
  136. package/agent-docs/components/scroll-shadow.md +1 -1
  137. package/agent-docs/components/search-field.md +1 -1
  138. package/agent-docs/components/segment.md +1 -1
  139. package/agent-docs/components/select.md +1 -1
  140. package/agent-docs/components/separator.md +1 -1
  141. package/agent-docs/components/sheet.md +1 -1
  142. package/agent-docs/components/sidebar.md +1 -1
  143. package/agent-docs/components/skeleton.md +1 -1
  144. package/agent-docs/components/slider.md +1 -1
  145. package/agent-docs/components/sortable-table.md +1 -1
  146. package/agent-docs/components/spinner.md +1 -1
  147. package/agent-docs/components/stack.md +1 -1
  148. package/agent-docs/components/status.md +1 -1
  149. package/agent-docs/components/stepper.md +1 -1
  150. package/agent-docs/components/surface.md +1 -1
  151. package/agent-docs/components/swap.md +1 -1
  152. package/agent-docs/components/switch.md +1 -1
  153. package/agent-docs/components/table.md +1 -1
  154. package/agent-docs/components/tabs.md +1 -1
  155. package/agent-docs/components/tag-group.md +1 -1
  156. package/agent-docs/components/text-area.md +1 -1
  157. package/agent-docs/components/text-field.md +1 -1
  158. package/agent-docs/components/text-rotate.md +1 -1
  159. package/agent-docs/components/text-shimmer.md +1 -1
  160. package/agent-docs/components/theme-controller.md +1 -1
  161. package/agent-docs/components/time-field.md +1 -1
  162. package/agent-docs/components/timeline.md +1 -1
  163. package/agent-docs/components/toast.md +1 -1
  164. package/agent-docs/components/toggle-button-group.md +1 -1
  165. package/agent-docs/components/toggle-button.md +1 -1
  166. package/agent-docs/components/toolbar.md +1 -1
  167. package/agent-docs/components/tooltip.md +1 -1
  168. package/agent-docs/components/trend-chip.md +1 -1
  169. package/agent-docs/components/typed-confirmation.md +1 -1
  170. package/agent-docs/components/typography.md +1 -1
  171. package/agent-docs/components/validator.md +1 -1
  172. package/agent-docs/components/visually-hidden.md +1 -1
  173. package/agent-docs/components/widget.md +1 -1
  174. package/agent-docs/components/window-mockup.md +1 -1
  175. package/agent-docs/llms-components.txt +175 -175
  176. package/agent-docs/llms-full.txt +237 -179
  177. package/agent-docs/llms-patterns.txt +63 -5
  178. package/agent-docs/llms.txt +1 -1
  179. package/package.json +4 -1
  180. package/ui/insight-charts.mjs +1 -1
  181. package/ui/insight-markdown.mjs +1 -1
  182. package/ui/mero-collections.css +1 -1
  183. package/ui/mero-collections.js +1 -1
  184. package/ui/mero-composition.css +1 -1
  185. package/ui/mero-composition.js +1 -1
  186. package/ui/mero-forms.js +2 -2
  187. package/ui/mero-gallery.css +1 -1
  188. package/ui/mero-gallery.js +1 -1
  189. package/ui/mero-insights.css +1 -1
  190. package/ui/mero-insights.js +1 -1
  191. package/ui/mero-inventory.css +1 -1
  192. package/ui/mero-inventory.js +1 -1
  193. package/ui/mero-layouts.css +1 -1
  194. package/ui/mero-live.js +1 -1
  195. package/ui/mero-workspace.css +1 -1
  196. package/ui/mero-workspace.js +1 -1
  197. package/ui/mero.css +1 -1
  198. package/ui/mero.js +19 -7
@@ -1,4 +1,4 @@
1
- # Mero UI 0.8.0 integration patterns
1
+ # Mero UI 0.9.0 integration patterns
2
2
 
3
3
  ## Install a component
4
4
 
@@ -24,9 +24,21 @@ Fires on the `data-mero-listbox` element when a person chooses an option.
24
24
 
25
25
  event.detail: `{ value, option }`. `value` is the option’s `data-value`, or its text when that is absent. `option` is the chosen element.
26
26
 
27
+ ### mero:tab
28
+
29
+ Fires on the newly selected tab when a person changes the tab with a click, an arrow key, Home or End, after the tabs and panels are updated. It does not fire for the tab selected at load, or when the selected tab is chosen again.
30
+
31
+ event.detail: `{ tab, panel }`. `tab` is the selected tab. `panel` is the element its `aria-controls` names, or `null` when there is none.
32
+
33
+ ### mero:toggle
34
+
35
+ Fires on a `data-mero-toggle` button after a click flips its `aria-pressed`.
36
+
37
+ event.detail: `{ pressed }`. `pressed` is the new state, a boolean.
38
+
27
39
  ### mero:query
28
40
 
29
- Fires on a remote combobox input when it needs fresh options, for example an arrow key after a failed request. Add it to `hx-trigger` next to `input`.
41
+ Fires on a remote combobox input when it needs fresh options, for example an arrow key after a failed request. Add it to `hx-trigger` next to `input`. To follow the option a person chooses, listen for the native `change` event on the input, which bubbles; the value is `event.target.value`.
30
42
 
31
43
  ### mero:action
32
44
 
@@ -79,9 +91,9 @@ Opens a `<dialog>` as a modal. Pass the element or its ID. Focus returns to `tri
79
91
 
80
92
  Closes an open dialog. `focus` overrides where focus returns. `value` becomes the dialog’s `returnValue`.
81
93
 
82
- ### MeroUI.toast(message, { tone, duration })
94
+ ### MeroUI.toast(message, { tone, duration, trigger })
83
95
 
84
- Shows a notification. `tone` is `accent`, `success`, `warning` or `danger`. `duration` is in milliseconds, 4800 by default. Use 0 to keep it until dismissed.
96
+ Shows a notification. `tone` is `accent`, `success`, `warning` or `danger`. `duration` is in milliseconds, 4800 by default. Use 0 to keep it until dismissed. `trigger` is the element the notification belongs to, by default the focused element. When it is inside an open dialog, the notification shows in that dialog.
85
97
 
86
98
  ### MeroUI.init(root)
87
99
 
@@ -170,7 +182,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
170
182
  - `data-mero-live-error` — An initially empty status region that announces a failed read. The last good status stays visible until a successful read. The attribute value, when set, replaces the default text; `{time}` becomes the time of the last good read in the browser’s locale, or the page load when no read has succeeded yet.
171
183
  - `data-mero-live-follow` — On the `data-mero-live` region. An error response with `HX-Redirect`, `HX-Location` or `HX-Refresh: true`, such as a 401 for an expired session, is handed to htmx instead of retried, and polling stops. Without it Mero ignores those headers on an error response and keeps retrying.
172
184
  - `data-mero-live-retry` — On a hidden button. Mero shows it after a failed read. Activating it refreshes the status immediately. If a successful read hides the focused button, focus returns to the region.
173
- - `data-mero-live-done` — On an operation with a final status. Mero sets it after a successful response with the terminal header, and after following a redirect with `data-mero-live-follow`. Render it yourself if the operation has already finished.
185
+ - `data-mero-live-done` (set by Mero) — On an operation with a final status. Mero sets it after a successful response with the terminal header, and after following a redirect with `data-mero-live-follow`. Render it yourself if the operation has already finished.
174
186
 
175
187
  ### Gallery · mero-gallery.js
176
188
 
@@ -248,3 +260,49 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
248
260
  - `data-mero-theme-picker` — On a select or radio. Its value becomes the scope’s `data-theme`.
249
261
  - `data-mero-cutoff-hour` — Around a `<time>`. Counts down to that hour, 0 to 23 in UTC.
250
262
  - `data-mero-check-form` — On the catalog’s validation demo form. It reports a fixed message and is not meant for your app.
263
+
264
+ ## State Mero owns
265
+
266
+ The native and ARIA state Mero writes besides the attributes marked set by Mero above. Render the starting state in your markup, then leave these to Mero: a second writer and Mero overwrite each other. This list covers `mero.js`, `mero-forms.js` and `mero-live.js`. The state the other scripts write is not listed.
267
+
268
+ - Dialog (mero.js) — The `open` state of a dialog opened with `data-mero-open` or `MeroUI.open`.
269
+ - Scoped IDs (mero.js) — Inside a `data-mero-scope` or `data-mero-tabs`: the `id` of an element whose ID is already used elsewhere on the page, and every reference to it in that scope: `for`, `aria-controls`, `aria-labelledby`, `aria-describedby`, `aria-activedescendant`, `popovertarget`, `data-mero-open` and the ID selectors `data-mero-scope` lists. Read these from the element. Do not write back the ID you rendered.
270
+ - Tabs (mero.js) — `aria-selected` and `tabindex` on each tab, and `hidden` on each panel a tab names in `aria-controls`.
271
+ - List box (mero.js) — `aria-selected` and `tabindex` on each option.
272
+ - Combobox (mero.js) — On the input: `aria-expanded`, `aria-activedescendant` and, while a remote query runs, `aria-busy`. On the list it controls: `hidden` on the list, on options that do not match and on the empty row, and `aria-selected` on options. The input’s value when a person chooses an option. Opening a `data-mero-command` dialog clears its combobox input.
273
+ - Accordion (mero.js) — The `name` of each `details` directly inside a `data-mero-accordion`.
274
+ - Toggle button (mero.js) — `aria-pressed` on a `data-mero-toggle` button.
275
+ - Menu (mero.js) — `aria-expanded` on the button that opens a popover with `role="menu"`.
276
+ - Shortcuts (mero.js) — `aria-keyshortcuts` on a `data-mero-shortcut` element. On a `data-mero-shortcuts-toggle`: `checked` on a checkbox, otherwise `aria-checked` or `aria-pressed`.
277
+ - Radio group (mero.js) — For a `data-mero-radio-group` outside a form: the `form` attribute on each radio, pointing at a hidden form Mero adds, and `checked` on the selected radio.
278
+ - Toast and peek (mero.js) — Mero creates these elements and sets their `role`, `aria-label`, `aria-live` and `aria-hidden`.
279
+ - Form (mero-forms.js) — On a `data-mero-form` while its request runs: `aria-busy` on the form and `disabled` on its submit buttons. `hidden` on its `data-mero-form-error` element and on a `data-mero-action-unknown` panel. With `data-mero-clear-passwords`: the value of its password inputs, cleared when the request ends unless it was cancelled.
280
+ - Action button (mero-forms.js) — On a `data-mero-action` button while its request runs: `aria-busy` and `aria-disabled`. `hidden` on a `data-mero-action-unknown` panel, and `hidden` and `data-tone` on `data-mero-action-status`. `aria-busy` on the region a `data-mero-action-reread` selector names, while Mero reads it again. That is the selected region, not the button, form or ancestor that carries the attribute, and it applies to a `data-mero-form` too.
281
+ - Typed confirmation (mero-forms.js) — `disabled` on `data-mero-confirm-submit`. The value of `data-mero-confirm-input`, cleared when its dialog closes.
282
+ - Show-when (mero-forms.js) — `hidden` on the branch, and `disabled` on a fieldset branch and on the controls inside a branch.
283
+ - Dirty (mero-forms.js) — `disabled` on the submit buttons of a `data-mero-dirty` form.
284
+ - Search (mero-forms.js) — `hidden` on `data-mero-search-error`. After a successful read: `defaultSelected` on each option and `defaultChecked` on each checkbox and radio of the form, set to the current choice, so a form reset returns to the last search that worked. After a failed read: `selected` and `checked`, put back to those defaults.
285
+ - Live progress (mero-live.js) — `aria-busy` on the `data-mero-live` region while a read runs, and `hidden` on `data-mero-live-retry`.
286
+ - Focus targets (mero.js, mero-forms.js, mero-live.js) — `tabindex="-1"` on a region Mero moves focus to when it has no `tabindex`: the boosted region, a `data-mero-live` region and an emptied `data-mero-ephemeral` element.
287
+
288
+ ## Headers
289
+
290
+ The `Mero-*` HTTP headers. Your server sends the response headers. Mero sends the request header.
291
+
292
+ - `Mero-Action-Outcome` (response, mero-forms.js) — `succeeded`, `rejected` or `unknown`. Overrides the outcome Mero derives from the status code of a `data-mero-action` or `data-mero-form` request. Any other value is ignored.
293
+ - `Mero-Action-Message` (response, mero-forms.js) — Text to show for the outcome of a `data-mero-action` or `data-mero-form` request.
294
+ - `Mero-Form-Error` (response, mero-forms.js) — Fallback text for a failed request. A form shows it when there is no `Mero-Action-Message` and no `data-mero-action-unknown` text, and never for a 422 without `Mero-Action-Outcome`, where the replacement form shows its own errors. A search shows it when `data-mero-search-error` has no value.
295
+ - `Mero-Live` (response, mero-live.js) — `done` on the final successful read of a `data-mero-live` region. Polling stops.
296
+ - `Mero-Reread` (request, mero-forms.js) — A number Mero sends with the GET that reads again the region a `data-mero-action-reread` selector names.
297
+
298
+ ## With Alpine or your own scripts
299
+
300
+ What a browser test proves about Mero next to Alpine. It runs Alpine 3.14.8, the oldest version tested, and Alpine 3.17.5, with htmx 4.0.2 and its `hx-alpine-compat` extension loaded straight after htmx. Other Alpine versions and setups without the extension are not tested. The events are listed under “Events Mero sends”.
301
+
302
+ - Script order — With Mero and Alpine both loaded as deferred scripts, either order works.
303
+ - Listen, do not read — Put `x-on:mero:selection`, `x-on:mero:tab` or `x-on:mero:toggle` on an `x-data` ancestor of the component. The event arrives after Mero has written the state, so the listener sees the new state. Mero selecting a tab or flipping a toggle inside an `x-data` root leaves Alpine’s own state alone.
304
+ - mero:action — For a form that stays in the page, or that a 422 response replaces with another `data-mero-form`, a listener on an ancestor hears both the pending and the final event. When the swap removes the form and leaves no replacement `data-mero-form`, the final event fires on the document. An ancestor listener misses it. Use `@mero:action.window` on an Alpine component or a native listener on `document`. The detail is `{ state }` while pending and `{ state, status, message }` at the end. It does not say which form or button it came from, and a window or document listener hears every action on the page, so it cannot tell which one settled once the element is gone. Tested with `data-mero-form`.
305
+ - Combobox — Use `x-model.lazy` on the combobox input. Choosing an option fires `change` and no `input` event.
306
+ - Writing a field value — A script that sets an input’s value fires no event. Dispatch a bubbling `change` on the input afterwards, or `data-mero-dirty` and `data-mero-show-when` keep their old state.
307
+ - htmx swaps — After an `innerHTML` swap into an `x-data` element, and after an `outerMorph` swap of one with `hx-alpine-compat` loaded, the Alpine state survives, Alpine binds the new children and Mero sets up the tabs in the new content.
308
+ - Markup Alpine inserts — Mero does not set up tabs that `x-if` inserts. Call `MeroUI.init(el)` on the inserted element. A second call changes nothing.
@@ -1,6 +1,6 @@
1
1
  # Mero UI
2
2
 
3
- > Mero UI 0.8.0 provides HTML components and HTMX 4 patterns for server-rendered applications.
3
+ > Mero UI 0.9.0 provides HTML components and HTMX 4 patterns for server-rendered applications.
4
4
 
5
5
  Choose a component to find its variants, templates and required assets. Use the bundled index for the release installed in your application.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubenlangeweg/mero-ui",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "description": "HTML components and HTMX patterns for server-rendered interfaces.",
6
6
  "scripts": {
@@ -33,8 +33,11 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@cloudflare/vite-plugin": "2.0.0-rc.2",
36
+ "alpinejs-current": "npm:alpinejs@3.17.5",
37
+ "alpinejs-floor": "npm:alpinejs@3.14.8",
36
38
  "axe-core": "^4.14.1",
37
39
  "cf": "1.0.0-rc.2",
40
+ "htmx.org": "4.0.2",
38
41
  "playwright": "^1.65.1",
39
42
  "vite": "8.3.8"
40
43
  },
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  // Optional server-side helper. Render the result in a full page or an HTMX response.
3
3
  // Each row is {label, values: [number, ...]}. Values are finite and nonnegative.
4
4
  const chartTypes = new Set(['line', 'area', 'bar', 'composed', 'pie', 'radar', 'radial']);
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  // Render a small Markdown subset for messages with no raw HTML or embeds.
3
3
  function escape(value) {
4
4
  return String(value).replace(/[&<>"']/g, character => ({ '&':'&amp;', '<':'&lt;', '>':'&gt;', '"':'&quot;', "'":'&#39;' }[character]));
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Optional collection components. Everything inherits the base Mero theme. */
3
3
  :where(.mero-collection,.mero-agenda,.mero-item-card,.mero-list-view,.mero-widget,.mero-file-tree,.mero-kanban,.mero-toc,.mero-place-map,.mero-collection-timeline,.mero-hover-card,.mero-collection-empty) {
4
4
  box-sizing: border-box;
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Optional Studio collection interactions. HTMX owns requests and swaps. */
3
3
  (() => {
4
4
  const gridSelector = '[data-mero-grid]';
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  :where(.mero-join, .mero-link-menu, .mero-editorial-hero, .mero-footer-nav, .mero-theme-sample,
3
3
  .mero-validation-example, .mero-aura, .mero-countdown, .mero-mask-sample, .mero-deck,
4
4
  .mero-status-marker, .mero-swap, .mero-text-cycle, .mero-device) {
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  (() => {
3
3
  const rotations = new Map();
4
4
  function advance(cycle) {
package/ui/mero-forms.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /**
3
3
  * Optional HTMX form behavior. Server responses:
4
4
  * 422 + replacement form for validation, or HX-Trigger:
@@ -413,7 +413,7 @@
413
413
 
414
414
  document.addEventListener("htmx:before:swap", event => {
415
415
  const { ctx, tasks } = event.detail;
416
- const id = ctx.request.headers?.["Mero-Reread"];
416
+ const id = ctx.request?.headers?.["Mero-Reread"];
417
417
  if (!id) return;
418
418
  const target = typeof ctx.target === "string" ? document.querySelector(ctx.target) : ctx.target;
419
419
  const url = new URL(ctx.request.action, location.href);
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Optional native gallery and media examples. */
3
3
  mero-gallery, mero-image-diff, mero-holo-card { display: block; min-inline-size: 0; }
4
4
  .mero-media-card {
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  (() => {
3
3
  const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)");
4
4
 
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Optional charts, metrics and conversation styles. Uses Mero's semantic theme. */
3
3
  .mero-plot, .mero-chat, .mero-chat-inbox, .mero-code-block, .mero-insight-metric, .mero-chat-disclosure, .mero-markdown-editor {
4
4
  box-sizing: border-box;
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  // Optional delegated behaviors. They also work on fragments added by HTMX.
3
3
  (() => {
4
4
  function showValue(mark) {
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  .lab {
3
3
  container: inventory / inline-size;
4
4
  inline-size: 100%;
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  // Optional behavior for the Studio Inventory block. HTMX owns all requests and swaps.
3
3
  (() => {
4
4
  function workbench(event) {
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Optional layouts built from the core theme tokens. */
3
3
  .mero-app {
4
4
  display: grid;
package/ui/mero-live.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  // Optional polling for a read-only status fragment. htmx owns each GET and swap.
3
3
  // With data-mero-live-follow, an error response carrying HX-Redirect, HX-Location or HX-Refresh
4
4
  // (such as a 401 after the session expired) is handed to htmx instead of retried.
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  /* Workspace forms, navigation and editing tools. Uses the host's Mero tokens. */
3
3
  :where(.mero-ws-cell,.mero-ws-labeled,.mero-ws-cardform,.mero-ws-inline,.mero-ws-upload,.mero-ws-editor,.mero-ws-shell,.mero-ws-navbar,.mero-ws-command,.mero-ws-context,.mero-ws-segment,.mero-ws-wizard,.mero-ws-split,.mero-ws-emoji,.mero-ws-filter,.mero-ws-dock,.mero-ws-mega,.mero-ws-fab) {
4
4
  box-sizing:border-box; max-inline-size:100%; color:var(--mero-text); font:400 .9rem/1.45 var(--mero-font);
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  (() => {
3
3
  "use strict";
4
4
 
package/ui/mero.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  :root {
3
3
  --mero-control-height: 2.5rem;
4
4
  --mero-control-padding-inline: .75rem;
package/ui/mero.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @rubenlangeweg/mero-ui 0.8.0 | MIT */
1
+ /*! @rubenlangeweg/mero-ui 0.9.0 | MIT */
2
2
  (() => {
3
3
  "use strict";
4
4
 
@@ -164,9 +164,10 @@
164
164
  return [...list.querySelectorAll(tabSelector)].filter(tab => tab.closest('[role="tablist"]') === list);
165
165
  }
166
166
 
167
- function selectTab(tab, focus = false) {
167
+ function selectTab(tab) {
168
168
  const list = tab.closest('[role="tablist"]');
169
- if (!list || disabled(tab)) return;
169
+ if (!list || disabled(tab)) return false;
170
+ const changed = tab.getAttribute("aria-selected") !== "true";
170
171
  for (const item of tabsFor(list)) {
171
172
  const selected = item === tab;
172
173
  item.tabIndex = selected ? 0 : -1;
@@ -174,7 +175,14 @@
174
175
  const panel = element(item.getAttribute("aria-controls"));
175
176
  if (panel) panel.hidden = !selected;
176
177
  }
177
- if (focus) tab.focus();
178
+ return changed;
179
+ }
180
+
181
+ // A person chose the tab. initTabs calls selectTab directly, so nothing fires at init.
182
+ function chooseTab(tab, focus) {
183
+ if (selectTab(tab)) tab.dispatchEvent(new CustomEvent("mero:tab", { bubbles: true, detail: { tab, panel: element(tab.getAttribute("aria-controls")) } }));
184
+ // Focus last, and only if a listener left this tab selected: a focus handler can select another tab.
185
+ if (focus && tab.getAttribute("aria-selected") === "true") tab.focus();
178
186
  }
179
187
 
180
188
  function initTabs(root) {
@@ -597,12 +605,16 @@
597
605
  pointerStarts.delete(target);
598
606
  if (beganOutside && outsideDialog(event, target)) close(target);
599
607
  }
600
- if (tab?.closest("[data-mero-tabs]")) selectTab(tab);
608
+ if (tab?.closest("[data-mero-tabs]")) chooseTab(tab);
601
609
  const combo = option?.closest("[data-mero-combo]");
602
610
  const list = !combo && option?.closest("[data-mero-listbox]");
603
611
  if (combo) selectCombo(combo.querySelector('[role="combobox"]'), option);
604
612
  if (list && !disabled(option)) chooseOption(list, option);
605
- if (toggle && !disabled(toggle)) toggle.setAttribute("aria-pressed", String(toggle.getAttribute("aria-pressed") !== "true"));
613
+ if (toggle && !disabled(toggle)) {
614
+ const pressed = toggle.getAttribute("aria-pressed") !== "true";
615
+ toggle.setAttribute("aria-pressed", String(pressed));
616
+ toggle.dispatchEvent(new CustomEvent("mero:toggle", { bubbles: true, detail: { pressed } }));
617
+ }
606
618
  if (notifier && !disabled(notifier)) toast(notifier.dataset.meroToast, { tone: notifier.dataset.meroTone, trigger: notifier });
607
619
  if (copier && !disabled(copier)) copy(copier);
608
620
  if (shortcutToggle && !disabled(shortcutToggle)) {
@@ -684,7 +696,7 @@
684
696
  const candidate = step(tab, tabsFor(list).filter(item => !disabled(item)), event.key, previous, next);
685
697
  if (candidate) {
686
698
  event.preventDefault();
687
- selectTab(candidate, true);
699
+ chooseTab(candidate, true);
688
700
  }
689
701
  return;
690
702
  }