@codbex/harmonia 0.4.0 → 0.5.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/dist/harmonia.css +1 -1
- package/dist/harmonia.esm.js +180 -190
- package/dist/harmonia.esm.min.js +3 -3
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +135 -145
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +1 -1
package/dist/harmonia.js
CHANGED
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
if (!accordion) {
|
|
149
149
|
throw new Error("h-accordion-item must be inside an h-accordion");
|
|
150
150
|
}
|
|
151
|
-
el.classList.add("border-b", "last:border-b-0");
|
|
151
|
+
el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
|
|
152
152
|
el.setAttribute("data-slot", "accordion-item");
|
|
153
153
|
const itemId = expression ?? `ha${v4_default()}`;
|
|
154
154
|
function getIsExpanded() {
|
|
@@ -183,7 +183,18 @@
|
|
|
183
183
|
if (!accordionItem || !accordion) {
|
|
184
184
|
throw new Error("h-accordion-trigger must be inside an h-accordion-item, which must be inside an h-accordion");
|
|
185
185
|
}
|
|
186
|
-
el.classList.add(
|
|
186
|
+
el.classList.add(
|
|
187
|
+
"flex",
|
|
188
|
+
"h-12",
|
|
189
|
+
"[[data-size=md]_&]:h-10",
|
|
190
|
+
"[[data-size=sm]_&]:h-8",
|
|
191
|
+
"[[data-variant=header]_&]:bg-object-header",
|
|
192
|
+
"[[data-variant=header]_&]:text-object-header-foreground",
|
|
193
|
+
"[[data-variant=header]_&]:px-4",
|
|
194
|
+
"[[data-variant=header]_&]:border-b",
|
|
195
|
+
"[[data-size=md][data-variant=header]_&]:px-3",
|
|
196
|
+
"[[data-size=sm][data-variant=header]_&]:px-2.5"
|
|
197
|
+
);
|
|
187
198
|
el.setAttribute("tabIndex", "-1");
|
|
188
199
|
const getLabel = evaluateLater(expression);
|
|
189
200
|
const chevronDown = createElement(ChevronDown, {
|
|
@@ -202,10 +213,9 @@
|
|
|
202
213
|
"focus-visible:ring-ring/50",
|
|
203
214
|
"flex",
|
|
204
215
|
"flex-1",
|
|
205
|
-
"items-
|
|
216
|
+
"items-center",
|
|
206
217
|
"justify-between",
|
|
207
218
|
"gap-4",
|
|
208
|
-
"py-4",
|
|
209
219
|
"text-left",
|
|
210
220
|
"text-sm",
|
|
211
221
|
"font-medium",
|
|
@@ -305,13 +315,11 @@
|
|
|
305
315
|
}
|
|
306
316
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
307
317
|
const observer = new MutationObserver((mutations) => {
|
|
308
|
-
mutations.forEach((
|
|
309
|
-
|
|
310
|
-
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
311
|
-
}
|
|
318
|
+
mutations.forEach(() => {
|
|
319
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
312
320
|
});
|
|
313
321
|
});
|
|
314
|
-
observer.observe(el, { attributes: true });
|
|
322
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
315
323
|
cleanup(() => {
|
|
316
324
|
observer.disconnect();
|
|
317
325
|
});
|
|
@@ -342,6 +350,7 @@
|
|
|
342
350
|
"has-[img]:border-0",
|
|
343
351
|
"flex",
|
|
344
352
|
"size-8",
|
|
353
|
+
"aspect-square",
|
|
345
354
|
"shrink-0",
|
|
346
355
|
"overflow-hidden",
|
|
347
356
|
"rounded-full",
|
|
@@ -384,13 +393,11 @@
|
|
|
384
393
|
interval = setInterval(completeCheck, 10);
|
|
385
394
|
}
|
|
386
395
|
const observer = new MutationObserver((mutations) => {
|
|
387
|
-
mutations.forEach((
|
|
388
|
-
|
|
389
|
-
if (mutation.attributeName === "src") interval = setInterval(completeCheck, 10);
|
|
390
|
-
}
|
|
396
|
+
mutations.forEach(() => {
|
|
397
|
+
interval = setInterval(completeCheck, 10);
|
|
391
398
|
});
|
|
392
399
|
});
|
|
393
|
-
observer.observe(el, { attributes: true });
|
|
400
|
+
observer.observe(el, { attributes: true, attributeFilter: ["src"] });
|
|
394
401
|
cleanup(() => {
|
|
395
402
|
if (interval) clearInterval(interval);
|
|
396
403
|
observer.disconnect();
|
|
@@ -433,12 +440,6 @@
|
|
|
433
440
|
"focus-visible:border-ring",
|
|
434
441
|
"focus-visible:ring-ring/50",
|
|
435
442
|
"focus-visible:ring-[3px]",
|
|
436
|
-
"aria-invalid:ring-negative/20",
|
|
437
|
-
"dark:aria-invalid:ring-negative/40",
|
|
438
|
-
"aria-invalid:border-negative",
|
|
439
|
-
"invalid:ring-negative/20",
|
|
440
|
-
"dark:invalid:ring-negative/40",
|
|
441
|
-
"invalid:border-negative",
|
|
442
443
|
"transition-[color,box-shadow]",
|
|
443
444
|
"overflow-hidden"
|
|
444
445
|
);
|
|
@@ -460,13 +461,11 @@
|
|
|
460
461
|
}
|
|
461
462
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
462
463
|
const observer = new MutationObserver((mutations) => {
|
|
463
|
-
mutations.forEach((
|
|
464
|
-
|
|
465
|
-
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
466
|
-
}
|
|
464
|
+
mutations.forEach(() => {
|
|
465
|
+
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
467
466
|
});
|
|
468
467
|
});
|
|
469
|
-
observer.observe(el, { attributes: true });
|
|
468
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant"] });
|
|
470
469
|
cleanup(() => {
|
|
471
470
|
observer.disconnect();
|
|
472
471
|
});
|
|
@@ -534,7 +533,6 @@
|
|
|
534
533
|
"border",
|
|
535
534
|
"bg-background",
|
|
536
535
|
"text-foreground",
|
|
537
|
-
"shadow-none",
|
|
538
536
|
"hover:bg-secondary",
|
|
539
537
|
"hover:text-secondary-foreground",
|
|
540
538
|
"active:bg-secondary-active",
|
|
@@ -582,11 +580,31 @@
|
|
|
582
580
|
"aria-invalid:ring-negative/20",
|
|
583
581
|
"dark:aria-invalid:ring-negative/40",
|
|
584
582
|
"aria-invalid:border-negative",
|
|
585
|
-
"invalid
|
|
586
|
-
"dark:invalid
|
|
587
|
-
"invalid
|
|
583
|
+
"invalid:!ring-negative/20",
|
|
584
|
+
"dark:invalid:!ring-negative/40",
|
|
585
|
+
"invalid:!border-negative"
|
|
588
586
|
);
|
|
589
587
|
};
|
|
588
|
+
var getButtonSize = (size3, inGroup = false) => {
|
|
589
|
+
switch (size3) {
|
|
590
|
+
case "xs":
|
|
591
|
+
return inGroup ? ["h-6", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2.5"];
|
|
592
|
+
case "sm":
|
|
593
|
+
return inGroup ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5"];
|
|
594
|
+
case "lg":
|
|
595
|
+
return ["h-10", "px-6", "has-[>svg]:px-4"];
|
|
596
|
+
case "icon-xs":
|
|
597
|
+
return inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"];
|
|
598
|
+
case "icon-sm":
|
|
599
|
+
return inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"];
|
|
600
|
+
case "icon":
|
|
601
|
+
return ["size-9"];
|
|
602
|
+
case "icon-lg":
|
|
603
|
+
return ["size-10"];
|
|
604
|
+
default:
|
|
605
|
+
return ["h-9", "px-4", "py-2", "has-[>svg]:px-3"];
|
|
606
|
+
}
|
|
607
|
+
};
|
|
590
608
|
function button_default(Alpine) {
|
|
591
609
|
Alpine.directive("h-button", (el, { modifiers }, { cleanup }) => {
|
|
592
610
|
setButtonClasses(el);
|
|
@@ -594,16 +612,6 @@
|
|
|
594
612
|
el.setAttribute("data-slot", "button");
|
|
595
613
|
}
|
|
596
614
|
const inGroup = modifiers.includes("group");
|
|
597
|
-
const sizes = {
|
|
598
|
-
default: ["h-9", "px-4", "py-2", "has-[>svg]:px-3"],
|
|
599
|
-
xs: inGroup ? ["h-6", "gap-1", "px-2", "[&>svg:not([class*='size-'])]:size-3.5", "has-[>svg]:px-2"] : ["h-6.5", "gap-1.5", "px-2.5", "has-[>svg]:px-2.5"],
|
|
600
|
-
sm: inGroup ? ["h-8", "px-2.5", "gap-1.5", "has-[>svg]:px-2.5"] : ["h-8", "gap-1.5", "px-3", "has-[>svg]:px-2.5"],
|
|
601
|
-
lg: ["h-10", "px-6", "has-[>svg]:px-4"],
|
|
602
|
-
"icon-xs": inGroup ? ["size-6", "p-0", "has-[>svg]:p-0"] : ["size-6.5"],
|
|
603
|
-
"icon-sm": inGroup ? ["size-8", "p-0", "has-[>svg]:p-0"] : ["size-8"],
|
|
604
|
-
icon: ["size-9"],
|
|
605
|
-
"icon-lg": ["size-10"]
|
|
606
|
-
};
|
|
607
615
|
function setVariant(variant) {
|
|
608
616
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
609
617
|
el.classList.remove(...value);
|
|
@@ -611,12 +619,9 @@
|
|
|
611
619
|
if (buttonVariants.hasOwnProperty(variant)) el.classList.add(...buttonVariants[variant]);
|
|
612
620
|
}
|
|
613
621
|
function setSize(size3) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
618
|
-
console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
|
|
619
|
-
}
|
|
622
|
+
el.classList.add(...getButtonSize(size3, inGroup));
|
|
623
|
+
if (size3 && size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
624
|
+
console.error('h-button: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute', el);
|
|
620
625
|
}
|
|
621
626
|
}
|
|
622
627
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
@@ -631,19 +636,17 @@
|
|
|
631
636
|
if (["date-picker-trigger", "time-picker-trigger"].includes(el.getAttribute("data-slot"))) {
|
|
632
637
|
setSize("icon-xs");
|
|
633
638
|
} else {
|
|
634
|
-
setSize(
|
|
639
|
+
setSize();
|
|
635
640
|
}
|
|
636
641
|
}
|
|
637
642
|
}
|
|
638
643
|
const observer = new MutationObserver((mutations) => {
|
|
639
644
|
mutations.forEach((mutation) => {
|
|
640
|
-
if (mutation.
|
|
641
|
-
|
|
642
|
-
else if (mutation.attributeName === "data-size") setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
|
|
643
|
-
}
|
|
645
|
+
if (mutation.attributeName === "data-variant") setVariant(el.getAttribute("data-variant") ?? "default");
|
|
646
|
+
else setSize(el.getAttribute("data-size") ?? (inGroup ? "xs" : "default"));
|
|
644
647
|
});
|
|
645
648
|
});
|
|
646
|
-
observer.observe(el, { attributes: true });
|
|
649
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
|
|
647
650
|
cleanup(() => {
|
|
648
651
|
observer.disconnect();
|
|
649
652
|
});
|
|
@@ -2869,8 +2872,8 @@
|
|
|
2869
2872
|
el.setAttribute("tabindex", "-1");
|
|
2870
2873
|
el.setAttribute("data-slot", "dialog-overlay");
|
|
2871
2874
|
const observer = new MutationObserver((mutations) => {
|
|
2872
|
-
mutations.forEach((
|
|
2873
|
-
if (
|
|
2875
|
+
mutations.forEach(() => {
|
|
2876
|
+
if (el.getAttribute("data-open") === "true") {
|
|
2874
2877
|
const inputs = el.getElementsByTagName("INPUT");
|
|
2875
2878
|
if (inputs.length) {
|
|
2876
2879
|
for (let i = 0; i < inputs.length; i++) {
|
|
@@ -2889,7 +2892,7 @@
|
|
|
2889
2892
|
}
|
|
2890
2893
|
});
|
|
2891
2894
|
});
|
|
2892
|
-
observer.observe(el, { attributes: true });
|
|
2895
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-open"] });
|
|
2893
2896
|
cleanup(() => {
|
|
2894
2897
|
observer.disconnect();
|
|
2895
2898
|
});
|
|
@@ -3129,9 +3132,9 @@
|
|
|
3129
3132
|
"aria-invalid:ring-negative/20",
|
|
3130
3133
|
"dark:aria-invalid:ring-negative/40",
|
|
3131
3134
|
"aria-invalid:border-negative",
|
|
3132
|
-
"invalid
|
|
3133
|
-
"dark:invalid
|
|
3134
|
-
"invalid
|
|
3135
|
+
"invalid:!ring-negative/20",
|
|
3136
|
+
"dark:invalid:!ring-negative/40",
|
|
3137
|
+
"invalid:!border-negative"
|
|
3135
3138
|
);
|
|
3136
3139
|
if (modifiers.includes("group")) {
|
|
3137
3140
|
el.classList.remove("rounded-control", "border", "bg-input-inner", "shadow-control", "focus-visible:ring-[3px]");
|
|
@@ -3283,9 +3286,9 @@
|
|
|
3283
3286
|
"aria-invalid:ring-negative/20",
|
|
3284
3287
|
"dark:aria-invalid:ring-negative/40",
|
|
3285
3288
|
"aria-invalid:border-negative",
|
|
3286
|
-
"invalid
|
|
3287
|
-
"dark:invalid
|
|
3288
|
-
"invalid
|
|
3289
|
+
"invalid:!ring-negative/20",
|
|
3290
|
+
"dark:invalid:!ring-negative/40",
|
|
3291
|
+
"invalid:!border-negative",
|
|
3289
3292
|
"[&>ul:first-child>*:first-child]:rounded-t-control",
|
|
3290
3293
|
"[&>ul:last-child>*:last-child]:rounded-b-control"
|
|
3291
3294
|
);
|
|
@@ -6185,10 +6188,28 @@
|
|
|
6185
6188
|
select._select.multiple = Array.isArray(el._x_model.get());
|
|
6186
6189
|
select._select.model = el._x_model.get();
|
|
6187
6190
|
}
|
|
6191
|
+
setButtonClasses(el);
|
|
6192
|
+
const setVariant = (variant) => {
|
|
6193
|
+
if (variant === "secondary") {
|
|
6194
|
+
el.classList.add(...buttonVariants["default"]);
|
|
6195
|
+
return;
|
|
6196
|
+
} else if (variant === "transparent") {
|
|
6197
|
+
el.classList.add(...buttonVariants["transparent"]);
|
|
6198
|
+
} else el.classList.add("shadow-control", ...buttonVariants["outline"]);
|
|
6199
|
+
};
|
|
6200
|
+
const setSize = (size3) => {
|
|
6201
|
+
const sizes = ["sm", "xs", "lg"];
|
|
6202
|
+
if (sizes.includes(size3)) {
|
|
6203
|
+
el.classList.add(...getButtonSize(size3));
|
|
6204
|
+
} else el.classList.add(...getButtonSize());
|
|
6205
|
+
};
|
|
6206
|
+
setVariant(el.getAttribute("data-variant"));
|
|
6207
|
+
setSize(el.getAttribute("data-size"));
|
|
6208
|
+
el.classList.add("w-full", "[&_svg]:opacity-50", "[&[data-state=open]>svg]:rotate-180");
|
|
6188
6209
|
el.setAttribute("type", "button");
|
|
6189
6210
|
const selectValue = document.createElement("span");
|
|
6190
6211
|
selectValue.setAttribute("data-slot", "select-value");
|
|
6191
|
-
selectValue.classList.add("pointer-events-none");
|
|
6212
|
+
selectValue.classList.add("text-left", "truncate", "pointer-events-none", "w-full");
|
|
6192
6213
|
function getPlaceholder() {
|
|
6193
6214
|
if (!el.value) {
|
|
6194
6215
|
const value = el.getAttribute("placeholder");
|
|
@@ -6203,17 +6224,15 @@
|
|
|
6203
6224
|
getPlaceholder();
|
|
6204
6225
|
const observer = new MutationObserver((mutations) => {
|
|
6205
6226
|
mutations.forEach((mutation) => {
|
|
6206
|
-
if (mutation.
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
getPlaceholder();
|
|
6212
|
-
}
|
|
6227
|
+
if (mutation.attributeName === "value") {
|
|
6228
|
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
6229
|
+
if (el.value) selectValue.classList.remove("text-muted-foreground");
|
|
6230
|
+
} else if (mutation.attributeName === "placeholder" && !select._select.label.length) {
|
|
6231
|
+
getPlaceholder();
|
|
6213
6232
|
}
|
|
6214
6233
|
});
|
|
6215
6234
|
});
|
|
6216
|
-
observer.observe(el, { attributes: true });
|
|
6235
|
+
observer.observe(el, { attributes: true, attributeFilter: ["value", "placeholder"] });
|
|
6217
6236
|
effect(() => {
|
|
6218
6237
|
if (select._select.label.length === 1) {
|
|
6219
6238
|
selectValue.innerText = select._select.label[0];
|
|
@@ -6223,48 +6242,6 @@
|
|
|
6223
6242
|
getPlaceholder();
|
|
6224
6243
|
}
|
|
6225
6244
|
});
|
|
6226
|
-
el.classList.add(
|
|
6227
|
-
"[&>*]:pointer-events-none",
|
|
6228
|
-
"cursor-pointer",
|
|
6229
|
-
"border-input",
|
|
6230
|
-
"focus-visible:border-ring",
|
|
6231
|
-
"focus-visible:ring-ring/50",
|
|
6232
|
-
"aria-invalid:ring-negative/20",
|
|
6233
|
-
"dark:aria-invalid:ring-negative/40",
|
|
6234
|
-
"aria-invalid:border-negative",
|
|
6235
|
-
"invalid:ring-negative/20",
|
|
6236
|
-
"dark:invalid:ring-negative/40",
|
|
6237
|
-
"invalid:border-negative",
|
|
6238
|
-
"hover:bg-secondary-hover",
|
|
6239
|
-
"active:bg-secondary-active",
|
|
6240
|
-
"flex",
|
|
6241
|
-
"w-full",
|
|
6242
|
-
"items-center",
|
|
6243
|
-
"justify-between",
|
|
6244
|
-
"gap-2",
|
|
6245
|
-
"rounded-control",
|
|
6246
|
-
"border",
|
|
6247
|
-
"bg-input-inner",
|
|
6248
|
-
"px-3",
|
|
6249
|
-
"text-sm",
|
|
6250
|
-
"whitespace-nowrap",
|
|
6251
|
-
"shadow-control",
|
|
6252
|
-
"transition-[color,box-shadow]",
|
|
6253
|
-
"outline-none",
|
|
6254
|
-
"focus-visible:ring-[3px]",
|
|
6255
|
-
"disabled:cursor-not-allowed",
|
|
6256
|
-
"disabled:opacity-50",
|
|
6257
|
-
"*:data-[slot=select-value]:line-clamp-1",
|
|
6258
|
-
"*:data-[slot=select-value]:flex",
|
|
6259
|
-
"*:data-[slot=select-value]:items-center",
|
|
6260
|
-
"*:data-[slot=select-value]:gap-2",
|
|
6261
|
-
"[&_svg]:pointer-events-none",
|
|
6262
|
-
"[&_svg]:shrink-0",
|
|
6263
|
-
"[&_svg:not([class*='size-'])]:size-4",
|
|
6264
|
-
"[&_svg]:size-4",
|
|
6265
|
-
"[&_svg]:opacity-50",
|
|
6266
|
-
"[&[data-state=open]>svg]:rotate-180"
|
|
6267
|
-
);
|
|
6268
6245
|
el.setAttribute("data-slot", "select-trigger");
|
|
6269
6246
|
if (el.hasAttribute("id")) {
|
|
6270
6247
|
select._select.id = el.getAttribute("id");
|
|
@@ -6276,21 +6253,6 @@
|
|
|
6276
6253
|
el.setAttribute("aria-haspopup", "listbox");
|
|
6277
6254
|
el.setAttribute("aria-autocomplete", "none");
|
|
6278
6255
|
el.setAttribute("role", "combobox");
|
|
6279
|
-
const sizes = {
|
|
6280
|
-
default: ["h-9", "py-2"],
|
|
6281
|
-
xs: ["h-6.5", "py-[0.188rem]"],
|
|
6282
|
-
sm: ["h-8", "py-1.5"]
|
|
6283
|
-
};
|
|
6284
|
-
function setSize(size3) {
|
|
6285
|
-
for (const [_, value] of Object.entries(sizes)) {
|
|
6286
|
-
el.classList.remove(...value);
|
|
6287
|
-
}
|
|
6288
|
-
if (sizes.hasOwnProperty(size3)) {
|
|
6289
|
-
el.classList.add(...sizes[size3]);
|
|
6290
|
-
}
|
|
6291
|
-
}
|
|
6292
|
-
if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
|
|
6293
|
-
setSize(el.getAttribute("data-size"));
|
|
6294
6256
|
effect(() => {
|
|
6295
6257
|
el.setAttribute("data-state", select._select.expanded ? "open" : "closed");
|
|
6296
6258
|
el.setAttribute("aria-expanded", select._select.expanded);
|
|
@@ -6375,7 +6337,7 @@
|
|
|
6375
6337
|
if (!select) {
|
|
6376
6338
|
throw new Error("h-select-content must be inside an h-select element");
|
|
6377
6339
|
}
|
|
6378
|
-
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-
|
|
6340
|
+
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "shadow-md");
|
|
6379
6341
|
el.setAttribute("data-slot", "select-content");
|
|
6380
6342
|
el.setAttribute("role", "listbox");
|
|
6381
6343
|
el.setAttribute("role", "presentation");
|
|
@@ -6507,7 +6469,7 @@
|
|
|
6507
6469
|
"cursor-default",
|
|
6508
6470
|
"items-center",
|
|
6509
6471
|
"gap-2",
|
|
6510
|
-
"rounded-
|
|
6472
|
+
"rounded-sm",
|
|
6511
6473
|
"py-1.5",
|
|
6512
6474
|
"pr-8",
|
|
6513
6475
|
"pl-2",
|
|
@@ -6667,15 +6629,11 @@
|
|
|
6667
6629
|
};
|
|
6668
6630
|
setFloating();
|
|
6669
6631
|
const observer = new MutationObserver((mutations) => {
|
|
6670
|
-
mutations.forEach((
|
|
6671
|
-
|
|
6672
|
-
if (mutation.attributeName === "data-floating") {
|
|
6673
|
-
setFloating();
|
|
6674
|
-
}
|
|
6675
|
-
}
|
|
6632
|
+
mutations.forEach(() => {
|
|
6633
|
+
setFloating();
|
|
6676
6634
|
});
|
|
6677
6635
|
});
|
|
6678
|
-
observer.observe(el, { attributes: true });
|
|
6636
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-floating"] });
|
|
6679
6637
|
cleanup(() => {
|
|
6680
6638
|
observer.disconnect();
|
|
6681
6639
|
});
|
|
@@ -6962,10 +6920,21 @@
|
|
|
6962
6920
|
el.classList.add("bg-secondary", "animate-pulse");
|
|
6963
6921
|
if (modifiers.includes("control")) {
|
|
6964
6922
|
el.classList.add("rounded-control");
|
|
6923
|
+
switch (el.getAttribute("data-size")) {
|
|
6924
|
+
case "xs":
|
|
6925
|
+
el.classList.add("h-6.5");
|
|
6926
|
+
break;
|
|
6927
|
+
case "sm":
|
|
6928
|
+
el.classList.add("h-8");
|
|
6929
|
+
break;
|
|
6930
|
+
default:
|
|
6931
|
+
el.classList.add("h-9");
|
|
6932
|
+
break;
|
|
6933
|
+
}
|
|
6965
6934
|
} else if (modifiers.includes("card")) {
|
|
6966
6935
|
el.classList.add("rounded-lg");
|
|
6967
6936
|
} else if (modifiers.includes("avatar")) {
|
|
6968
|
-
el.classList.add("rounded-full", "size-8");
|
|
6937
|
+
el.classList.add("rounded-full", "size-8", "aspect-square");
|
|
6969
6938
|
} else el.classList.add("rounded-md");
|
|
6970
6939
|
el.setAttribute("data-slot", "skeleton");
|
|
6971
6940
|
});
|
|
@@ -7328,8 +7297,11 @@
|
|
|
7328
7297
|
case "blockquote":
|
|
7329
7298
|
el.classList.add("mt-6", "border-l-2", "pl-6", "italic");
|
|
7330
7299
|
break;
|
|
7300
|
+
case "code-inline":
|
|
7301
|
+
el.classList.add("bg-muted", "relative", "rounded", "px-[0.3rem]", "py-[0.2rem]", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
|
|
7302
|
+
break;
|
|
7331
7303
|
case "code":
|
|
7332
|
-
el.classList.add("bg-muted", "relative", "rounded", "
|
|
7304
|
+
el.classList.add("bg-muted", "relative", "rounded", "p-3", "font-mono", "text-sm", "font-semibold", "whitespace-pre");
|
|
7333
7305
|
break;
|
|
7334
7306
|
case "lead":
|
|
7335
7307
|
el.classList.add("text-muted-foreground", "text-xl");
|
|
@@ -7363,9 +7335,9 @@
|
|
|
7363
7335
|
"aria-invalid:ring-negative/20",
|
|
7364
7336
|
"dark:aria-invalid:ring-negative/40",
|
|
7365
7337
|
"aria-invalid:border-negative",
|
|
7366
|
-
"invalid
|
|
7367
|
-
"dark:invalid
|
|
7368
|
-
"invalid
|
|
7338
|
+
"invalid:!ring-negative/20",
|
|
7339
|
+
"dark:invalid:!ring-negative/40",
|
|
7340
|
+
"invalid:!border-negative",
|
|
7369
7341
|
"bg-input-inner",
|
|
7370
7342
|
"flex",
|
|
7371
7343
|
"field-sizing-content",
|
|
@@ -8150,6 +8122,7 @@
|
|
|
8150
8122
|
"w-full",
|
|
8151
8123
|
"h-12",
|
|
8152
8124
|
"data-[size=sm]:h-8",
|
|
8125
|
+
"data-[size=md]:h-10",
|
|
8153
8126
|
"data-[variant=transparent]:bg-transparent",
|
|
8154
8127
|
"data-[variant=transparent]:text-foreground",
|
|
8155
8128
|
"data-[floating=true]:shadow-xs",
|
|
@@ -8159,11 +8132,11 @@
|
|
|
8159
8132
|
el.setAttribute("data-slot", "toolbar");
|
|
8160
8133
|
});
|
|
8161
8134
|
Alpine.directive("h-toolbar-image", (el) => {
|
|
8162
|
-
el.classList.add("size-8", "[[data-size=sm]_&]:size-6");
|
|
8135
|
+
el.classList.add("size-8", "[[data-size=md]_&]:size-7", "[[data-size=sm]_&]:size-6");
|
|
8163
8136
|
el.setAttribute("data-slot", "toolbar-image");
|
|
8164
8137
|
});
|
|
8165
8138
|
Alpine.directive("h-toolbar-title", (el) => {
|
|
8166
|
-
el.classList.add("text", "[[data-size=sm]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
|
|
8139
|
+
el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
|
|
8167
8140
|
el.setAttribute("data-slot", "toolbar-title");
|
|
8168
8141
|
});
|
|
8169
8142
|
Alpine.directive("h-toolbar-spacer", (el) => {
|
|
@@ -8172,7 +8145,7 @@
|
|
|
8172
8145
|
el.setAttribute("data-slot", "toolbar-spacer");
|
|
8173
8146
|
});
|
|
8174
8147
|
Alpine.directive("h-toolbar-separator", (el) => {
|
|
8175
|
-
el.classList.add("w-px", "h-8", "[[data-size=sm]_&]:h-6", "border-l");
|
|
8148
|
+
el.classList.add("w-px", "h-8", "[[data-size=md]_&]:h-6", "[[data-size=sm]_&]:h-6", "border-l");
|
|
8176
8149
|
el.setAttribute("data-slot", "toolbar-separator");
|
|
8177
8150
|
});
|
|
8178
8151
|
}
|
|
@@ -8305,11 +8278,28 @@
|
|
|
8305
8278
|
};
|
|
8306
8279
|
initColorScheme();
|
|
8307
8280
|
|
|
8281
|
+
// src/utils/breakpoint-listener.js
|
|
8282
|
+
function getBreakpointListener(handler2, breakpoint = 768) {
|
|
8283
|
+
const mql = top.matchMedia(`(width <= ${breakpoint}px)`);
|
|
8284
|
+
const onWidthChange = (event) => {
|
|
8285
|
+
handler2(event.matches);
|
|
8286
|
+
};
|
|
8287
|
+
mql.addEventListener("change", onWidthChange);
|
|
8288
|
+
handler2(mql.matches);
|
|
8289
|
+
return {
|
|
8290
|
+
_mql: mql,
|
|
8291
|
+
_onWidthChange: onWidthChange,
|
|
8292
|
+
remove() {
|
|
8293
|
+
this._mql.removeEventListener("change", this._onWidthChange);
|
|
8294
|
+
}
|
|
8295
|
+
};
|
|
8296
|
+
}
|
|
8297
|
+
|
|
8308
8298
|
// package.json
|
|
8309
|
-
var version = "0.
|
|
8299
|
+
var version = "0.5.0";
|
|
8310
8300
|
|
|
8311
8301
|
// src/index.js
|
|
8312
|
-
window.Harmonia = { getColorScheme, setColorScheme, version };
|
|
8302
|
+
window.Harmonia = { getBreakpointListener, getColorScheme, setColorScheme, version };
|
|
8313
8303
|
document.addEventListener("alpine:init", () => {
|
|
8314
8304
|
window.Alpine.plugin(accordion_default);
|
|
8315
8305
|
window.Alpine.plugin(alert_default);
|