@rubenlangeweg/mero-ui 0.9.0 → 0.10.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.
- package/CHANGELOG.md +27 -0
- package/README.md +28 -10
- package/agent-docs/components/accordion.md +1 -1
- package/agent-docs/components/action-bar.md +1 -1
- package/agent-docs/components/action-button.md +1 -1
- package/agent-docs/components/agenda.md +1 -1
- package/agent-docs/components/alert-dialog.md +1 -1
- package/agent-docs/components/alert.md +1 -1
- package/agent-docs/components/app-layout.md +1 -1
- package/agent-docs/components/area-chart.md +1 -1
- package/agent-docs/components/aura.md +1 -1
- package/agent-docs/components/autocomplete.md +1 -1
- package/agent-docs/components/avatar-group.md +1 -1
- package/agent-docs/components/avatar.md +1 -1
- package/agent-docs/components/badge.md +1 -1
- package/agent-docs/components/bar-chart.md +1 -1
- package/agent-docs/components/breadcrumbs.md +1 -1
- package/agent-docs/components/browser-mockup.md +1 -1
- package/agent-docs/components/button-group.md +1 -1
- package/agent-docs/components/button.md +1 -1
- package/agent-docs/components/calendar.md +3 -3
- package/agent-docs/components/card.md +1 -1
- package/agent-docs/components/carousel.md +1 -1
- package/agent-docs/components/cell-color-picker.md +1 -1
- package/agent-docs/components/cell-select.md +1 -1
- package/agent-docs/components/cell-slider.md +1 -1
- package/agent-docs/components/cell-switch.md +1 -1
- package/agent-docs/components/chain-of-thought.md +1 -1
- package/agent-docs/components/chart-tooltip.md +1 -1
- package/agent-docs/components/chat-attachment.md +1 -1
- package/agent-docs/components/chat-conversation.md +1 -1
- package/agent-docs/components/chat-list-view.md +1 -1
- package/agent-docs/components/chat-loader.md +1 -1
- package/agent-docs/components/chat-message-actions.md +1 -1
- package/agent-docs/components/chat-message.md +1 -1
- package/agent-docs/components/chat-source.md +1 -1
- package/agent-docs/components/chat-tool.md +1 -1
- package/agent-docs/components/checkbox-button-group.md +1 -1
- package/agent-docs/components/checkbox-group.md +1 -1
- package/agent-docs/components/checkbox.md +1 -1
- package/agent-docs/components/chip.md +1 -1
- package/agent-docs/components/close-button.md +1 -1
- package/agent-docs/components/code-block.md +1 -1
- package/agent-docs/components/code-mockup.md +1 -1
- package/agent-docs/components/color-area.md +1 -1
- package/agent-docs/components/color-field.md +1 -1
- package/agent-docs/components/color-picker.md +1 -1
- package/agent-docs/components/color-slider.md +1 -1
- package/agent-docs/components/color-swatch.md +1 -1
- package/agent-docs/components/combo-box.md +41 -1
- package/agent-docs/components/command-menu.md +1 -1
- package/agent-docs/components/command.md +1 -1
- package/agent-docs/components/composed-chart.md +1 -1
- package/agent-docs/components/context-menu.md +1 -1
- package/agent-docs/components/countdown.md +1 -1
- package/agent-docs/components/data-grid.md +1 -1
- package/agent-docs/components/date-field.md +1 -1
- package/agent-docs/components/date-picker.md +1 -1
- package/agent-docs/components/date-range-picker.md +1 -1
- package/agent-docs/components/description-list.md +1 -1
- package/agent-docs/components/description.md +1 -1
- package/agent-docs/components/diff.md +1 -1
- package/agent-docs/components/disclosure-group.md +1 -1
- package/agent-docs/components/disclosure.md +1 -1
- package/agent-docs/components/dock.md +1 -1
- package/agent-docs/components/drawer.md +1 -1
- package/agent-docs/components/drop-zone.md +1 -1
- package/agent-docs/components/dropdown.md +1 -1
- package/agent-docs/components/emoji-picker.md +1 -1
- package/agent-docs/components/emoji-reaction-button.md +1 -1
- package/agent-docs/components/empty-state.md +1 -1
- package/agent-docs/components/error-message.md +1 -1
- package/agent-docs/components/fab.md +1 -1
- package/agent-docs/components/field-error.md +1 -1
- package/agent-docs/components/fieldset.md +1 -1
- package/agent-docs/components/file-input.md +1 -1
- package/agent-docs/components/file-tree.md +1 -1
- package/agent-docs/components/filter-chips.md +1 -1
- package/agent-docs/components/floating-toc.md +1 -1
- package/agent-docs/components/footer.md +1 -1
- package/agent-docs/components/form.md +1 -1
- package/agent-docs/components/hero.md +1 -1
- package/agent-docs/components/holo-card.md +1 -1
- package/agent-docs/components/hover-card.md +1 -1
- package/agent-docs/components/hover-gallery.md +1 -1
- package/agent-docs/components/indicator.md +1 -1
- package/agent-docs/components/inline-select.md +1 -1
- package/agent-docs/components/input-group.md +1 -1
- package/agent-docs/components/input-otp.md +1 -1
- package/agent-docs/components/input.md +1 -1
- package/agent-docs/components/item-card-group.md +1 -1
- package/agent-docs/components/item-card.md +1 -1
- package/agent-docs/components/join.md +1 -1
- package/agent-docs/components/joined-filter.md +1 -1
- package/agent-docs/components/kanban.md +1 -1
- package/agent-docs/components/kbd.md +1 -1
- package/agent-docs/components/kpi-group.md +1 -1
- package/agent-docs/components/kpi.md +1 -1
- package/agent-docs/components/label.md +1 -1
- package/agent-docs/components/line-chart.md +1 -1
- package/agent-docs/components/link.md +1 -1
- package/agent-docs/components/list-box.md +1 -1
- package/agent-docs/components/list-view.md +1 -1
- package/agent-docs/components/live-progress.md +1 -1
- package/agent-docs/components/map.md +1 -1
- package/agent-docs/components/markdown.md +1 -1
- package/agent-docs/components/mask.md +1 -1
- package/agent-docs/components/megamenu.md +1 -1
- package/agent-docs/components/menu-button.md +1 -1
- package/agent-docs/components/menu.md +1 -1
- package/agent-docs/components/meter.md +1 -1
- package/agent-docs/components/modal.md +1 -1
- package/agent-docs/components/native-select.md +1 -1
- package/agent-docs/components/navbar.md +1 -1
- package/agent-docs/components/number-field.md +1 -1
- package/agent-docs/components/number-stepper.md +1 -1
- package/agent-docs/components/number-value.md +1 -1
- package/agent-docs/components/page-header.md +1 -1
- package/agent-docs/components/pagination.md +1 -1
- package/agent-docs/components/phone-mockup.md +1 -1
- package/agent-docs/components/pie-chart.md +1 -1
- package/agent-docs/components/popover.md +1 -1
- package/agent-docs/components/pressable-feedback.md +1 -1
- package/agent-docs/components/progress-bar.md +1 -1
- package/agent-docs/components/progress-circle.md +1 -1
- package/agent-docs/components/prompt-input.md +1 -1
- package/agent-docs/components/prompt-suggestion.md +1 -1
- package/agent-docs/components/radar-chart.md +1 -1
- package/agent-docs/components/radial-chart.md +1 -1
- package/agent-docs/components/radio-button-group.md +1 -1
- package/agent-docs/components/radio-group.md +1 -1
- package/agent-docs/components/range-calendar.md +1 -1
- package/agent-docs/components/rating.md +1 -1
- package/agent-docs/components/resizable.md +1 -1
- package/agent-docs/components/rich-text-editor.md +1 -1
- package/agent-docs/components/scroll-shadow.md +1 -1
- package/agent-docs/components/search-field.md +1 -1
- package/agent-docs/components/segment.md +1 -1
- package/agent-docs/components/select.md +1 -1
- package/agent-docs/components/separator.md +1 -1
- package/agent-docs/components/sheet.md +1 -1
- package/agent-docs/components/sidebar.md +1 -1
- package/agent-docs/components/skeleton.md +1 -1
- package/agent-docs/components/slider.md +1 -1
- package/agent-docs/components/sortable-table.md +1 -1
- package/agent-docs/components/spinner.md +1 -1
- package/agent-docs/components/stack.md +1 -1
- package/agent-docs/components/status.md +1 -1
- package/agent-docs/components/stepper.md +1 -1
- package/agent-docs/components/surface.md +1 -1
- package/agent-docs/components/swap.md +1 -1
- package/agent-docs/components/switch.md +1 -1
- package/agent-docs/components/table.md +1 -1
- package/agent-docs/components/tabs.md +1 -1
- package/agent-docs/components/tag-group.md +1 -1
- package/agent-docs/components/text-area.md +1 -1
- package/agent-docs/components/text-field.md +1 -1
- package/agent-docs/components/text-rotate.md +1 -1
- package/agent-docs/components/text-shimmer.md +1 -1
- package/agent-docs/components/theme-controller.md +1 -1
- package/agent-docs/components/time-field.md +1 -1
- package/agent-docs/components/timeline.md +1 -1
- package/agent-docs/components/toast.md +1 -1
- package/agent-docs/components/toggle-button-group.md +1 -1
- package/agent-docs/components/toggle-button.md +1 -1
- package/agent-docs/components/toolbar.md +1 -1
- package/agent-docs/components/tooltip.md +1 -1
- package/agent-docs/components/trend-chip.md +1 -1
- package/agent-docs/components/typed-confirmation.md +1 -1
- package/agent-docs/components/typography.md +1 -1
- package/agent-docs/components/validator.md +23 -2
- package/agent-docs/components/visually-hidden.md +1 -1
- package/agent-docs/components/widget.md +1 -1
- package/agent-docs/components/window-mockup.md +1 -1
- package/agent-docs/llms-components.txt +237 -176
- package/agent-docs/llms-full.txt +309 -198
- package/agent-docs/llms-patterns.txt +73 -23
- package/agent-docs/llms.txt +1 -1
- package/bin/mero-ui.mjs +505 -0
- package/dist/manifest.json +230 -0
- package/dist/ui/mero-collections.min.css +3 -0
- package/dist/ui/mero-collections.min.js +2 -0
- package/dist/ui/mero-composition.min.css +3 -0
- package/dist/ui/mero-composition.min.js +2 -0
- package/dist/ui/mero-forms.min.js +2 -0
- package/dist/ui/mero-gallery.min.css +3 -0
- package/dist/ui/mero-gallery.min.js +2 -0
- package/dist/ui/mero-insights.min.css +3 -0
- package/dist/ui/mero-insights.min.js +2 -0
- package/dist/ui/mero-layouts.min.css +3 -0
- package/dist/ui/mero-live.min.js +2 -0
- package/dist/ui/mero-themes.min.css +3 -0
- package/dist/ui/mero-workspace.min.css +3 -0
- package/dist/ui/mero-workspace.min.js +4 -0
- package/dist/ui/mero.min.css +3 -0
- package/dist/ui/mero.min.js +2 -0
- package/package.json +24 -5
- package/ui/insight-charts.d.ts +20 -0
- package/ui/insight-charts.mjs +1 -1
- package/ui/insight-markdown.d.ts +2 -0
- package/ui/insight-markdown.mjs +2 -2
- package/ui/mero-collections.css +3 -1
- package/ui/mero-collections.js +1 -1
- package/ui/mero-composition.css +3 -1
- package/ui/mero-composition.js +2 -2
- package/ui/mero-forms.js +383 -71
- package/ui/mero-gallery.css +4 -16
- package/ui/mero-gallery.js +1 -1
- package/ui/mero-insights.css +3 -1
- package/ui/mero-insights.js +2 -2
- package/ui/mero-layouts.css +3 -1
- package/ui/mero-live.js +68 -10
- package/ui/mero-themes.css +186 -0
- package/ui/mero-workspace.css +3 -1
- package/ui/mero-workspace.js +1 -1
- package/ui/mero.css +104 -16
- package/ui/mero.d.ts +162 -0
- package/ui/mero.js +433 -56
- package/ui/mero-inventory.css +0 -182
- package/ui/mero-inventory.js +0 -56
- package/ui/studio-lamp.webp +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Mero UI 0.
|
|
1
|
+
# Mero UI 0.10.0 integration patterns
|
|
2
2
|
|
|
3
3
|
## Install a component
|
|
4
4
|
|
|
@@ -10,9 +10,9 @@ Replace demonstration URLs with your routes and render user data with your templ
|
|
|
10
10
|
|
|
11
11
|
For a validating data-mero-form, return the filled form with HTTP 422 and mark the invalid field. For Typed Confirmation, keep the original form on a successful save using the response headers under mero:form-saved below.
|
|
12
12
|
|
|
13
|
-
## Apply a theme
|
|
13
|
+
## Apply a theme and coexist with Tailwind CSS v4
|
|
14
14
|
|
|
15
|
-
Load
|
|
15
|
+
Load optional ui/mero-themes.css after mero.css for composable presets (cobalt, fern, clay, editorial) and structural modifiers (compact, flat, crisp) alongside light, dark or auto on data-theme (e.g. data-theme="cobalt dark compact"), or override --mero-* tokens including --mero-border-width and --mero-depth. For zero-JS constraint validation hints, add .mero-validator on an input/select/textarea with a sibling .mero-validator-hint. When using Tailwind CSS v4 alongside Mero, declare `@layer theme, base, mero, components, utilities;` before importing Tailwind and mero.css.
|
|
16
16
|
|
|
17
17
|
## Events Mero sends
|
|
18
18
|
|
|
@@ -20,9 +20,9 @@ Events bubble to the document.
|
|
|
20
20
|
|
|
21
21
|
### mero:selection
|
|
22
22
|
|
|
23
|
-
Fires on
|
|
23
|
+
Fires on a `data-mero-listbox` when a person chooses an option, or on a `data-mero-multiselect` when a chip is added or removed.
|
|
24
24
|
|
|
25
|
-
event.detail: `{ value, option }`. `value` is the option’s `data-value
|
|
25
|
+
event.detail: `{ value, option } or { values, added, removed, option }`. On a listbox, `value` is the option’s `data-value` or trimmed text. On a multi-select, `values` is the array of selected values and `added` / `removed` name the change.
|
|
26
26
|
|
|
27
27
|
### mero:tab
|
|
28
28
|
|
|
@@ -36,15 +36,45 @@ Fires on a `data-mero-toggle` button after a click flips its `aria-pressed`.
|
|
|
36
36
|
|
|
37
37
|
event.detail: `{ pressed }`. `pressed` is the new state, a boolean.
|
|
38
38
|
|
|
39
|
+
### mero:select
|
|
40
|
+
|
|
41
|
+
Fires on a combobox input after a person selects an option and Mero writes the value and fires `change`.
|
|
42
|
+
|
|
43
|
+
event.detail: `{ value, label, option }`. `value` is the option’s `data-value` or trimmed text, `label` is its trimmed text and `option` is the chosen element.
|
|
44
|
+
|
|
45
|
+
### mero:dialog
|
|
46
|
+
|
|
47
|
+
Fires on a `<dialog>` when Mero opens it and when any `<dialog>` closes.
|
|
48
|
+
|
|
49
|
+
event.detail: `{ open, dialog, returnValue }`. `open` is a boolean, `dialog` is the dialog element and `returnValue` is the dialog’s return value on close (empty string on open).
|
|
50
|
+
|
|
51
|
+
### mero:peek
|
|
52
|
+
|
|
53
|
+
Fires on the `data-mero-peek` region when the row preview opens, moves to another row or closes (or on `document` if the region was removed). Swaps that keep the same row open do not repeat the event.
|
|
54
|
+
|
|
55
|
+
event.detail: `{ open, key, href, link, panel }`. `open` is a boolean, `key` is the row’s ID or link `href`, and `href`, `link` and `panel` are set while open and `null` on close.
|
|
56
|
+
|
|
57
|
+
### mero:dirty
|
|
58
|
+
|
|
59
|
+
Fires on a `form[data-mero-dirty]` when its dirty state changes between clean and modified. Does not fire at load or from `MeroUI.init()`. Requires `mero-forms.js`.
|
|
60
|
+
|
|
61
|
+
event.detail: `{ dirty, form }`. `dirty` is a boolean and `form` is the form element.
|
|
62
|
+
|
|
63
|
+
### mero:boost-unmatched
|
|
64
|
+
|
|
65
|
+
Fires on a boosted non-GET element (or on `document` when detached) when the server’s response does not contain the `data-mero-boost` region. Mero cancels the swap and keeps the current page instead of navigating to the action URL with GET.
|
|
66
|
+
|
|
67
|
+
event.detail: `{ source, status, method, url, text, response }`. `source` is the requesting element, `status` is the HTTP status code (or 0), `method` is the uppercase HTTP method, `url` is the final response or action URL, `text` is the raw response body and `response` is the htmx response object.
|
|
68
|
+
|
|
39
69
|
### mero:query
|
|
40
70
|
|
|
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,
|
|
71
|
+
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 `mero:select` or the native `change` event on the input, both of which bubble.
|
|
42
72
|
|
|
43
73
|
### mero:action
|
|
44
74
|
|
|
45
75
|
Fires on a `data-mero-action` button or a `data-mero-form` when its request starts and when it ends, or on the document when a swap removed the element. Requires `mero-forms.js`.
|
|
46
76
|
|
|
47
|
-
event.detail: `{ state, status, message }`. `state` is `pending`, `succeeded`, `rejected` or `unknown`. `status` and `message` are set once the request ends
|
|
77
|
+
event.detail: `{ state, status, message, source, id }`. `state` is `pending`, `succeeded`, `rejected` or `unknown`. `source` is the originating form or button (even when detached by a swap) and `id` is its `id` or `null`. `status` and `message` are set once the request ends; `status` is 0 when no response arrived.
|
|
48
78
|
|
|
49
79
|
### mero:refresh
|
|
50
80
|
|
|
@@ -87,9 +117,9 @@ HX-Trigger: {"mero:form-saved":{"message":"Saved"}}
|
|
|
87
117
|
|
|
88
118
|
Opens a `<dialog>` as a modal. Pass the element or its ID. Focus returns to `trigger` on close, by default the element focused when you call it.
|
|
89
119
|
|
|
90
|
-
### MeroUI.close(dialog, { focus, value })
|
|
120
|
+
### MeroUI.close(dialog, { focus, value, preserveToasts })
|
|
91
121
|
|
|
92
|
-
Closes an open dialog. `focus` overrides where focus returns. `value` becomes the dialog’s `returnValue`.
|
|
122
|
+
Closes an open dialog. `focus` overrides where focus returns. `value` becomes the dialog’s `returnValue`. Set `preserveToasts: true` to move live toasts inside the dialog to `document.body` instead of removing them.
|
|
93
123
|
|
|
94
124
|
### MeroUI.toast(message, { tone, duration, trigger })
|
|
95
125
|
|
|
@@ -97,7 +127,15 @@ Shows a notification. `tone` is `accent`, `success`, `warning` or `danger`. `dur
|
|
|
97
127
|
|
|
98
128
|
### MeroUI.init(root)
|
|
99
129
|
|
|
100
|
-
Sets up tabs, listboxes, comboboxes
|
|
130
|
+
Sets up tabs, listboxes, comboboxes, auto-opening dialogs, and—when loaded—`mero-forms.js` state helpers (`data-mero-dirty`, `data-mero-show-when`, `data-mero-confirm`) and `mero-live.js` polling inside `root`. Mero calls it for every htmx swap. Call it yourself for markup you insert another way.
|
|
131
|
+
|
|
132
|
+
### MeroUI.cleanup(root)
|
|
133
|
+
|
|
134
|
+
Tears down Mero state inside `root` before removing it outside htmx: stops and aborts `data-mero-live` polls, clears tracked tooltips and closes any open row preview in `root`.
|
|
135
|
+
|
|
136
|
+
### MeroUI.configure({ messages, locale, dialogBackdrop })
|
|
137
|
+
|
|
138
|
+
Configures runtime strings (`messages`), default formatting locale (`locale`, or `"document"` / `"browser"`) and backdrop light-dismiss scope (`dialogBackdrop`: `"all"` or `"mero-only"`). Returns the resolved configuration snapshot.
|
|
101
139
|
|
|
102
140
|
## Component attributes
|
|
103
141
|
|
|
@@ -107,6 +145,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
107
145
|
- `data-mero-close` — On a control inside a dialog. Closes it. The value becomes the dialog’s `returnValue`.
|
|
108
146
|
- `data-mero-autoopen` — On a dialog. Opens it as soon as it is on the page or swapped in.
|
|
109
147
|
- `data-mero-static` — On a dialog. A click on the backdrop does not close it.
|
|
148
|
+
- `data-mero-dialog` — On a dialog without `.mero-dialog`. Opts the dialog into backdrop light-dismiss when `MeroUI.configure({ dialogBackdrop: "mero-only" })` is set.
|
|
110
149
|
- `data-mero-toast` — On a button. Shows the value as a notification on click.
|
|
111
150
|
- `data-mero-tone` — With `data-mero-toast`. One of `accent`, `success`, `warning` or `danger`.
|
|
112
151
|
- `data-mero-toggle` — On a button. Flips `aria-pressed` on click.
|
|
@@ -121,6 +160,10 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
121
160
|
- `data-mero-combo` — Root of a combobox. Wraps the `role="combobox"` input and its options.
|
|
122
161
|
- `data-mero-combo-remote` — On the combobox root when the options come from your server. Mero then leaves filtering to the response.
|
|
123
162
|
- `data-mero-combo-status` — Inside a combobox. The element that receives loading and error text.
|
|
163
|
+
- `data-mero-multiselect` — With `data-mero-combo`. Turns a combobox into a multi-select tag picker whose selected chips submit as hidden inputs and emit `mero:selection`. See the [Combo Box](components/combo-box.md) Multi-select variant.
|
|
164
|
+
- `data-mero-multiselect-chips` — Inside a `data-mero-multiselect`. The list element holding selected `.mero-chip` items and their hidden inputs.
|
|
165
|
+
- `data-mero-multiselect-name` — On a `data-mero-multiselect`. The field `name` used for generated hidden inputs.
|
|
166
|
+
- `data-mero-multiselect-remove` — On a chip’s remove button inside `data-mero-multiselect`. Removes the chip, updates `aria-selected` and moves focus to a neighbour or the combobox input.
|
|
124
167
|
- `data-mero-empty-option` — On the option to show when nothing matches. It cannot be selected.
|
|
125
168
|
- `data-mero-active` (set by Mero) — On the option highlighted with the keyboard.
|
|
126
169
|
- `data-mero-combo-pending` (set by Mero) — On the combobox input while a request for options is in flight.
|
|
@@ -138,12 +181,14 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
138
181
|
- `data-mero-restore-focus` — On a list container. After Back to this page, focuses the link in it that was opened. Links are matched by `href`.
|
|
139
182
|
- `data-mero-copy-target` — On a button. A selector for an input, textarea or element whose value or text the button copies, then confirms with a “Copied” notification. When the browser blocks clipboard access, Mero selects the text instead. Prefer it for secrets. See the [Button](components/button.md) Copy to clipboard variant.
|
|
140
183
|
- `data-mero-copy-message` — With `data-mero-copy` or `data-mero-copy-target`. Replaces the “Copied” notification.
|
|
141
|
-
- `data-mero-time` — On a `<time datetime>`. Rewrites its text in the
|
|
184
|
+
- `data-mero-time` — On a `<time datetime>`. Rewrites its text in the resolved locale and reader’s time zone: `absolute` (date and time), `date`, `time` or `relative` (“5 minutes ago”, refreshed every minute, with the full date in `title`). Follows a differing `[lang]` ancestor automatically, or `data-mero-locale` / `MeroUI.configure({ locale })`. Render the UTC time as its text for readers without scripts. See the [Typography](components/typography.md) Local time variant.
|
|
185
|
+
- `data-mero-locale` — On a `<time data-mero-time>`, a `data-mero-live` region or an ancestor. Overrides the BCP-47 locale used to format dates and times, or accepts `document` (follow `[lang]`) or `browser` (always use the browser locale).
|
|
142
186
|
- `data-mero-shortcut` — On a control. A single key such as `/` or `n`, or a two-key sequence such as `g r`, that focuses a field or clicks anything else. Ignored while typing in a field, in a menu, list, tab list, grid or combobox, with Ctrl, Cmd or Alt held, and outside an open modal dialog. Mero sets `aria-keyshortcuts` for single keys. See the [Kbd](components/kbd.md) Keyboard shortcuts variant.
|
|
143
187
|
- `data-mero-shortcuts-toggle` — On a checkbox, switch, `menuitemcheckbox` or button. Turns single-key shortcuts off and on for every page in this browser, as WCAG 2.1.4 requires, and removes `aria-keyshortcuts` while they are off. Mero keeps its checked or pressed state in step.
|
|
144
188
|
- `data-mero-focus-fallback` — On one focusable element inside an htmx swap target, or inside a `data-mero-restore-focus` container. When a swap or morph removes the focused element and leaves focus on the page body, Mero focuses the same element if it survived, else the element with its ID, else this fallback. Mero only acts when focus was inside the target as the swap began, never after the person moved focus elsewhere, and a server `autofocus` wins.
|
|
145
189
|
- `data-mero-focus-manual` — On an htmx swap target, or an ancestor. Mero leaves focus after swaps inside it to your own code.
|
|
146
|
-
- `data-mero-boost` — On an element with `hx-boost:inherited`, such as `<body>`. A selector for the region every boosted page contains. The newest
|
|
190
|
+
- `data-mero-boost` — On an element with `hx-boost:inherited`, such as `<body>`. A selector for the region every boosted page contains. Guards both boosted requests and declarative `hx-get` requests whose target is or contains the region (unless opted out with `data-mero-boost-ignore`), automatically selecting the region from full-page answers when the control omits `hx-select`. The newest GET wins and older ones are aborted; boosted forms that change data are never aborted. A guarded GET response without the region and without `HX-Redirect`, `HX-Location` or `HX-Refresh`, or a GET that fails without a response, becomes a full page load. A boosted non-GET response without the region cancels the swap, leaves the page intact and fires `mero:boost-unmatched` instead of issuing a GET to the action URL. When a guarded page swaps in, open dialogs other than static and alert dialogs close, and focus moves to the region unless htmx `autofocus` placed it or the person moved it during the load. See the [Drawer](components/drawer.md) Boosted navigation variant.
|
|
191
|
+
- `data-mero-boost-ignore` — On a control or ancestor inside a `data-mero-boost` container. Opts declarative `hx-get` fragment requests targeting the boosted region out of the boost guard, automatic region selection, dialog closing and full-load fallback.
|
|
147
192
|
- `data-mero-pending` — On any element. Shows a `.mero-indicator` inside it, as `.htmx-request` does.
|
|
148
193
|
- `data-mero-request` — With a pending state. Sets a progress cursor on the element.
|
|
149
194
|
|
|
@@ -155,7 +200,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
155
200
|
- `data-mero-confirm-reason` — On the optional reason field. Add `required` to require a non-empty, trimmed value.
|
|
156
201
|
- `data-mero-confirm-submit` — On the danger submit button. Render it disabled until the phrase and any required reason are ready.
|
|
157
202
|
- `data-mero-confirm-hint` — A polite status in the form explaining what still needs to be entered. Associate it with the input and the confirm button.
|
|
158
|
-
- `data-mero-form` — On a form that htmx submits. Disables its submit buttons while the request runs, swaps in the replacement form on HTTP 422 and focuses the first invalid field. Reports the outcome like `data-mero-action`: the submitter gets `data-mero-action-state`, the form fires `mero:action`, and `Mero-Action-Outcome` and `Mero-Action-Message` override the state and the error text. A `mero:form-saved` trigger only acts on a succeeded outcome. A succeeded `Mero-Action-Message` shows as a toast.
|
|
203
|
+
- `data-mero-form` — On a form that htmx submits. Disables its submit buttons and marks editable fields and multi-select containers `inert` while the request runs (without affecting submitted form data; pass `data-mero-form="keep-editable"` for composers that preserve mid-flight drafts), swaps in the replacement form on HTTP 422 and focuses the first invalid field. Reports the outcome like `data-mero-action`: the submitter gets `data-mero-action-state`, the form fires `mero:action`, and `Mero-Action-Outcome` and `Mero-Action-Message` override the state and the error text. A `mero:form-saved` trigger only acts on a succeeded outcome. A succeeded `Mero-Action-Message` shows as a toast.
|
|
159
204
|
- `data-mero-clear-passwords` — On a `data-mero-form`. Empties its password fields after every response, whatever the outcome, and in the replacement form after a 422.
|
|
160
205
|
- `data-mero-action` — On a button outside a form that makes an htmx request. Shows its outcome and ignores clicks while the request runs. `Mero-Action-Outcome` and `Mero-Action-Message` response headers override the state and the text.
|
|
161
206
|
- `data-mero-action-state` (set by Mero) — On a `data-mero-action` button, or on the button that submitted a `data-mero-form` (the form itself when there is none): `pending`, then `succeeded` (2xx), `rejected` (4xx other than 408) or `unknown` (anything else, including network errors, timeouts and a request aborted after it was sent). A request cancelled before it was sent clears the state.
|
|
@@ -168,8 +213,12 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
168
213
|
- `data-mero-form-error` — Inside the form. Receives the message when a request fails with a status other than 422. Send your own text in a `Mero-Form-Error` response header.
|
|
169
214
|
- `data-mero-return-focus` — On the form. Selector for the element to focus after `mero:form-saved`.
|
|
170
215
|
- `data-mero-fallback-focus` — On the form. Selector to focus when the return-focus element is gone.
|
|
171
|
-
- `data-mero-show-when` — On a branch inside a form, ideally a `<fieldset>`. `field=value other` shows the branch while the form’s field has one of the values and hides and disables it otherwise, so its fields neither validate nor submit. Render the right state on the server too. See the [Fieldset](components/fieldset.md) Conditional fields variant.
|
|
172
|
-
- `data-mero-
|
|
216
|
+
- `data-mero-show-when` — On a branch inside a form, ideally a `<fieldset>`. `field=value other` shows the branch while the form’s field has one of the values (or `field!=value other` when it has none of them) and hides and disables it otherwise, so its fields neither validate nor submit. Render the right state on the server too. See the [Fieldset](components/fieldset.md) Conditional fields variant.
|
|
217
|
+
- `data-mero-show-when-keep-enabled` — With `data-mero-show-when`. Hides the branch visually without disabling its controls, so hidden fields still submit.
|
|
218
|
+
- `data-mero-dirty` — On a form. Keeps its submit buttons disabled until a field or `data-mero-multiselect` differs from the value the server rendered, emits `mero:dirty` on transitions, and resets its baseline after `mero:form-saved` when the form stays in the page.
|
|
219
|
+
- `data-mero-dirty-guard` — With `data-mero-dirty`. Prompts before boosted navigation or page unload while the form has unsaved edits. Optional value overrides the confirmation message.
|
|
220
|
+
- `data-mero-conflict-swap` — On a `data-mero-form`. Allows HTTP 409 responses to swap a conflict or merge replacement form (like HTTP 422) without overwriting the form error banner.
|
|
221
|
+
- `data-mero-conflict-focus` — On a control inside a swapped 409 conflict form. Receives focus automatically after the swap, ahead of `aria-invalid`.
|
|
173
222
|
- `data-mero-close-all` — On a form in a nested dialog. A save closes the parent dialogs too.
|
|
174
223
|
- `data-mero-hold` — Keeps the page while something the person cannot get back is on its way or on screen. On a `data-mero-form` or `data-mero-action` button it holds while the request is pending. On a `data-mero-ephemeral` element it holds while the element has content. While held, Mero cancels boosted navigation, history restores and requests whose target is the body or contains the held element, undoes Back to another htmx history entry and asks before the page unloads. Requests from controls inside the held content still run. The value is the warning shown as a toast; empty uses a generic text. See the [Form](components/form.md) One-time credential variant.
|
|
175
224
|
- `data-mero-ephemeral` — On the element that receives a one-time secret, such as a new API token. Mero empties it when its dialog closes, when a `data-mero-ephemeral-dismiss` button inside it is activated, and when the page is hidden, so the back-forward cache cannot show it again. Add `data-mero-hold` to keep the page while it has content.
|
|
@@ -259,7 +308,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
259
308
|
- `data-mero-theme-scope` — On a section. Receives the theme chosen in the picker inside it.
|
|
260
309
|
- `data-mero-theme-picker` — On a select or radio. Its value becomes the scope’s `data-theme`.
|
|
261
310
|
- `data-mero-cutoff-hour` — Around a `<time>`. Counts down to that hour, 0 to 23 in UTC.
|
|
262
|
-
- `data-mero-check-form` —
|
|
311
|
+
- `data-mero-check-form` — Deprecated. Demo-only validation form hook; will be removed in 1.0.
|
|
263
312
|
|
|
264
313
|
## State Mero owns
|
|
265
314
|
|
|
@@ -276,7 +325,7 @@ The native and ARIA state Mero writes besides the attributes marked set by Mero
|
|
|
276
325
|
- 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
326
|
- 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
327
|
- 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
|
|
328
|
+
- Form (mero-forms.js) — On a `data-mero-form` while its request runs: `aria-busy` on the form, `disabled` on its submit buttons and `inert` on its editable fields, reset buttons and multi-select containers (restored when the request ends if the form survives). `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
329
|
- 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
330
|
- Typed confirmation (mero-forms.js) — `disabled` on `data-mero-confirm-submit`. The value of `data-mero-confirm-input`, cleared when its dialog closes.
|
|
282
331
|
- Show-when (mero-forms.js) — `hidden` on the branch, and `disabled` on a fieldset branch and on the controls inside a branch.
|
|
@@ -293,6 +342,7 @@ The `Mero-*` HTTP headers. Your server sends the response headers. Mero sends th
|
|
|
293
342
|
- `Mero-Action-Message` (response, mero-forms.js) — Text to show for the outcome of a `data-mero-action` or `data-mero-form` request.
|
|
294
343
|
- `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
344
|
- `Mero-Live` (response, mero-live.js) — `done` on the final successful read of a `data-mero-live` region. Polling stops.
|
|
345
|
+
- `Mero-Live-Interval` (response, mero-live.js) — Positive interval in milliseconds returned on a successful `data-mero-live` read to adjust subsequent polling cadence.
|
|
296
346
|
- `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
347
|
|
|
298
348
|
## With Alpine or your own scripts
|
|
@@ -300,9 +350,9 @@ The `Mero-*` HTTP headers. Your server sends the response headers. Mero sends th
|
|
|
300
350
|
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
351
|
|
|
302
352
|
- 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:
|
|
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
|
|
305
|
-
- Combobox — Use `x-model.lazy` on the combobox input. Choosing an option fires `change` and
|
|
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
|
|
353
|
+
- Listen, do not read — Put `x-on:mero:selection`, `x-on:mero:tab`, `x-on:mero:toggle`, `x-on:mero:select`, `x-on:mero:dialog` or `x-on:mero:dirty` on an `x-data` ancestor of the component. Each 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.
|
|
354
|
+
- mero:action — For a form or `data-mero-action` button that stays in the page, or a form 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 element and leaves no replacement, the final event fires on the document; use `@mero:action.window` on an Alpine component or a native listener on `document`. The detail is `{ state, source, id }` while pending and `{ state, status, message, source, id }` at the end, so a window listener can identify which form or button settled by `id` or `source` even after removal. Tested with `data-mero-form` and `data-mero-action` across succeeded, rejected and unknown outcomes.
|
|
355
|
+
- Combobox — Use `@mero:select` or `x-model.lazy` on the combobox input. Choosing an option fires `change` and `mero:select`, and never fires a synthetic `input` event (so remote comboboxes do not trigger a redundant server search).
|
|
356
|
+
- 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`, `mero:dirty` and `data-mero-show-when` keep their old state.
|
|
357
|
+
- htmx swaps — After an `innerHTML` swap into an `x-data` element, and after an `innerMorph` or `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.
|
|
358
|
+
- Markup Alpine inserts or removes — Mero does not watch `x-if` or `x-teleport` insertions automatically. Call `MeroUI.init(el)` on the inserted element to set up tabs, `mero-forms.js` state helpers (`data-mero-dirty`, `data-mero-show-when`, `data-mero-confirm`) and `mero-live.js` polling (`mero-live.js` also invokes `htmx.process()` on an unprocessed live region; call `htmx.process(el)` explicitly for any other manually inserted `hx-*` controls). Repeated calls do not duplicate setup and reconcile state that changed between calls. Call `MeroUI.cleanup(el)` before removing a subtree with a `data-mero-live` region so pending polls stop immediately.
|
package/agent-docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mero UI
|
|
2
2
|
|
|
3
|
-
> Mero UI 0.
|
|
3
|
+
> Mero UI 0.10.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
|
|