@codbex/harmonia 1.8.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.css +1 -1
- package/dist/harmonia.esm.js +314 -206
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +3 -3
- package/dist/harmonia.js +314 -206
- 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");
|
|
@@ -932,7 +932,8 @@
|
|
|
932
932
|
"focus-visible:border-ring",
|
|
933
933
|
"focus-visible:ring-ring/50",
|
|
934
934
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
935
|
-
"transition-
|
|
935
|
+
"transition-colors",
|
|
936
|
+
"transition-shadow",
|
|
936
937
|
"motion-reduce:transition-none",
|
|
937
938
|
"overflow-hidden"
|
|
938
939
|
);
|
|
@@ -950,7 +951,7 @@
|
|
|
950
951
|
for (const [_2, value] of Object.entries(variants)) {
|
|
951
952
|
el.classList.remove(...value);
|
|
952
953
|
}
|
|
953
|
-
if (
|
|
954
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
954
955
|
}
|
|
955
956
|
setVariant(el.getAttribute("data-variant") ?? "default");
|
|
956
957
|
const observer = new MutationObserver(() => {
|
|
@@ -1003,7 +1004,7 @@
|
|
|
1003
1004
|
for (const [_2, value] of Object.entries(variants)) {
|
|
1004
1005
|
el.classList.remove(...value);
|
|
1005
1006
|
}
|
|
1006
|
-
if (
|
|
1007
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
1007
1008
|
}
|
|
1008
1009
|
setVariant(el.getAttribute("data-variant") ?? "primary");
|
|
1009
1010
|
const observer = new MutationObserver(() => {
|
|
@@ -1021,6 +1022,7 @@
|
|
|
1021
1022
|
default: [
|
|
1022
1023
|
"bg-secondary",
|
|
1023
1024
|
"text-secondary-foreground",
|
|
1025
|
+
"fill-secondary-foreground",
|
|
1024
1026
|
"shadow-button",
|
|
1025
1027
|
"hover:bg-secondary-hover",
|
|
1026
1028
|
"active:bg-secondary-active",
|
|
@@ -1032,6 +1034,7 @@
|
|
|
1032
1034
|
primary: [
|
|
1033
1035
|
"bg-primary",
|
|
1034
1036
|
"text-primary-foreground",
|
|
1037
|
+
"fill-primary-foreground",
|
|
1035
1038
|
"shadow-button",
|
|
1036
1039
|
"focus-visible:outline-primary/50",
|
|
1037
1040
|
"hover:bg-primary-hover",
|
|
@@ -1044,6 +1047,7 @@
|
|
|
1044
1047
|
positive: [
|
|
1045
1048
|
"bg-positive",
|
|
1046
1049
|
"text-positive-foreground",
|
|
1050
|
+
"fill-positive-foreground",
|
|
1047
1051
|
"shadow-button",
|
|
1048
1052
|
"focus-visible:outline-positive/50",
|
|
1049
1053
|
"hover:bg-positive-hover",
|
|
@@ -1056,6 +1060,7 @@
|
|
|
1056
1060
|
negative: [
|
|
1057
1061
|
"bg-negative",
|
|
1058
1062
|
"text-negative-foreground",
|
|
1063
|
+
"fill-negative-foreground",
|
|
1059
1064
|
"shadow-button",
|
|
1060
1065
|
"focus-visible:outline-negative/50",
|
|
1061
1066
|
"hover:bg-negative-hover",
|
|
@@ -1068,6 +1073,7 @@
|
|
|
1068
1073
|
warning: [
|
|
1069
1074
|
"bg-warning",
|
|
1070
1075
|
"text-warning-foreground",
|
|
1076
|
+
"fill-warning-foreground",
|
|
1071
1077
|
"shadow-button",
|
|
1072
1078
|
"focus-visible:outline-warning/50",
|
|
1073
1079
|
"hover:bg-warning-hover",
|
|
@@ -1080,6 +1086,7 @@
|
|
|
1080
1086
|
information: [
|
|
1081
1087
|
"bg-information",
|
|
1082
1088
|
"text-information-foreground",
|
|
1089
|
+
"fill-information-foreground",
|
|
1083
1090
|
"shadow-button",
|
|
1084
1091
|
"focus-visible:outline-information/50",
|
|
1085
1092
|
"hover:bg-information-hover",
|
|
@@ -1093,25 +1100,49 @@
|
|
|
1093
1100
|
"border",
|
|
1094
1101
|
"bg-background",
|
|
1095
1102
|
"text-foreground",
|
|
1103
|
+
"fill-foreground",
|
|
1096
1104
|
"hover:bg-secondary",
|
|
1097
1105
|
"hover:text-secondary-foreground",
|
|
1106
|
+
"hover:fill-secondary-foreground",
|
|
1098
1107
|
"active:bg-secondary-active",
|
|
1108
|
+
"active:text-secondary-foreground",
|
|
1109
|
+
"active:fill-secondary-foreground",
|
|
1099
1110
|
"aria-pressed:bg-secondary-active",
|
|
1111
|
+
"aria-pressed:text-secondary-foreground",
|
|
1112
|
+
"aria-pressed:fill-secondary-foreground",
|
|
1100
1113
|
"active:data-[toggled=true]:bg-secondary-active",
|
|
1114
|
+
"active:data-[toggled=true]:text-secondary-foreground",
|
|
1115
|
+
"active:data-[toggled=true]:fill-secondary-foreground",
|
|
1101
1116
|
"hover:data-[toggled=true]:bg-secondary-hover",
|
|
1102
|
-
"data-[toggled=true]:
|
|
1117
|
+
"hover:data-[toggled=true]:text-secondary-foreground",
|
|
1118
|
+
"hover:data-[toggled=true]:fill-secondary-foreground",
|
|
1119
|
+
"data-[toggled=true]:bg-secondary-active",
|
|
1120
|
+
"data-[toggled=true]:text-secondary-foreground",
|
|
1121
|
+
"data-[toggled=true]:fill-secondary-foreground"
|
|
1103
1122
|
],
|
|
1104
1123
|
transparent: [
|
|
1105
1124
|
"bg-transparent",
|
|
1106
1125
|
"text-foreground",
|
|
1126
|
+
"fill-foreground",
|
|
1107
1127
|
"shadow-none",
|
|
1108
1128
|
"hover:bg-secondary",
|
|
1109
1129
|
"hover:text-secondary-foreground",
|
|
1130
|
+
"hover:fill-secondary-foreground",
|
|
1110
1131
|
"active:bg-secondary-active",
|
|
1132
|
+
"active:text-secondary-foreground",
|
|
1133
|
+
"active:fill-secondary-foreground",
|
|
1111
1134
|
"aria-pressed:bg-secondary-active",
|
|
1135
|
+
"aria-pressed:text-secondary-foreground",
|
|
1136
|
+
"aria-pressed:fill-secondary-foreground",
|
|
1112
1137
|
"active:data-[toggled=true]:bg-secondary-active",
|
|
1138
|
+
"active:data-[toggled=true]:text-secondary-foreground",
|
|
1139
|
+
"active:data-[toggled=true]:fill-secondary-foreground",
|
|
1113
1140
|
"hover:data-[toggled=true]:bg-secondary-hover",
|
|
1114
|
-
"data-[toggled=true]:
|
|
1141
|
+
"hover:data-[toggled=true]:text-secondary-foreground",
|
|
1142
|
+
"hover:data-[toggled=true]:fill-secondary-foreground",
|
|
1143
|
+
"data-[toggled=true]:bg-secondary-active",
|
|
1144
|
+
"data-[toggled=true]:text-secondary-foreground",
|
|
1145
|
+
"data-[toggled=true]:fill-secondary-foreground"
|
|
1115
1146
|
],
|
|
1116
1147
|
link: ["text-primary", "underline-offset-4", "hover:underline"]
|
|
1117
1148
|
};
|
|
@@ -1127,6 +1158,7 @@
|
|
|
1127
1158
|
"text-sm",
|
|
1128
1159
|
"font-medium",
|
|
1129
1160
|
"transition-all",
|
|
1161
|
+
"duration-100",
|
|
1130
1162
|
"motion-reduce:transition-none",
|
|
1131
1163
|
"disabled:pointer-events-none",
|
|
1132
1164
|
"disabled:opacity-50",
|
|
@@ -1162,7 +1194,7 @@
|
|
|
1162
1194
|
}
|
|
1163
1195
|
};
|
|
1164
1196
|
function button_default(Alpine) {
|
|
1165
|
-
Alpine.directive("h-button", (el, { original
|
|
1197
|
+
Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
|
|
1166
1198
|
setButtonClasses(el);
|
|
1167
1199
|
if (!el.hasAttribute("data-slot")) {
|
|
1168
1200
|
el.setAttribute("data-slot", "button");
|
|
@@ -1173,13 +1205,13 @@
|
|
|
1173
1205
|
for (const [_, value] of Object.entries(buttonVariants)) {
|
|
1174
1206
|
el.classList.remove(...value);
|
|
1175
1207
|
}
|
|
1176
|
-
if (
|
|
1208
|
+
if (Object.prototype.hasOwnProperty.call(buttonVariants, variant)) el.classList.add(...buttonVariants[variant]);
|
|
1177
1209
|
}
|
|
1178
1210
|
function setSize2(size3 = "default") {
|
|
1179
1211
|
el.classList.remove(...getButtonSize(lastSize, isAddon));
|
|
1180
1212
|
el.classList.add(...getButtonSize(size3, isAddon));
|
|
1181
1213
|
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
1182
|
-
console.error(`${
|
|
1214
|
+
console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
1183
1215
|
}
|
|
1184
1216
|
lastSize = size3;
|
|
1185
1217
|
}
|
|
@@ -1232,7 +1264,7 @@
|
|
|
1232
1264
|
for (const [_, value] of Object.entries(variants)) {
|
|
1233
1265
|
el.classList.remove(...value);
|
|
1234
1266
|
}
|
|
1235
|
-
if (
|
|
1267
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
1236
1268
|
}
|
|
1237
1269
|
setVariant(el.getAttribute("data-orientation") ?? "horizontal");
|
|
1238
1270
|
});
|
|
@@ -1258,8 +1290,8 @@
|
|
|
1258
1290
|
bottom: "top",
|
|
1259
1291
|
top: "bottom"
|
|
1260
1292
|
};
|
|
1261
|
-
function clamp(start, value,
|
|
1262
|
-
return max(start, min(value,
|
|
1293
|
+
function clamp(start, value, end) {
|
|
1294
|
+
return max(start, min(value, end));
|
|
1263
1295
|
}
|
|
1264
1296
|
function evaluate(value, param) {
|
|
1265
1297
|
return typeof value === "function" ? value(param) : value;
|
|
@@ -2733,8 +2765,8 @@
|
|
|
2733
2765
|
|
|
2734
2766
|
// src/components/calendar.js
|
|
2735
2767
|
function calendar_default(Alpine) {
|
|
2736
|
-
Alpine.directive("h-calendar", (el, { original
|
|
2737
|
-
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"));
|
|
2738
2770
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
2739
2771
|
el.setAttribute("tabindex", "-1");
|
|
2740
2772
|
if (datepicker) {
|
|
@@ -2791,7 +2823,7 @@
|
|
|
2791
2823
|
const onInputChange = () => {
|
|
2792
2824
|
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
2793
2825
|
if (isNaN(newValue)) {
|
|
2794
|
-
console.error(`${
|
|
2826
|
+
console.error(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
|
|
2795
2827
|
datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2796
2828
|
return;
|
|
2797
2829
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
@@ -2807,7 +2839,7 @@
|
|
|
2807
2839
|
function setFromModel() {
|
|
2808
2840
|
selected = new Date(el._x_model.get());
|
|
2809
2841
|
if (isNaN(selected)) {
|
|
2810
|
-
console.error(`${
|
|
2842
|
+
console.error(`${original}: input value is not a valid date - ${el._x_model.get()}`);
|
|
2811
2843
|
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2812
2844
|
else el.setAttribute("data-invalid", "true");
|
|
2813
2845
|
} else if (datepicker) {
|
|
@@ -2815,7 +2847,7 @@
|
|
|
2815
2847
|
}
|
|
2816
2848
|
}
|
|
2817
2849
|
function checkForModel() {
|
|
2818
|
-
if (
|
|
2850
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model") && el._x_model.get()) {
|
|
2819
2851
|
setFromModel();
|
|
2820
2852
|
}
|
|
2821
2853
|
}
|
|
@@ -3019,8 +3051,8 @@
|
|
|
3019
3051
|
const year = date.getFullYear();
|
|
3020
3052
|
const month = date.getMonth();
|
|
3021
3053
|
const start = new Date(year, month, 1);
|
|
3022
|
-
const
|
|
3023
|
-
const days =
|
|
3054
|
+
const end = new Date(year, month + 1, 0);
|
|
3055
|
+
const days = end.getDate();
|
|
3024
3056
|
const prevEndDay = new Date(year, month, 1);
|
|
3025
3057
|
prevEndDay.setDate(prevEndDay.getDate() - 1);
|
|
3026
3058
|
let lastPrevMonthDay = prevEndDay.getDate();
|
|
@@ -3127,7 +3159,7 @@
|
|
|
3127
3159
|
break;
|
|
3128
3160
|
case "End":
|
|
3129
3161
|
event.preventDefault();
|
|
3130
|
-
newDay.setDate(
|
|
3162
|
+
newDay.setDate(new Date(newDay.getFullYear(), newDay.getMonth() + 1, 0).getDate());
|
|
3131
3163
|
break;
|
|
3132
3164
|
case "PageUp":
|
|
3133
3165
|
event.preventDefault();
|
|
@@ -3236,7 +3268,7 @@
|
|
|
3236
3268
|
if (datepicker) {
|
|
3237
3269
|
el.addEventListener("transitionend", onTransitionEnd);
|
|
3238
3270
|
}
|
|
3239
|
-
if (
|
|
3271
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
3240
3272
|
const modelExpression = el.getAttribute("x-model");
|
|
3241
3273
|
const evaluateModel = evaluateLater(modelExpression);
|
|
3242
3274
|
effect(() => {
|
|
@@ -3365,7 +3397,7 @@
|
|
|
3365
3397
|
|
|
3366
3398
|
// src/components/datepicker.js
|
|
3367
3399
|
function datepicker_default(Alpine) {
|
|
3368
|
-
Alpine.directive("h-date-picker", (el, { original
|
|
3400
|
+
Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
3369
3401
|
const state = Alpine2.reactive({
|
|
3370
3402
|
expanded: false
|
|
3371
3403
|
});
|
|
@@ -3378,7 +3410,7 @@
|
|
|
3378
3410
|
};
|
|
3379
3411
|
el._h_datepicker.input = el.querySelector("input");
|
|
3380
3412
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
3381
|
-
throw new Error(`${
|
|
3413
|
+
throw new Error(`${original} must contain an input`);
|
|
3382
3414
|
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
3383
3415
|
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
3384
3416
|
} else {
|
|
@@ -3391,7 +3423,8 @@
|
|
|
3391
3423
|
"border-input",
|
|
3392
3424
|
"flex",
|
|
3393
3425
|
"items-center",
|
|
3394
|
-
"transition-
|
|
3426
|
+
"transition-colors",
|
|
3427
|
+
"transition-shadow",
|
|
3395
3428
|
"motion-reduce:transition-none",
|
|
3396
3429
|
"duration-200",
|
|
3397
3430
|
"outline-none",
|
|
@@ -3456,18 +3489,31 @@
|
|
|
3456
3489
|
observer.disconnect();
|
|
3457
3490
|
});
|
|
3458
3491
|
});
|
|
3459
|
-
Alpine.directive("h-date-picker-trigger", (el, { original
|
|
3492
|
+
Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
3460
3493
|
if (el.tagName !== "BUTTON") {
|
|
3461
|
-
throw new Error(`${
|
|
3494
|
+
throw new Error(`${original} must be a button`);
|
|
3462
3495
|
}
|
|
3463
3496
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3464
|
-
throw new Error(`${
|
|
3497
|
+
throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3465
3498
|
}
|
|
3466
|
-
const datepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
3499
|
+
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_datepicker"));
|
|
3467
3500
|
if (!datepicker) {
|
|
3468
|
-
throw new Error(`${
|
|
3501
|
+
throw new Error(`${original} must be inside an date-picker element`);
|
|
3469
3502
|
}
|
|
3470
|
-
el.classList.add(
|
|
3503
|
+
el.classList.add(
|
|
3504
|
+
"cursor-pointer",
|
|
3505
|
+
"inline-flex",
|
|
3506
|
+
"items-center",
|
|
3507
|
+
"justify-center",
|
|
3508
|
+
"h-full",
|
|
3509
|
+
"aspect-square",
|
|
3510
|
+
"bg-transparent",
|
|
3511
|
+
"hover:bg-secondary",
|
|
3512
|
+
"hover:text-secondary-foreground",
|
|
3513
|
+
"active:bg-secondary-active",
|
|
3514
|
+
"active:text-secondary-foreground",
|
|
3515
|
+
"outline-none"
|
|
3516
|
+
);
|
|
3471
3517
|
if (datepicker._h_datepicker.inTable) {
|
|
3472
3518
|
el.classList.add(
|
|
3473
3519
|
"focus-visible:inset-ring-ring/50",
|
|
@@ -3498,7 +3544,7 @@
|
|
|
3498
3544
|
el.appendChild(
|
|
3499
3545
|
createSvg({
|
|
3500
3546
|
icon: Calendar,
|
|
3501
|
-
classes: "opacity-70 text-
|
|
3547
|
+
classes: "opacity-70 text-inherit size-4",
|
|
3502
3548
|
attrs: {
|
|
3503
3549
|
"aria-hidden": true,
|
|
3504
3550
|
role: "presentation"
|
|
@@ -3740,13 +3786,13 @@
|
|
|
3740
3786
|
});
|
|
3741
3787
|
}
|
|
3742
3788
|
});
|
|
3743
|
-
Alpine.directive("h-exp-panel-trigger", (el, { original
|
|
3789
|
+
Alpine.directive("h-exp-panel-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
3744
3790
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
3745
|
-
throw new Error(`${
|
|
3791
|
+
throw new Error(`${original} must be a header element`);
|
|
3746
3792
|
}
|
|
3747
|
-
const expPanelItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
3793
|
+
const expPanelItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_expPanelItem"));
|
|
3748
3794
|
if (!expPanelItem) {
|
|
3749
|
-
throw new Error(`${
|
|
3795
|
+
throw new Error(`${original} must have an exp-panel-item parent element`);
|
|
3750
3796
|
}
|
|
3751
3797
|
el.classList.add(
|
|
3752
3798
|
"bg-object-header",
|
|
@@ -3927,13 +3973,13 @@
|
|
|
3927
3973
|
|
|
3928
3974
|
// src/components/icon.js
|
|
3929
3975
|
function icon_default(Alpine) {
|
|
3930
|
-
Alpine.directive("h-icon", (el, { original
|
|
3976
|
+
Alpine.directive("h-icon", (el, { original, modifiers }) => {
|
|
3931
3977
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
3932
|
-
throw new Error(`${
|
|
3978
|
+
throw new Error(`${original} works only on svg elements`);
|
|
3933
3979
|
} else if (!el.hasAttribute("role")) {
|
|
3934
|
-
throw new Error(`${
|
|
3980
|
+
throw new Error(`${original} must have a role`);
|
|
3935
3981
|
} else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3936
|
-
throw new Error(`${
|
|
3982
|
+
throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3937
3983
|
}
|
|
3938
3984
|
el.classList.add("fill-current");
|
|
3939
3985
|
el.setAttribute("data-slot", "icon");
|
|
@@ -4005,7 +4051,8 @@
|
|
|
4005
4051
|
"[&::-webkit-color-swatch-wrapper]:rounded-0",
|
|
4006
4052
|
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
4007
4053
|
"text-base",
|
|
4008
|
-
"transition-
|
|
4054
|
+
"transition-colors",
|
|
4055
|
+
"transition-shadow",
|
|
4009
4056
|
"motion-reduce:transition-none",
|
|
4010
4057
|
"outline-none",
|
|
4011
4058
|
"file:inline-flex",
|
|
@@ -4063,7 +4110,8 @@
|
|
|
4063
4110
|
"rounded-control",
|
|
4064
4111
|
"border",
|
|
4065
4112
|
"shadow-input",
|
|
4066
|
-
"transition-
|
|
4113
|
+
"transition-colors",
|
|
4114
|
+
"transition-shadow",
|
|
4067
4115
|
"motion-reduce:transition-none",
|
|
4068
4116
|
"outline-none",
|
|
4069
4117
|
"min-w-0",
|
|
@@ -4132,7 +4180,7 @@
|
|
|
4132
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"]
|
|
4133
4181
|
};
|
|
4134
4182
|
function setVariant(variant) {
|
|
4135
|
-
if (
|
|
4183
|
+
if (Object.prototype.hasOwnProperty.call(variants, variant)) el.classList.add(...variants[variant]);
|
|
4136
4184
|
}
|
|
4137
4185
|
setVariant(el.getAttribute("data-align") ?? "inline-start");
|
|
4138
4186
|
const handler = (event) => {
|
|
@@ -4152,7 +4200,7 @@
|
|
|
4152
4200
|
el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
|
|
4153
4201
|
el.setAttribute("data-slot", "label");
|
|
4154
4202
|
});
|
|
4155
|
-
Alpine.directive("h-input-number", (el, { original
|
|
4203
|
+
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
4156
4204
|
el.classList.add(
|
|
4157
4205
|
"overflow-hidden",
|
|
4158
4206
|
"group/input-number",
|
|
@@ -4165,8 +4213,10 @@
|
|
|
4165
4213
|
"rounded-control",
|
|
4166
4214
|
"border",
|
|
4167
4215
|
"shadow-input",
|
|
4168
|
-
"transition-
|
|
4216
|
+
"transition-colors",
|
|
4217
|
+
"transition-shadow",
|
|
4169
4218
|
"motion-reduce:transition-none",
|
|
4219
|
+
"duration-200",
|
|
4170
4220
|
"outline-none",
|
|
4171
4221
|
"min-w-0",
|
|
4172
4222
|
"has-[input:focus-visible]:border-ring",
|
|
@@ -4186,7 +4236,7 @@
|
|
|
4186
4236
|
el.setAttribute("data-slot", "input-number");
|
|
4187
4237
|
const input = el.querySelector("input");
|
|
4188
4238
|
if (!input || input.getAttribute("type") !== "number") {
|
|
4189
|
-
throw new Error(`${
|
|
4239
|
+
throw new Error(`${original} must contain an input of type 'number'`);
|
|
4190
4240
|
}
|
|
4191
4241
|
if (!input.hasAttribute("type")) input.setAttribute("type", "number");
|
|
4192
4242
|
if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
|
|
@@ -4211,7 +4261,7 @@
|
|
|
4211
4261
|
stepDown.appendChild(
|
|
4212
4262
|
createSvg({
|
|
4213
4263
|
icon: Minus,
|
|
4214
|
-
classes: "opacity-70
|
|
4264
|
+
classes: "opacity-70 text-inherit size-4 shrink-0 pointer-events-none",
|
|
4215
4265
|
attrs: {
|
|
4216
4266
|
"aria-hidden": true,
|
|
4217
4267
|
role: "presentation"
|
|
@@ -4229,16 +4279,23 @@
|
|
|
4229
4279
|
"[input:invalid~&]:border-negative",
|
|
4230
4280
|
"h-full",
|
|
4231
4281
|
"aspect-square",
|
|
4282
|
+
"transition-colors",
|
|
4283
|
+
"motion-reduce:transition-none",
|
|
4284
|
+
"duration-100",
|
|
4232
4285
|
"bg-transparent",
|
|
4233
4286
|
"hover:bg-secondary",
|
|
4287
|
+
"hover:text-secondary-foreground",
|
|
4234
4288
|
"active:bg-secondary-active",
|
|
4289
|
+
"active:text-secondary-foreground",
|
|
4235
4290
|
"outline-none",
|
|
4236
4291
|
"relative",
|
|
4237
4292
|
"[&:hover>svg]:text-secondary-foreground"
|
|
4238
4293
|
);
|
|
4239
4294
|
el.appendChild(stepDown);
|
|
4240
4295
|
const onStepDown = () => {
|
|
4241
|
-
input.
|
|
4296
|
+
if (input.step === "any") {
|
|
4297
|
+
input.value = (parseFloat(input.value) || 0) - 1;
|
|
4298
|
+
} else input.stepDown();
|
|
4242
4299
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
4243
4300
|
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
4244
4301
|
};
|
|
@@ -4252,7 +4309,7 @@
|
|
|
4252
4309
|
stepUp.appendChild(
|
|
4253
4310
|
createSvg({
|
|
4254
4311
|
icon: Plus,
|
|
4255
|
-
classes: "opacity-70
|
|
4312
|
+
classes: "opacity-70 text-inherit size-4 shrink-0 pointer-events-none",
|
|
4256
4313
|
attrs: {
|
|
4257
4314
|
"aria-hidden": true,
|
|
4258
4315
|
role: "presentation"
|
|
@@ -4270,16 +4327,23 @@
|
|
|
4270
4327
|
"[input:invalid~&]:border-negative",
|
|
4271
4328
|
"h-full",
|
|
4272
4329
|
"aspect-square",
|
|
4330
|
+
"transition-all",
|
|
4331
|
+
"motion-reduce:transition-none",
|
|
4332
|
+
"duration-100",
|
|
4273
4333
|
"bg-transparent",
|
|
4274
4334
|
"hover:bg-secondary",
|
|
4335
|
+
"hover:text-secondary-foreground",
|
|
4275
4336
|
"active:bg-secondary-active",
|
|
4337
|
+
"active:text-secondary-foreground",
|
|
4276
4338
|
"outline-none",
|
|
4277
4339
|
"relative",
|
|
4278
4340
|
"[&:hover>svg]:text-secondary-foreground"
|
|
4279
4341
|
);
|
|
4280
4342
|
el.appendChild(stepUp);
|
|
4281
4343
|
const onStepUp = () => {
|
|
4282
|
-
input.
|
|
4344
|
+
if (input.step === "any") {
|
|
4345
|
+
input.value = (parseFloat(input.value) || 0) + 1;
|
|
4346
|
+
} else input.stepUp();
|
|
4283
4347
|
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
4284
4348
|
input.dispatchEvent(new Event("change", { bubbles: true }));
|
|
4285
4349
|
};
|
|
@@ -4386,7 +4450,8 @@
|
|
|
4386
4450
|
focusLastOption(el);
|
|
4387
4451
|
break;
|
|
4388
4452
|
case "Up":
|
|
4389
|
-
case "ArrowUp":
|
|
4453
|
+
case "ArrowUp": {
|
|
4454
|
+
event.preventDefault();
|
|
4390
4455
|
let prevElem = event.target.previousElementSibling;
|
|
4391
4456
|
if (prevElem && prevElem.getAttribute("data-slot") !== "list-header") {
|
|
4392
4457
|
prevElem.focus();
|
|
@@ -4397,8 +4462,10 @@
|
|
|
4397
4462
|
}
|
|
4398
4463
|
}
|
|
4399
4464
|
break;
|
|
4465
|
+
}
|
|
4400
4466
|
case "Down":
|
|
4401
|
-
case "ArrowDown":
|
|
4467
|
+
case "ArrowDown": {
|
|
4468
|
+
event.preventDefault();
|
|
4402
4469
|
let nextElem = event.target.nextElementSibling;
|
|
4403
4470
|
if (nextElem) {
|
|
4404
4471
|
nextElem.focus();
|
|
@@ -4409,6 +4476,7 @@
|
|
|
4409
4476
|
}
|
|
4410
4477
|
}
|
|
4411
4478
|
break;
|
|
4479
|
+
}
|
|
4412
4480
|
case " ":
|
|
4413
4481
|
case "Enter":
|
|
4414
4482
|
selectOption(event.target);
|
|
@@ -4432,13 +4500,13 @@
|
|
|
4432
4500
|
el.setAttribute("data-slot", "list");
|
|
4433
4501
|
el.setAttribute("role", "group");
|
|
4434
4502
|
});
|
|
4435
|
-
Alpine.directive("h-list-header", (el, { original
|
|
4503
|
+
Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
|
|
4436
4504
|
el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
|
|
4437
4505
|
el.setAttribute("role", "presentation");
|
|
4438
4506
|
el.setAttribute("data-slot", "list-header");
|
|
4439
4507
|
const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
|
|
4440
4508
|
if (!list) {
|
|
4441
|
-
throw new Error(`${
|
|
4509
|
+
throw new Error(`${original} must be placed inside a list element`);
|
|
4442
4510
|
}
|
|
4443
4511
|
if (!el.hasAttribute("id")) {
|
|
4444
4512
|
const id = `lbh${uuid_default()}`;
|
|
@@ -4496,9 +4564,9 @@
|
|
|
4496
4564
|
}
|
|
4497
4565
|
}
|
|
4498
4566
|
});
|
|
4499
|
-
Alpine.directive("h-menu", (el, { original
|
|
4567
|
+
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
4500
4568
|
if (el.tagName !== "UL") {
|
|
4501
|
-
throw new Error(`${
|
|
4569
|
+
throw new Error(`${original} must be an ul element`);
|
|
4502
4570
|
}
|
|
4503
4571
|
el.classList.add(
|
|
4504
4572
|
"hidden",
|
|
@@ -4530,11 +4598,11 @@
|
|
|
4530
4598
|
const menuTrigger = (() => {
|
|
4531
4599
|
if (isSubmenu) return;
|
|
4532
4600
|
let sibling = el.previousElementSibling;
|
|
4533
|
-
while (sibling && !
|
|
4601
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_menu_trigger")) {
|
|
4534
4602
|
sibling = sibling.previousElementSibling;
|
|
4535
4603
|
}
|
|
4536
|
-
if (!
|
|
4537
|
-
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`);
|
|
4538
4606
|
}
|
|
4539
4607
|
return sibling;
|
|
4540
4608
|
})();
|
|
@@ -4543,7 +4611,7 @@
|
|
|
4543
4611
|
if (parent && parent.hasAttribute("id")) {
|
|
4544
4612
|
el.setAttribute("aria-labelledby", parent.id);
|
|
4545
4613
|
} else {
|
|
4546
|
-
throw new Error(`${
|
|
4614
|
+
throw new Error(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
4547
4615
|
}
|
|
4548
4616
|
}
|
|
4549
4617
|
}
|
|
@@ -4551,7 +4619,7 @@
|
|
|
4551
4619
|
if (isSubmenu) {
|
|
4552
4620
|
menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
|
|
4553
4621
|
if (!menuSubItem) {
|
|
4554
|
-
throw new Error(`${
|
|
4622
|
+
throw new Error(`${original} must be placed inside a ${Alpine2.prefixed("h-menu-sub")} element`);
|
|
4555
4623
|
}
|
|
4556
4624
|
setAriaAttrubutes(menuSubItem);
|
|
4557
4625
|
} else if (menuTrigger) {
|
|
@@ -4614,7 +4682,9 @@
|
|
|
4614
4682
|
}
|
|
4615
4683
|
function onClick(event) {
|
|
4616
4684
|
if (event.type === "contextmenu") event.preventDefault();
|
|
4617
|
-
|
|
4685
|
+
if (el.getAttribute("data-innerclicks") === "true" && el.contains(event.composedPath()[0])) {
|
|
4686
|
+
return;
|
|
4687
|
+
} else close(isSubmenu);
|
|
4618
4688
|
}
|
|
4619
4689
|
el.pauseKeyEvents = false;
|
|
4620
4690
|
function onKeyDown(event) {
|
|
@@ -4657,7 +4727,7 @@
|
|
|
4657
4727
|
}
|
|
4658
4728
|
break;
|
|
4659
4729
|
case "Up":
|
|
4660
|
-
case "ArrowUp":
|
|
4730
|
+
case "ArrowUp": {
|
|
4661
4731
|
event.preventDefault();
|
|
4662
4732
|
let menuitems = el.querySelectorAll(':scope > [role^=menuitem][tabIndex="-1"]:has(~ [role^=menuitem][tabIndex="0"])');
|
|
4663
4733
|
if (menuitems.length) {
|
|
@@ -4669,6 +4739,7 @@
|
|
|
4669
4739
|
menuitem.focus();
|
|
4670
4740
|
}
|
|
4671
4741
|
break;
|
|
4742
|
+
}
|
|
4672
4743
|
case "Home":
|
|
4673
4744
|
case "PageUp":
|
|
4674
4745
|
event.preventDefault();
|
|
@@ -4790,9 +4861,9 @@
|
|
|
4790
4861
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
4791
4862
|
});
|
|
4792
4863
|
});
|
|
4793
|
-
Alpine.directive("h-menu-item", (el, { original
|
|
4864
|
+
Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4794
4865
|
if (el.tagName !== "LI") {
|
|
4795
|
-
throw new Error(`${
|
|
4866
|
+
throw new Error(`${original} must be a li element`);
|
|
4796
4867
|
}
|
|
4797
4868
|
el.classList.add(
|
|
4798
4869
|
"focus:bg-secondary-hover",
|
|
@@ -4846,7 +4917,7 @@
|
|
|
4846
4917
|
el.removeEventListener("mouseleave", focusOut);
|
|
4847
4918
|
});
|
|
4848
4919
|
});
|
|
4849
|
-
Alpine.directive("h-menu-sub", (el, { original
|
|
4920
|
+
Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4850
4921
|
el.classList.add(
|
|
4851
4922
|
"focus:bg-secondary-hover",
|
|
4852
4923
|
"hover:bg-secondary-hover",
|
|
@@ -4878,7 +4949,7 @@
|
|
|
4878
4949
|
const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
|
|
4879
4950
|
el.appendChild(chevronRight);
|
|
4880
4951
|
const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
|
|
4881
|
-
if (!parentMenu) throw new Error(`${
|
|
4952
|
+
if (!parentMenu) throw new Error(`${original} must have a parent`);
|
|
4882
4953
|
if (!el.hasAttribute("id")) {
|
|
4883
4954
|
el.setAttribute("id", `ms${uuid_default()}`);
|
|
4884
4955
|
}
|
|
@@ -4975,9 +5046,9 @@
|
|
|
4975
5046
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
4976
5047
|
el.setAttribute("data-slot", "menu-label");
|
|
4977
5048
|
});
|
|
4978
|
-
Alpine.directive("h-menu-checkbox-item", (el, { original
|
|
5049
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4979
5050
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
4980
|
-
throw new Error(`${
|
|
5051
|
+
throw new Error(`${original} must be a li or div element`);
|
|
4981
5052
|
}
|
|
4982
5053
|
el.classList.add(
|
|
4983
5054
|
"focus:bg-secondary-hover",
|
|
@@ -5017,7 +5088,7 @@
|
|
|
5017
5088
|
el._x_model.set(!el._x_model.get());
|
|
5018
5089
|
setState(el._x_model.get());
|
|
5019
5090
|
}
|
|
5020
|
-
if (
|
|
5091
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5021
5092
|
setState(el._x_model.get(), false);
|
|
5022
5093
|
el.addEventListener("click", onActivate);
|
|
5023
5094
|
}
|
|
@@ -5034,7 +5105,7 @@
|
|
|
5034
5105
|
el.addEventListener("mouseenter", focusIn);
|
|
5035
5106
|
el.addEventListener("focus", focusIn);
|
|
5036
5107
|
cleanup(() => {
|
|
5037
|
-
if (
|
|
5108
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5038
5109
|
el.removeEventListener("click", onActivate);
|
|
5039
5110
|
el.removeEventListener("keydown", onActivate);
|
|
5040
5111
|
}
|
|
@@ -5044,9 +5115,9 @@
|
|
|
5044
5115
|
el.removeEventListener("mouseleave", focusOut);
|
|
5045
5116
|
});
|
|
5046
5117
|
});
|
|
5047
|
-
Alpine.directive("h-menu-radio-item", (el, { original
|
|
5118
|
+
Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
5048
5119
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
5049
|
-
throw new Error(`${
|
|
5120
|
+
throw new Error(`${original} must be a li or div element`);
|
|
5050
5121
|
}
|
|
5051
5122
|
el.classList.add(
|
|
5052
5123
|
"focus:bg-secondary-hover",
|
|
@@ -5102,7 +5173,7 @@
|
|
|
5102
5173
|
el._x_model.set(value);
|
|
5103
5174
|
}
|
|
5104
5175
|
}
|
|
5105
|
-
if (
|
|
5176
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5106
5177
|
effect(() => {
|
|
5107
5178
|
setState(el._x_model.get() === value);
|
|
5108
5179
|
});
|
|
@@ -5122,7 +5193,7 @@
|
|
|
5122
5193
|
el.addEventListener("mouseenter", focusIn);
|
|
5123
5194
|
el.addEventListener("focus", focusIn);
|
|
5124
5195
|
cleanup(() => {
|
|
5125
|
-
if (
|
|
5196
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
5126
5197
|
el.removeEventListener("click", onActivate);
|
|
5127
5198
|
el.removeEventListener("keydown", onActivate);
|
|
5128
5199
|
}
|
|
@@ -5170,7 +5241,7 @@
|
|
|
5170
5241
|
};
|
|
5171
5242
|
this.items.push(item);
|
|
5172
5243
|
this.listeners.forEach((listener) => {
|
|
5173
|
-
if (
|
|
5244
|
+
if (Object.prototype.hasOwnProperty.call(listener, "added")) listener.added(item);
|
|
5174
5245
|
});
|
|
5175
5246
|
},
|
|
5176
5247
|
update(id, data) {
|
|
@@ -5183,7 +5254,7 @@
|
|
|
5183
5254
|
this.items[index].data[key] = value;
|
|
5184
5255
|
}
|
|
5185
5256
|
this.listeners.forEach((listener) => {
|
|
5186
|
-
if (
|
|
5257
|
+
if (Object.prototype.hasOwnProperty.call(listener, "updated")) listener.updated(id, data);
|
|
5187
5258
|
});
|
|
5188
5259
|
} else {
|
|
5189
5260
|
console.error(`Notification with id "${id}" does not exist`);
|
|
@@ -5194,7 +5265,7 @@
|
|
|
5194
5265
|
throw new Error("Cannot remove a notification if an ID is not provided");
|
|
5195
5266
|
}
|
|
5196
5267
|
this.listeners.forEach((listener) => {
|
|
5197
|
-
if (
|
|
5268
|
+
if (Object.prototype.hasOwnProperty.call(listener, "removed")) listener.removed(id);
|
|
5198
5269
|
});
|
|
5199
5270
|
this.items = this.items.filter((n) => n.id !== id);
|
|
5200
5271
|
}
|
|
@@ -5219,9 +5290,9 @@
|
|
|
5219
5290
|
}
|
|
5220
5291
|
};
|
|
5221
5292
|
});
|
|
5222
|
-
Alpine.directive("h-notification-overlay", (el, { original
|
|
5293
|
+
Alpine.directive("h-notification-overlay", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
5223
5294
|
if (el.tagName !== "SECTION") {
|
|
5224
|
-
throw new Error(`${
|
|
5295
|
+
throw new Error(`${original} must be a button`);
|
|
5225
5296
|
}
|
|
5226
5297
|
const notificationTemplates = {};
|
|
5227
5298
|
el.querySelectorAll("template").forEach((template) => {
|
|
@@ -5356,17 +5427,17 @@
|
|
|
5356
5427
|
xlBreakpointListener.remove();
|
|
5357
5428
|
});
|
|
5358
5429
|
});
|
|
5359
|
-
Alpine.directive("h-notification-list", (el, { original
|
|
5430
|
+
Alpine.directive("h-notification-list", (el, { original }) => {
|
|
5360
5431
|
if (el.tagName !== "OL" && el.tagName !== "UL") {
|
|
5361
|
-
throw new Error(`${
|
|
5432
|
+
throw new Error(`${original} must be a list element`);
|
|
5362
5433
|
}
|
|
5363
5434
|
el.classList.add("flex", "flex-col", "divide-solid", "divide-y");
|
|
5364
5435
|
el.setAttribute("data-slot", "notification-list");
|
|
5365
5436
|
el.setAttribute("role", "group");
|
|
5366
5437
|
});
|
|
5367
|
-
Alpine.directive("h-notification", (el, { original
|
|
5438
|
+
Alpine.directive("h-notification", (el, { original, modifiers }) => {
|
|
5368
5439
|
if (el.tagName !== "LI") {
|
|
5369
|
-
throw new Error(`${
|
|
5440
|
+
throw new Error(`${original} must be a list item element`);
|
|
5370
5441
|
}
|
|
5371
5442
|
el.classList.add("pointer-events-auto", "p-3", "flex", "gap-2");
|
|
5372
5443
|
if (modifiers.includes("floating")) {
|
|
@@ -5402,7 +5473,7 @@
|
|
|
5402
5473
|
el.classList.add("flex", "gap-2", "data-[orientation=vertical]:flex-col");
|
|
5403
5474
|
el.setAttribute("data-slot", "notification-actions");
|
|
5404
5475
|
});
|
|
5405
|
-
Alpine.directive("h-notification-close", (el, { original
|
|
5476
|
+
Alpine.directive("h-notification-close", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
5406
5477
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "notification-close");
|
|
5407
5478
|
let nId;
|
|
5408
5479
|
function close() {
|
|
@@ -5421,7 +5492,7 @@
|
|
|
5421
5492
|
el.removeEventListener("click", close);
|
|
5422
5493
|
});
|
|
5423
5494
|
} else {
|
|
5424
|
-
console.error(`${
|
|
5495
|
+
console.error(`${original} must be inside a notification with an id`);
|
|
5425
5496
|
}
|
|
5426
5497
|
});
|
|
5427
5498
|
}
|
|
@@ -5510,7 +5581,7 @@
|
|
|
5510
5581
|
// src/components/popover.js
|
|
5511
5582
|
function popover_default(Alpine) {
|
|
5512
5583
|
Alpine.directive("h-popover-trigger", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
5513
|
-
el.
|
|
5584
|
+
el._h_popover = Alpine2.reactive({
|
|
5514
5585
|
id: void 0,
|
|
5515
5586
|
controls: `hpc${uuid_default()}`,
|
|
5516
5587
|
auto: expression ? false : true,
|
|
@@ -5520,7 +5591,7 @@
|
|
|
5520
5591
|
const getExpanded = evaluateLater(expression);
|
|
5521
5592
|
effect(() => {
|
|
5522
5593
|
getExpanded((expanded) => {
|
|
5523
|
-
el.
|
|
5594
|
+
el._h_popover.expanded = expanded;
|
|
5524
5595
|
});
|
|
5525
5596
|
});
|
|
5526
5597
|
}
|
|
@@ -5530,33 +5601,33 @@
|
|
|
5530
5601
|
}
|
|
5531
5602
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "popover-trigger");
|
|
5532
5603
|
if (el.hasAttribute("id")) {
|
|
5533
|
-
el.
|
|
5604
|
+
el._h_popover.id = el.getAttribute("id");
|
|
5534
5605
|
} else {
|
|
5535
|
-
el.
|
|
5536
|
-
el.setAttribute("id", el.
|
|
5606
|
+
el._h_popover.id = `hp${uuid_default()}`;
|
|
5607
|
+
el.setAttribute("id", el._h_popover.id);
|
|
5537
5608
|
}
|
|
5538
|
-
el.setAttribute("aria-controls", el.
|
|
5609
|
+
el.setAttribute("aria-controls", el._h_popover.controls);
|
|
5539
5610
|
el.setAttribute("aria-haspopup", "dialog");
|
|
5540
5611
|
const setAttributes = () => {
|
|
5541
|
-
el.setAttribute("aria-expanded", el.
|
|
5612
|
+
el.setAttribute("aria-expanded", el._h_popover.expanded);
|
|
5542
5613
|
};
|
|
5543
5614
|
const close = () => {
|
|
5544
|
-
el.
|
|
5615
|
+
el._h_popover.expanded = false;
|
|
5545
5616
|
el.addEventListener("click", handler);
|
|
5546
5617
|
setAttributes();
|
|
5547
5618
|
};
|
|
5548
5619
|
const handler = () => {
|
|
5549
|
-
el.
|
|
5620
|
+
el._h_popover.expanded = !el._h_popover.expanded;
|
|
5550
5621
|
setAttributes();
|
|
5551
5622
|
Alpine2.nextTick(() => {
|
|
5552
|
-
if (el.
|
|
5623
|
+
if (el._h_popover.auto && el._h_popover.expanded) {
|
|
5553
5624
|
top.addEventListener("click", close, { once: true });
|
|
5554
5625
|
el.removeEventListener("click", handler);
|
|
5555
5626
|
}
|
|
5556
5627
|
});
|
|
5557
5628
|
};
|
|
5558
5629
|
setAttributes();
|
|
5559
|
-
if (el.
|
|
5630
|
+
if (el._h_popover.auto) {
|
|
5560
5631
|
el.addEventListener("click", handler);
|
|
5561
5632
|
cleanup(() => {
|
|
5562
5633
|
el.removeEventListener("click", handler);
|
|
@@ -5568,16 +5639,16 @@
|
|
|
5568
5639
|
});
|
|
5569
5640
|
}
|
|
5570
5641
|
});
|
|
5571
|
-
Alpine.directive("h-popover", (el, { original
|
|
5642
|
+
Alpine.directive("h-popover", (el, { original, modifiers }, { effect, cleanup }) => {
|
|
5572
5643
|
const popover = (() => {
|
|
5573
5644
|
let sibling = el.previousElementSibling;
|
|
5574
|
-
while (sibling && !
|
|
5645
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_h_popover")) {
|
|
5575
5646
|
sibling = sibling.previousElementSibling;
|
|
5576
5647
|
}
|
|
5577
5648
|
return sibling;
|
|
5578
5649
|
})();
|
|
5579
5650
|
if (!popover) {
|
|
5580
|
-
throw new Error(`${
|
|
5651
|
+
throw new Error(`${original} must be placed after a popover element`);
|
|
5581
5652
|
}
|
|
5582
5653
|
el.classList.add(
|
|
5583
5654
|
"absolute",
|
|
@@ -5603,8 +5674,8 @@
|
|
|
5603
5674
|
el.setAttribute("data-slot", "popover");
|
|
5604
5675
|
el.setAttribute("role", "dialog");
|
|
5605
5676
|
el.setAttribute("tabindex", "-1");
|
|
5606
|
-
el.setAttribute("id", popover.
|
|
5607
|
-
el.setAttribute("aria-labelledby", popover.
|
|
5677
|
+
el.setAttribute("id", popover._h_popover.controls);
|
|
5678
|
+
el.setAttribute("aria-labelledby", popover._h_popover.id);
|
|
5608
5679
|
let noScroll = modifiers.includes("no-scroll");
|
|
5609
5680
|
if (noScroll) {
|
|
5610
5681
|
el.classList.remove("overflow-auto");
|
|
@@ -5642,7 +5713,7 @@
|
|
|
5642
5713
|
});
|
|
5643
5714
|
}
|
|
5644
5715
|
effect(() => {
|
|
5645
|
-
if (popover.
|
|
5716
|
+
if (popover._h_popover.expanded) {
|
|
5646
5717
|
el.classList.remove("hidden");
|
|
5647
5718
|
autoUpdateCleanup = autoUpdate(popover, el, updatePosition);
|
|
5648
5719
|
} else {
|
|
@@ -7614,7 +7685,7 @@
|
|
|
7614
7685
|
el.classList.add("harmonia-slider");
|
|
7615
7686
|
el.setAttribute("data-slot", "range");
|
|
7616
7687
|
initialize(el, evaluate2(expression));
|
|
7617
|
-
if (
|
|
7688
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
7618
7689
|
el.noUiSlider.on("change", (values) => {
|
|
7619
7690
|
el._x_model.set(values);
|
|
7620
7691
|
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
@@ -7652,9 +7723,18 @@
|
|
|
7652
7723
|
set: void 0,
|
|
7653
7724
|
get: void 0
|
|
7654
7725
|
};
|
|
7655
|
-
el.classList.add("cursor-pointer", "outline-none", "transition-
|
|
7726
|
+
el.classList.add("cursor-pointer", "outline-none", "transition-colors", "transition-shadow", "motion-reduce:transition-none", "duration-200", "w-full", "has-[input:disabled]:pointer-events-none", "has-[input:disabled]:opacity-50");
|
|
7656
7727
|
if (modifiers.includes("table")) {
|
|
7657
|
-
el.classList.add(
|
|
7728
|
+
el.classList.add(
|
|
7729
|
+
"h-10",
|
|
7730
|
+
"flex",
|
|
7731
|
+
"focus-visible:inset-ring-ring/50",
|
|
7732
|
+
"focus-visible:inset-ring-2",
|
|
7733
|
+
'[&>[data-slot="select-input"]]:hover:bg-table-hover',
|
|
7734
|
+
'[&>[data-slot="select-input"]]:hover:text-table-hover-foreground',
|
|
7735
|
+
'[&>[data-slot="select-input"]]:active:!bg-table-active',
|
|
7736
|
+
'[&>[data-slot="select-input"]]:active:!text-table-active-foreground'
|
|
7737
|
+
);
|
|
7658
7738
|
el.setAttribute("data-slot", "cell-input-select");
|
|
7659
7739
|
} else {
|
|
7660
7740
|
el.classList.add(
|
|
@@ -7668,8 +7748,11 @@
|
|
|
7668
7748
|
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
7669
7749
|
"has-[input:invalid]:border-negative",
|
|
7670
7750
|
"has-[input:invalid]:ring-negative/20",
|
|
7671
|
-
"hover:bg-secondary-hover
|
|
7672
|
-
"
|
|
7751
|
+
'[&>[data-slot="select-input"]]:hover:bg-secondary-hover',
|
|
7752
|
+
'[&>[data-slot="select-input"]]:hover:text-secondary-foreground',
|
|
7753
|
+
'[&>[data-slot="select-input"]]:active:bg-secondary-active',
|
|
7754
|
+
'[&>[data-slot="select-input"]]:active:text-secondary-foreground',
|
|
7755
|
+
'[&>[data-slot="select-input"]]:rounded-control',
|
|
7673
7756
|
"rounded-control",
|
|
7674
7757
|
"border",
|
|
7675
7758
|
"bg-input-inner",
|
|
@@ -7684,11 +7767,11 @@
|
|
|
7684
7767
|
});
|
|
7685
7768
|
}
|
|
7686
7769
|
});
|
|
7687
|
-
Alpine.directive("h-select-input", (el, { original
|
|
7770
|
+
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7688
7771
|
if (el.tagName !== "INPUT") {
|
|
7689
|
-
throw new Error(`${
|
|
7772
|
+
throw new Error(`${original} must be an input of type "text"`);
|
|
7690
7773
|
}
|
|
7691
|
-
const select = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
7774
|
+
const select = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_select"));
|
|
7692
7775
|
const label = (() => {
|
|
7693
7776
|
const field = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "field");
|
|
7694
7777
|
if (field) {
|
|
@@ -7697,8 +7780,8 @@
|
|
|
7697
7780
|
return;
|
|
7698
7781
|
})();
|
|
7699
7782
|
if (!select) {
|
|
7700
|
-
throw new Error(`${
|
|
7701
|
-
} else if (
|
|
7783
|
+
throw new Error(`${original} must be inside a select element`);
|
|
7784
|
+
} else if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
7702
7785
|
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
7703
7786
|
select._h_model.set = (value) => {
|
|
7704
7787
|
if (select._h_select.multiple) {
|
|
@@ -7796,7 +7879,7 @@
|
|
|
7796
7879
|
const onKeyDown = (event) => {
|
|
7797
7880
|
switch (event.key) {
|
|
7798
7881
|
case "Down":
|
|
7799
|
-
case "ArrowDown":
|
|
7882
|
+
case "ArrowDown": {
|
|
7800
7883
|
event.preventDefault();
|
|
7801
7884
|
let nextIndex = 0;
|
|
7802
7885
|
for (let o = 0; o < options.length; o++) {
|
|
@@ -7818,8 +7901,9 @@
|
|
|
7818
7901
|
options[nextIndex].setAttribute("tabindex", "0");
|
|
7819
7902
|
options[nextIndex].focus();
|
|
7820
7903
|
break;
|
|
7904
|
+
}
|
|
7821
7905
|
case "Up":
|
|
7822
|
-
case "ArrowUp":
|
|
7906
|
+
case "ArrowUp": {
|
|
7823
7907
|
event.preventDefault();
|
|
7824
7908
|
let prevIndex = options.length - 1;
|
|
7825
7909
|
for (let o = options.length - 1; o >= 0; o--) {
|
|
@@ -7841,6 +7925,7 @@
|
|
|
7841
7925
|
options[prevIndex].setAttribute("tabindex", "0");
|
|
7842
7926
|
options[prevIndex].focus();
|
|
7843
7927
|
break;
|
|
7928
|
+
}
|
|
7844
7929
|
case "Home":
|
|
7845
7930
|
case "PageUp":
|
|
7846
7931
|
event.preventDefault();
|
|
@@ -7926,7 +8011,7 @@
|
|
|
7926
8011
|
fakeTrigger.addEventListener("click", onClick);
|
|
7927
8012
|
const chevronDown = createSvg({
|
|
7928
8013
|
icon: ChevronDown,
|
|
7929
|
-
classes: "opacity-70 text-
|
|
8014
|
+
classes: "opacity-70 text-inherit size-4 shrink-0 pointer-events-none transition-transform motion-reduce:transition-none duration-200",
|
|
7930
8015
|
attrs: {
|
|
7931
8016
|
"aria-hidden": true,
|
|
7932
8017
|
role: "presentation"
|
|
@@ -7957,10 +8042,10 @@
|
|
|
7957
8042
|
}
|
|
7958
8043
|
});
|
|
7959
8044
|
});
|
|
7960
|
-
Alpine.directive("h-select-content", (el, { original
|
|
7961
|
-
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"));
|
|
7962
8047
|
if (!select) {
|
|
7963
|
-
throw new Error(`${
|
|
8048
|
+
throw new Error(`${original} must be inside a select element`);
|
|
7964
8049
|
}
|
|
7965
8050
|
el.classList.add(
|
|
7966
8051
|
"absolute",
|
|
@@ -7989,7 +8074,7 @@
|
|
|
7989
8074
|
el.setAttribute("id", select._h_select.controls);
|
|
7990
8075
|
el.setAttribute("tabindex", "-1");
|
|
7991
8076
|
if (!select._h_select.trigger) {
|
|
7992
|
-
throw new Error(`${
|
|
8077
|
+
throw new Error(`${original}: trigger not found`);
|
|
7993
8078
|
}
|
|
7994
8079
|
let autoUpdateCleanup;
|
|
7995
8080
|
function updatePosition() {
|
|
@@ -8050,10 +8135,10 @@
|
|
|
8050
8135
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
8051
8136
|
});
|
|
8052
8137
|
});
|
|
8053
|
-
Alpine.directive("h-select-search", (el, { original
|
|
8054
|
-
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"));
|
|
8055
8140
|
if (!select) {
|
|
8056
|
-
throw new Error(`${
|
|
8141
|
+
throw new Error(`${original} must be inside an h-select element`);
|
|
8057
8142
|
} else {
|
|
8058
8143
|
select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
|
|
8059
8144
|
}
|
|
@@ -8118,17 +8203,17 @@
|
|
|
8118
8203
|
Alpine.directive("h-select-label", (el) => {
|
|
8119
8204
|
el.classList.add("text-muted-foreground", "px-2", "py-1.5", "text-xs");
|
|
8120
8205
|
el.setAttribute("data-slot", "select-label");
|
|
8121
|
-
const selectGroup = Alpine.findClosest(el.parentElement, (parent) =>
|
|
8206
|
+
const selectGroup = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_selectGroup"));
|
|
8122
8207
|
if (selectGroup) {
|
|
8123
8208
|
const id = `hsl${uuid_default()}`;
|
|
8124
8209
|
el.setAttribute("id", id);
|
|
8125
8210
|
selectGroup._h_selectGroup.labelledby = id;
|
|
8126
8211
|
}
|
|
8127
8212
|
});
|
|
8128
|
-
Alpine.directive("h-select-option", (el, { original
|
|
8129
|
-
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"));
|
|
8130
8215
|
if (!select) {
|
|
8131
|
-
throw new Error(`${
|
|
8216
|
+
throw new Error(`${original} must be inside an h-select element`);
|
|
8132
8217
|
}
|
|
8133
8218
|
el.classList.add(
|
|
8134
8219
|
"focus:bg-primary",
|
|
@@ -8221,6 +8306,7 @@
|
|
|
8221
8306
|
const onActivate = (event) => {
|
|
8222
8307
|
if (event.type === "keydown" && (event.key === "Enter" || event.key === " ") || event.type === "click") {
|
|
8223
8308
|
if (select._h_select.multiple) {
|
|
8309
|
+
event.stopPropagation();
|
|
8224
8310
|
const vIndex = select._h_model.get().indexOf(getValue());
|
|
8225
8311
|
if (vIndex > -1) {
|
|
8226
8312
|
const val = select._h_model.get().splice(vIndex, 1);
|
|
@@ -8323,10 +8409,10 @@
|
|
|
8323
8409
|
el.removeEventListener("transitionend", onTransitionEnd);
|
|
8324
8410
|
});
|
|
8325
8411
|
});
|
|
8326
|
-
Alpine.directive("h-sheet", (el, { original
|
|
8327
|
-
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"));
|
|
8328
8414
|
if (!overlay) {
|
|
8329
|
-
throw new Error(`${
|
|
8415
|
+
throw new Error(`${original} must be placed inside a sheet overlay`);
|
|
8330
8416
|
}
|
|
8331
8417
|
el.classList.add("hidden", "bg-background", "fixed", "shadow-lg", "transform", "transition-all", "motion-reduce:transition-none", "duration-200", "ease-out");
|
|
8332
8418
|
el.setAttribute("data-slot", "sheet");
|
|
@@ -8449,10 +8535,10 @@
|
|
|
8449
8535
|
});
|
|
8450
8536
|
}
|
|
8451
8537
|
});
|
|
8452
|
-
Alpine.directive("h-sidebar-group-label", (el, { original
|
|
8453
|
-
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"));
|
|
8454
8540
|
if (!group) {
|
|
8455
|
-
throw new Error(`${
|
|
8541
|
+
throw new Error(`${original} must be placed inside a sidebar group`);
|
|
8456
8542
|
}
|
|
8457
8543
|
el.classList.add(
|
|
8458
8544
|
"ring-sidebar-ring",
|
|
@@ -8475,7 +8561,7 @@
|
|
|
8475
8561
|
);
|
|
8476
8562
|
el.setAttribute("data-slot", "sidebar-group-label");
|
|
8477
8563
|
if (group._h_sidebar_group.collapsable) {
|
|
8478
|
-
el.classList.add("text-sidebar-foreground", "text-sm", "hover:bg-secondary-
|
|
8564
|
+
el.classList.add("text-sidebar-foreground", "text-sm", "hover:bg-sidebar-secondary", "hover:text-sidebar-secondary-foreground", "active:bg-sidebar-secondary", "active:text-sidebar-secondary-foreground");
|
|
8479
8565
|
if (el.hasAttribute("id")) {
|
|
8480
8566
|
group._h_sidebar_group.controlId = el.getAttribute("id");
|
|
8481
8567
|
} else {
|
|
@@ -8541,10 +8627,10 @@
|
|
|
8541
8627
|
}
|
|
8542
8628
|
el.setAttribute("data-slot", "sidebar-group-action");
|
|
8543
8629
|
});
|
|
8544
|
-
Alpine.directive("h-sidebar-group-content", (el, { original
|
|
8545
|
-
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"));
|
|
8546
8632
|
if (!group) {
|
|
8547
|
-
throw new Error(`${
|
|
8633
|
+
throw new Error(`${original} must be placed inside a sidebar group`);
|
|
8548
8634
|
}
|
|
8549
8635
|
el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
|
|
8550
8636
|
el.setAttribute("data-slot", "sidebar-group-content");
|
|
@@ -8557,16 +8643,16 @@
|
|
|
8557
8643
|
});
|
|
8558
8644
|
}
|
|
8559
8645
|
});
|
|
8560
|
-
Alpine.directive("h-sidebar-menu", (el, { original
|
|
8646
|
+
Alpine.directive("h-sidebar-menu", (el, { original }) => {
|
|
8561
8647
|
if (el.tagName !== "UL") {
|
|
8562
|
-
throw new Error(`${
|
|
8648
|
+
throw new Error(`${original} must be an ul element`);
|
|
8563
8649
|
}
|
|
8564
8650
|
el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
|
|
8565
8651
|
el.setAttribute("data-slot", "sidebar-menu");
|
|
8566
8652
|
});
|
|
8567
|
-
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 }) => {
|
|
8568
8654
|
if (el.tagName !== "LI") {
|
|
8569
|
-
throw new Error(`${
|
|
8655
|
+
throw new Error(`${original} must be a li element`);
|
|
8570
8656
|
}
|
|
8571
8657
|
el._h_sidebar_menu_item = {
|
|
8572
8658
|
isSub: false,
|
|
@@ -8602,13 +8688,13 @@
|
|
|
8602
8688
|
});
|
|
8603
8689
|
}
|
|
8604
8690
|
});
|
|
8605
|
-
Alpine.directive("h-sidebar-menu-button", (el, { original
|
|
8691
|
+
Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
8606
8692
|
if (el.tagName !== "BUTTON" && el.tagName !== "A") {
|
|
8607
|
-
throw new Error(`${
|
|
8693
|
+
throw new Error(`${original} must be a button or a link`);
|
|
8608
8694
|
} else if (el.tagName === "BUTTON") {
|
|
8609
8695
|
el.setAttribute("type", "button");
|
|
8610
8696
|
}
|
|
8611
|
-
const menuItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8697
|
+
const menuItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_menu_item"));
|
|
8612
8698
|
el.classList.add(
|
|
8613
8699
|
"flex",
|
|
8614
8700
|
"w-full",
|
|
@@ -8641,7 +8727,7 @@
|
|
|
8641
8727
|
lg: ["h-12", "text-sm", "group-data-[collapsed=true]/sidebar:p-0!"]
|
|
8642
8728
|
};
|
|
8643
8729
|
function setSize2(size3) {
|
|
8644
|
-
if (
|
|
8730
|
+
if (Object.prototype.hasOwnProperty.call(sizes, size3)) {
|
|
8645
8731
|
el.classList.add(...sizes[size3]);
|
|
8646
8732
|
}
|
|
8647
8733
|
}
|
|
@@ -8742,9 +8828,9 @@
|
|
|
8742
8828
|
}
|
|
8743
8829
|
el.setAttribute("data-slot", "sidebar-menu-action");
|
|
8744
8830
|
});
|
|
8745
|
-
Alpine.directive("h-sidebar-menu-badge", (el, { original
|
|
8831
|
+
Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
|
|
8746
8832
|
if (el.tagName !== "SPAN") {
|
|
8747
|
-
throw new Error(`${
|
|
8833
|
+
throw new Error(`${original} must be a span element`);
|
|
8748
8834
|
}
|
|
8749
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");
|
|
8750
8836
|
el.setAttribute("data-slot", "sidebar-menu-badge");
|
|
@@ -8770,13 +8856,13 @@
|
|
|
8770
8856
|
el.setAttribute("data-slot", "sidebar-separator");
|
|
8771
8857
|
el.setAttribute("role", "none");
|
|
8772
8858
|
});
|
|
8773
|
-
Alpine.directive("h-sidebar-menu-sub", (el, { original
|
|
8859
|
+
Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
8774
8860
|
if (el.tagName !== "UL") {
|
|
8775
|
-
throw new Error(`${
|
|
8861
|
+
throw new Error(`${original} must be an ul element`);
|
|
8776
8862
|
}
|
|
8777
|
-
const menuItem = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
8863
|
+
const menuItem = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_sidebar_menu_item"));
|
|
8778
8864
|
if (!menuItem) {
|
|
8779
|
-
throw new Error(`${
|
|
8865
|
+
throw new Error(`${original} must be placed inside a sidebar menu item`);
|
|
8780
8866
|
}
|
|
8781
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");
|
|
8782
8868
|
if (el.getAttribute("data-line") !== "false") {
|
|
@@ -8851,7 +8937,7 @@
|
|
|
8851
8937
|
|
|
8852
8938
|
// src/components/split.js
|
|
8853
8939
|
function split_default(Alpine) {
|
|
8854
|
-
Alpine.directive("h-split", (el,
|
|
8940
|
+
Alpine.directive("h-split", (el, _, { cleanup, Alpine: Alpine2 }) => {
|
|
8855
8941
|
const panels = [];
|
|
8856
8942
|
const state = Alpine2.reactive({
|
|
8857
8943
|
isHorizontal: el.getAttribute("data-orientation") === "horizontal",
|
|
@@ -9047,10 +9133,10 @@
|
|
|
9047
9133
|
observer.disconnect();
|
|
9048
9134
|
});
|
|
9049
9135
|
});
|
|
9050
|
-
Alpine.directive("h-split-panel", (el, { original
|
|
9051
|
-
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"));
|
|
9052
9138
|
if (!split) {
|
|
9053
|
-
throw new Error(`${
|
|
9139
|
+
throw new Error(`${original} must be inside an split element`);
|
|
9054
9140
|
}
|
|
9055
9141
|
el.classList.add(
|
|
9056
9142
|
"flex",
|
|
@@ -9495,7 +9581,8 @@
|
|
|
9495
9581
|
"justify-between",
|
|
9496
9582
|
"outline-none",
|
|
9497
9583
|
"gap-2",
|
|
9498
|
-
"transition-
|
|
9584
|
+
"transition-colors",
|
|
9585
|
+
"transition-shadow",
|
|
9499
9586
|
"motion-reduce:transition-none",
|
|
9500
9587
|
"[&_svg]:pointer-events-none",
|
|
9501
9588
|
"[&_svg]:opacity-70",
|
|
@@ -9600,7 +9687,7 @@
|
|
|
9600
9687
|
el.setAttribute("role", "tablist");
|
|
9601
9688
|
el.setAttribute("data-slot", "tab-list");
|
|
9602
9689
|
});
|
|
9603
|
-
Alpine.directive("h-tab", (el, { original
|
|
9690
|
+
Alpine.directive("h-tab", (el, { original }) => {
|
|
9604
9691
|
el.classList.add(
|
|
9605
9692
|
"cursor-pointer",
|
|
9606
9693
|
"focus-visible:border-ring",
|
|
@@ -9621,7 +9708,8 @@
|
|
|
9621
9708
|
"text-sm",
|
|
9622
9709
|
"font-medium",
|
|
9623
9710
|
"whitespace-nowrap",
|
|
9624
|
-
"transition-
|
|
9711
|
+
"transition-colors",
|
|
9712
|
+
"transition-shadow",
|
|
9625
9713
|
"motion-reduce:transition-none",
|
|
9626
9714
|
"group-data-[floating=true]/tab-bar:rounded-md",
|
|
9627
9715
|
"group-data-[floating=true]/tab-bar:border",
|
|
@@ -9648,8 +9736,8 @@
|
|
|
9648
9736
|
);
|
|
9649
9737
|
el.setAttribute("role", "tab");
|
|
9650
9738
|
el.setAttribute("data-slot", "tab");
|
|
9651
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
9652
|
-
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.`);
|
|
9653
9741
|
});
|
|
9654
9742
|
Alpine.directive("h-tab-action", (el) => {
|
|
9655
9743
|
el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
|
|
@@ -9683,13 +9771,13 @@
|
|
|
9683
9771
|
el.setAttribute("role", "button");
|
|
9684
9772
|
el.setAttribute("data-slot", "tab-list-action");
|
|
9685
9773
|
});
|
|
9686
|
-
Alpine.directive("h-tabs-content", (el, { original
|
|
9774
|
+
Alpine.directive("h-tabs-content", (el, { original }) => {
|
|
9687
9775
|
el.classList.add("flex-1", "outline-none");
|
|
9688
9776
|
el.setAttribute("role", "tabpanel");
|
|
9689
9777
|
el.setAttribute("tabindex", "0");
|
|
9690
9778
|
el.setAttribute("data-slot", "tabs-content");
|
|
9691
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
9692
|
-
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.`);
|
|
9693
9781
|
});
|
|
9694
9782
|
}
|
|
9695
9783
|
|
|
@@ -9803,7 +9891,8 @@
|
|
|
9803
9891
|
"py-2",
|
|
9804
9892
|
"text-base",
|
|
9805
9893
|
"shadow-input",
|
|
9806
|
-
"transition-
|
|
9894
|
+
"transition-colors",
|
|
9895
|
+
"transition-shadow",
|
|
9807
9896
|
"motion-reduce:transition-none",
|
|
9808
9897
|
"outline-none",
|
|
9809
9898
|
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
@@ -9985,8 +10074,6 @@
|
|
|
9985
10074
|
el.classList.add(
|
|
9986
10075
|
"cursor-pointer",
|
|
9987
10076
|
"border-input",
|
|
9988
|
-
"hover:bg-secondary-hover",
|
|
9989
|
-
"active:bg-secondary-active",
|
|
9990
10077
|
"flex",
|
|
9991
10078
|
"items-center",
|
|
9992
10079
|
"justify-between",
|
|
@@ -9996,7 +10083,8 @@
|
|
|
9996
10083
|
"data-[size=sm]:pr-1",
|
|
9997
10084
|
"text-sm",
|
|
9998
10085
|
"whitespace-nowrap",
|
|
9999
|
-
"transition-
|
|
10086
|
+
"transition-colors",
|
|
10087
|
+
"transition-shadow",
|
|
10000
10088
|
"motion-reduce:transition-none",
|
|
10001
10089
|
"duration-200",
|
|
10002
10090
|
"outline-none",
|
|
@@ -10013,16 +10101,30 @@
|
|
|
10013
10101
|
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
10014
10102
|
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
10015
10103
|
"has-[input:invalid]:!inset-ring-negative/20",
|
|
10016
|
-
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
10104
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40",
|
|
10105
|
+
"hover:bg-table-hover",
|
|
10106
|
+
"hover:text-table-hover-foreground",
|
|
10107
|
+
"active:!bg-table-active",
|
|
10108
|
+
"active:!text-table-active-foreground",
|
|
10109
|
+
"has-[[aria-expanded=true]]:bg-transparent",
|
|
10110
|
+
"has-[[aria-expanded=true]]:text-foreground"
|
|
10017
10111
|
);
|
|
10018
10112
|
el.setAttribute("data-slot", "cell-input-time");
|
|
10019
10113
|
} else {
|
|
10020
10114
|
el.classList.add(
|
|
10021
10115
|
"w-full",
|
|
10116
|
+
"hover:bg-secondary-hover",
|
|
10117
|
+
"hover:text-secondary-foreground",
|
|
10118
|
+
'[&>[data-slot="time-picker-input"]]:hover:text-secondary-foreground',
|
|
10119
|
+
"active:bg-secondary-active",
|
|
10120
|
+
"active:text-secondary-foreground",
|
|
10121
|
+
'[&>[data-slot="time-picker-input"]]:active:text-secondary-foreground',
|
|
10022
10122
|
"rounded-control",
|
|
10023
10123
|
"border",
|
|
10024
10124
|
"bg-input-inner",
|
|
10025
10125
|
"shadow-input",
|
|
10126
|
+
"has-[[aria-expanded=true]]:bg-input-inner",
|
|
10127
|
+
"has-[[aria-expanded=true]]:text-foreground",
|
|
10026
10128
|
"has-[input:focus-visible]:border-ring",
|
|
10027
10129
|
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
10028
10130
|
"has-[input:focus-visible]:ring-ring/50",
|
|
@@ -10039,7 +10141,7 @@
|
|
|
10039
10141
|
el.appendChild(
|
|
10040
10142
|
createSvg({
|
|
10041
10143
|
icon: Clock,
|
|
10042
|
-
classes: "opacity-70 text-
|
|
10144
|
+
classes: "opacity-70 text-inherit size-4 shrink-0 pointer-events-none",
|
|
10043
10145
|
attrs: {
|
|
10044
10146
|
"aria-hidden": true,
|
|
10045
10147
|
role: "presentation"
|
|
@@ -10086,13 +10188,13 @@
|
|
|
10086
10188
|
top.removeEventListener("click", el._h_timepicker.close);
|
|
10087
10189
|
});
|
|
10088
10190
|
});
|
|
10089
|
-
Alpine.directive("h-time-picker-input", (el, { original
|
|
10191
|
+
Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
10090
10192
|
if (el.tagName !== "INPUT") {
|
|
10091
|
-
throw new Error(`${
|
|
10193
|
+
throw new Error(`${original} must be a readonly input of type "text"`);
|
|
10092
10194
|
}
|
|
10093
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
10195
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_timepicker"));
|
|
10094
10196
|
if (!timepicker) {
|
|
10095
|
-
throw new Error(`${
|
|
10197
|
+
throw new Error(`${original} must be inside a time-picker element`);
|
|
10096
10198
|
}
|
|
10097
10199
|
timepicker._h_timepicker.focusInput = () => {
|
|
10098
10200
|
el.focus();
|
|
@@ -10102,7 +10204,7 @@
|
|
|
10102
10204
|
el.dispatchEvent(new Event("change"));
|
|
10103
10205
|
});
|
|
10104
10206
|
};
|
|
10105
|
-
if (
|
|
10207
|
+
if (Object.prototype.hasOwnProperty.call(el, "_x_model")) {
|
|
10106
10208
|
timepicker._h_timepicker.model = el._x_model;
|
|
10107
10209
|
} else {
|
|
10108
10210
|
timepicker._h_timepicker.model = {
|
|
@@ -10190,7 +10292,7 @@
|
|
|
10190
10292
|
});
|
|
10191
10293
|
});
|
|
10192
10294
|
Alpine.directive("h-time-picker-popup", (el, _, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
10193
|
-
const timepicker = Alpine2.findClosest(el.parentElement, (parent) =>
|
|
10295
|
+
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_timepicker"));
|
|
10194
10296
|
el.classList.add(
|
|
10195
10297
|
"overflow-hidden",
|
|
10196
10298
|
"outline-none",
|
|
@@ -10290,7 +10392,7 @@
|
|
|
10290
10392
|
}
|
|
10291
10393
|
switch (event.key) {
|
|
10292
10394
|
case "Up":
|
|
10293
|
-
case "ArrowUp":
|
|
10395
|
+
case "ArrowUp": {
|
|
10294
10396
|
event.target.setAttribute("tabindex", "-1");
|
|
10295
10397
|
let prevElem = event.target.previousElementSibling;
|
|
10296
10398
|
if (prevElem === null || prevElem.classList.contains("hidden")) {
|
|
@@ -10303,8 +10405,9 @@
|
|
|
10303
10405
|
prevElem.setAttribute("tabindex", "0");
|
|
10304
10406
|
prevElem.focus();
|
|
10305
10407
|
break;
|
|
10408
|
+
}
|
|
10306
10409
|
case "Down":
|
|
10307
|
-
case "ArrowDown":
|
|
10410
|
+
case "ArrowDown": {
|
|
10308
10411
|
event.target.setAttribute("tabindex", "-1");
|
|
10309
10412
|
let nextElem = event.target.nextElementSibling;
|
|
10310
10413
|
if (nextElem === null || nextElem.classList.contains("hidden")) {
|
|
@@ -10317,8 +10420,9 @@
|
|
|
10317
10420
|
nextElem.setAttribute("tabindex", "0");
|
|
10318
10421
|
nextElem.focus();
|
|
10319
10422
|
break;
|
|
10423
|
+
}
|
|
10320
10424
|
case "Home":
|
|
10321
|
-
case "PageUp":
|
|
10425
|
+
case "PageUp": {
|
|
10322
10426
|
let firstChild;
|
|
10323
10427
|
if (list.firstChild === event.target) {
|
|
10324
10428
|
break;
|
|
@@ -10335,8 +10439,9 @@
|
|
|
10335
10439
|
firstChild.setAttribute("tabindex", "0");
|
|
10336
10440
|
firstChild.focus();
|
|
10337
10441
|
break;
|
|
10442
|
+
}
|
|
10338
10443
|
case "End":
|
|
10339
|
-
case "PageDown":
|
|
10444
|
+
case "PageDown": {
|
|
10340
10445
|
let lastElem;
|
|
10341
10446
|
if (list.lastChild === event.target) {
|
|
10342
10447
|
break;
|
|
@@ -10353,22 +10458,25 @@
|
|
|
10353
10458
|
lastElem.setAttribute("tabindex", "0");
|
|
10354
10459
|
lastElem.focus();
|
|
10355
10460
|
break;
|
|
10461
|
+
}
|
|
10356
10462
|
case "Right":
|
|
10357
|
-
case "ArrowRight":
|
|
10463
|
+
case "ArrowRight": {
|
|
10358
10464
|
let nextColumn = event.target.parentElement.nextElementSibling;
|
|
10359
10465
|
if (nextColumn) {
|
|
10360
10466
|
const child = nextColumn.querySelector('li[tabindex="0"]');
|
|
10361
10467
|
child.focus();
|
|
10362
10468
|
}
|
|
10363
10469
|
break;
|
|
10470
|
+
}
|
|
10364
10471
|
case "Left":
|
|
10365
|
-
case "ArrowLeft":
|
|
10472
|
+
case "ArrowLeft": {
|
|
10366
10473
|
let prevColumn = event.target.parentElement.previousElementSibling;
|
|
10367
10474
|
if (prevColumn) {
|
|
10368
10475
|
const child = prevColumn.querySelector('li[tabindex="0"]');
|
|
10369
10476
|
child.focus();
|
|
10370
10477
|
}
|
|
10371
10478
|
break;
|
|
10479
|
+
}
|
|
10372
10480
|
case "Enter":
|
|
10373
10481
|
case " ":
|
|
10374
10482
|
event.target.click();
|
|
@@ -10769,16 +10877,16 @@
|
|
|
10769
10877
|
el.removeEventListener("pointerleave", handler);
|
|
10770
10878
|
});
|
|
10771
10879
|
});
|
|
10772
|
-
Alpine.directive("h-tooltip", (el, { original
|
|
10880
|
+
Alpine.directive("h-tooltip", (el, { original }, { effect, cleanup }) => {
|
|
10773
10881
|
const tooltip = (() => {
|
|
10774
10882
|
let sibling = el.previousElementSibling;
|
|
10775
|
-
while (sibling && !
|
|
10883
|
+
while (sibling && !Object.prototype.hasOwnProperty.call(sibling, "_tooltip")) {
|
|
10776
10884
|
sibling = sibling.previousElementSibling;
|
|
10777
10885
|
}
|
|
10778
10886
|
return sibling;
|
|
10779
10887
|
})();
|
|
10780
10888
|
if (!tooltip) {
|
|
10781
|
-
throw new Error(`${
|
|
10889
|
+
throw new Error(`${original} must be placed after a tooltip trigger element`);
|
|
10782
10890
|
}
|
|
10783
10891
|
el.classList.add(
|
|
10784
10892
|
"absolute",
|
|
@@ -10883,7 +10991,7 @@
|
|
|
10883
10991
|
);
|
|
10884
10992
|
el.setAttribute("data-slot", "subtree");
|
|
10885
10993
|
el.setAttribute("role", "group");
|
|
10886
|
-
const treeItem = Alpine.findClosest(el.parentElement, (parent) =>
|
|
10994
|
+
const treeItem = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_tree_item"));
|
|
10887
10995
|
effect(() => {
|
|
10888
10996
|
if (treeItem._h_tree_item.expanded) {
|
|
10889
10997
|
el.classList.remove("!hidden");
|
|
@@ -11023,9 +11131,9 @@
|
|
|
11023
11131
|
});
|
|
11024
11132
|
}
|
|
11025
11133
|
});
|
|
11026
|
-
Alpine.directive("h-tree-button", (el, { original
|
|
11027
|
-
const treeItem = Alpine.findClosest(el.parentElement, (parent) =>
|
|
11028
|
-
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`);
|
|
11029
11137
|
el.classList.add(
|
|
11030
11138
|
"flex",
|
|
11031
11139
|
"w-full",
|
|
@@ -11167,7 +11275,7 @@
|
|
|
11167
11275
|
|
|
11168
11276
|
// src/utils/template.js
|
|
11169
11277
|
function template_default(Alpine) {
|
|
11170
|
-
Alpine.directive("h-template", (el, { original
|
|
11278
|
+
Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
11171
11279
|
if (el.hasAttribute(Alpine2.prefixed("data"))) {
|
|
11172
11280
|
const template = evaluate2(expression);
|
|
11173
11281
|
const clone = template.content.cloneNode(true).firstElementChild;
|
|
@@ -11181,14 +11289,14 @@
|
|
|
11181
11289
|
clone.remove();
|
|
11182
11290
|
});
|
|
11183
11291
|
} else {
|
|
11184
|
-
console.error(`${
|
|
11292
|
+
console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
|
|
11185
11293
|
}
|
|
11186
11294
|
});
|
|
11187
11295
|
}
|
|
11188
11296
|
|
|
11189
11297
|
// src/utils/include.js
|
|
11190
11298
|
function include_default(Alpine) {
|
|
11191
|
-
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 }) => {
|
|
11192
11300
|
const getUrl = evaluateLater(expression);
|
|
11193
11301
|
function executeScript(oldScript) {
|
|
11194
11302
|
return new Promise((resolve, reject) => {
|
|
@@ -11274,7 +11382,7 @@
|
|
|
11274
11382
|
}
|
|
11275
11383
|
|
|
11276
11384
|
// package.json
|
|
11277
|
-
var version = "1.
|
|
11385
|
+
var version = "1.9.1";
|
|
11278
11386
|
|
|
11279
11387
|
// src/index.js
|
|
11280
11388
|
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, getSystemColorScheme, version };
|