@codbex/harmonia 1.9.0 → 1.9.1
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.esm.js +191 -178
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +3 -3
- package/dist/harmonia.js +191 -178
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +3 -3
- package/package.json +7 -1
package/dist/harmonia.js
CHANGED
|
@@ -597,10 +597,10 @@
|
|
|
597
597
|
}) : { single: false };
|
|
598
598
|
el.setAttribute("data-slot", "accordion");
|
|
599
599
|
});
|
|
600
|
-
Alpine.directive("h-accordion-item", (el, { original
|
|
601
|
-
const accordion = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
600
|
+
Alpine.directive("h-accordion-item", (el, { original, expression, modifiers }, { Alpine: Alpine2 }) => {
|
|
601
|
+
const accordion = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_accordion"));
|
|
602
602
|
if (!accordion) {
|
|
603
|
-
throw new Error(`${
|
|
603
|
+
throw new Error(`${original} must be inside an accordion`);
|
|
604
604
|
}
|
|
605
605
|
el.classList.add("border-b", "last:border-b-0");
|
|
606
606
|
el.setAttribute("data-slot", "accordion-item");
|
|
@@ -623,14 +623,14 @@
|
|
|
623
623
|
expanded: getIsExpanded()
|
|
624
624
|
});
|
|
625
625
|
});
|
|
626
|
-
Alpine.directive("h-accordion-trigger", (el, { original
|
|
626
|
+
Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
627
627
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
628
|
-
throw new Error(`${
|
|
628
|
+
throw new Error(`${original} must be a header element`);
|
|
629
629
|
}
|
|
630
|
-
const accordion = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
631
|
-
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
630
|
+
const accordion = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_accordion"));
|
|
631
|
+
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_accordionItem"));
|
|
632
632
|
if (!accordionItem || !accordion) {
|
|
633
|
-
throw new Error(`${
|
|
633
|
+
throw new Error(`${original} must have an accordion and accordion item parent elements`);
|
|
634
634
|
}
|
|
635
635
|
el.classList.add("flex", "h-12", "min-h-12", "[[data-size=md]_&]:h-10", "[[data-size=md]_&]:min-h-10", "[[data-size=sm]_&]:h-8", "[[data-size=sm]_&]:min-h-8");
|
|
636
636
|
el.setAttribute("tabIndex", "-1");
|
|
@@ -703,7 +703,7 @@
|
|
|
703
703
|
Alpine.directive("h-accordion-content", (el, _, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
704
704
|
el.classList.add("pb-0", "overflow-hidden", "text-sm", "hidden", "transition-[opacity,max-height,padding-bottom]", "motion-reduce:transition-none", "duration-200", "ease-out", "opacity-0");
|
|
705
705
|
el.setAttribute("data-slot", "accordion-content");
|
|
706
|
-
const parent = Alpine2.findClosest(el.parentElement, (parent2) =>
|
|
706
|
+
const parent = Alpine2.findClosest(el.parentElement, (parent2) => Object.prototype.hasOwnProperty.call(parent2, "_h_accordionItem"));
|
|
707
707
|
if (parent) {
|
|
708
708
|
let onTransitionEnd = function(event) {
|
|
709
709
|
if (event.target === el && event.target.classList.contains("opacity-0")) {
|
|
@@ -780,7 +780,7 @@
|
|
|
780
780
|
for (const [_, value] of Object.entries(variants)) {
|
|
781
781
|
el.classList.remove(...value);
|
|
782
782
|
}
|
|
783
|
-
if (
|
|
783
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
784
784
|
}
|
|
785
785
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
786
786
|
const observer = new MutationObserver(() => {
|
|
@@ -861,10 +861,10 @@
|
|
|
861
861
|
el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
|
|
862
862
|
}
|
|
863
863
|
});
|
|
864
|
-
Alpine.directive("h-avatar-image", (el, { original
|
|
865
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) =>
|
|
864
|
+
Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
|
|
865
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_avatar"));
|
|
866
866
|
if (!avatar) {
|
|
867
|
-
throw new Error(`${
|
|
867
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
868
868
|
}
|
|
869
869
|
el.classList.add("aspect-square", "size-full", "rounded-[inherit]");
|
|
870
870
|
el.setAttribute("data-slot", "avatar-image");
|
|
@@ -895,10 +895,10 @@
|
|
|
895
895
|
observer.disconnect();
|
|
896
896
|
});
|
|
897
897
|
});
|
|
898
|
-
Alpine.directive("h-avatar-fallback", (el, { original
|
|
899
|
-
const avatar = Alpine.findClosest(el.parentElement, (parent) =>
|
|
898
|
+
Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
|
|
899
|
+
const avatar = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_avatar"));
|
|
900
900
|
if (!avatar) {
|
|
901
|
-
throw new Error(`${
|
|
901
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
902
902
|
}
|
|
903
903
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center", "rounded-[inherit]");
|
|
904
904
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
@@ -951,7 +951,7 @@
|
|
|
951
951
|
for (const [_2, value] of Object.entries(variants)) {
|
|
952
952
|
el.classList.remove(...value);
|
|
953
953
|
}
|
|
954
|
-
if (
|
|
954
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
955
955
|
}
|
|
956
956
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
957
957
|
const observer = new MutationObserver(() => {
|
|
@@ -1004,7 +1004,7 @@
|
|
|
1004
1004
|
for (const [_2, value] of Object.entries(variants)) {
|
|
1005
1005
|
el.classList.remove(...value);
|
|
1006
1006
|
}
|
|
1007
|
-
if (
|
|
1007
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
1008
1008
|
}
|
|
1009
1009
|
setVariant(el.getAttribute("data-variant") ?? "primary");
|
|
1010
1010
|
const observer = new MutationObserver(() => {
|
|
@@ -1194,7 +1194,7 @@
|
|
|
1194
1194
|
}
|
|
1195
1195
|
};
|
|
1196
1196
|
function button_default(Alpine) {
|
|
1197
|
-
Alpine.directive("h-button", (el, { original
|
|
1197
|
+
Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
|
|
1198
1198
|
setButtonClasses(el);
|
|
1199
1199
|
if (!el.hasAttribute("data-slot")) {
|
|
1200
1200
|
el.setAttribute("data-slot", "button");
|
|
@@ -1205,13 +1205,13 @@
|
|
|
1205
1205
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
1206
1206
|
el.classList.remove(...value);
|
|
1207
1207
|
}
|
|
1208
|
-
if (
|
|
1208
|
+
if (Object.prototype.hasOwnProperty.call(buttonVariants, variant)) el.classList.add(...buttonVariants[variant]);
|
|
1209
1209
|
}
|
|
1210
1210
|
function setSize2(size3 = "default") {
|
|
1211
1211
|
el.classList.remove(...getButtonSize(lastSize, isAddon));
|
|
1212
1212
|
el.classList.add(...getButtonSize(size3, isAddon));
|
|
1213
1213
|
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
1214
|
-
console.error(`${
|
|
1214
|
+
console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
1215
1215
|
}
|
|
1216
1216
|
lastSize = size3;
|
|
1217
1217
|
}
|
|
@@ -1264,7 +1264,7 @@
|
|
|
1264
1264
|
for (const [_, value] of Object.entries(variants)) {
|
|
1265
1265
|
el.classList.remove(...value);
|
|
1266
1266
|
}
|
|
1267
|
-
if (
|
|
1267
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
1268
1268
|
}
|
|
1269
1269
|
setVariant(el.getAttribute("data-orientation") ?? "horizontal");
|
|
1270
1270
|
});
|
|
@@ -1290,8 +1290,8 @@
|
|
|
1290
1290
|
bottom: "top",
|
|
1291
1291
|
top: "bottom"
|
|
1292
1292
|
};
|
|
1293
|
-
function clamp(start, value,
|
|
1294
|
-
return max(start, min(value,
|
|
1293
|
+
function clamp(start, value, end) {
|
|
1294
|
+
return max(start, min(value, end));
|
|
1295
1295
|
}
|
|
1296
1296
|
function evaluate(value, param) {
|
|
1297
1297
|
return typeof value === "function" ? value(param) : value;
|
|
@@ -2765,8 +2765,8 @@
|
|
|
2765
2765
|
|
|
2766
2766
|
// src/components/calendar.js
|
|
2767
2767
|
function calendar_default(Alpine) {
|
|
2768
|
-
Alpine.directive("h-calendar", (el, { original
|
|
2769
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
2768
|
+
Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
2769
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_datepicker"));
|
|
2770
2770
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
2771
2771
|
el.setAttribute("tabindex", "-1");
|
|
2772
2772
|
if (datepicker) {
|
|
@@ -2823,7 +2823,7 @@
|
|
|
2823
2823
|
const onInputChange = () => {
|
|
2824
2824
|
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
2825
2825
|
if (isNaN(newValue)) {
|
|
2826
|
-
console.error(`${
|
|
2826
|
+
console.error(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
|
|
2827
2827
|
datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2828
2828
|
return;
|
|
2829
2829
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
@@ -2839,7 +2839,7 @@
|
|
|
2839
2839
|
function setFromModel() {
|
|
2840
2840
|
selected = new Date(el._x_model.get());
|
|
2841
2841
|
if (isNaN(selected)) {
|
|
2842
|
-
console.error(`${
|
|
2842
|
+
console.error(`${original}: input value is not a valid date - ${el._x_model.get()}`);
|
|
2843
2843
|
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2844
2844
|
else el.setAttribute("data-invalid", "true");
|
|
2845
2845
|
} else if (datepicker) {
|
|
@@ -2847,7 +2847,7 @@
|
|
|
2847
2847
|
}
|
|
2848
2848
|
}
|
|
2849
2849
|
function checkForModel() {
|
|
2850
|
-
if (
|
|
2850
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model") && el._x_model.get()) {
|
|
2851
2851
|
setFromModel();
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
@@ -3051,8 +3051,8 @@
|
|
|
3051
3051
|
const year = date.getFullYear();
|
|
3052
3052
|
const month = date.getMonth();
|
|
3053
3053
|
const start = new Date(year, month, 1);
|
|
3054
|
-
const
|
|
3055
|
-
const days =
|
|
3054
|
+
const end = new Date(year, month + 1, 0);
|
|
3055
|
+
const days = end.getDate();
|
|
3056
3056
|
const prevEndDay = new Date(year, month, 1);
|
|
3057
3057
|
prevEndDay.setDate(prevEndDay.getDate() - 1);
|
|
3058
3058
|
let lastPrevMonthDay = prevEndDay.getDate();
|
|
@@ -3159,7 +3159,7 @@
|
|
|
3159
3159
|
break;
|
|
3160
3160
|
case "End":
|
|
3161
3161
|
event.preventDefault();
|
|
3162
|
-
newDay.setDate(
|
|
3162
|
+
newDay.setDate(new Date(newDay.getFullYear(), newDay.getMonth() + 1, 0).getDate());
|
|
3163
3163
|
break;
|
|
3164
3164
|
case "PageUp":
|
|
3165
3165
|
event.preventDefault();
|
|
@@ -3268,7 +3268,7 @@
|
|
|
3268
3268
|
if (datepicker) {
|
|
3269
3269
|
el.addEventListener("transitionend", onTransitionEnd);
|
|
3270
3270
|
}
|
|
3271
|
-
if (
|
|
3271
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
3272
3272
|
const modelExpression = el.getAttribute("x-model");
|
|
3273
3273
|
const evaluateModel = evaluateLater(modelExpression);
|
|
3274
3274
|
effect(() => {
|
|
@@ -3397,7 +3397,7 @@
|
|
|
3397
3397
|
|
|
3398
3398
|
// src/components/datepicker.js
|
|
3399
3399
|
function datepicker_default(Alpine) {
|
|
3400
|
-
Alpine.directive("h-date-picker", (el, { original
|
|
3400
|
+
Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
3401
3401
|
const state = Alpine2.reactive({
|
|
3402
3402
|
expanded: false
|
|
3403
3403
|
});
|
|
@@ -3410,7 +3410,7 @@
|
|
|
3410
3410
|
};
|
|
3411
3411
|
el._h_datepicker.input = el.querySelector("input");
|
|
3412
3412
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
3413
|
-
throw new Error(`${
|
|
3413
|
+
throw new Error(`${original} must contain an input`);
|
|
3414
3414
|
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
3415
3415
|
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
3416
3416
|
} else {
|
|
@@ -3489,16 +3489,16 @@
|
|
|
3489
3489
|
observer.disconnect();
|
|
3490
3490
|
});
|
|
3491
3491
|
});
|
|
3492
|
-
Alpine.directive("h-date-picker-trigger", (el, { original
|
|
3492
|
+
Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
3493
3493
|
if (el.tagName !== "BUTTON") {
|
|
3494
|
-
throw new Error(`${
|
|
3494
|
+
throw new Error(`${original} must be a button`);
|
|
3495
3495
|
}
|
|
3496
3496
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3497
|
-
throw new Error(`${
|
|
3497
|
+
throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3498
3498
|
}
|
|
3499
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
3499
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_datepicker"));
|
|
3500
3500
|
if (!datepicker) {
|
|
3501
|
-
throw new Error(`${
|
|
3501
|
+
throw new Error(`${original} must be inside an date-picker element`);
|
|
3502
3502
|
}
|
|
3503
3503
|
el.classList.add(
|
|
3504
3504
|
"cursor-pointer",
|
|
@@ -3786,13 +3786,13 @@
|
|
|
3786
3786
|
});
|
|
3787
3787
|
}
|
|
3788
3788
|
});
|
|
3789
|
-
Alpine.directive("h-exp-panel-trigger", (el, { original
|
|
3789
|
+
Alpine.directive("h-exp-panel-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
3790
3790
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
3791
|
-
throw new Error(`${
|
|
3791
|
+
throw new Error(`${original} must be a header element`);
|
|
3792
3792
|
}
|
|
3793
|
-
const expPanelItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
3793
|
+
const expPanelItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_expPanelItem"));
|
|
3794
3794
|
if (!expPanelItem) {
|
|
3795
|
-
throw new Error(`${
|
|
3795
|
+
throw new Error(`${original} must have an exp-panel-item parent element`);
|
|
3796
3796
|
}
|
|
3797
3797
|
el.classList.add(
|
|
3798
3798
|
"bg-object-header",
|
|
@@ -3973,13 +3973,13 @@
|
|
|
3973
3973
|
|
|
3974
3974
|
// src/components/icon.js
|
|
3975
3975
|
function icon_default(Alpine) {
|
|
3976
|
-
Alpine.directive("h-icon", (el, { original
|
|
3976
|
+
Alpine.directive("h-icon", (el, { original, modifiers }) => {
|
|
3977
3977
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
3978
|
-
throw new Error(`${
|
|
3978
|
+
throw new Error(`${original} works only on svg elements`);
|
|
3979
3979
|
} else if (!el.hasAttribute("role")) {
|
|
3980
|
-
throw new Error(`${
|
|
3980
|
+
throw new Error(`${original} must have a role`);
|
|
3981
3981
|
} else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3982
|
-
throw new Error(`${
|
|
3982
|
+
throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3983
3983
|
}
|
|
3984
3984
|
el.classList.add("fill-current");
|
|
3985
3985
|
el.setAttribute("data-slot", "icon");
|
|
@@ -4180,7 +4180,7 @@
|
|
|
4180
4180
|
"block-end": ["order-last", "w-full", "justify-start", "px-3", "pb-3", "[.border-t]:pt-3", "group-has-[>input]/input-group:pb-2.5"]
|
|
4181
4181
|
};
|
|
4182
4182
|
function setVariant(variant) {
|
|
4183
|
-
if (
|
|
4183
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
4184
4184
|
}
|
|
4185
4185
|
setVariant(el.getAttribute("data-align") ?? "inline-start");
|
|
4186
4186
|
const handler = (event) => {
|
|
@@ -4200,7 +4200,7 @@
|
|
|
4200
4200
|
el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
|
|
4201
4201
|
el.setAttribute("data-slot", "label");
|
|
4202
4202
|
});
|
|
4203
|
-
Alpine.directive("h-input-number", (el, { original
|
|
4203
|
+
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
4204
4204
|
el.classList.add(
|
|
4205
4205
|
"overflow-hidden",
|
|
4206
4206
|
"group/input-number",
|
|
@@ -4236,7 +4236,7 @@
|
|
|
4236
4236
|
el.setAttribute("data-slot", "input-number");
|
|
4237
4237
|
const input = el.querySelector("input");
|
|
4238
4238
|
if (!input || input.getAttribute("type") !== "number") {
|
|
4239
|
-
throw new Error(`${
|
|
4239
|
+
throw new Error(`${original} must contain an input of type 'number'`);
|
|
4240
4240
|
}
|
|
4241
4241
|
if (!input.hasAttribute("type")) input.setAttribute("type", "number");
|
|
4242
4242
|
if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
|
|
@@ -4450,7 +4450,8 @@
|
|
|
4450
4450
|
focusLastOption(el);
|
|
4451
4451
|
break;
|
|
4452
4452
|
case "Up":
|
|
4453
|
-
case "ArrowUp":
|
|
4453
|
+
case "ArrowUp": {
|
|
4454
|
+
event.preventDefault();
|
|
4454
4455
|
let prevElem = event.target.previousElementSibling;
|
|
4455
4456
|
if (prevElem && prevElem.getAttribute("data-slot") !== "list-header") {
|
|
4456
4457
|
prevElem.focus();
|
|
@@ -4461,8 +4462,10 @@
|
|
|
4461
4462
|
}
|
|
4462
4463
|
}
|
|
4463
4464
|
break;
|
|
4465
|
+
}
|
|
4464
4466
|
case "Down":
|
|
4465
|
-
case "ArrowDown":
|
|
4467
|
+
case "ArrowDown": {
|
|
4468
|
+
event.preventDefault();
|
|
4466
4469
|
let nextElem = event.target.nextElementSibling;
|
|
4467
4470
|
if (nextElem) {
|
|
4468
4471
|
nextElem.focus();
|
|
@@ -4473,6 +4476,7 @@
|
|
|
4473
4476
|
}
|
|
4474
4477
|
}
|
|
4475
4478
|
break;
|
|
4479
|
+
}
|
|
4476
4480
|
case " ":
|
|
4477
4481
|
case "Enter":
|
|
4478
4482
|
selectOption(event.target);
|
|
@@ -4496,13 +4500,13 @@
|
|
|
4496
4500
|
el.setAttribute("data-slot", "list");
|
|
4497
4501
|
el.setAttribute("role", "group");
|
|
4498
4502
|
});
|
|
4499
|
-
Alpine.directive("h-list-header", (el, { original
|
|
4503
|
+
Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
|
|
4500
4504
|
el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
|
|
4501
4505
|
el.setAttribute("role", "presentation");
|
|
4502
4506
|
el.setAttribute("data-slot", "list-header");
|
|
4503
4507
|
const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
|
|
4504
4508
|
if (!list) {
|
|
4505
|
-
throw new Error(`${
|
|
4509
|
+
throw new Error(`${original} must be placed inside a list element`);
|
|
4506
4510
|
}
|
|
4507
4511
|
if (!el.hasAttribute("id")) {
|
|
4508
4512
|
const id = `lbh${uuid_default()}`;
|
|
@@ -4560,9 +4564,9 @@
|
|
|
4560
4564
|
}
|
|
4561
4565
|
}
|
|
4562
4566
|
});
|
|
4563
|
-
Alpine.directive("h-menu", (el, { original
|
|
4567
|
+
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
4564
4568
|
if (el.tagName !== "UL") {
|
|
4565
|
-
throw new Error(`${
|
|
4569
|
+
throw new Error(`${original} must be an ul element`);
|
|
4566
4570
|
}
|
|
4567
4571
|
el.classList.add(
|
|
4568
4572
|
"hidden",
|
|
@@ -4594,11 +4598,11 @@
|
|
|
4594
4598
|
const menuTrigger = (() => {
|
|
4595
4599
|
if (isSubmenu) return;
|
|
4596
4600
|
let sibling = el.previousElementSibling;
|
|
4597
|
-
while (sibling && !
|
|
4601
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_menu_trigger")) {
|
|
4598
4602
|
sibling = sibling.previousElementSibling;
|
|
4599
4603
|
}
|
|
4600
|
-
if (!
|
|
4601
|
-
throw new Error(`${
|
|
4604
|
+
if (!Object.prototype.hasOwnProperty.call(sibling, "_menu_trigger")) {
|
|
4605
|
+
throw new Error(`${original} menu must be placed after a menu trigger element`);
|
|
4602
4606
|
}
|
|
4603
4607
|
return sibling;
|
|
4604
4608
|
})();
|
|
@@ -4607,7 +4611,7 @@
|
|
|
4607
4611
|
if (parent && parent.hasAttribute("id")) {
|
|
4608
4612
|
el.setAttribute("aria-labelledby", parent.id);
|
|
4609
4613
|
} else {
|
|
4610
|
-
throw new Error(`${
|
|
4614
|
+
throw new Error(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
4611
4615
|
}
|
|
4612
4616
|
}
|
|
4613
4617
|
}
|
|
@@ -4615,7 +4619,7 @@
|
|
|
4615
4619
|
if (isSubmenu) {
|
|
4616
4620
|
menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
|
|
4617
4621
|
if (!menuSubItem) {
|
|
4618
|
-
throw new Error(`${
|
|
4622
|
+
throw new Error(`${original} must be placed inside a ${Alpine2.prefixed("h-menu-sub")} element`);
|
|
4619
4623
|
}
|
|
4620
4624
|
setAriaAttrubutes(menuSubItem);
|
|
4621
4625
|
} else if (menuTrigger) {
|
|
@@ -4723,7 +4727,7 @@
|
|
|
4723
4727
|
}
|
|
4724
4728
|
break;
|
|
4725
4729
|
case "Up":
|
|
4726
|
-
case "ArrowUp":
|
|
4730
|
+
case "ArrowUp": {
|
|
4727
4731
|
event.preventDefault();
|
|
4728
4732
|
let menuitems = el.querySelectorAll(':scope > [role^=menuitem][tabIndex="-1"]:has(~ [role^=menuitem][tabIndex="0"])');
|
|
4729
4733
|
if (menuitems.length) {
|
|
@@ -4735,6 +4739,7 @@
|
|
|
4735
4739
|
menuitem.focus();
|
|
4736
4740
|
}
|
|
4737
4741
|
break;
|
|
4742
|
+
}
|
|
4738
4743
|
case "Home":
|
|
4739
4744
|
case "PageUp":
|
|
4740
4745
|
event.preventDefault();
|
|
@@ -4856,9 +4861,9 @@
|
|
|
4856
4861
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
4857
4862
|
});
|
|
4858
4863
|
});
|
|
4859
|
-
Alpine.directive("h-menu-item", (el, { original
|
|
4864
|
+
Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4860
4865
|
if (el.tagName !== "LI") {
|
|
4861
|
-
throw new Error(`${
|
|
4866
|
+
throw new Error(`${original} must be a li element`);
|
|
4862
4867
|
}
|
|
4863
4868
|
el.classList.add(
|
|
4864
4869
|
"focus:bg-secondary-hover",
|
|
@@ -4912,7 +4917,7 @@
|
|
|
4912
4917
|
el.removeEventListener("mouseleave", focusOut);
|
|
4913
4918
|
});
|
|
4914
4919
|
});
|
|
4915
|
-
Alpine.directive("h-menu-sub", (el, { original
|
|
4920
|
+
Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4916
4921
|
el.classList.add(
|
|
4917
4922
|
"focus:bg-secondary-hover",
|
|
4918
4923
|
"hover:bg-secondary-hover",
|
|
@@ -4944,7 +4949,7 @@
|
|
|
4944
4949
|
const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
|
|
4945
4950
|
el.appendChild(chevronRight);
|
|
4946
4951
|
const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
|
|
4947
|
-
if (!parentMenu) throw new Error(`${
|
|
4952
|
+
if (!parentMenu) throw new Error(`${original} must have a parent`);
|
|
4948
4953
|
if (!el.hasAttribute("id")) {
|
|
4949
4954
|
el.setAttribute("id", `ms${uuid_default()}`);
|
|
4950
4955
|
}
|
|
@@ -5041,9 +5046,9 @@
|
|
|
5041
5046
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
5042
5047
|
el.setAttribute("data-slot", "menu-label");
|
|
5043
5048
|
});
|
|
5044
|
-
Alpine.directive("h-menu-checkbox-item", (el, { original
|
|
5049
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
5045
5050
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
5046
|
-
throw new Error(`${
|
|
5051
|
+
throw new Error(`${original} must be a li or div element`);
|
|
5047
5052
|
}
|
|
5048
5053
|
el.classList.add(
|
|
5049
5054
|
"focus:bg-secondary-hover",
|
|
@@ -5083,7 +5088,7 @@
|
|
|
5083
5088
|
el._x_model.set(!el._x_model.get());
|
|
5084
5089
|
setState(el._x_model.get());
|
|
5085
5090
|
}
|
|
5086
|
-
if (
|
|
5091
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5087
5092
|
setState(el._x_model.get(), false);
|
|
5088
5093
|
el.addEventListener("click", onActivate);
|
|
5089
5094
|
}
|
|
@@ -5100,7 +5105,7 @@
|
|
|
5100
5105
|
el.addEventListener("mouseenter", focusIn);
|
|
5101
5106
|
el.addEventListener("focus", focusIn);
|
|
5102
5107
|
cleanup(() => {
|
|
5103
|
-
if (
|
|
5108
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5104
5109
|
el.removeEventListener("click", onActivate);
|
|
5105
5110
|
el.removeEventListener("keydown", onActivate);
|
|
5106
5111
|
}
|
|
@@ -5110,9 +5115,9 @@
|
|
|
5110
5115
|
el.removeEventListener("mouseleave", focusOut);
|
|
5111
5116
|
});
|
|
5112
5117
|
});
|
|
5113
|
-
Alpine.directive("h-menu-radio-item", (el, { original
|
|
5118
|
+
Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
5114
5119
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
5115
|
-
throw new Error(`${
|
|
5120
|
+
throw new Error(`${original} must be a li or div element`);
|
|
5116
5121
|
}
|
|
5117
5122
|
el.classList.add(
|
|
5118
5123
|
"focus:bg-secondary-hover",
|
|
@@ -5168,7 +5173,7 @@
|
|
|
5168
5173
|
el._x_model.set(value);
|
|
5169
5174
|
}
|
|
5170
5175
|
}
|
|
5171
|
-
if (
|
|
5176
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5172
5177
|
effect(() => {
|
|
5173
5178
|
setState(el._x_model.get() === value);
|
|
5174
5179
|
});
|
|
@@ -5188,7 +5193,7 @@
|
|
|
5188
5193
|
el.addEventListener("mouseenter", focusIn);
|
|
5189
5194
|
el.addEventListener("focus", focusIn);
|
|
5190
5195
|
cleanup(() => {
|
|
5191
|
-
if (
|
|
5196
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5192
5197
|
el.removeEventListener("click", onActivate);
|
|
5193
5198
|
el.removeEventListener("keydown", onActivate);
|
|
5194
5199
|
}
|
|
@@ -5236,7 +5241,7 @@
|
|
|
5236
5241
|
};
|
|
5237
5242
|
this.items.push(item);
|
|
5238
5243
|
this.listeners.forEach((listener) => {
|
|
5239
|
-
if (
|
|
5244
|
+
if (Object.prototype.hasOwnProperty.call(listener, "added")) listener.added(item);
|
|
5240
5245
|
});
|
|
5241
5246
|
},
|
|
5242
5247
|
update(id, data) {
|
|
@@ -5249,7 +5254,7 @@
|
|
|
5249
5254
|
this.items[index].data[key] = value;
|
|
5250
5255
|
}
|
|
5251
5256
|
this.listeners.forEach((listener) => {
|
|
5252
|
-
if (
|
|
5257
|
+
if (Object.prototype.hasOwnProperty.call(listener, "updated")) listener.updated(id, data);
|
|
5253
5258
|
});
|
|
5254
5259
|
} else {
|
|
5255
5260
|
console.error(`Notification with id "${id}" does not exist`);
|
|
@@ -5260,7 +5265,7 @@
|
|
|
5260
5265
|
throw new Error("Cannot remove a notification if an ID is not provided");
|
|
5261
5266
|
}
|
|
5262
5267
|
this.listeners.forEach((listener) => {
|
|
5263
|
-
if (
|
|
5268
|
+
if (Object.prototype.hasOwnProperty.call(listener, "removed")) listener.removed(id);
|
|
5264
5269
|
});
|
|
5265
5270
|
this.items = this.items.filter((n) => n.id !== id);
|
|
5266
5271
|
}
|
|
@@ -5285,9 +5290,9 @@
|
|
|
5285
5290
|
}
|
|
5286
5291
|
};
|
|
5287
5292
|
});
|
|
5288
|
-
Alpine.directive("h-notification-overlay", (el, { original
|
|
5293
|
+
Alpine.directive("h-notification-overlay", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
5289
5294
|
if (el.tagName !== "SECTION") {
|
|
5290
|
-
throw new Error(`${
|
|
5295
|
+
throw new Error(`${original} must be a button`);
|
|
5291
5296
|
}
|
|
5292
5297
|
const notificationTemplates = {};
|
|
5293
5298
|
el.querySelectorAll("template").forEach((template) => {
|
|
@@ -5422,17 +5427,17 @@
|
|
|
5422
5427
|
xlBreakpointListener.remove();
|
|
5423
5428
|
});
|
|
5424
5429
|
});
|
|
5425
|
-
Alpine.directive("h-notification-list", (el, { original
|
|
5430
|
+
Alpine.directive("h-notification-list", (el, { original }) => {
|
|
5426
5431
|
if (el.tagName !== "OL" && el.tagName !== "UL") {
|
|
5427
|
-
throw new Error(`${
|
|
5432
|
+
throw new Error(`${original} must be a list element`);
|
|
5428
5433
|
}
|
|
5429
5434
|
el.classList.add("flex", "flex-col", "divide-solid", "divide-y");
|
|
5430
5435
|
el.setAttribute("data-slot", "notification-list");
|
|
5431
5436
|
el.setAttribute("role", "group");
|
|
5432
5437
|
});
|
|
5433
|
-
Alpine.directive("h-notification", (el, { original
|
|
5438
|
+
Alpine.directive("h-notification", (el, { original, modifiers }) => {
|
|
5434
5439
|
if (el.tagName !== "LI") {
|
|
5435
|
-
throw new Error(`${
|
|
5440
|
+
throw new Error(`${original} must be a list item element`);
|
|
5436
5441
|
}
|
|
5437
5442
|
el.classList.add("pointer-events-auto", "p-3", "flex", "gap-2");
|
|
5438
5443
|
if (modifiers.includes("floating")) {
|
|
@@ -5468,7 +5473,7 @@
|
|
|
5468
5473
|
el.classList.add("flex", "gap-2", "data-[orientation=vertical]:flex-col");
|
|
5469
5474
|
el.setAttribute("data-slot", "notification-actions");
|
|
5470
5475
|
});
|
|
5471
|
-
Alpine.directive("h-notification-close", (el, { original
|
|
5476
|
+
Alpine.directive("h-notification-close", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
5472
5477
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "notification-close");
|
|
5473
5478
|
let nId;
|
|
5474
5479
|
function close() {
|
|
@@ -5487,7 +5492,7 @@
|
|
|
5487
5492
|
el.removeEventListener("click", close);
|
|
5488
5493
|
});
|
|
5489
5494
|
} else {
|
|
5490
|
-
console.error(`${
|
|
5495
|
+
console.error(`${original} must be inside a notification with an id`);
|
|
5491
5496
|
}
|
|
5492
5497
|
});
|
|
5493
5498
|
}
|
|
@@ -5576,7 +5581,7 @@
|
|
|
5576
5581
|
// src/components/popover.js
|
|
5577
5582
|
function popover_default(Alpine) {
|
|
5578
5583
|
Alpine.directive("h-popover-trigger", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
5579
|
-
el.
|
|
5584
|
+
el._h_popover = Alpine2.reactive({
|
|
5580
5585
|
id: void 0,
|
|
5581
5586
|
controls: `hpc${uuid_default()}`,
|
|
5582
5587
|
auto: expression ? false : true,
|
|
@@ -5586,7 +5591,7 @@
|
|
|
5586
5591
|
const getExpanded = evaluateLater(expression);
|
|
5587
5592
|
effect(() => {
|
|
5588
5593
|
getExpanded((expanded) => {
|
|
5589
|
-
el.
|
|
5594
|
+
el._h_popover.expanded = expanded;
|
|
5590
5595
|
});
|
|
5591
5596
|
});
|
|
5592
5597
|
}
|
|
@@ -5596,33 +5601,33 @@
|
|
|
5596
5601
|
}
|
|
5597
5602
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "popover-trigger");
|
|
5598
5603
|
if (el.hasAttribute("id")) {
|
|
5599
|
-
el.
|
|
5604
|
+
el._h_popover.id = el.getAttribute("id");
|
|
5600
5605
|
} else {
|
|
5601
|
-
el.
|
|
5602
|
-
el.setAttribute("id", el.
|
|
5606
|
+
el._h_popover.id = `hp${uuid_default()}`;
|
|
5607
|
+
el.setAttribute("id", el._h_popover.id);
|
|
5603
5608
|
}
|
|
5604
|
-
el.setAttribute("aria-controls", el.
|
|
5609
|
+
el.setAttribute("aria-controls", el._h_popover.controls);
|
|
5605
5610
|
el.setAttribute("aria-haspopup", "dialog");
|
|
5606
5611
|
const setAttributes = () => {
|
|
5607
|
-
el.setAttribute("aria-expanded", el.
|
|
5612
|
+
el.setAttribute("aria-expanded", el._h_popover.expanded);
|
|
5608
5613
|
};
|
|
5609
5614
|
const close = () => {
|
|
5610
|
-
el.
|
|
5615
|
+
el._h_popover.expanded = false;
|
|
5611
5616
|
el.addEventListener("click", handler);
|
|
5612
5617
|
setAttributes();
|
|
5613
5618
|
};
|
|
5614
5619
|
const handler = () => {
|
|
5615
|
-
el.
|
|
5620
|
+
el._h_popover.expanded = !el._h_popover.expanded;
|
|
5616
5621
|
setAttributes();
|
|
5617
5622
|
Alpine2.nextTick(() => {
|
|
5618
|
-
if (el.
|
|
5623
|
+
if (el._h_popover.auto && el._h_popover.expanded) {
|
|
5619
5624
|
top.addEventListener("click", close, { once: true });
|
|
5620
5625
|
el.removeEventListener("click", handler);
|
|
5621
5626
|
}
|
|
5622
5627
|
});
|
|
5623
5628
|
};
|
|
5624
5629
|
setAttributes();
|
|
5625
|
-
if (el.
|
|
5630
|
+
if (el._h_popover.auto) {
|
|
5626
5631
|
el.addEventListener("click", handler);
|
|
5627
5632
|
cleanup(() => {
|
|
5628
5633
|
el.removeEventListener("click", handler);
|
|
@@ -5634,16 +5639,16 @@
|
|
|
5634
5639
|
});
|
|
5635
5640
|
}
|
|
5636
5641
|
});
|
|
5637
|
-
Alpine.directive("h-popover", (el, { original
|
|
5642
|
+
Alpine.directive("h-popover", (el, { original, modifiers }, { effect, cleanup }) => {
|
|
5638
5643
|
const popover = (() => {
|
|
5639
5644
|
let sibling = el.previousElementSibling;
|
|
5640
|
-
while (sibling && !
|
|
5645
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_h_popover")) {
|
|
5641
5646
|
sibling = sibling.previousElementSibling;
|
|
5642
5647
|
}
|
|
5643
5648
|
return sibling;
|
|
5644
5649
|
})();
|
|
5645
5650
|
if (!popover) {
|
|
5646
|
-
throw new Error(`${
|
|
5651
|
+
throw new Error(`${original} must be placed after a popover element`);
|
|
5647
5652
|
}
|
|
5648
5653
|
el.classList.add(
|
|
5649
5654
|
"absolute",
|
|
@@ -5669,8 +5674,8 @@
|
|
|
5669
5674
|
el.setAttribute("data-slot", "popover");
|
|
5670
5675
|
el.setAttribute("role", "dialog");
|
|
5671
5676
|
el.setAttribute("tabindex", "-1");
|
|
5672
|
-
el.setAttribute("id", popover.
|
|
5673
|
-
el.setAttribute("aria-labelledby", popover.
|
|
5677
|
+
el.setAttribute("id", popover._h_popover.controls);
|
|
5678
|
+
el.setAttribute("aria-labelledby", popover._h_popover.id);
|
|
5674
5679
|
let noScroll = modifiers.includes("no-scroll");
|
|
5675
5680
|
if (noScroll) {
|
|
5676
5681
|
el.classList.remove("overflow-auto");
|
|
@@ -5708,7 +5713,7 @@
|
|
|
5708
5713
|
});
|
|
5709
5714
|
}
|
|
5710
5715
|
effect(() => {
|
|
5711
|
-
if (popover.
|
|
5716
|
+
if (popover._h_popover.expanded) {
|
|
5712
5717
|
el.classList.remove("hidden");
|
|
5713
5718
|
autoUpdateCleanup = autoUpdate(popover, el, updatePosition);
|
|
5714
5719
|
} else {
|
|
@@ -7680,7 +7685,7 @@
|
|
|
7680
7685
|
el.classList.add("harmonia-slider");
|
|
7681
7686
|
el.setAttribute("data-slot", "range");
|
|
7682
7687
|
initialize(el, evaluate2(expression));
|
|
7683
|
-
if (
|
|
7688
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
7684
7689
|
el.noUiSlider.on("change", (values) => {
|
|
7685
7690
|
el._x_model.set(values);
|
|
7686
7691
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
@@ -7762,11 +7767,11 @@
|
|
|
7762
7767
|
});
|
|
7763
7768
|
}
|
|
7764
7769
|
});
|
|
7765
|
-
Alpine.directive("h-select-input", (el, { original
|
|
7770
|
+
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7766
7771
|
if (el.tagName !== "INPUT") {
|
|
7767
|
-
throw new Error(`${
|
|
7772
|
+
throw new Error(`${original} must be an input of type "text"`);
|
|
7768
7773
|
}
|
|
7769
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
7774
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_select"));
|
|
7770
7775
|
const label = (() => {
|
|
7771
7776
|
const field = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "field");
|
|
7772
7777
|
if (field) {
|
|
@@ -7775,8 +7780,8 @@
|
|
|
7775
7780
|
return;
|
|
7776
7781
|
})();
|
|
7777
7782
|
if (!select) {
|
|
7778
|
-
throw new Error(`${
|
|
7779
|
-
} else if (
|
|
7783
|
+
throw new Error(`${original} must be inside a select element`);
|
|
7784
|
+
} else if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
7780
7785
|
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
7781
7786
|
select._h_model.set = (value) => {
|
|
7782
7787
|
if (select._h_select.multiple) {
|
|
@@ -7874,7 +7879,7 @@
|
|
|
7874
7879
|
const onKeyDown = (event) => {
|
|
7875
7880
|
switch (event.key) {
|
|
7876
7881
|
case "Down":
|
|
7877
|
-
case "ArrowDown":
|
|
7882
|
+
case "ArrowDown": {
|
|
7878
7883
|
event.preventDefault();
|
|
7879
7884
|
let nextIndex = 0;
|
|
7880
7885
|
for (let o = 0; o < options.length; o++) {
|
|
@@ -7896,8 +7901,9 @@
|
|
|
7896
7901
|
options[nextIndex].setAttribute("tabindex", "0");
|
|
7897
7902
|
options[nextIndex].focus();
|
|
7898
7903
|
break;
|
|
7904
|
+
}
|
|
7899
7905
|
case "Up":
|
|
7900
|
-
case "ArrowUp":
|
|
7906
|
+
case "ArrowUp": {
|
|
7901
7907
|
event.preventDefault();
|
|
7902
7908
|
let prevIndex = options.length - 1;
|
|
7903
7909
|
for (let o = options.length - 1; o >= 0; o--) {
|
|
@@ -7919,6 +7925,7 @@
|
|
|
7919
7925
|
options[prevIndex].setAttribute("tabindex", "0");
|
|
7920
7926
|
options[prevIndex].focus();
|
|
7921
7927
|
break;
|
|
7928
|
+
}
|
|
7922
7929
|
case "Home":
|
|
7923
7930
|
case "PageUp":
|
|
7924
7931
|
event.preventDefault();
|
|
@@ -8035,10 +8042,10 @@
|
|
|
8035
8042
|
}
|
|
8036
8043
|
});
|
|
8037
8044
|
});
|
|
8038
|
-
Alpine.directive("h-select-content", (el, { original
|
|
8039
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8045
|
+
Alpine.directive("h-select-content", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8046
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_select"));
|
|
8040
8047
|
if (!select) {
|
|
8041
|
-
throw new Error(`${
|
|
8048
|
+
throw new Error(`${original} must be inside a select element`);
|
|
8042
8049
|
}
|
|
8043
8050
|
el.classList.add(
|
|
8044
8051
|
"absolute",
|
|
@@ -8067,7 +8074,7 @@
|
|
|
8067
8074
|
el.setAttribute("id", select._h_select.controls);
|
|
8068
8075
|
el.setAttribute("tabindex", "-1");
|
|
8069
8076
|
if (!select._h_select.trigger) {
|
|
8070
|
-
throw new Error(`${
|
|
8077
|
+
throw new Error(`${original}: trigger not found`);
|
|
8071
8078
|
}
|
|
8072
8079
|
let autoUpdateCleanup;
|
|
8073
8080
|
function updatePosition() {
|
|
@@ -8128,10 +8135,10 @@
|
|
|
8128
8135
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
8129
8136
|
});
|
|
8130
8137
|
});
|
|
8131
|
-
Alpine.directive("h-select-search", (el, { original
|
|
8132
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8138
|
+
Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8139
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_select"));
|
|
8133
8140
|
if (!select) {
|
|
8134
|
-
throw new Error(`${
|
|
8141
|
+
throw new Error(`${original} must be inside an h-select element`);
|
|
8135
8142
|
} else {
|
|
8136
8143
|
select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
|
|
8137
8144
|
}
|
|
@@ -8196,17 +8203,17 @@
|
|
|
8196
8203
|
Alpine.directive("h-select-label", (el) => {
|
|
8197
8204
|
el.classList.add("text-muted-foreground", "px-2", "py-1.5", "text-xs");
|
|
8198
8205
|
el.setAttribute("data-slot", "select-label");
|
|
8199
|
-
const selectGroup = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8206
|
+
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_selectGroup"));
|
|
8200
8207
|
if (selectGroup) {
|
|
8201
8208
|
const id = `hsl${uuid_default()}`;
|
|
8202
8209
|
el.setAttribute("id", id);
|
|
8203
8210
|
selectGroup._h_selectGroup.labelledby = id;
|
|
8204
8211
|
}
|
|
8205
8212
|
});
|
|
8206
|
-
Alpine.directive("h-select-option", (el, { original
|
|
8207
|
-
const select = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8213
|
+
Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
|
|
8214
|
+
const select = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_select"));
|
|
8208
8215
|
if (!select) {
|
|
8209
|
-
throw new Error(`${
|
|
8216
|
+
throw new Error(`${original} must be inside an h-select element`);
|
|
8210
8217
|
}
|
|
8211
8218
|
el.classList.add(
|
|
8212
8219
|
"focus:bg-primary",
|
|
@@ -8402,10 +8409,10 @@
|
|
|
8402
8409
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
8403
8410
|
});
|
|
8404
8411
|
});
|
|
8405
|
-
Alpine.directive("h-sheet", (el, { original
|
|
8406
|
-
const overlay = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8412
|
+
Alpine.directive("h-sheet", (el, { original }, { effect, cleanup }) => {
|
|
8413
|
+
const overlay = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sheet_overlay"));
|
|
8407
8414
|
if (!overlay) {
|
|
8408
|
-
throw new Error(`${
|
|
8415
|
+
throw new Error(`${original} must be placed inside a sheet overlay`);
|
|
8409
8416
|
}
|
|
8410
8417
|
el.classList.add("hidden", "bg-background", "fixed", "shadow-lg", "transform", "transition-all", "motion-reduce:transition-none", "duration-200", "ease-out");
|
|
8411
8418
|
el.setAttribute("data-slot", "sheet");
|
|
@@ -8528,10 +8535,10 @@
|
|
|
8528
8535
|
});
|
|
8529
8536
|
}
|
|
8530
8537
|
});
|
|
8531
|
-
Alpine.directive("h-sidebar-group-label", (el, { original
|
|
8532
|
-
const group = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8538
|
+
Alpine.directive("h-sidebar-group-label", (el, { original }, { cleanup }) => {
|
|
8539
|
+
const group = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_group"));
|
|
8533
8540
|
if (!group) {
|
|
8534
|
-
throw new Error(`${
|
|
8541
|
+
throw new Error(`${original} must be placed inside a sidebar group`);
|
|
8535
8542
|
}
|
|
8536
8543
|
el.classList.add(
|
|
8537
8544
|
"ring-sidebar-ring",
|
|
@@ -8620,10 +8627,10 @@
|
|
|
8620
8627
|
}
|
|
8621
8628
|
el.setAttribute("data-slot", "sidebar-group-action");
|
|
8622
8629
|
});
|
|
8623
|
-
Alpine.directive("h-sidebar-group-content", (el, { original
|
|
8624
|
-
const group = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8630
|
+
Alpine.directive("h-sidebar-group-content", (el, { original }, { effect }) => {
|
|
8631
|
+
const group = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_group"));
|
|
8625
8632
|
if (!group) {
|
|
8626
|
-
throw new Error(`${
|
|
8633
|
+
throw new Error(`${original} must be placed inside a sidebar group`);
|
|
8627
8634
|
}
|
|
8628
8635
|
el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
|
|
8629
8636
|
el.setAttribute("data-slot", "sidebar-group-content");
|
|
@@ -8636,16 +8643,16 @@
|
|
|
8636
8643
|
});
|
|
8637
8644
|
}
|
|
8638
8645
|
});
|
|
8639
|
-
Alpine.directive("h-sidebar-menu", (el, { original
|
|
8646
|
+
Alpine.directive("h-sidebar-menu", (el, { original }) => {
|
|
8640
8647
|
if (el.tagName !== "UL") {
|
|
8641
|
-
throw new Error(`${
|
|
8648
|
+
throw new Error(`${original} must be an ul element`);
|
|
8642
8649
|
}
|
|
8643
8650
|
el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
|
|
8644
8651
|
el.setAttribute("data-slot", "sidebar-menu");
|
|
8645
8652
|
});
|
|
8646
|
-
Alpine.directive("h-sidebar-menu-item", (el, { original
|
|
8653
|
+
Alpine.directive("h-sidebar-menu-item", (el, { original, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
8647
8654
|
if (el.tagName !== "LI") {
|
|
8648
|
-
throw new Error(`${
|
|
8655
|
+
throw new Error(`${original} must be a li element`);
|
|
8649
8656
|
}
|
|
8650
8657
|
el._h_sidebar_menu_item = {
|
|
8651
8658
|
isSub: false,
|
|
@@ -8681,13 +8688,13 @@
|
|
|
8681
8688
|
});
|
|
8682
8689
|
}
|
|
8683
8690
|
});
|
|
8684
|
-
Alpine.directive("h-sidebar-menu-button", (el, { original
|
|
8691
|
+
Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
8685
8692
|
if (el.tagName !== "BUTTON" && el.tagName !== "A") {
|
|
8686
|
-
throw new Error(`${
|
|
8693
|
+
throw new Error(`${original} must be a button or a link`);
|
|
8687
8694
|
} else if (el.tagName === "BUTTON") {
|
|
8688
8695
|
el.setAttribute("type", "button");
|
|
8689
8696
|
}
|
|
8690
|
-
const menuItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8697
|
+
const menuItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_menu_item"));
|
|
8691
8698
|
el.classList.add(
|
|
8692
8699
|
"flex",
|
|
8693
8700
|
"w-full",
|
|
@@ -8720,7 +8727,7 @@
|
|
|
8720
8727
|
lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
|
|
8721
8728
|
};
|
|
8722
8729
|
function setSize2(size3) {
|
|
8723
|
-
if (
|
|
8730
|
+
if (Object.prototype.hasOwnProperty.call(sizes, size3)) {
|
|
8724
8731
|
el.classList.add(...sizes[size3]);
|
|
8725
8732
|
}
|
|
8726
8733
|
}
|
|
@@ -8821,9 +8828,9 @@
|
|
|
8821
8828
|
}
|
|
8822
8829
|
el.setAttribute("data-slot", "sidebar-menu-action");
|
|
8823
8830
|
});
|
|
8824
|
-
Alpine.directive("h-sidebar-menu-badge", (el, { original
|
|
8831
|
+
Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
|
|
8825
8832
|
if (el.tagName !== "SPAN") {
|
|
8826
|
-
throw new Error(`${
|
|
8833
|
+
throw new Error(`${original} must be a span element`);
|
|
8827
8834
|
}
|
|
8828
8835
|
el.classList.add("flex-1", "pointer-events-none", "flex", "h-full", "min-w-min", "items-center", "justify-end", "text-xs", "font-medium", "tabular-nums", "select-none", "group-data-[collapsed=true]/sidebar:hidden");
|
|
8829
8836
|
el.setAttribute("data-slot", "sidebar-menu-badge");
|
|
@@ -8849,13 +8856,13 @@
|
|
|
8849
8856
|
el.setAttribute("data-slot", "sidebar-separator");
|
|
8850
8857
|
el.setAttribute("role", "none");
|
|
8851
8858
|
});
|
|
8852
|
-
Alpine.directive("h-sidebar-menu-sub", (el, { original
|
|
8859
|
+
Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
8853
8860
|
if (el.tagName !== "UL") {
|
|
8854
|
-
throw new Error(`${
|
|
8861
|
+
throw new Error(`${original} must be an ul element`);
|
|
8855
8862
|
}
|
|
8856
|
-
const menuItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8863
|
+
const menuItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_menu_item"));
|
|
8857
8864
|
if (!menuItem) {
|
|
8858
|
-
throw new Error(`${
|
|
8865
|
+
throw new Error(`${original} must be placed inside a sidebar menu item`);
|
|
8859
8866
|
}
|
|
8860
8867
|
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "pl-2.5", "py-0.5", "ml-3.5", "data-[collapsed=true]:!hidden", "group-data-[collapsed=true]/sidebar:!hidden");
|
|
8861
8868
|
if (el.getAttribute("data-line") !== "false") {
|
|
@@ -8930,7 +8937,7 @@
|
|
|
8930
8937
|
|
|
8931
8938
|
// src/components/split.js
|
|
8932
8939
|
function split_default(Alpine) {
|
|
8933
|
-
Alpine.directive("h-split", (el,
|
|
8940
|
+
Alpine.directive("h-split", (el, _, { cleanup, Alpine: Alpine2 }) => {
|
|
8934
8941
|
const panels = [];
|
|
8935
8942
|
const state = Alpine2.reactive({
|
|
8936
8943
|
isHorizontal: el.getAttribute("data-orientation") === "horizontal",
|
|
@@ -9126,10 +9133,10 @@
|
|
|
9126
9133
|
observer.disconnect();
|
|
9127
9134
|
});
|
|
9128
9135
|
});
|
|
9129
|
-
Alpine.directive("h-split-panel", (el, { original
|
|
9130
|
-
const split = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
9136
|
+
Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
9137
|
+
const split = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_split"));
|
|
9131
9138
|
if (!split) {
|
|
9132
|
-
throw new Error(`${
|
|
9139
|
+
throw new Error(`${original} must be inside an split element`);
|
|
9133
9140
|
}
|
|
9134
9141
|
el.classList.add(
|
|
9135
9142
|
"flex",
|
|
@@ -9680,7 +9687,7 @@
|
|
|
9680
9687
|
el.setAttribute("role", "tablist");
|
|
9681
9688
|
el.setAttribute("data-slot", "tab-list");
|
|
9682
9689
|
});
|
|
9683
|
-
Alpine.directive("h-tab", (el, { original
|
|
9690
|
+
Alpine.directive("h-tab", (el, { original }) => {
|
|
9684
9691
|
el.classList.add(
|
|
9685
9692
|
"cursor-pointer",
|
|
9686
9693
|
"focus-visible:border-ring",
|
|
@@ -9729,8 +9736,8 @@
|
|
|
9729
9736
|
);
|
|
9730
9737
|
el.setAttribute("role", "tab");
|
|
9731
9738
|
el.setAttribute("data-slot", "tab");
|
|
9732
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
9733
|
-
if (!el.hasAttribute("aria-controls")) throw new Error(`${
|
|
9739
|
+
if (!el.hasAttribute("id")) throw new Error(`${original}: Tabs must have an id`);
|
|
9740
|
+
if (!el.hasAttribute("aria-controls")) throw new Error(`${original}: aria-controls must be set to the tab-content id.`);
|
|
9734
9741
|
});
|
|
9735
9742
|
Alpine.directive("h-tab-action", (el) => {
|
|
9736
9743
|
el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
|
|
@@ -9764,13 +9771,13 @@
|
|
|
9764
9771
|
el.setAttribute("role", "button");
|
|
9765
9772
|
el.setAttribute("data-slot", "tab-list-action");
|
|
9766
9773
|
});
|
|
9767
|
-
Alpine.directive("h-tabs-content", (el, { original
|
|
9774
|
+
Alpine.directive("h-tabs-content", (el, { original }) => {
|
|
9768
9775
|
el.classList.add("flex-1", "outline-none");
|
|
9769
9776
|
el.setAttribute("role", "tabpanel");
|
|
9770
9777
|
el.setAttribute("tabindex", "0");
|
|
9771
9778
|
el.setAttribute("data-slot", "tabs-content");
|
|
9772
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
9773
|
-
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${
|
|
9779
|
+
if (!el.hasAttribute("id")) throw new Error(`${original}: Tab content must have an id`);
|
|
9780
|
+
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original}: aria-labelledby must be set to the tab id.`);
|
|
9774
9781
|
});
|
|
9775
9782
|
}
|
|
9776
9783
|
|
|
@@ -10181,13 +10188,13 @@
|
|
|
10181
10188
|
top.removeEventListener("click", el._h_timepicker.close);
|
|
10182
10189
|
});
|
|
10183
10190
|
});
|
|
10184
|
-
Alpine.directive("h-time-picker-input", (el, { original
|
|
10191
|
+
Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
10185
10192
|
if (el.tagName !== "INPUT") {
|
|
10186
|
-
throw new Error(`${
|
|
10193
|
+
throw new Error(`${original} must be a readonly input of type "text"`);
|
|
10187
10194
|
}
|
|
10188
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
10195
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_timepicker"));
|
|
10189
10196
|
if (!timepicker) {
|
|
10190
|
-
throw new Error(`${
|
|
10197
|
+
throw new Error(`${original} must be inside a time-picker element`);
|
|
10191
10198
|
}
|
|
10192
10199
|
timepicker._h_timepicker.focusInput = () => {
|
|
10193
10200
|
el.focus();
|
|
@@ -10197,7 +10204,7 @@
|
|
|
10197
10204
|
el.dispatchEvent(new Event("change"));
|
|
10198
10205
|
});
|
|
10199
10206
|
};
|
|
10200
|
-
if (
|
|
10207
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
10201
10208
|
timepicker._h_timepicker.model = el._x_model;
|
|
10202
10209
|
} else {
|
|
10203
10210
|
timepicker._h_timepicker.model = {
|
|
@@ -10285,7 +10292,7 @@
|
|
|
10285
10292
|
});
|
|
10286
10293
|
});
|
|
10287
10294
|
Alpine.directive("h-time-picker-popup", (el, _, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
10288
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
10295
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_timepicker"));
|
|
10289
10296
|
el.classList.add(
|
|
10290
10297
|
"overflow-hidden",
|
|
10291
10298
|
"outline-none",
|
|
@@ -10385,7 +10392,7 @@
|
|
|
10385
10392
|
}
|
|
10386
10393
|
switch (event.key) {
|
|
10387
10394
|
case "Up":
|
|
10388
|
-
case "ArrowUp":
|
|
10395
|
+
case "ArrowUp": {
|
|
10389
10396
|
event.target.setAttribute("tabindex", "-1");
|
|
10390
10397
|
let prevElem = event.target.previousElementSibling;
|
|
10391
10398
|
if (prevElem === null || prevElem.classList.contains("hidden")) {
|
|
@@ -10398,8 +10405,9 @@
|
|
|
10398
10405
|
prevElem.setAttribute("tabindex", "0");
|
|
10399
10406
|
prevElem.focus();
|
|
10400
10407
|
break;
|
|
10408
|
+
}
|
|
10401
10409
|
case "Down":
|
|
10402
|
-
case "ArrowDown":
|
|
10410
|
+
case "ArrowDown": {
|
|
10403
10411
|
event.target.setAttribute("tabindex", "-1");
|
|
10404
10412
|
let nextElem = event.target.nextElementSibling;
|
|
10405
10413
|
if (nextElem === null || nextElem.classList.contains("hidden")) {
|
|
@@ -10412,8 +10420,9 @@
|
|
|
10412
10420
|
nextElem.setAttribute("tabindex", "0");
|
|
10413
10421
|
nextElem.focus();
|
|
10414
10422
|
break;
|
|
10423
|
+
}
|
|
10415
10424
|
case "Home":
|
|
10416
|
-
case "PageUp":
|
|
10425
|
+
case "PageUp": {
|
|
10417
10426
|
let firstChild;
|
|
10418
10427
|
if (list.firstChild === event.target) {
|
|
10419
10428
|
break;
|
|
@@ -10430,8 +10439,9 @@
|
|
|
10430
10439
|
firstChild.setAttribute("tabindex", "0");
|
|
10431
10440
|
firstChild.focus();
|
|
10432
10441
|
break;
|
|
10442
|
+
}
|
|
10433
10443
|
case "End":
|
|
10434
|
-
case "PageDown":
|
|
10444
|
+
case "PageDown": {
|
|
10435
10445
|
let lastElem;
|
|
10436
10446
|
if (list.lastChild === event.target) {
|
|
10437
10447
|
break;
|
|
@@ -10448,22 +10458,25 @@
|
|
|
10448
10458
|
lastElem.setAttribute("tabindex", "0");
|
|
10449
10459
|
lastElem.focus();
|
|
10450
10460
|
break;
|
|
10461
|
+
}
|
|
10451
10462
|
case "Right":
|
|
10452
|
-
case "ArrowRight":
|
|
10463
|
+
case "ArrowRight": {
|
|
10453
10464
|
let nextColumn = event.target.parentElement.nextElementSibling;
|
|
10454
10465
|
if (nextColumn) {
|
|
10455
10466
|
const child = nextColumn.querySelector('li[tabindex="0"]');
|
|
10456
10467
|
child.focus();
|
|
10457
10468
|
}
|
|
10458
10469
|
break;
|
|
10470
|
+
}
|
|
10459
10471
|
case "Left":
|
|
10460
|
-
case "ArrowLeft":
|
|
10472
|
+
case "ArrowLeft": {
|
|
10461
10473
|
let prevColumn = event.target.parentElement.previousElementSibling;
|
|
10462
10474
|
if (prevColumn) {
|
|
10463
10475
|
const child = prevColumn.querySelector('li[tabindex="0"]');
|
|
10464
10476
|
child.focus();
|
|
10465
10477
|
}
|
|
10466
10478
|
break;
|
|
10479
|
+
}
|
|
10467
10480
|
case "Enter":
|
|
10468
10481
|
case " ":
|
|
10469
10482
|
event.target.click();
|
|
@@ -10864,16 +10877,16 @@
|
|
|
10864
10877
|
el.removeEventListener("pointerleave", handler);
|
|
10865
10878
|
});
|
|
10866
10879
|
});
|
|
10867
|
-
Alpine.directive("h-tooltip", (el, { original
|
|
10880
|
+
Alpine.directive("h-tooltip", (el, { original }, { effect, cleanup }) => {
|
|
10868
10881
|
const tooltip = (() => {
|
|
10869
10882
|
let sibling = el.previousElementSibling;
|
|
10870
|
-
while (sibling && !
|
|
10883
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_tooltip")) {
|
|
10871
10884
|
sibling = sibling.previousElementSibling;
|
|
10872
10885
|
}
|
|
10873
10886
|
return sibling;
|
|
10874
10887
|
})();
|
|
10875
10888
|
if (!tooltip) {
|
|
10876
|
-
throw new Error(`${
|
|
10889
|
+
throw new Error(`${original} must be placed after a tooltip trigger element`);
|
|
10877
10890
|
}
|
|
10878
10891
|
el.classList.add(
|
|
10879
10892
|
"absolute",
|
|
@@ -10978,7 +10991,7 @@
|
|
|
10978
10991
|
);
|
|
10979
10992
|
el.setAttribute("data-slot", "subtree");
|
|
10980
10993
|
el.setAttribute("role", "group");
|
|
10981
|
-
const treeItem = Alpine.findClosest(el.parentElement, (parent) =>
|
|
10994
|
+
const treeItem = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_tree_item"));
|
|
10982
10995
|
effect(() => {
|
|
10983
10996
|
if (treeItem._h_tree_item.expanded) {
|
|
10984
10997
|
el.classList.remove("!hidden");
|
|
@@ -11118,9 +11131,9 @@
|
|
|
11118
11131
|
});
|
|
11119
11132
|
}
|
|
11120
11133
|
});
|
|
11121
|
-
Alpine.directive("h-tree-button", (el, { original
|
|
11122
|
-
const treeItem = Alpine.findClosest(el.parentElement, (parent) =>
|
|
11123
|
-
if (!treeItem) throw new Error(`${
|
|
11134
|
+
Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
|
|
11135
|
+
const treeItem = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_tree_item"));
|
|
11136
|
+
if (!treeItem) throw new Error(`${original} must be inside a tree item`);
|
|
11124
11137
|
el.classList.add(
|
|
11125
11138
|
"flex",
|
|
11126
11139
|
"w-full",
|
|
@@ -11262,7 +11275,7 @@
|
|
|
11262
11275
|
|
|
11263
11276
|
// src/utils/template.js
|
|
11264
11277
|
function template_default(Alpine) {
|
|
11265
|
-
Alpine.directive("h-template", (el, { original
|
|
11278
|
+
Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
11266
11279
|
if (el.hasAttribute(Alpine2.prefixed("data"))) {
|
|
11267
11280
|
const template = evaluate2(expression);
|
|
11268
11281
|
const clone = template.content.cloneNode(true).firstElementChild;
|
|
@@ -11276,14 +11289,14 @@
|
|
|
11276
11289
|
clone.remove();
|
|
11277
11290
|
});
|
|
11278
11291
|
} else {
|
|
11279
|
-
console.error(`${
|
|
11292
|
+
console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
|
|
11280
11293
|
}
|
|
11281
11294
|
});
|
|
11282
11295
|
}
|
|
11283
11296
|
|
|
11284
11297
|
// src/utils/include.js
|
|
11285
11298
|
function include_default(Alpine) {
|
|
11286
|
-
Alpine.directive("h-include", (el, { modifiers, expression }, { evaluateLater, effect, cleanup, Alpine: Alpine2 }) => {
|
|
11299
|
+
Alpine.directive("h-include", (el, { original, modifiers, expression }, { evaluateLater, effect, cleanup, Alpine: Alpine2 }) => {
|
|
11287
11300
|
const getUrl = evaluateLater(expression);
|
|
11288
11301
|
function executeScript(oldScript) {
|
|
11289
11302
|
return new Promise((resolve, reject) => {
|
|
@@ -11369,7 +11382,7 @@
|
|
|
11369
11382
|
}
|
|
11370
11383
|
|
|
11371
11384
|
// package.json
|
|
11372
|
-
var version = "1.9.
|
|
11385
|
+
var version = "1.9.1";
|
|
11373
11386
|
|
|
11374
11387
|
// src/index.js
|
|
11375
11388
|
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, getSystemColorScheme, version };
|