@rubenlangeweg/mero-ui 0.0.0-stage → 0.7.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 +71 -0
- package/LICENSE +21 -0
- package/README.md +141 -2
- package/agent-docs/components/accordion.md +31 -0
- package/agent-docs/components/action-bar.md +45 -0
- package/agent-docs/components/action-button.md +42 -0
- package/agent-docs/components/agenda.md +38 -0
- package/agent-docs/components/alert-dialog.md +36 -0
- package/agent-docs/components/alert.md +25 -0
- package/agent-docs/components/app-layout.md +36 -0
- package/agent-docs/components/area-chart.md +36 -0
- package/agent-docs/components/aura.md +24 -0
- package/agent-docs/components/autocomplete.md +81 -0
- package/agent-docs/components/avatar-group.md +26 -0
- package/agent-docs/components/avatar.md +25 -0
- package/agent-docs/components/badge.md +26 -0
- package/agent-docs/components/bar-chart.md +36 -0
- package/agent-docs/components/breadcrumbs.md +28 -0
- package/agent-docs/components/browser-mockup.md +26 -0
- package/agent-docs/components/button-group.md +26 -0
- package/agent-docs/components/button.md +75 -0
- package/agent-docs/components/calendar.md +105 -0
- package/agent-docs/components/card.md +26 -0
- package/agent-docs/components/carousel.md +78 -0
- package/agent-docs/components/cell-color-picker.md +32 -0
- package/agent-docs/components/cell-select.md +32 -0
- package/agent-docs/components/cell-slider.md +32 -0
- package/agent-docs/components/cell-switch.md +32 -0
- package/agent-docs/components/chain-of-thought.md +26 -0
- package/agent-docs/components/chart-tooltip.md +36 -0
- package/agent-docs/components/chat-attachment.md +26 -0
- package/agent-docs/components/chat-conversation.md +61 -0
- package/agent-docs/components/chat-list-view.md +25 -0
- package/agent-docs/components/chat-loader.md +24 -0
- package/agent-docs/components/chat-message-actions.md +25 -0
- package/agent-docs/components/chat-message.md +24 -0
- package/agent-docs/components/chat-source.md +24 -0
- package/agent-docs/components/chat-tool.md +41 -0
- package/agent-docs/components/checkbox-button-group.md +29 -0
- package/agent-docs/components/checkbox-group.md +29 -0
- package/agent-docs/components/checkbox.md +25 -0
- package/agent-docs/components/chip.md +22 -0
- package/agent-docs/components/close-button.md +33 -0
- package/agent-docs/components/code-block.md +24 -0
- package/agent-docs/components/code-mockup.md +25 -0
- package/agent-docs/components/color-area.md +30 -0
- package/agent-docs/components/color-field.md +30 -0
- package/agent-docs/components/color-picker.md +28 -0
- package/agent-docs/components/color-slider.md +31 -0
- package/agent-docs/components/color-swatch.md +26 -0
- package/agent-docs/components/combo-box.md +41 -0
- package/agent-docs/components/command-menu.md +46 -0
- package/agent-docs/components/command.md +38 -0
- package/agent-docs/components/composed-chart.md +36 -0
- package/agent-docs/components/context-menu.md +31 -0
- package/agent-docs/components/countdown.md +26 -0
- package/agent-docs/components/data-grid.md +159 -0
- package/agent-docs/components/date-field.md +28 -0
- package/agent-docs/components/date-picker.md +30 -0
- package/agent-docs/components/date-range-picker.md +40 -0
- package/agent-docs/components/description.md +28 -0
- package/agent-docs/components/diff.md +43 -0
- package/agent-docs/components/disclosure-group.md +31 -0
- package/agent-docs/components/disclosure.md +25 -0
- package/agent-docs/components/dock.md +26 -0
- package/agent-docs/components/drawer.md +34 -0
- package/agent-docs/components/drop-zone.md +34 -0
- package/agent-docs/components/dropdown.md +31 -0
- package/agent-docs/components/emoji-picker.md +31 -0
- package/agent-docs/components/emoji-reaction-button.md +26 -0
- package/agent-docs/components/empty-state.md +24 -0
- package/agent-docs/components/error-message.md +25 -0
- package/agent-docs/components/fab.md +26 -0
- package/agent-docs/components/field-error.md +30 -0
- package/agent-docs/components/fieldset.md +38 -0
- package/agent-docs/components/file-input.md +32 -0
- package/agent-docs/components/file-tree.md +24 -0
- package/agent-docs/components/filter-chips.md +149 -0
- package/agent-docs/components/floating-toc.md +24 -0
- package/agent-docs/components/footer.md +24 -0
- package/agent-docs/components/form.md +35 -0
- package/agent-docs/components/hero.md +26 -0
- package/agent-docs/components/holo-card.md +33 -0
- package/agent-docs/components/hover-card.md +26 -0
- package/agent-docs/components/hover-gallery.md +78 -0
- package/agent-docs/components/indicator.md +24 -0
- package/agent-docs/components/inline-select.md +26 -0
- package/agent-docs/components/input-group.md +30 -0
- package/agent-docs/components/input-otp.md +30 -0
- package/agent-docs/components/input.md +28 -0
- package/agent-docs/components/item-card-group.md +24 -0
- package/agent-docs/components/item-card.md +24 -0
- package/agent-docs/components/join.md +24 -0
- package/agent-docs/components/joined-filter.md +28 -0
- package/agent-docs/components/kanban.md +26 -0
- package/agent-docs/components/kbd.md +22 -0
- package/agent-docs/components/kpi-group.md +24 -0
- package/agent-docs/components/kpi.md +24 -0
- package/agent-docs/components/label.md +28 -0
- package/agent-docs/components/line-chart.md +64 -0
- package/agent-docs/components/link.md +22 -0
- package/agent-docs/components/list-box.md +30 -0
- package/agent-docs/components/list-view.md +24 -0
- package/agent-docs/components/live-progress.md +38 -0
- package/agent-docs/components/map.md +26 -0
- package/agent-docs/components/markdown.md +36 -0
- package/agent-docs/components/mask.md +26 -0
- package/agent-docs/components/megamenu.md +26 -0
- package/agent-docs/components/menu-button.md +78 -0
- package/agent-docs/components/menu.md +24 -0
- package/agent-docs/components/meter.md +28 -0
- package/agent-docs/components/modal.md +34 -0
- package/agent-docs/components/native-select.md +26 -0
- package/agent-docs/components/navbar.md +24 -0
- package/agent-docs/components/number-field.md +28 -0
- package/agent-docs/components/number-stepper.md +31 -0
- package/agent-docs/components/number-value.md +26 -0
- package/agent-docs/components/pagination.md +40 -0
- package/agent-docs/components/phone-mockup.md +26 -0
- package/agent-docs/components/pie-chart.md +36 -0
- package/agent-docs/components/popover.md +30 -0
- package/agent-docs/components/pressable-feedback.md +24 -0
- package/agent-docs/components/progress-bar.md +27 -0
- package/agent-docs/components/progress-circle.md +23 -0
- package/agent-docs/components/prompt-input.md +32 -0
- package/agent-docs/components/prompt-suggestion.md +32 -0
- package/agent-docs/components/radar-chart.md +36 -0
- package/agent-docs/components/radial-chart.md +36 -0
- package/agent-docs/components/radio-button-group.md +28 -0
- package/agent-docs/components/radio-group.md +29 -0
- package/agent-docs/components/range-calendar.md +40 -0
- package/agent-docs/components/rating.md +26 -0
- package/agent-docs/components/resizable.md +55 -0
- package/agent-docs/components/rich-text-editor.md +35 -0
- package/agent-docs/components/scroll-shadow.md +31 -0
- package/agent-docs/components/search-field.md +28 -0
- package/agent-docs/components/segment.md +28 -0
- package/agent-docs/components/select.md +31 -0
- package/agent-docs/components/separator.md +26 -0
- package/agent-docs/components/sheet.md +34 -0
- package/agent-docs/components/sidebar.md +36 -0
- package/agent-docs/components/skeleton.md +26 -0
- package/agent-docs/components/slider.md +27 -0
- package/agent-docs/components/sortable-table.md +303 -0
- package/agent-docs/components/spinner.md +25 -0
- package/agent-docs/components/stack.md +26 -0
- package/agent-docs/components/status.md +24 -0
- package/agent-docs/components/stepper.md +32 -0
- package/agent-docs/components/surface.md +25 -0
- package/agent-docs/components/swap.md +24 -0
- package/agent-docs/components/switch.md +75 -0
- package/agent-docs/components/table.md +31 -0
- package/agent-docs/components/tabs.md +65 -0
- package/agent-docs/components/tag-group.md +26 -0
- package/agent-docs/components/text-area.md +27 -0
- package/agent-docs/components/text-field.md +28 -0
- package/agent-docs/components/text-rotate.md +24 -0
- package/agent-docs/components/text-shimmer.md +24 -0
- package/agent-docs/components/theme-controller.md +24 -0
- package/agent-docs/components/time-field.md +30 -0
- package/agent-docs/components/timeline.md +24 -0
- package/agent-docs/components/toast.md +22 -0
- package/agent-docs/components/toggle-button-group.md +31 -0
- package/agent-docs/components/toggle-button.md +24 -0
- package/agent-docs/components/toolbar.md +28 -0
- package/agent-docs/components/tooltip.md +27 -0
- package/agent-docs/components/trend-chip.md +24 -0
- package/agent-docs/components/typed-confirmation.md +160 -0
- package/agent-docs/components/typography.md +26 -0
- package/agent-docs/components/validator.md +26 -0
- package/agent-docs/components/widget.md +24 -0
- package/agent-docs/components/window-mockup.md +24 -0
- package/agent-docs/llms-components.txt +5881 -0
- package/agent-docs/llms-full.txt +6110 -0
- package/agent-docs/llms-patterns.txt +230 -0
- package/agent-docs/llms.txt +261 -0
- package/package.json +48 -4
- package/ui/insight-charts.mjs +124 -0
- package/ui/insight-markdown.mjs +46 -0
- package/ui/mero-collections.css +146 -0
- package/ui/mero-collections.js +272 -0
- package/ui/mero-composition.css +342 -0
- package/ui/mero-composition.js +79 -0
- package/ui/mero-forms.js +223 -0
- package/ui/mero-gallery.css +122 -0
- package/ui/mero-gallery.js +193 -0
- package/ui/mero-insights.css +168 -0
- package/ui/mero-insights.js +188 -0
- package/ui/mero-inventory.css +182 -0
- package/ui/mero-inventory.js +56 -0
- package/ui/mero-layouts.css +73 -0
- package/ui/mero-live.js +120 -0
- package/ui/mero-workspace.css +152 -0
- package/ui/mero-workspace.js +590 -0
- package/ui/mero.css +922 -0
- package/ui/mero.js +868 -0
- package/ui/studio-lamp.webp +0 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/*! @rubenlangeweg/mero-ui 0.7.0 | MIT */
|
|
2
|
+
:where(.mero-join, .mero-link-menu, .mero-editorial-hero, .mero-footer-nav, .mero-theme-sample,
|
|
3
|
+
.mero-validation-example, .mero-aura, .mero-countdown, .mero-mask-sample, .mero-deck,
|
|
4
|
+
.mero-status-marker, .mero-swap, .mero-text-cycle, .mero-device) {
|
|
5
|
+
font: 400 0.9375rem/1.5 var(--mero-font);
|
|
6
|
+
color: var(--mero-text);
|
|
7
|
+
}
|
|
8
|
+
:where(.mero-join, .mero-footer-nav, .mero-status-marker, .mero-text-cycle, .mero-swap) {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 0.6rem;
|
|
12
|
+
}
|
|
13
|
+
.mero-join {
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
gap: 0;
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
}
|
|
18
|
+
.mero-join input {
|
|
19
|
+
min-width: 0;
|
|
20
|
+
border-start-end-radius: 0;
|
|
21
|
+
border-end-end-radius: 0;
|
|
22
|
+
}
|
|
23
|
+
.mero-join input:not(.mero-input) {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
min-block-size: var(--mero-control-height, 2.5rem);
|
|
26
|
+
width: 100%;
|
|
27
|
+
padding-inline: var(--mero-control-padding-inline, 0.75rem);
|
|
28
|
+
border: 1px solid var(--mero-control-line);
|
|
29
|
+
border-start-start-radius: var(--mero-radius);
|
|
30
|
+
border-end-start-radius: var(--mero-radius);
|
|
31
|
+
color: var(--mero-text);
|
|
32
|
+
background: var(--mero-surface);
|
|
33
|
+
font: inherit;
|
|
34
|
+
}
|
|
35
|
+
.mero-join input:focus-visible {
|
|
36
|
+
position: relative;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
}
|
|
39
|
+
.mero-join .mero-button {
|
|
40
|
+
flex: none;
|
|
41
|
+
border-start-start-radius: 0;
|
|
42
|
+
border-end-start-radius: 0;
|
|
43
|
+
}
|
|
44
|
+
.mero-link-menu,
|
|
45
|
+
.mero-theme-sample,
|
|
46
|
+
.mero-validation-example,
|
|
47
|
+
.mero-aura,
|
|
48
|
+
.mero-countdown {
|
|
49
|
+
display: grid;
|
|
50
|
+
gap: 0.55rem;
|
|
51
|
+
}
|
|
52
|
+
.mero-link-menu,
|
|
53
|
+
.mero-theme-sample,
|
|
54
|
+
.mero-aura,
|
|
55
|
+
.mero-countdown,
|
|
56
|
+
.mero-device {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
padding: 1rem;
|
|
59
|
+
border: 1px solid var(--mero-line);
|
|
60
|
+
border-radius: var(--mero-radius-panel);
|
|
61
|
+
background: var(--mero-surface);
|
|
62
|
+
color: var(--mero-text);
|
|
63
|
+
}
|
|
64
|
+
.mero-link-menu {
|
|
65
|
+
width: min(100%, 12rem);
|
|
66
|
+
gap: 0.25rem;
|
|
67
|
+
}
|
|
68
|
+
.mero-link-menu strong {
|
|
69
|
+
padding: 0.25rem 0.625rem;
|
|
70
|
+
}
|
|
71
|
+
.mero-link-menu a {
|
|
72
|
+
border-radius: 0.5rem;
|
|
73
|
+
padding: 0.375rem 0.625rem;
|
|
74
|
+
color: inherit;
|
|
75
|
+
text-decoration: none;
|
|
76
|
+
}
|
|
77
|
+
.mero-link-menu a:is(:hover, [aria-current]) {
|
|
78
|
+
background: var(--mero-raised);
|
|
79
|
+
}
|
|
80
|
+
.mero-editorial-hero {
|
|
81
|
+
box-sizing: border-box;
|
|
82
|
+
display: grid;
|
|
83
|
+
grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 1rem;
|
|
86
|
+
width: min(100%, 38rem);
|
|
87
|
+
padding: 1rem;
|
|
88
|
+
border: 1px solid var(--mero-line);
|
|
89
|
+
border-radius: var(--mero-radius-panel);
|
|
90
|
+
background: var(--mero-surface);
|
|
91
|
+
}
|
|
92
|
+
.mero-editorial-hero h2 {
|
|
93
|
+
font-size: clamp(1.4rem, 4vw, 2.5rem);
|
|
94
|
+
letter-spacing: -0.06em;
|
|
95
|
+
line-height: 1.08;
|
|
96
|
+
margin: 0.24em 0;
|
|
97
|
+
}
|
|
98
|
+
.mero-editorial-hero img,
|
|
99
|
+
.mero-device img,
|
|
100
|
+
.mero-deck img {
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: auto;
|
|
103
|
+
display: block;
|
|
104
|
+
}
|
|
105
|
+
.mero-editorial-hero img {
|
|
106
|
+
border-radius: max(0.375rem, calc(var(--mero-radius-panel) - 1rem));
|
|
107
|
+
}
|
|
108
|
+
.mero-editorial-hero small,
|
|
109
|
+
.mero-footer-nav nav,
|
|
110
|
+
.mero-countdown span {
|
|
111
|
+
color: var(--mero-muted);
|
|
112
|
+
}
|
|
113
|
+
.mero-footer-nav {
|
|
114
|
+
width: 100%;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
padding-block: 1rem;
|
|
117
|
+
border-block-start: 1px solid var(--mero-line);
|
|
118
|
+
}
|
|
119
|
+
.mero-footer-nav nav {
|
|
120
|
+
display: flex;
|
|
121
|
+
flex-wrap: wrap;
|
|
122
|
+
gap: 0.75rem;
|
|
123
|
+
}
|
|
124
|
+
.mero-footer-nav a {
|
|
125
|
+
display: inline-flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
min-block-size: 2rem;
|
|
128
|
+
color: inherit;
|
|
129
|
+
}
|
|
130
|
+
.mero-theme-sample {
|
|
131
|
+
width: min(100%, 25rem);
|
|
132
|
+
background: var(--mero-bg);
|
|
133
|
+
}
|
|
134
|
+
.mero-theme-sample label {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: space-between;
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
gap: 0.5rem;
|
|
140
|
+
}
|
|
141
|
+
.mero-theme-sample select {
|
|
142
|
+
width: auto;
|
|
143
|
+
}
|
|
144
|
+
.mero-validation-example small {
|
|
145
|
+
color: var(--mero-muted);
|
|
146
|
+
}
|
|
147
|
+
.mero-validation-example .mero-label {
|
|
148
|
+
display: grid;
|
|
149
|
+
gap: 0.375rem;
|
|
150
|
+
}
|
|
151
|
+
.mero-validation-example output:empty {
|
|
152
|
+
position: absolute;
|
|
153
|
+
inline-size: 1px;
|
|
154
|
+
block-size: 1px;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
clip-path: inset(50%);
|
|
157
|
+
}
|
|
158
|
+
.mero-validation-example input:user-invalid {
|
|
159
|
+
border-color: var(--mero-danger);
|
|
160
|
+
}
|
|
161
|
+
.mero-aura {
|
|
162
|
+
padding: 1.5rem 2rem;
|
|
163
|
+
border-color: var(--mero-control-line);
|
|
164
|
+
text-decoration: none;
|
|
165
|
+
transition:
|
|
166
|
+
box-shadow var(--mero-enter),
|
|
167
|
+
border-color var(--mero-enter);
|
|
168
|
+
}
|
|
169
|
+
.mero-aura:is(:hover, :focus-visible) {
|
|
170
|
+
border-color: var(--mero-accent);
|
|
171
|
+
box-shadow: 0 0 1.8rem color-mix(in srgb, var(--mero-accent) 25%, transparent);
|
|
172
|
+
}
|
|
173
|
+
.mero-aura span {
|
|
174
|
+
font-size: 0.8em;
|
|
175
|
+
color: var(--mero-muted);
|
|
176
|
+
}
|
|
177
|
+
.mero-countdown time {
|
|
178
|
+
font: 600 2.3rem/1.1 var(--mero-font);
|
|
179
|
+
font-variant-numeric: tabular-nums;
|
|
180
|
+
letter-spacing: -0.045em;
|
|
181
|
+
}
|
|
182
|
+
.mero-indicator-anchor {
|
|
183
|
+
position: relative;
|
|
184
|
+
}
|
|
185
|
+
.mero-corner-count {
|
|
186
|
+
box-sizing: border-box;
|
|
187
|
+
position: absolute;
|
|
188
|
+
inset-block-start: -0.5rem;
|
|
189
|
+
inset-inline-end: -0.5rem;
|
|
190
|
+
display: grid;
|
|
191
|
+
place-items: center;
|
|
192
|
+
background: var(--mero-accent);
|
|
193
|
+
color: var(--mero-accent-ink);
|
|
194
|
+
border-radius: 2rem;
|
|
195
|
+
min-inline-size: 1.25rem;
|
|
196
|
+
block-size: 1.25rem;
|
|
197
|
+
font-size: 0.7rem;
|
|
198
|
+
line-height: 1;
|
|
199
|
+
padding-inline: 0.25rem;
|
|
200
|
+
}
|
|
201
|
+
.mero-mask-sample,
|
|
202
|
+
.mero-deck,
|
|
203
|
+
.mero-device {
|
|
204
|
+
margin: 0;
|
|
205
|
+
}
|
|
206
|
+
.mero-mask-sample {
|
|
207
|
+
display: grid;
|
|
208
|
+
justify-items: center;
|
|
209
|
+
gap: 0.5rem;
|
|
210
|
+
}
|
|
211
|
+
.mero-mask-sample img {
|
|
212
|
+
width: 9rem;
|
|
213
|
+
height: 9rem;
|
|
214
|
+
object-fit: cover;
|
|
215
|
+
border-radius: 50%;
|
|
216
|
+
}
|
|
217
|
+
.mero-deck {
|
|
218
|
+
width: min(75%, 16rem);
|
|
219
|
+
background: var(--mero-surface);
|
|
220
|
+
padding: 0.6rem;
|
|
221
|
+
border: 1px solid var(--mero-line);
|
|
222
|
+
border-radius: 1rem;
|
|
223
|
+
box-shadow:
|
|
224
|
+
0.4rem 0.4rem var(--mero-raised),
|
|
225
|
+
0.7rem 0.7rem var(--mero-line);
|
|
226
|
+
}
|
|
227
|
+
.mero-deck figcaption {
|
|
228
|
+
padding-block: 0.5rem 0.125rem;
|
|
229
|
+
}
|
|
230
|
+
.mero-deck img {
|
|
231
|
+
border-radius: 0.375rem;
|
|
232
|
+
}
|
|
233
|
+
.mero-status-marker i {
|
|
234
|
+
flex: none;
|
|
235
|
+
width: 0.55rem;
|
|
236
|
+
height: 0.55rem;
|
|
237
|
+
border-radius: 50%;
|
|
238
|
+
background: var(--mero-success);
|
|
239
|
+
}
|
|
240
|
+
.mero-swap {
|
|
241
|
+
display: inline-grid;
|
|
242
|
+
place-items: center;
|
|
243
|
+
position: relative;
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
border: 1px solid var(--mero-control-line);
|
|
246
|
+
border-radius: var(--mero-radius);
|
|
247
|
+
padding: 0.5rem 1rem;
|
|
248
|
+
}
|
|
249
|
+
.mero-swap > span {
|
|
250
|
+
grid-area: 1 / 1;
|
|
251
|
+
}
|
|
252
|
+
.mero-swap input {
|
|
253
|
+
position: absolute;
|
|
254
|
+
inset: 0;
|
|
255
|
+
width: 100%;
|
|
256
|
+
height: 100%;
|
|
257
|
+
margin: 0;
|
|
258
|
+
opacity: 0;
|
|
259
|
+
cursor: pointer;
|
|
260
|
+
}
|
|
261
|
+
.mero-swap:has(input:focus-visible) {
|
|
262
|
+
outline: 2px solid var(--mero-accent);
|
|
263
|
+
outline-offset: 3px;
|
|
264
|
+
}
|
|
265
|
+
.mero-swap input:not(:checked) ~ span:last-child,
|
|
266
|
+
.mero-swap input:checked + span {
|
|
267
|
+
visibility: hidden;
|
|
268
|
+
}
|
|
269
|
+
.mero-text-cycle {
|
|
270
|
+
max-width: 26rem;
|
|
271
|
+
flex-wrap: wrap;
|
|
272
|
+
}
|
|
273
|
+
.mero-text-cycle > span {
|
|
274
|
+
color: var(--mero-muted);
|
|
275
|
+
}
|
|
276
|
+
.mero-text-cycle strong {
|
|
277
|
+
flex: 1 0 50%;
|
|
278
|
+
}
|
|
279
|
+
.mero-text-cycle [hidden] {
|
|
280
|
+
display: none;
|
|
281
|
+
}
|
|
282
|
+
.mero-text-cycle [data-cycle-play][aria-pressed="true"] {
|
|
283
|
+
--_bg: var(--mero-primary);
|
|
284
|
+
--_ink: var(--mero-primary-ink);
|
|
285
|
+
}
|
|
286
|
+
@media (forced-colors: active) {
|
|
287
|
+
.mero-text-cycle [data-cycle-play][aria-pressed="true"] {
|
|
288
|
+
outline: 1px solid Highlight;
|
|
289
|
+
outline-offset: -3px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
.mero-device {
|
|
293
|
+
padding: 0.5rem;
|
|
294
|
+
max-width: 22rem;
|
|
295
|
+
min-width: 0;
|
|
296
|
+
}
|
|
297
|
+
.mero-device figcaption,
|
|
298
|
+
.mero-device div,
|
|
299
|
+
.mero-device pre {
|
|
300
|
+
padding: 0.6rem;
|
|
301
|
+
margin: 0;
|
|
302
|
+
}
|
|
303
|
+
.mero-device figcaption {
|
|
304
|
+
font-size: 0.8rem;
|
|
305
|
+
color: var(--mero-muted);
|
|
306
|
+
}
|
|
307
|
+
.mero-device-browser {
|
|
308
|
+
width: min(100%, 22rem);
|
|
309
|
+
}
|
|
310
|
+
.mero-device-browser img {
|
|
311
|
+
border-radius: max(0.25rem, calc(var(--mero-radius-panel) - 0.5rem - 1px));
|
|
312
|
+
}
|
|
313
|
+
.mero-device-window p {
|
|
314
|
+
margin: 0.375rem 0 0;
|
|
315
|
+
}
|
|
316
|
+
.mero-device-phone {
|
|
317
|
+
width: 10rem;
|
|
318
|
+
border: 5px solid var(--mero-line);
|
|
319
|
+
border-radius: 1.7rem;
|
|
320
|
+
min-height: 17rem;
|
|
321
|
+
overflow: hidden;
|
|
322
|
+
}
|
|
323
|
+
.mero-device-phone img {
|
|
324
|
+
height: 12rem;
|
|
325
|
+
object-fit: cover;
|
|
326
|
+
border-radius: calc(1.7rem - 0.5rem - 5px);
|
|
327
|
+
}
|
|
328
|
+
.mero-device-terminal pre {
|
|
329
|
+
overflow: auto;
|
|
330
|
+
white-space: pre-wrap;
|
|
331
|
+
overflow-wrap: anywhere;
|
|
332
|
+
color: var(--mero-success);
|
|
333
|
+
}
|
|
334
|
+
.mero-device-window figcaption,
|
|
335
|
+
.mero-device-terminal figcaption {
|
|
336
|
+
border-bottom: 1px solid var(--mero-line);
|
|
337
|
+
}
|
|
338
|
+
@media (prefers-reduced-motion: reduce) {
|
|
339
|
+
.mero-aura {
|
|
340
|
+
transition: none;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*! @rubenlangeweg/mero-ui 0.7.0 | MIT */
|
|
2
|
+
(() => {
|
|
3
|
+
const rotations = new Map();
|
|
4
|
+
function advance(cycle) {
|
|
5
|
+
const items = [...cycle.querySelectorAll("[data-cycle-item]")];
|
|
6
|
+
if (!items.length) return;
|
|
7
|
+
const next = (items.findIndex((item) => !item.hidden) + 1) % items.length;
|
|
8
|
+
items.forEach((item, i) => {
|
|
9
|
+
item.hidden = i !== next;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function stop(cycle) {
|
|
13
|
+
clearInterval(rotations.get(cycle));
|
|
14
|
+
rotations.delete(cycle);
|
|
15
|
+
cycle.querySelector("[data-cycle-play]")?.setAttribute("aria-pressed", "false");
|
|
16
|
+
}
|
|
17
|
+
document.addEventListener("click", (event) => {
|
|
18
|
+
const control = event.target.closest("[data-cycle-next],[data-cycle-play]");
|
|
19
|
+
const cycle = control?.closest("[data-mero-text-cycle]");
|
|
20
|
+
if (!cycle) return;
|
|
21
|
+
if (control.hasAttribute("data-cycle-next")) {
|
|
22
|
+
stop(cycle);
|
|
23
|
+
advance(cycle);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (rotations.has(cycle)) {
|
|
27
|
+
stop(cycle);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
control.setAttribute("aria-pressed", "true");
|
|
31
|
+
rotations.set(
|
|
32
|
+
cycle,
|
|
33
|
+
setInterval(() => (cycle.isConnected ? advance(cycle) : stop(cycle)), 3200),
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
document.addEventListener("change", (event) => {
|
|
37
|
+
const picker = event.target.closest("[data-mero-theme-picker]");
|
|
38
|
+
const scope = picker?.closest("[data-mero-theme-scope]");
|
|
39
|
+
if (scope) scope.dataset.theme = picker.value;
|
|
40
|
+
});
|
|
41
|
+
document.addEventListener("submit", (event) => {
|
|
42
|
+
const form = event.target.closest("[data-mero-check-form]");
|
|
43
|
+
if (!form) return;
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
form.querySelector("output").textContent = "SKU format accepted.";
|
|
46
|
+
});
|
|
47
|
+
document.addEventListener("input", (event) => {
|
|
48
|
+
const form = event.target.closest("[data-mero-check-form]");
|
|
49
|
+
if (form) form.querySelector("output").textContent = "";
|
|
50
|
+
});
|
|
51
|
+
let tick;
|
|
52
|
+
function update() {
|
|
53
|
+
const clocks = document.querySelectorAll("[data-mero-cutoff-hour]");
|
|
54
|
+
clearTimeout(tick);
|
|
55
|
+
if (!clocks.length) return;
|
|
56
|
+
const now = new Date();
|
|
57
|
+
for (const clock of clocks) {
|
|
58
|
+
const hour = clock.dataset.meroCutoffHour;
|
|
59
|
+
if (!/^([01]?\d|2[0-3])$/.test(hour)) continue;
|
|
60
|
+
const target = new Date(now);
|
|
61
|
+
target.setUTCHours(Number(hour), 0, 0, 0);
|
|
62
|
+
if (+target <= +now) target.setUTCDate(target.getUTCDate() + 1);
|
|
63
|
+
const seconds = Math.ceil((target - now) / 1000);
|
|
64
|
+
const time = clock.querySelector("time");
|
|
65
|
+
if (!time) continue;
|
|
66
|
+
time.dateTime = target.toISOString();
|
|
67
|
+
time.textContent = [Math.floor(seconds / 3600), Math.floor(seconds / 60) % 60, seconds % 60]
|
|
68
|
+
.map((value) => String(value).padStart(2, "0"))
|
|
69
|
+
.join(":");
|
|
70
|
+
}
|
|
71
|
+
tick = setTimeout(update, 1000);
|
|
72
|
+
}
|
|
73
|
+
update();
|
|
74
|
+
document.addEventListener("htmx:after:swap", update);
|
|
75
|
+
document.addEventListener("htmx:before:cleanup", (event) => {
|
|
76
|
+
const removed = event.target;
|
|
77
|
+
for (const cycle of rotations.keys()) if (removed.contains(cycle)) stop(cycle);
|
|
78
|
+
});
|
|
79
|
+
})();
|
package/ui/mero-forms.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*! @rubenlangeweg/mero-ui 0.7.0 | MIT */
|
|
2
|
+
/**
|
|
3
|
+
* Optional HTMX form behavior. Server responses:
|
|
4
|
+
* 422 + replacement form for validation, or HX-Trigger:
|
|
5
|
+
* {"mero:form-saved":{"message":"Saved"}}, which htmx 4 fires after the swap settles.
|
|
6
|
+
* Standalone [data-mero-action] buttons get data-mero-action-state
|
|
7
|
+
* pending|succeeded|rejected|unknown: 2xx succeeded, 4xx (not 408) rejected,
|
|
8
|
+
* anything else unknown. Mero-Action-Outcome and Mero-Action-Message headers
|
|
9
|
+
* override the state and text; a bubbling mero:action event reports each step.
|
|
10
|
+
*/
|
|
11
|
+
(() => {
|
|
12
|
+
const formSelector = "form[data-mero-form]";
|
|
13
|
+
const confirmSelector = "form[data-mero-form][data-mero-confirm]";
|
|
14
|
+
const requesting = new WeakMap();
|
|
15
|
+
const formRequests = new WeakMap();
|
|
16
|
+
// htmx 4 also reports requests a before:request listener cancelled: no response, still "issuing".
|
|
17
|
+
const cancelled = ctx => !ctx.response && !String(ctx.status).startsWith("error");
|
|
18
|
+
|
|
19
|
+
function requestForm(event) {
|
|
20
|
+
const source = event.detail.ctx?.sourceElement;
|
|
21
|
+
if (source?.matches(formSelector)) return source;
|
|
22
|
+
// A combobox or other independent request inside a form must not put the
|
|
23
|
+
// whole form into its submission state or replace it on a field error.
|
|
24
|
+
if (source?.matches("button:not([type]), [type=submit], input[type=image]") && source.form?.matches(formSelector)) {
|
|
25
|
+
return source.form;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function checkConfirmation(form) {
|
|
30
|
+
const expected = form.querySelector("[data-mero-confirm-phrase]")?.textContent.trim();
|
|
31
|
+
const typed = form.querySelector("[data-mero-confirm-input]")?.value.trim();
|
|
32
|
+
const reason = form.querySelector("[data-mero-confirm-reason][required]");
|
|
33
|
+
const matches = Boolean(expected && typed === expected);
|
|
34
|
+
const ready = matches && (!reason || Boolean(reason.value.trim()));
|
|
35
|
+
for (const button of form.querySelectorAll("[data-mero-confirm-submit]")) {
|
|
36
|
+
button.disabled = !ready || requesting.has(form);
|
|
37
|
+
}
|
|
38
|
+
const hint = form.querySelector("[data-mero-confirm-hint]");
|
|
39
|
+
const message = !matches ? "Type the phrase exactly to enable confirmation."
|
|
40
|
+
: !ready ? "Phrase matches. Enter a reason to enable confirmation." : "Ready to confirm.";
|
|
41
|
+
if (hint && hint.textContent !== message) hint.textContent = message;
|
|
42
|
+
return ready;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
document.addEventListener("input", event => {
|
|
46
|
+
const form = event.target.closest?.(confirmSelector);
|
|
47
|
+
if (form) checkConfirmation(form);
|
|
48
|
+
});
|
|
49
|
+
document.addEventListener("htmx:after:init", event => {
|
|
50
|
+
if (event.target.matches?.(confirmSelector)) checkConfirmation(event.target);
|
|
51
|
+
});
|
|
52
|
+
document.addEventListener("reset", event => {
|
|
53
|
+
if (event.target.matches(confirmSelector)) queueMicrotask(() => checkConfirmation(event.target));
|
|
54
|
+
});
|
|
55
|
+
document.addEventListener("close", event => {
|
|
56
|
+
if (!event.target.matches?.("dialog") || event.target.open) return;
|
|
57
|
+
for (const form of event.target.querySelectorAll(confirmSelector)) {
|
|
58
|
+
const input = form.querySelector("[data-mero-confirm-input]");
|
|
59
|
+
if (input) input.value = "";
|
|
60
|
+
checkConfirmation(form);
|
|
61
|
+
}
|
|
62
|
+
}, true);
|
|
63
|
+
|
|
64
|
+
// Guard implicit and scripted submissions too, before htmx can queue a duplicate.
|
|
65
|
+
document.addEventListener("htmx:config:request", event => {
|
|
66
|
+
const form = requestForm(event);
|
|
67
|
+
if (form?.matches(confirmSelector) && (!checkConfirmation(form) || requesting.has(form))) event.preventDefault();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
document.addEventListener("htmx:before:request", (event) => {
|
|
71
|
+
const form = requestForm(event);
|
|
72
|
+
if (!form) return;
|
|
73
|
+
if (requesting.has(form)) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
formRequests.set(event.detail.ctx, form);
|
|
78
|
+
const buttons = [...form.elements].filter(control => !control.disabled && (control.type === "submit" || control.type === "image"));
|
|
79
|
+
requesting.set(form, { buttons, ctx: event.detail.ctx });
|
|
80
|
+
form.setAttribute("aria-busy", "true");
|
|
81
|
+
buttons.forEach((button) => { button.disabled = true; });
|
|
82
|
+
const error = form.querySelector("[data-mero-form-error]");
|
|
83
|
+
if (error) error.hidden = true;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
document.addEventListener("htmx:before:swap", (event) => {
|
|
87
|
+
const status = event.detail.ctx.response?.status;
|
|
88
|
+
if (!(status >= 400) || !requestForm(event)) return;
|
|
89
|
+
// htmx 4 swaps every error response. Only a 422 carries a replacement form.
|
|
90
|
+
if (status !== 422) event.preventDefault();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// after:swap, not after:settle: htmx 4 applies [autofocus] in the new form after settling.
|
|
94
|
+
// It fires on the source, which htmx points at the new form when the swap replaced it.
|
|
95
|
+
document.addEventListener("htmx:after:swap", (event) => {
|
|
96
|
+
if (event.detail.ctx.response?.status !== 422) return;
|
|
97
|
+
const form = event.target.closest?.(formSelector);
|
|
98
|
+
const field = form?.querySelector('[aria-invalid="true"]');
|
|
99
|
+
field?.focus();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
function showError(form, message) {
|
|
103
|
+
const error = form.querySelector("[data-mero-form-error]");
|
|
104
|
+
if (error) {
|
|
105
|
+
error.textContent = message;
|
|
106
|
+
error.hidden = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
document.addEventListener("htmx:finally:request", (event) => {
|
|
111
|
+
const { ctx } = event.detail;
|
|
112
|
+
const form = formRequests.get(ctx);
|
|
113
|
+
// A cancelled duplicate has no entry, so it never releases the request still in flight.
|
|
114
|
+
if (!form) return;
|
|
115
|
+
form.removeAttribute("aria-busy");
|
|
116
|
+
requesting.get(form)?.buttons.forEach((button) => { button.disabled = false; });
|
|
117
|
+
requesting.delete(form);
|
|
118
|
+
const typed = form.matches(confirmSelector);
|
|
119
|
+
if (typed) checkConfirmation(form);
|
|
120
|
+
if (cancelled(ctx)) return;
|
|
121
|
+
const status = ctx.response?.status;
|
|
122
|
+
if (typed) {
|
|
123
|
+
if (!status || status >= 500 || String(ctx.status).startsWith("error")) {
|
|
124
|
+
showError(form, "Outcome unknown. Check the current state before retrying.");
|
|
125
|
+
} else if (status >= 400 && status !== 422) {
|
|
126
|
+
showError(form, ctx.response.headers.get("Mero-Form-Error") || "The server rejected this action.");
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const signal = ctx.request.signal;
|
|
131
|
+
if (!ctx.response && (signal?.reason === "timeout" || !signal?.aborted)) {
|
|
132
|
+
showError(form, "The server could not be reached. Check whether the change was saved before retrying.");
|
|
133
|
+
} else if (!ctx.response || (status >= 400 && status !== 422)) {
|
|
134
|
+
showError(form, ctx.response?.headers.get("Mero-Form-Error") || "The request could not be completed. Check the current state and try again.");
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
document.addEventListener("mero:form-saved", (event) => {
|
|
139
|
+
const form = event.target.closest?.(formSelector);
|
|
140
|
+
if (!form) return;
|
|
141
|
+
// Typed confirmations keep their form on success (HX-Reswap: none). An
|
|
142
|
+
// error response carrying a stray success trigger must never dismiss it.
|
|
143
|
+
if (form.matches(confirmSelector)) {
|
|
144
|
+
const ctx = requesting.get(form)?.ctx;
|
|
145
|
+
if (!ctx?.response || ctx.response.status < 200 || ctx.response.status >= 300 || String(ctx.status).startsWith("error")) return;
|
|
146
|
+
}
|
|
147
|
+
const focus = [form.dataset.meroReturnFocus, form.dataset.meroFallbackFocus]
|
|
148
|
+
.filter(Boolean).map((selector) => document.querySelector(selector)).find(Boolean);
|
|
149
|
+
let dialog = form.closest("dialog");
|
|
150
|
+
while (dialog) {
|
|
151
|
+
const parent = form.hasAttribute("data-mero-close-all") ? dialog.parentElement.closest("dialog") : null;
|
|
152
|
+
window.MeroUI.close(dialog, { focus: parent ? null : focus });
|
|
153
|
+
dialog = parent;
|
|
154
|
+
}
|
|
155
|
+
focus?.focus({ preventScroll: true });
|
|
156
|
+
if (event.detail.message) window.MeroUI.toast(event.detail.message, { tone: "success" });
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const actionOf = event => event.target.closest?.("[data-mero-action]");
|
|
160
|
+
const actionMessages = {
|
|
161
|
+
succeeded: ["Done.", "success"],
|
|
162
|
+
rejected: ["The server refused this action. Nothing changed.", "warning"],
|
|
163
|
+
unknown: ["The result is unknown. Check the current state before you try again.", "danger"],
|
|
164
|
+
};
|
|
165
|
+
const actionStatus = action => action.parentElement?.querySelector("[data-mero-action-status]");
|
|
166
|
+
|
|
167
|
+
// htmx queues a click made during a request and sends it later, so the guard runs before its sync logic.
|
|
168
|
+
// aria-disabled instead of disabled keeps focus on the button.
|
|
169
|
+
// config:request precedes the sync queue, and a cancel there fires no finally:request.
|
|
170
|
+
document.addEventListener("htmx:config:request", (event) => {
|
|
171
|
+
if (actionOf(event)?.dataset.meroActionState === "pending") event.preventDefault();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// A swap can detach the button before finally:request, so the request remembers its button and status.
|
|
175
|
+
const actionRequests = new WeakMap();
|
|
176
|
+
|
|
177
|
+
document.addEventListener("htmx:before:request", (event) => {
|
|
178
|
+
const action = actionOf(event);
|
|
179
|
+
if (!action || event.defaultPrevented) return;
|
|
180
|
+
const output = actionStatus(action);
|
|
181
|
+
actionRequests.set(event.detail.ctx, { action, output });
|
|
182
|
+
action.dataset.meroActionState = "pending";
|
|
183
|
+
action.setAttribute("aria-busy", "true");
|
|
184
|
+
action.setAttribute("aria-disabled", "true");
|
|
185
|
+
if (output) { output.textContent = ""; delete output.dataset.tone; }
|
|
186
|
+
action.dispatchEvent(new CustomEvent("mero:action", { bubbles: true, detail: { state: "pending" } }));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// htmx fires finally:request after load, error, abort and timeout alike.
|
|
190
|
+
document.addEventListener("htmx:finally:request", (event) => {
|
|
191
|
+
const { ctx } = event.detail;
|
|
192
|
+
const request = actionRequests.get(ctx);
|
|
193
|
+
if (!request) return;
|
|
194
|
+
actionRequests.delete(ctx);
|
|
195
|
+
const { action, output } = request;
|
|
196
|
+
if (cancelled(ctx)) {
|
|
197
|
+
// A later before:request listener cancelled it: nothing was sent.
|
|
198
|
+
action.removeAttribute("aria-busy");
|
|
199
|
+
action.removeAttribute("aria-disabled");
|
|
200
|
+
delete action.dataset.meroActionState;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const status = ctx.response?.status ?? 0;
|
|
204
|
+
const header = ctx.response?.headers.get("Mero-Action-Outcome") ?? null;
|
|
205
|
+
const state = Object.hasOwn(actionMessages, header) ? header
|
|
206
|
+
: status >= 200 && status < 300 ? "succeeded"
|
|
207
|
+
: status >= 400 && status < 500 && status !== 408 ? "rejected" : "unknown";
|
|
208
|
+
const [fallback, tone] = actionMessages[state];
|
|
209
|
+
const message = ctx.response?.headers.get("Mero-Action-Message") || fallback;
|
|
210
|
+
action.removeAttribute("aria-busy");
|
|
211
|
+
action.removeAttribute("aria-disabled");
|
|
212
|
+
action.dataset.meroActionState = state;
|
|
213
|
+
if (output?.isConnected) {
|
|
214
|
+
// Clearing first makes a repeated message announce again.
|
|
215
|
+
output.textContent = "";
|
|
216
|
+
output.textContent = message;
|
|
217
|
+
output.dataset.tone = tone;
|
|
218
|
+
} else {
|
|
219
|
+
window.MeroUI?.toast(message, { tone, trigger: action.isConnected ? action : event.target });
|
|
220
|
+
}
|
|
221
|
+
(action.isConnected ? action : document).dispatchEvent(new CustomEvent("mero:action", { bubbles: true, detail: { state, status, message } }));
|
|
222
|
+
});
|
|
223
|
+
})();
|