@rubenlangeweg/mero-ui 0.7.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.
- package/CHANGELOG.md +25 -0
- package/README.md +25 -4
- package/agent-docs/components/accordion.md +1 -1
- package/agent-docs/components/action-bar.md +1 -1
- package/agent-docs/components/action-button.md +32 -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 +32 -1
- package/agent-docs/components/calendar.md +3 -3
- package/agent-docs/components/card.md +56 -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 +1 -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 +30 -0
- 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 +83 -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 +36 -4
- 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 +45 -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 +155 -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 +32 -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 +34 -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 +35 -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 +69 -0
- 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 +43 -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 +58 -1
- package/agent-docs/components/tabs.md +24 -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 +24 -1
- package/agent-docs/components/validator.md +1 -1
- package/agent-docs/components/visually-hidden.md +27 -0
- package/agent-docs/components/widget.md +1 -1
- package/agent-docs/components/window-mockup.md +1 -1
- package/agent-docs/llms-components.txt +989 -194
- package/agent-docs/llms-full.txt +1079 -206
- package/agent-docs/llms-patterns.txt +91 -13
- package/agent-docs/llms.txt +5 -2
- package/package.json +4 -1
- package/ui/insight-charts.mjs +1 -1
- package/ui/insight-markdown.mjs +1 -1
- package/ui/mero-collections.css +1 -7
- package/ui/mero-collections.js +1 -1
- package/ui/mero-composition.css +1 -1
- package/ui/mero-composition.js +1 -1
- package/ui/mero-forms.js +415 -27
- package/ui/mero-gallery.css +1 -1
- package/ui/mero-gallery.js +1 -1
- package/ui/mero-insights.css +1 -1
- package/ui/mero-insights.js +1 -1
- package/ui/mero-inventory.css +1 -1
- package/ui/mero-inventory.js +1 -1
- package/ui/mero-layouts.css +1 -4
- package/ui/mero-live.js +25 -4
- package/ui/mero-workspace.css +1 -1
- package/ui/mero-workspace.js +1 -1
- package/ui/mero.css +104 -5
- package/ui/mero.js +220 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Mero UI 0.
|
|
1
|
+
# Mero UI 0.9.0 integration patterns
|
|
2
2
|
|
|
3
3
|
## Install a component
|
|
4
4
|
|
|
@@ -24,15 +24,27 @@ 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
|
|
|
33
|
-
Fires on a `data-mero-action` button when its request starts and when it ends, or on the document when a swap removed the
|
|
45
|
+
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`.
|
|
34
46
|
|
|
35
|
-
event.detail: `{ state, status, message }`. `state` is `pending`, `succeeded`, `rejected` or `unknown`. `status` and `message` are set once the request ends.
|
|
47
|
+
event.detail: `{ state, status, message }`. `state` is `pending`, `succeeded`, `rejected` or `unknown`. `status` and `message` are set once the request ends. `status` is 0 when no response arrived.
|
|
36
48
|
|
|
37
49
|
### mero:refresh
|
|
38
50
|
|
|
@@ -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
|
|
|
@@ -104,7 +116,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
104
116
|
- `data-mero-accordion` — On the parent of `<details>` elements. Only one stays open at a time.
|
|
105
117
|
- `data-mero-radio-group` — Around radios that sit outside a form. Repeated copies with the same `name` stay independent.
|
|
106
118
|
- `data-mero-radio-owner` (set by Mero) — On the hidden form Mero adds to own those radios.
|
|
107
|
-
- `data-mero-scope` — On a repeated snippet or fragment. Mero renames duplicate IDs inside it and updates `for`, ARIA, `popovertarget`, `data-mero-open` and ID selectors in `hx-target`, `data-mero-return-focus` and `data-mero-
|
|
119
|
+
- `data-mero-scope` — On a repeated snippet or fragment. Mero renames duplicate IDs inside it and updates `for`, ARIA, `popovertarget`, `data-mero-open` and ID selectors in `hx-target`, `data-mero-return-focus`, `data-mero-fallback-focus`, `data-mero-action-unknown`, `data-mero-action-reread` and `data-mero-ephemeral-dismiss` to match.
|
|
108
120
|
- `data-mero-listbox` — On a `role="listbox"`. Adds arrow-key navigation and selection, and fires `mero:selection`.
|
|
109
121
|
- `data-mero-combo` — Root of a combobox. Wraps the `role="combobox"` input and its options.
|
|
110
122
|
- `data-mero-combo-remote` — On the combobox root when the options come from your server. Mero then leaves filtering to the response.
|
|
@@ -118,12 +130,20 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
118
130
|
- `data-mero-tooltip-below` (set by Mero) — On a tooltip placed below its anchor because there is no room above.
|
|
119
131
|
- `data-mero-tooltip-dismissed` (set by Mero) — On a tooltip closed with Escape, until the pointer and focus leave it.
|
|
120
132
|
- `data-mero-cell-label` — On an `aria-hidden="true"` span inside a table cell. Copy its column heading here for the card layout. Add `mero-table-cards` to the table wrapper for cards below 768 px, or `mero-table-cards-wide` for 1024 px. See the [Sortable Table](components/sortable-table.md) for the table roles and sort links.
|
|
133
|
+
- `data-mero-card-hidden` — On a `th` or `td` in a `mero-table-cards` table. Hides that column in the card layout below 768 px, or 1024 px with `mero-table-cards-wide`. Put it on the column's header and on each of its cells. See the [Table](components/table?variant=Cards%20on%20phones.md).
|
|
121
134
|
- `data-mero-command` — On a `<dialog>` holding a remote combobox. Cmd or Ctrl K opens it with an empty query, and choosing an option runs that option’s link, `hx-*` request or toast. Give the shortcut to one command menu per page, including the workspace Command. Group server results with `role="group"` and `aria-labelledby` pointing to a visible heading. Give each option a unique ID. Up and Down cross groups, Home and End reach the first and last result, and the status counts selectable options. Omit empty groups and return one disabled “No results” option when nothing matches.
|
|
122
135
|
- `data-mero-peek` — Around a table wrapper whose rows have a `.mero-row-link`. With a row link focused, Space shows the row’s `data-mero-peek-body` template in a Preview panel beside the table, or in a bottom sheet below 768 px. While it is open, Up and Down Arrow move between rows and the panel follows focus. Space or Escape closes it and focuses the row. See the [Sortable Table](components/sortable-table.md) Row peek variant.
|
|
123
136
|
- `data-mero-peek-body` — On a `<template>` inside a row of a `data-mero-peek` table. Holds the server-rendered preview for that row. Give the row a stable `id` so the preview follows it through swaps; otherwise Mero matches the row link’s `href`.
|
|
124
137
|
- `data-mero-peek-close` (set by Mero) — On the Close button of the Preview panel Mero adds.
|
|
125
138
|
- `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`.
|
|
126
|
-
- `data-mero-
|
|
139
|
+
- `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
|
+
- `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 reader’s locale and time zone: `absolute` (date and time), `date`, `time` or `relative` (“5 minutes ago”, refreshed every minute, with the full date in `title`). Render the UTC time as its text for readers without scripts. See the [Typography](components/typography.md) Local time variant.
|
|
142
|
+
- `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
|
+
- `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
|
+
- `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
|
+
- `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 boosted GET wins and older ones are aborted; boosted forms that change data are never aborted. A 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. When a boosted 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.
|
|
127
147
|
- `data-mero-pending` — On any element. Shows a `.mero-indicator` inside it, as `.htmx-request` does.
|
|
128
148
|
- `data-mero-request` — With a pending state. Sets a progress cursor on the element.
|
|
129
149
|
|
|
@@ -135,22 +155,34 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
135
155
|
- `data-mero-confirm-reason` — On the optional reason field. Add `required` to require a non-empty, trimmed value.
|
|
136
156
|
- `data-mero-confirm-submit` — On the danger submit button. Render it disabled until the phrase and any required reason are ready.
|
|
137
157
|
- `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.
|
|
138
|
-
- `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.
|
|
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.
|
|
159
|
+
- `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.
|
|
139
160
|
- `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.
|
|
140
|
-
- `data-mero-action-state` (set by Mero) — On a `data-mero-action` button: `pending`, then `succeeded` (2xx), `rejected` (4xx other than 408) or `unknown` (anything else, including network errors).
|
|
161
|
+
- `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.
|
|
162
|
+
- `data-mero-action-expect` — On a `data-mero-action` button, a `data-mero-form` or its submit button. A selector the response body must contain. A success without a match becomes `unknown`, is not swapped and does not show the server’s success message. Use it when the response carries something the person cannot get again, such as a new token.
|
|
163
|
+
- `data-mero-action-unknown` — On a `data-mero-action` button, a `data-mero-form` or its submit button. The text to show for an unknown outcome when the server sent no `Mero-Action-Message`, or `#id` of a hidden recovery panel to reveal. Mero hides the panel again when the next request starts. Wrap a `.mero-alert` in the hidden element, because the alert sets its own display.
|
|
164
|
+
- `data-mero-action-reread` — On a `data-mero-action` button, a `data-mero-form` or an ancestor. A selector for the region to read again after an `unknown` outcome. Mero GETs the current page with a `Mero-Reread` request header, morphs the region from the response and shows the unknown message again. It never repeats the action. The answer is dropped when it is not a 2xx, lacks the region, the URL changed or a newer read started. See the [Action Button](components/action-button.md) Re-read after unknown variant.
|
|
141
165
|
- `data-mero-action-status` — A live region next to the button. Receives the outcome message and a `data-tone`. Without one, the message shows as a toast.
|
|
166
|
+
- `data-mero-search` — On a search or filter form whose htmx GET replaces a list. A failed read never replaces the list: Mero skips the swap of a non-2xx response and of a response without the `hx-select` region, shows a message in `data-mero-search-error` and, once no search is pending, returns selects, checkboxes and radios to the values of the list on screen. Text the person typed stays. A redirected response without the region, such as a login page, loads as a full page. Use `hx-sync="this:replace"` so the newest search wins. See the [Search Field](components/search-field.md) Filtered list variant.
|
|
167
|
+
- `data-mero-search-error` — Inside a `data-mero-search` form. A hidden alert that receives the failure message and hides again after the next successful read. Its attribute value, when set, is the message; otherwise Mero uses `Mero-Form-Error` or a default.
|
|
142
168
|
- `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.
|
|
143
169
|
- `data-mero-return-focus` — On the form. Selector for the element to focus after `mero:form-saved`.
|
|
144
170
|
- `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-dirty` — On a form. Keeps its submit buttons disabled until a field differs from the value the server rendered, and again once every field is back to that value.
|
|
145
173
|
- `data-mero-close-all` — On a form in a nested dialog. A save closes the parent dialogs too.
|
|
174
|
+
- `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
|
+
- `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.
|
|
176
|
+
- `data-mero-ephemeral-dismiss` — On a button inside a `data-mero-ephemeral` element. Empties that element. The optional value is a selector to focus afterwards; otherwise the emptied element takes focus.
|
|
146
177
|
|
|
147
178
|
### Live progress · mero-live.js
|
|
148
179
|
|
|
149
180
|
- `data-mero-live` — On a region with `hx-get` and `hx-trigger="mero:refresh"`. Its value is the interval in milliseconds, 3000 by default. Polling pauses while the page is hidden. Send `Mero-Live: done` on the final successful response.
|
|
150
181
|
- `data-mero-live-status` — Use this polite status region as the innerHTML target. Return a status label as an HTML fragment. Mero skips a repeated label so it is announced once.
|
|
151
|
-
- `data-mero-live-error` — An initially empty status region that announces a failed read. The last good status stays visible until a successful read.
|
|
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.
|
|
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.
|
|
152
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.
|
|
153
|
-
- `data-mero-live-done` — On an operation with a final status. Mero sets it after a successful response with the terminal header
|
|
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.
|
|
154
186
|
|
|
155
187
|
### Gallery · mero-gallery.js
|
|
156
188
|
|
|
@@ -182,7 +214,7 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
182
214
|
- `data-mero-series` — On each chart mark. Arrow up and down move between series at the same category.
|
|
183
215
|
- `data-mero-plot-readout` — Receives the text of the active mark for assistive technology.
|
|
184
216
|
- `data-mero-plot-tooltip` — The tooltip positioned at the active mark.
|
|
185
|
-
- `data-mero-copy` — On a button in a code block or chat message
|
|
217
|
+
- `data-mero-copy` — On a button in a code block or chat message, empty: copies the code or the message text (`mero-insights.js`). With a value, on any button: copies that text and confirms it with a notification (`mero.js`).
|
|
186
218
|
- `data-mero-copy-label` (set by Mero) — On a copy button. Its original label, restored after “Copied”.
|
|
187
219
|
- `data-mero-message-text` — Inside a chat message. The text a copy button copies.
|
|
188
220
|
- `data-mero-reaction` — On a reaction button. Toggles `aria-pressed`, updates the count and fires `mero:reaction`.
|
|
@@ -228,3 +260,49 @@ Sets up tabs, listboxes, comboboxes and auto-opening dialogs inside `root`. Mero
|
|
|
228
260
|
- `data-mero-theme-picker` — On a select or radio. Its value becomes the scope’s `data-theme`.
|
|
229
261
|
- `data-mero-cutoff-hour` — Around a `<time>`. Counts down to that hour, 0 to 23 in UTC.
|
|
230
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.
|
package/agent-docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mero UI
|
|
2
2
|
|
|
3
|
-
> Mero UI 0.
|
|
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
|
|
|
@@ -22,7 +22,6 @@ Choose a component to find its variants, templates and required assets. Use the
|
|
|
22
22
|
- [Data Grid](components/data-grid.md) — Search, sort, select and edit products in a server-rendered collection.
|
|
23
23
|
- [Action Bar](components/action-bar.md) — Select records and apply one status change to the selection.
|
|
24
24
|
- [Agenda](components/agenda.md) — Browse daily bookings and add a timed event.
|
|
25
|
-
- [Empty State](components/empty-state.md) — Explain an empty result and give the user a relevant next action.
|
|
26
25
|
- [File Tree](components/file-tree.md) — Expand folders and preview a selected file with native disclosure controls.
|
|
27
26
|
- [Floating TOC](components/floating-toc.md) — Navigate to sections with an index that follows the reading position.
|
|
28
27
|
- [Hover Card](components/hover-card.md) — Preview a contributor on hover, focus or tap.
|
|
@@ -183,6 +182,7 @@ Choose a component to find its variants, templates and required assets. Use the
|
|
|
183
182
|
## Feedback
|
|
184
183
|
|
|
185
184
|
- [Alert](components/alert.md) — Place status or guidance alongside the content it describes.
|
|
185
|
+
- [Empty State](components/empty-state.md) — Explain an empty result and give the user a relevant next action.
|
|
186
186
|
- [Meter](components/meter.md) — Show a measurement between known bounds.
|
|
187
187
|
- [Live Progress](components/live-progress.md) — Follow a deployment through to its final status.
|
|
188
188
|
- [Progress Bar](components/progress-bar.md) — Report measurable progress toward completion.
|
|
@@ -193,6 +193,7 @@ Choose a component to find its variants, templates and required assets. Use the
|
|
|
193
193
|
## Layout
|
|
194
194
|
|
|
195
195
|
- [Card](components/card.md) — Group related content and an action into one compact surface.
|
|
196
|
+
- [Page Header](components/page-header.md) — Open a page with its title, a short description and the page’s main actions.
|
|
196
197
|
- [Separator](components/separator.md) — Separate related content sections using a semantic rule.
|
|
197
198
|
- [Surface](components/surface.md) — Give related content a tonal background with shared theme tokens.
|
|
198
199
|
- [Toolbar](components/toolbar.md) — Keep nearby actions aligned and grouped by purpose.
|
|
@@ -217,6 +218,7 @@ Choose a component to find its variants, templates and required assets. Use the
|
|
|
217
218
|
|
|
218
219
|
- [Badge](components/badge.md) — Label a status using text and a semantic tone.
|
|
219
220
|
- [Chip](components/chip.md) — Display a lightweight label for an attribute or filter value.
|
|
221
|
+
- [Description List](components/description-list.md) — Show a record’s fields as label and value pairs.
|
|
220
222
|
- [Table](components/table.md) — Show comparable records in a native table with column headers.
|
|
221
223
|
- [Sortable Table](components/sortable-table.md) — Sort server-rendered rows from the column headers and open a row from anywhere in it.
|
|
222
224
|
- [Filter Chips](components/filter-chips.md) — Add filters from a menu, see them as chips and remove them one at a time. The URL keeps the state.
|
|
@@ -232,6 +234,7 @@ Choose a component to find its variants, templates and required assets. Use the
|
|
|
232
234
|
## Utilities
|
|
233
235
|
|
|
234
236
|
- [Scroll Shadow](components/scroll-shadow.md) — Expose a scrollable region with a visual cue that more content is available.
|
|
237
|
+
- [Visually Hidden](components/visually-hidden.md) — Give screen readers context that the visible text leaves implied.
|
|
235
238
|
|
|
236
239
|
## Composition
|
|
237
240
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubenlangeweg/mero-ui",
|
|
3
|
-
"version": "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
|
},
|
package/ui/insight-charts.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @rubenlangeweg/mero-ui 0.
|
|
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']);
|
package/ui/insight-markdown.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @rubenlangeweg/mero-ui 0.
|
|
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 => ({ '&':'&', '<':'<', '>':'>', '"':'"', "'":''' }[character]));
|
package/ui/mero-collections.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @rubenlangeweg/mero-ui 0.
|
|
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;
|
|
@@ -59,12 +59,6 @@
|
|
|
59
59
|
.mero-collection-message:empty { margin:0; }
|
|
60
60
|
.mero-collection-foot { margin-bottom:0; }
|
|
61
61
|
.mero-collection-empty { text-align:center; }
|
|
62
|
-
.mero-empty-state { padding:1.1rem; text-align:center; color:var(--mero-text); }
|
|
63
|
-
.mero-empty-state strong,.mero-empty-state p { display:block; margin:.3rem 0 0; }
|
|
64
|
-
.mero-empty-state p { color:var(--mero-muted); font-size:.79rem; }
|
|
65
|
-
.mero-empty-glyph { position:relative; display:inline-grid; place-items:center; width:2.5rem; height:2.5rem; border-radius:var(--mero-radius); background:var(--mero-raised); font:1.6rem/1 system-ui; }
|
|
66
|
-
.mero-empty-glyph::before { content:""; box-sizing:border-box; width:.85rem; height:.85rem; border:1.5px solid currentColor; border-radius:50%; transform:translate(-.09rem,-.09rem); }
|
|
67
|
-
.mero-empty-glyph::after { content:""; position:absolute; width:.45rem; height:1.5px; border-radius:1px; background:currentColor; transform:translate(.35rem,.35rem) rotate(45deg); }
|
|
68
62
|
.mero-agenda .mero-collection-actions button { display:grid; place-items:center; inline-size:2rem; min-block-size:2rem; padding:0; }
|
|
69
63
|
.mero-agenda .mero-collection-actions button span { box-sizing:border-box; inline-size:.44rem; block-size:.44rem; border:solid currentColor; border-width:1.5px 1.5px 0 0; transform:translateX(-.08rem) rotate(45deg); }
|
|
70
64
|
.mero-agenda button[data-agenda-action=previous] span, .mero-agenda button[data-agenda-action=next]:dir(rtl) span { transform:translateX(.08rem) rotate(-135deg); }
|
package/ui/mero-collections.js
CHANGED
package/ui/mero-composition.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @rubenlangeweg/mero-ui 0.
|
|
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) {
|
package/ui/mero-composition.js
CHANGED