@codbex/harmonia 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harmonia.css +2 -2
- package/dist/harmonia.esm.js +827 -269
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +3 -3
- package/dist/harmonia.js +827 -269
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +3 -3
- package/package.json +13 -11
package/dist/harmonia.js
CHANGED
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
var Clock = 7;
|
|
66
66
|
var Search = 8;
|
|
67
67
|
var Ellipsis = 9;
|
|
68
|
+
var Minus = 10;
|
|
69
|
+
var Plus = 11;
|
|
68
70
|
function setCalendarContent(svg) {
|
|
69
71
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
70
72
|
path.setAttributeNS(
|
|
@@ -177,6 +179,20 @@
|
|
|
177
179
|
circle3.setAttributeNS(null, "r", "1.5");
|
|
178
180
|
svg.appendChild(circle3);
|
|
179
181
|
}
|
|
182
|
+
function setMinusContent(svg) {
|
|
183
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
184
|
+
path.setAttributeNS(null, "d", "m2.75 7.25h10.5c0.4155 0 0.75 0.3345 0.75 0.75s-0.3345 0.75-0.75 0.75h-10.5c-0.4155 0-0.75-0.3345-0.75-0.75s0.3345-0.75 0.75-0.75z");
|
|
185
|
+
svg.appendChild(path);
|
|
186
|
+
}
|
|
187
|
+
function setPlusContent(svg) {
|
|
188
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
189
|
+
path.setAttributeNS(
|
|
190
|
+
null,
|
|
191
|
+
"d",
|
|
192
|
+
"m8 2c-0.4155 0-0.75 0.3345-0.75 0.75v4.5h-4.5c-0.4155 0-0.75 0.3345-0.75 0.75s0.3345 0.75 0.75 0.75h4.5v4.5c0 0.4155 0.3345 0.75 0.75 0.75s0.75-0.3345 0.75-0.75v-4.5h4.5c0.4155 0 0.75-0.3345 0.75-0.75s-0.3345-0.75-0.75-0.75h-4.5v-4.5c0-0.4155-0.3345-0.75-0.75-0.75z"
|
|
193
|
+
);
|
|
194
|
+
svg.appendChild(path);
|
|
195
|
+
}
|
|
180
196
|
function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
181
197
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
182
198
|
svg.setAttributeNS(null, "width", "16");
|
|
@@ -220,9 +236,64 @@
|
|
|
220
236
|
case Ellipsis:
|
|
221
237
|
setEllipsisContent(svg);
|
|
222
238
|
break;
|
|
239
|
+
case Minus:
|
|
240
|
+
setMinusContent(svg);
|
|
241
|
+
break;
|
|
242
|
+
case Plus:
|
|
243
|
+
setPlusContent(svg);
|
|
244
|
+
break;
|
|
245
|
+
default:
|
|
246
|
+
break;
|
|
223
247
|
}
|
|
224
248
|
return svg;
|
|
225
249
|
}
|
|
250
|
+
function setSvgContent(svg, icon) {
|
|
251
|
+
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
252
|
+
svg.setAttribute("width", "16");
|
|
253
|
+
svg.setAttribute("height", "16");
|
|
254
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
255
|
+
svg.setAttribute("fill", "currentColor");
|
|
256
|
+
switch (icon) {
|
|
257
|
+
case "calendar":
|
|
258
|
+
setCalendarContent(svg);
|
|
259
|
+
break;
|
|
260
|
+
case "check":
|
|
261
|
+
setCheckContent(svg);
|
|
262
|
+
break;
|
|
263
|
+
case "chevron-down":
|
|
264
|
+
setChevronDownContent(svg);
|
|
265
|
+
break;
|
|
266
|
+
case "chevron-left":
|
|
267
|
+
setChevronLeftContent(svg);
|
|
268
|
+
break;
|
|
269
|
+
case "chevron-right":
|
|
270
|
+
setChevronRightContent(svg);
|
|
271
|
+
break;
|
|
272
|
+
case "chevrons-left":
|
|
273
|
+
setChevronsLeftContent(svg);
|
|
274
|
+
break;
|
|
275
|
+
case "chevrons-right":
|
|
276
|
+
setChevronsRightContent(svg);
|
|
277
|
+
break;
|
|
278
|
+
case "clock":
|
|
279
|
+
setClockContent(svg);
|
|
280
|
+
break;
|
|
281
|
+
case "search":
|
|
282
|
+
setSearchContent(svg);
|
|
283
|
+
break;
|
|
284
|
+
case "ellipsis":
|
|
285
|
+
setEllipsisContent(svg);
|
|
286
|
+
break;
|
|
287
|
+
case "minus":
|
|
288
|
+
setMinusContent(svg);
|
|
289
|
+
break;
|
|
290
|
+
case "plus":
|
|
291
|
+
setPlusContent(svg);
|
|
292
|
+
break;
|
|
293
|
+
default:
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
226
297
|
|
|
227
298
|
// src/components/accordion.js
|
|
228
299
|
function accordion_default(Alpine) {
|
|
@@ -459,7 +530,7 @@
|
|
|
459
530
|
Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
|
|
460
531
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
461
532
|
if (!avatar) {
|
|
462
|
-
throw new Error(`${original} must be inside an
|
|
533
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
463
534
|
}
|
|
464
535
|
el.classList.add("aspect-square", "size-full");
|
|
465
536
|
el.setAttribute("data-slot", "avatar-image");
|
|
@@ -493,7 +564,7 @@
|
|
|
493
564
|
Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
|
|
494
565
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
495
566
|
if (!avatar) {
|
|
496
|
-
throw new Error(`${original} must be inside an
|
|
567
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
497
568
|
}
|
|
498
569
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
499
570
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
@@ -970,6 +1041,62 @@
|
|
|
970
1041
|
}
|
|
971
1042
|
return coords;
|
|
972
1043
|
}
|
|
1044
|
+
async function detectOverflow(state, options) {
|
|
1045
|
+
var _await$platform$isEle;
|
|
1046
|
+
if (options === void 0) {
|
|
1047
|
+
options = {};
|
|
1048
|
+
}
|
|
1049
|
+
const {
|
|
1050
|
+
x,
|
|
1051
|
+
y,
|
|
1052
|
+
platform: platform2,
|
|
1053
|
+
rects,
|
|
1054
|
+
elements,
|
|
1055
|
+
strategy
|
|
1056
|
+
} = state;
|
|
1057
|
+
const {
|
|
1058
|
+
boundary = "clippingAncestors",
|
|
1059
|
+
rootBoundary = "viewport",
|
|
1060
|
+
elementContext = "floating",
|
|
1061
|
+
altBoundary = false,
|
|
1062
|
+
padding = 0
|
|
1063
|
+
} = evaluate(options, state);
|
|
1064
|
+
const paddingObject = getPaddingObject(padding);
|
|
1065
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
1066
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
1067
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
1068
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
1069
|
+
boundary,
|
|
1070
|
+
rootBoundary,
|
|
1071
|
+
strategy
|
|
1072
|
+
}));
|
|
1073
|
+
const rect = elementContext === "floating" ? {
|
|
1074
|
+
x,
|
|
1075
|
+
y,
|
|
1076
|
+
width: rects.floating.width,
|
|
1077
|
+
height: rects.floating.height
|
|
1078
|
+
} : rects.reference;
|
|
1079
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
1080
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
1081
|
+
x: 1,
|
|
1082
|
+
y: 1
|
|
1083
|
+
} : {
|
|
1084
|
+
x: 1,
|
|
1085
|
+
y: 1
|
|
1086
|
+
};
|
|
1087
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1088
|
+
elements,
|
|
1089
|
+
rect,
|
|
1090
|
+
offsetParent,
|
|
1091
|
+
strategy
|
|
1092
|
+
}) : rect);
|
|
1093
|
+
return {
|
|
1094
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1095
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1096
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1097
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
973
1100
|
var computePosition = async (reference, floating, config) => {
|
|
974
1101
|
const {
|
|
975
1102
|
placement = "bottom",
|
|
@@ -992,6 +1119,7 @@
|
|
|
992
1119
|
let middlewareData = {};
|
|
993
1120
|
let resetCount = 0;
|
|
994
1121
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
1122
|
+
var _platform$detectOverf;
|
|
995
1123
|
const {
|
|
996
1124
|
name,
|
|
997
1125
|
fn
|
|
@@ -1009,7 +1137,10 @@
|
|
|
1009
1137
|
strategy,
|
|
1010
1138
|
middlewareData,
|
|
1011
1139
|
rects,
|
|
1012
|
-
platform:
|
|
1140
|
+
platform: {
|
|
1141
|
+
...platform2,
|
|
1142
|
+
detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
1143
|
+
},
|
|
1013
1144
|
elements: {
|
|
1014
1145
|
reference,
|
|
1015
1146
|
floating
|
|
@@ -1053,62 +1184,6 @@
|
|
|
1053
1184
|
middlewareData
|
|
1054
1185
|
};
|
|
1055
1186
|
};
|
|
1056
|
-
async function detectOverflow(state, options) {
|
|
1057
|
-
var _await$platform$isEle;
|
|
1058
|
-
if (options === void 0) {
|
|
1059
|
-
options = {};
|
|
1060
|
-
}
|
|
1061
|
-
const {
|
|
1062
|
-
x,
|
|
1063
|
-
y,
|
|
1064
|
-
platform: platform2,
|
|
1065
|
-
rects,
|
|
1066
|
-
elements,
|
|
1067
|
-
strategy
|
|
1068
|
-
} = state;
|
|
1069
|
-
const {
|
|
1070
|
-
boundary = "clippingAncestors",
|
|
1071
|
-
rootBoundary = "viewport",
|
|
1072
|
-
elementContext = "floating",
|
|
1073
|
-
altBoundary = false,
|
|
1074
|
-
padding = 0
|
|
1075
|
-
} = evaluate(options, state);
|
|
1076
|
-
const paddingObject = getPaddingObject(padding);
|
|
1077
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
1078
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
1079
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
1080
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
1081
|
-
boundary,
|
|
1082
|
-
rootBoundary,
|
|
1083
|
-
strategy
|
|
1084
|
-
}));
|
|
1085
|
-
const rect = elementContext === "floating" ? {
|
|
1086
|
-
x,
|
|
1087
|
-
y,
|
|
1088
|
-
width: rects.floating.width,
|
|
1089
|
-
height: rects.floating.height
|
|
1090
|
-
} : rects.reference;
|
|
1091
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
1092
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
1093
|
-
x: 1,
|
|
1094
|
-
y: 1
|
|
1095
|
-
} : {
|
|
1096
|
-
x: 1,
|
|
1097
|
-
y: 1
|
|
1098
|
-
};
|
|
1099
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1100
|
-
elements,
|
|
1101
|
-
rect,
|
|
1102
|
-
offsetParent,
|
|
1103
|
-
strategy
|
|
1104
|
-
}) : rect);
|
|
1105
|
-
return {
|
|
1106
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1107
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1108
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1109
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
1187
|
var arrow = (options) => ({
|
|
1113
1188
|
name: "arrow",
|
|
1114
1189
|
options,
|
|
@@ -1210,7 +1285,7 @@
|
|
|
1210
1285
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1211
1286
|
}
|
|
1212
1287
|
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
1213
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1288
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1214
1289
|
const overflows = [];
|
|
1215
1290
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1216
1291
|
if (checkMainAxis) {
|
|
@@ -1359,7 +1434,8 @@
|
|
|
1359
1434
|
const {
|
|
1360
1435
|
x,
|
|
1361
1436
|
y,
|
|
1362
|
-
placement
|
|
1437
|
+
placement,
|
|
1438
|
+
platform: platform2
|
|
1363
1439
|
} = state;
|
|
1364
1440
|
const {
|
|
1365
1441
|
mainAxis: checkMainAxis = true,
|
|
@@ -1382,7 +1458,7 @@
|
|
|
1382
1458
|
x,
|
|
1383
1459
|
y
|
|
1384
1460
|
};
|
|
1385
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1461
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1386
1462
|
const crossAxis = getSideAxis(getSide(placement));
|
|
1387
1463
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
1388
1464
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -1440,7 +1516,7 @@
|
|
|
1440
1516
|
},
|
|
1441
1517
|
...detectOverflowOptions
|
|
1442
1518
|
} = evaluate(options, state);
|
|
1443
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1519
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
1444
1520
|
const side = getSide(placement);
|
|
1445
1521
|
const alignment = getAlignment(placement);
|
|
1446
1522
|
const isYAxis = getSideAxis(placement) === "y";
|
|
@@ -2272,7 +2348,7 @@
|
|
|
2272
2348
|
el.setAttribute("role", "dialog");
|
|
2273
2349
|
el.setAttribute("aria-modal", "true");
|
|
2274
2350
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
2275
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
2351
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
2276
2352
|
} else {
|
|
2277
2353
|
el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
|
|
2278
2354
|
}
|
|
@@ -2338,7 +2414,7 @@
|
|
|
2338
2414
|
selected = new Date(focusedDay);
|
|
2339
2415
|
modelChange(true);
|
|
2340
2416
|
render();
|
|
2341
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
2417
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
2342
2418
|
}
|
|
2343
2419
|
function isDisabled(d) {
|
|
2344
2420
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
@@ -2648,7 +2724,7 @@
|
|
|
2648
2724
|
break;
|
|
2649
2725
|
case "Escape":
|
|
2650
2726
|
event.preventDefault();
|
|
2651
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
2727
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
2652
2728
|
return;
|
|
2653
2729
|
case "Enter":
|
|
2654
2730
|
case " ":
|
|
@@ -2712,8 +2788,8 @@
|
|
|
2712
2788
|
}
|
|
2713
2789
|
if (datepicker) {
|
|
2714
2790
|
effect(() => {
|
|
2715
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
2716
|
-
if (datepicker._h_datepicker.expanded) {
|
|
2791
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
2792
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
2717
2793
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
2718
2794
|
Alpine2.nextTick(() => {
|
|
2719
2795
|
focusDay();
|
|
@@ -2889,13 +2965,17 @@
|
|
|
2889
2965
|
|
|
2890
2966
|
// src/components/datepicker.js
|
|
2891
2967
|
function datepicker_default(Alpine) {
|
|
2892
|
-
Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2, cleanup }) => {
|
|
2893
|
-
|
|
2968
|
+
Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
2969
|
+
const state = Alpine2.reactive({
|
|
2970
|
+
expanded: false
|
|
2971
|
+
});
|
|
2972
|
+
el._h_datepicker = {
|
|
2894
2973
|
id: void 0,
|
|
2895
2974
|
controls: `hdpc${v4_default()}`,
|
|
2896
2975
|
input: void 0,
|
|
2897
|
-
|
|
2898
|
-
|
|
2976
|
+
state,
|
|
2977
|
+
inTable: modifiers.includes("table")
|
|
2978
|
+
};
|
|
2899
2979
|
el._h_datepicker.input = el.querySelector("input");
|
|
2900
2980
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
2901
2981
|
throw new Error(`${original} must contain an input`);
|
|
@@ -2907,30 +2987,50 @@
|
|
|
2907
2987
|
el._h_datepicker.id = id;
|
|
2908
2988
|
}
|
|
2909
2989
|
el.classList.add(
|
|
2990
|
+
"overflow-hidden",
|
|
2910
2991
|
"border-input",
|
|
2911
|
-
"bg-input-inner",
|
|
2912
2992
|
"flex",
|
|
2913
|
-
"w-full",
|
|
2914
2993
|
"items-center",
|
|
2915
|
-
"rounded-control",
|
|
2916
|
-
"border",
|
|
2917
|
-
"shadow-input",
|
|
2918
2994
|
"transition-[color,box-shadow]",
|
|
2919
2995
|
"duration-200",
|
|
2920
2996
|
"outline-none",
|
|
2921
2997
|
"pl-3",
|
|
2922
2998
|
"min-w-0",
|
|
2923
|
-
"has-[input:
|
|
2924
|
-
"has-[input:
|
|
2925
|
-
"has-[input:
|
|
2926
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
2927
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
2928
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
2929
|
-
"has-[input:invalid]:ring-negative/20",
|
|
2930
|
-
"has-[input:invalid]:border-negative",
|
|
2931
|
-
"dark:has-[input:invalid]:ring-negative/40"
|
|
2999
|
+
"has-[input:disabled]:pointer-events-none",
|
|
3000
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
3001
|
+
"has-[input:disabled]:opacity-50"
|
|
2932
3002
|
);
|
|
2933
|
-
el.
|
|
3003
|
+
if (el._h_datepicker.inTable) {
|
|
3004
|
+
el.classList.add(
|
|
3005
|
+
"size-full",
|
|
3006
|
+
"h-10",
|
|
3007
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
3008
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
3009
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
3010
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
3011
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
3012
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
3013
|
+
);
|
|
3014
|
+
el.setAttribute("data-slot", "cell-input-date");
|
|
3015
|
+
} else {
|
|
3016
|
+
el.classList.add(
|
|
3017
|
+
"w-full",
|
|
3018
|
+
"rounded-control",
|
|
3019
|
+
"border",
|
|
3020
|
+
"bg-input-inner",
|
|
3021
|
+
"shadow-input",
|
|
3022
|
+
"has-[input:focus-visible]:border-ring",
|
|
3023
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
3024
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
3025
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
3026
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
3027
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
3028
|
+
"has-[input:invalid]:ring-negative/20",
|
|
3029
|
+
"has-[input:invalid]:border-negative",
|
|
3030
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
3031
|
+
);
|
|
3032
|
+
el.setAttribute("data-slot", "date-picker");
|
|
3033
|
+
}
|
|
2934
3034
|
el._h_datepicker.input.classList.add(
|
|
2935
3035
|
"bg-transparent",
|
|
2936
3036
|
"outline-none",
|
|
@@ -2966,28 +3066,29 @@
|
|
|
2966
3066
|
if (!datepicker) {
|
|
2967
3067
|
throw new Error(`${original} must be inside an date-picker element`);
|
|
2968
3068
|
}
|
|
2969
|
-
el.classList.add(
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3069
|
+
el.classList.add("cursor-pointer", "inline-flex", "items-center", "justify-center", "h-full", "aspect-square", "bg-transparent", "hover:bg-secondary", "active:bg-secondary-active", "outline-none");
|
|
3070
|
+
if (datepicker._h_datepicker.inTable) {
|
|
3071
|
+
el.classList.add(
|
|
3072
|
+
"focus-visible:inset-ring-ring/50",
|
|
3073
|
+
"focus-visible:inset-ring-2",
|
|
3074
|
+
"[input[aria-invalid=true]~&]:inset-ring-negative/20",
|
|
3075
|
+
"dark:[input[aria-invalid=true]~&]:inset-ring-negative/40",
|
|
3076
|
+
"[input:invalid~&]:!inset-ring-negative/20",
|
|
3077
|
+
"dark:[input:invalid~&]:!inset-ring-negative/40"
|
|
3078
|
+
);
|
|
3079
|
+
} else {
|
|
3080
|
+
el.classList.add(
|
|
3081
|
+
"focus-visible:border-ring",
|
|
3082
|
+
"focus-visible:ring-ring/50",
|
|
3083
|
+
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
3084
|
+
"[input[aria-invalid=true]~&]:ring-negative/20",
|
|
3085
|
+
"[input[aria-invalid=true]~&]:border-negative",
|
|
3086
|
+
"dark:[input[aria-invalid=true]~&]:ring-negative/40",
|
|
3087
|
+
"[input:invalid~&]:ring-negative/20",
|
|
3088
|
+
"[input:invalid~&]:border-negative",
|
|
3089
|
+
"dark:[input:invalid~&]:ring-negative/40"
|
|
3090
|
+
);
|
|
3091
|
+
}
|
|
2991
3092
|
el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
|
|
2992
3093
|
el.setAttribute("aria-expanded", "false");
|
|
2993
3094
|
el.setAttribute("aria-haspopup", "dialog");
|
|
@@ -3004,17 +3105,16 @@
|
|
|
3004
3105
|
})
|
|
3005
3106
|
);
|
|
3006
3107
|
effect(() => {
|
|
3007
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
3008
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
3108
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
3109
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.state.expanded);
|
|
3009
3110
|
});
|
|
3010
3111
|
const close = () => {
|
|
3011
|
-
datepicker._h_datepicker.expanded = false;
|
|
3112
|
+
datepicker._h_datepicker.state.expanded = false;
|
|
3012
3113
|
};
|
|
3013
3114
|
const handler = () => {
|
|
3014
|
-
datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
|
|
3015
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
3115
|
+
datepicker._h_datepicker.state.expanded = !datepicker._h_datepicker.state.expanded;
|
|
3016
3116
|
Alpine2.nextTick(() => {
|
|
3017
|
-
if (datepicker._h_datepicker.expanded) {
|
|
3117
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
3018
3118
|
top.addEventListener("click", close, { once: true });
|
|
3019
3119
|
} else {
|
|
3020
3120
|
top.removeEventListener("click", close);
|
|
@@ -3101,7 +3201,7 @@
|
|
|
3101
3201
|
el.setAttribute("data-slot", "dialog-header");
|
|
3102
3202
|
});
|
|
3103
3203
|
Alpine.directive("h-dialog-title", (el, _, { Alpine: Alpine2 }) => {
|
|
3104
|
-
el.classList.add("text-lg", "leading-none", "font-semibold");
|
|
3204
|
+
el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
|
|
3105
3205
|
el.setAttribute("data-slot", "dialog-title");
|
|
3106
3206
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
3107
3207
|
if (dialog && (!dialog.hasAttribute("aria-labelledby") || !dialog.hasAttribute("aria-label"))) {
|
|
@@ -3114,6 +3214,7 @@
|
|
|
3114
3214
|
});
|
|
3115
3215
|
Alpine.directive("h-dialog-close", (el) => {
|
|
3116
3216
|
el.classList.add(
|
|
3217
|
+
"order-2",
|
|
3117
3218
|
"ring-offset-background",
|
|
3118
3219
|
"focus:ring-ring",
|
|
3119
3220
|
"rounded-xs",
|
|
@@ -3129,9 +3230,10 @@
|
|
|
3129
3230
|
"[&_svg:not([class*='size-'])]:size-4"
|
|
3130
3231
|
);
|
|
3131
3232
|
el.setAttribute("data-slot", "dialog-close");
|
|
3233
|
+
el.setAttribute("type", "button");
|
|
3132
3234
|
});
|
|
3133
3235
|
Alpine.directive("h-dialog-description", (el, _, { Alpine: Alpine2 }) => {
|
|
3134
|
-
el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
|
|
3236
|
+
el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
|
|
3135
3237
|
el.setAttribute("data-slot", "dialog-description");
|
|
3136
3238
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
3137
3239
|
if (dialog && (!dialog.hasAttribute("aria-describedby") || !dialog.hasAttribute("aria-description"))) {
|
|
@@ -3242,7 +3344,7 @@
|
|
|
3242
3344
|
|
|
3243
3345
|
// src/components/icon.js
|
|
3244
3346
|
function icon_default(Alpine) {
|
|
3245
|
-
Alpine.directive("h-icon", (el, { original }) => {
|
|
3347
|
+
Alpine.directive("h-icon", (el, { original, modifiers }) => {
|
|
3246
3348
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
3247
3349
|
throw new Error(`${original} works only on svg elements`);
|
|
3248
3350
|
} else if (!el.hasAttribute("role")) {
|
|
@@ -3266,6 +3368,8 @@
|
|
|
3266
3368
|
}).catch((response) => {
|
|
3267
3369
|
console.error(response);
|
|
3268
3370
|
});
|
|
3371
|
+
} else if (modifiers[0]) {
|
|
3372
|
+
setSvgContent(el, modifiers[0]);
|
|
3269
3373
|
}
|
|
3270
3374
|
});
|
|
3271
3375
|
}
|
|
@@ -3342,6 +3446,18 @@
|
|
|
3342
3446
|
if (modifiers.includes("group")) {
|
|
3343
3447
|
el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
3344
3448
|
el.setAttribute("data-slot", "input-group-control");
|
|
3449
|
+
} else if (modifiers.includes("table")) {
|
|
3450
|
+
el.classList.add(
|
|
3451
|
+
"size-full",
|
|
3452
|
+
"h-10",
|
|
3453
|
+
"focus-visible:inset-ring-ring/50",
|
|
3454
|
+
"focus-visible:inset-ring-2",
|
|
3455
|
+
"aria-invalid:inset-ring-negative/20",
|
|
3456
|
+
"dark:aria-invalid:inset-ring-negative/40",
|
|
3457
|
+
"invalid:!inset-ring-negative/20",
|
|
3458
|
+
"dark:invalid:!inset-ring-negative/40"
|
|
3459
|
+
);
|
|
3460
|
+
el.setAttribute("data-slot", "cell-input");
|
|
3345
3461
|
} else {
|
|
3346
3462
|
el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
|
|
3347
3463
|
el.setAttribute("data-slot", "input");
|
|
@@ -3453,6 +3569,7 @@
|
|
|
3453
3569
|
});
|
|
3454
3570
|
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
3455
3571
|
el.classList.add(
|
|
3572
|
+
"overflow-hidden",
|
|
3456
3573
|
"group/input-number",
|
|
3457
3574
|
"border-input",
|
|
3458
3575
|
"bg-input-inner",
|
|
@@ -3466,12 +3583,18 @@
|
|
|
3466
3583
|
"transition-[color,box-shadow]",
|
|
3467
3584
|
"outline-none",
|
|
3468
3585
|
"min-w-0",
|
|
3469
|
-
"has-[
|
|
3470
|
-
"has-[
|
|
3471
|
-
"has-[
|
|
3472
|
-
"has-[[
|
|
3473
|
-
"has-[[
|
|
3474
|
-
"dark:has-[[
|
|
3586
|
+
"has-[input:focus-visible]:border-ring",
|
|
3587
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
3588
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
3589
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
3590
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
3591
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
3592
|
+
"has-[input:invalid]:ring-negative/20",
|
|
3593
|
+
"has-[input:invalid]:border-negative",
|
|
3594
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
3595
|
+
"has-[input:disabled]:pointer-events-none",
|
|
3596
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
3597
|
+
"has-[input:disabled]:opacity-50"
|
|
3475
3598
|
);
|
|
3476
3599
|
el.setAttribute("role", "group");
|
|
3477
3600
|
el.setAttribute("data-slot", "input-number");
|
|
@@ -3492,14 +3615,27 @@
|
|
|
3492
3615
|
input.setAttribute("autocorrect", "off");
|
|
3493
3616
|
input.setAttribute("spellcheck", "off");
|
|
3494
3617
|
input.setAttribute("data-slot", "input-number-control");
|
|
3495
|
-
input.classList.add("
|
|
3618
|
+
input.classList.add("size-full", "px-3", "py-1", "outline-none");
|
|
3496
3619
|
const stepDown = document.createElement("button");
|
|
3497
3620
|
stepDown.setAttribute("type", "button");
|
|
3498
3621
|
stepDown.setAttribute("tabIndex", "-1");
|
|
3499
3622
|
stepDown.setAttribute("aria-label", "Decrease");
|
|
3500
3623
|
stepDown.setAttribute("aria-controls", input.getAttribute("id"));
|
|
3501
3624
|
stepDown.setAttribute("data-slot", "step-up-trigger");
|
|
3625
|
+
stepDown.appendChild(
|
|
3626
|
+
createSvg({
|
|
3627
|
+
icon: Minus,
|
|
3628
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
3629
|
+
attrs: {
|
|
3630
|
+
"aria-hidden": true,
|
|
3631
|
+
role: "presentation"
|
|
3632
|
+
}
|
|
3633
|
+
})
|
|
3634
|
+
);
|
|
3502
3635
|
stepDown.classList.add(
|
|
3636
|
+
"inline-flex",
|
|
3637
|
+
"items-center",
|
|
3638
|
+
"justify-center",
|
|
3503
3639
|
"cursor-pointer",
|
|
3504
3640
|
"border-l",
|
|
3505
3641
|
"border-input",
|
|
@@ -3512,15 +3648,7 @@
|
|
|
3512
3648
|
"active:bg-secondary-active",
|
|
3513
3649
|
"outline-none",
|
|
3514
3650
|
"relative",
|
|
3515
|
-
"
|
|
3516
|
-
"before:opacity-70",
|
|
3517
|
-
"before:rounded-full",
|
|
3518
|
-
"before:h-0.5",
|
|
3519
|
-
"before:min-h-px",
|
|
3520
|
-
"before:w-3",
|
|
3521
|
-
"before:mx-auto",
|
|
3522
|
-
"before:bg-foreground",
|
|
3523
|
-
"before:hover:bg-secondary-foreground"
|
|
3651
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
3524
3652
|
);
|
|
3525
3653
|
el.appendChild(stepDown);
|
|
3526
3654
|
const onStepDown = () => {
|
|
@@ -3535,13 +3663,25 @@
|
|
|
3535
3663
|
stepUp.setAttribute("aria-label", "Increase");
|
|
3536
3664
|
stepUp.setAttribute("aria-controls", input.getAttribute("id"));
|
|
3537
3665
|
stepUp.setAttribute("data-slot", "step-up-trigger");
|
|
3666
|
+
stepUp.appendChild(
|
|
3667
|
+
createSvg({
|
|
3668
|
+
icon: Plus,
|
|
3669
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
3670
|
+
attrs: {
|
|
3671
|
+
"aria-hidden": true,
|
|
3672
|
+
role: "presentation"
|
|
3673
|
+
}
|
|
3674
|
+
})
|
|
3675
|
+
);
|
|
3538
3676
|
stepUp.classList.add(
|
|
3677
|
+
"inline-flex",
|
|
3678
|
+
"items-center",
|
|
3679
|
+
"justify-center",
|
|
3539
3680
|
"cursor-pointer",
|
|
3540
3681
|
"border-l",
|
|
3541
3682
|
"border-input",
|
|
3542
3683
|
"[input[aria-invalid=true]~&]:border-negative",
|
|
3543
3684
|
"[input:invalid~&]:border-negative",
|
|
3544
|
-
"rounded-r-control",
|
|
3545
3685
|
"h-full",
|
|
3546
3686
|
"aspect-square",
|
|
3547
3687
|
"bg-transparent",
|
|
@@ -3549,32 +3689,7 @@
|
|
|
3549
3689
|
"active:bg-secondary-active",
|
|
3550
3690
|
"outline-none",
|
|
3551
3691
|
"relative",
|
|
3552
|
-
"
|
|
3553
|
-
"before:opacity-70",
|
|
3554
|
-
"before:absolute",
|
|
3555
|
-
"before:rounded-full",
|
|
3556
|
-
"before:h-0.5",
|
|
3557
|
-
"before:min-h-px",
|
|
3558
|
-
"before:w-3",
|
|
3559
|
-
"before:top-1/2",
|
|
3560
|
-
"before:left-1/2",
|
|
3561
|
-
"before:-translate-x-1/2",
|
|
3562
|
-
"before:-translate-y-1/2",
|
|
3563
|
-
"before:bg-foreground",
|
|
3564
|
-
"before:hover:bg-secondary-foreground",
|
|
3565
|
-
"after:block",
|
|
3566
|
-
"after:opacity-70",
|
|
3567
|
-
"after:absolute",
|
|
3568
|
-
"after:rounded-full",
|
|
3569
|
-
"after:h-3",
|
|
3570
|
-
"after:min-w-px",
|
|
3571
|
-
"after:w-0.5",
|
|
3572
|
-
"after:top-1/2",
|
|
3573
|
-
"after:left-1/2",
|
|
3574
|
-
"after:-translate-x-1/2",
|
|
3575
|
-
"after:-translate-y-1/2",
|
|
3576
|
-
"after:bg-foreground",
|
|
3577
|
-
"after:hover:bg-secondary-foreground"
|
|
3692
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
3578
3693
|
);
|
|
3579
3694
|
el.appendChild(stepUp);
|
|
3580
3695
|
const onStepUp = () => {
|
|
@@ -3782,10 +3897,17 @@
|
|
|
3782
3897
|
function menu_default(Alpine) {
|
|
3783
3898
|
Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
|
|
3784
3899
|
el._menu_trigger = {
|
|
3785
|
-
isDropdown: modifiers.includes("dropdown")
|
|
3900
|
+
isDropdown: modifiers.includes("dropdown"),
|
|
3901
|
+
setOpen(open) {
|
|
3902
|
+
el.setAttribute("data-state", open ? "open" : "closed");
|
|
3903
|
+
}
|
|
3786
3904
|
};
|
|
3905
|
+
el.setAttribute("data-state", "closed");
|
|
3787
3906
|
});
|
|
3788
3907
|
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
3908
|
+
if (el.tagName !== "UL") {
|
|
3909
|
+
throw new Error(`${original} must be an ul element`);
|
|
3910
|
+
}
|
|
3789
3911
|
el.classList.add("hidden", "fixed", "bg-popover", "text-popover-foreground", "font-normal", "z-50", "min-w-[8rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "p-1", "shadow-md", "border", "outline-none");
|
|
3790
3912
|
el.setAttribute("role", "menu");
|
|
3791
3913
|
el.setAttribute("aria-orientation", "vertical");
|
|
@@ -3834,6 +3956,9 @@
|
|
|
3834
3956
|
} else {
|
|
3835
3957
|
listenForTrigger(true);
|
|
3836
3958
|
if (focusTrigger) menuTrigger.focus();
|
|
3959
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
3960
|
+
menuTrigger._menu_trigger.setOpen(false);
|
|
3961
|
+
}
|
|
3837
3962
|
}
|
|
3838
3963
|
}
|
|
3839
3964
|
el._menu = { close };
|
|
@@ -3984,6 +4109,9 @@
|
|
|
3984
4109
|
}
|
|
3985
4110
|
}
|
|
3986
4111
|
function openDropdown() {
|
|
4112
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
4113
|
+
menuTrigger._menu_trigger.setOpen(true);
|
|
4114
|
+
}
|
|
3987
4115
|
open(menuTrigger);
|
|
3988
4116
|
}
|
|
3989
4117
|
function onContextmenu(event) {
|
|
@@ -4017,7 +4145,10 @@
|
|
|
4017
4145
|
el.removeEventListener("keydown", onKeyDown);
|
|
4018
4146
|
});
|
|
4019
4147
|
});
|
|
4020
|
-
Alpine.directive("h-menu-item", (el,
|
|
4148
|
+
Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4149
|
+
if (el.tagName !== "LI") {
|
|
4150
|
+
throw new Error(`${original} must be a li element`);
|
|
4151
|
+
}
|
|
4021
4152
|
el.classList.add(
|
|
4022
4153
|
"focus:bg-secondary-hover",
|
|
4023
4154
|
"focus:text-secondary-foreground",
|
|
@@ -4196,7 +4327,10 @@
|
|
|
4196
4327
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
4197
4328
|
el.setAttribute("data-slot", "menu-label");
|
|
4198
4329
|
});
|
|
4199
|
-
Alpine.directive("h-menu-checkbox-item", (el,
|
|
4330
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4331
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
4332
|
+
throw new Error(`${original} must be a li or div element`);
|
|
4333
|
+
}
|
|
4200
4334
|
el.classList.add(
|
|
4201
4335
|
"focus:bg-secondary-hover",
|
|
4202
4336
|
"hover:bg-secondary-hover",
|
|
@@ -4261,7 +4395,10 @@
|
|
|
4261
4395
|
el.removeEventListener("mouseleave", focusOut);
|
|
4262
4396
|
});
|
|
4263
4397
|
});
|
|
4264
|
-
Alpine.directive("h-menu-radio-item", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4398
|
+
Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4399
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
4400
|
+
throw new Error(`${original} must be a li or div element`);
|
|
4401
|
+
}
|
|
4265
4402
|
el.classList.add(
|
|
4266
4403
|
"focus:bg-secondary-hover",
|
|
4267
4404
|
"hover:bg-secondary-hover",
|
|
@@ -6509,7 +6646,7 @@
|
|
|
6509
6646
|
none: 3
|
|
6510
6647
|
});
|
|
6511
6648
|
function select_default(Alpine) {
|
|
6512
|
-
Alpine.directive("h-select", (el,
|
|
6649
|
+
Alpine.directive("h-select", (el, { modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
6513
6650
|
el._h_select = Alpine2.reactive({
|
|
6514
6651
|
id: void 0,
|
|
6515
6652
|
controls: `hsc${v4_default()}`,
|
|
@@ -6526,38 +6663,37 @@
|
|
|
6526
6663
|
set: void 0,
|
|
6527
6664
|
get: void 0
|
|
6528
6665
|
};
|
|
6529
|
-
el.classList.add(
|
|
6530
|
-
|
|
6531
|
-
"
|
|
6532
|
-
"
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
"
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
});
|
|
6666
|
+
el.classList.add("cursor-pointer", "outline-none", "transition-[color,box-shadow]", "duration-200", "w-full", "has-[input:disabled]:pointer-events-none", "has-[input:disabled]:opacity-50");
|
|
6667
|
+
if (modifiers.includes("table")) {
|
|
6668
|
+
el.classList.add("h-10", "flex", "focus-visible:inset-ring-ring/50", "focus-visible:inset-ring-2", "hover:bg-table-hover", "hover:text-table-hover-foreground", "active:!bg-table-active", "active:!text-table-active-foreground");
|
|
6669
|
+
el.setAttribute("data-slot", "cell-input-select");
|
|
6670
|
+
} else {
|
|
6671
|
+
el.classList.add(
|
|
6672
|
+
"border-input",
|
|
6673
|
+
"has-focus-visible:border-ring",
|
|
6674
|
+
"has-focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
6675
|
+
"has-focus-visible:ring-ring/50",
|
|
6676
|
+
"dark:has-[aria-invalid=true]:ring-negative/40",
|
|
6677
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
6678
|
+
"has-[aria-invalid=true]:border-negative",
|
|
6679
|
+
"has-[aria-invalid=true]:ring-negative/20",
|
|
6680
|
+
"has-[input:invalid]:border-negative",
|
|
6681
|
+
"has-[input:invalid]:ring-negative/20",
|
|
6682
|
+
"hover:bg-secondary-hover",
|
|
6683
|
+
"active:bg-secondary-active",
|
|
6684
|
+
"rounded-control",
|
|
6685
|
+
"border",
|
|
6686
|
+
"bg-input-inner",
|
|
6687
|
+
"text-sm",
|
|
6688
|
+
"whitespace-nowrap",
|
|
6689
|
+
"shadow-input"
|
|
6690
|
+
);
|
|
6691
|
+
el.setAttribute("data-slot", "select");
|
|
6692
|
+
const observer = sizeObserver(el);
|
|
6693
|
+
cleanup(() => {
|
|
6694
|
+
observer.disconnect();
|
|
6695
|
+
});
|
|
6696
|
+
}
|
|
6561
6697
|
});
|
|
6562
6698
|
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6563
6699
|
if (el.tagName !== "INPUT") {
|
|
@@ -7385,7 +7521,7 @@
|
|
|
7385
7521
|
el.setAttribute("role", "none");
|
|
7386
7522
|
});
|
|
7387
7523
|
Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
|
|
7388
|
-
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar
|
|
7524
|
+
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
|
|
7389
7525
|
if (!modifiers.includes("flat")) {
|
|
7390
7526
|
el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
|
|
7391
7527
|
}
|
|
@@ -7501,18 +7637,212 @@
|
|
|
7501
7637
|
|
|
7502
7638
|
// src/components/split.js
|
|
7503
7639
|
function split_default(Alpine) {
|
|
7504
|
-
Alpine.directive("h-split", (el) => {
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7640
|
+
Alpine.directive("h-split", (el, {}, { cleanup, Alpine: Alpine2 }) => {
|
|
7641
|
+
const panels = [];
|
|
7642
|
+
const state = Alpine2.reactive({
|
|
7643
|
+
isHorizontal: el.getAttribute("data-orientation") === "horizontal",
|
|
7644
|
+
isBorder: el.getAttribute("data-variant") === "border"
|
|
7645
|
+
});
|
|
7646
|
+
const storageKey = el.getAttribute("data-key");
|
|
7647
|
+
const loadSizes = () => {
|
|
7648
|
+
if (!storageKey) return null;
|
|
7649
|
+
try {
|
|
7650
|
+
const raw = localStorage.getItem(storageKey);
|
|
7651
|
+
if (!raw) return null;
|
|
7652
|
+
return JSON.parse(raw);
|
|
7653
|
+
} catch {
|
|
7654
|
+
return null;
|
|
7655
|
+
}
|
|
7656
|
+
};
|
|
7657
|
+
let saveTimer = null;
|
|
7658
|
+
const SAVE_DELAY = 200;
|
|
7659
|
+
const saveSizes = () => {
|
|
7660
|
+
if (!storageKey) return;
|
|
7661
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7662
|
+
saveTimer = setTimeout(() => {
|
|
7663
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7664
|
+
const sizes = visible.map((p) => p.size / usableSize());
|
|
7665
|
+
localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
7666
|
+
saveTimer = null;
|
|
7667
|
+
}, SAVE_DELAY);
|
|
7668
|
+
};
|
|
7669
|
+
const sizeProp = () => state.isHorizontal ? "width" : "height";
|
|
7670
|
+
const containerSize = () => state.isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
|
|
7671
|
+
const gutterSize = () => {
|
|
7672
|
+
const panel = panels.find((p) => p.gutter.parentElement);
|
|
7673
|
+
if (panel) {
|
|
7674
|
+
return panel.gutter.getBoundingClientRect()[sizeProp()] ?? 0;
|
|
7675
|
+
}
|
|
7676
|
+
return 0;
|
|
7677
|
+
};
|
|
7678
|
+
const usableSize = () => {
|
|
7679
|
+
const visiblePanels = panels.filter((p) => !p.hidden);
|
|
7680
|
+
const gutters = Math.max(0, visiblePanels.length - 1);
|
|
7681
|
+
return containerSize() - gutters * gutterSize();
|
|
7682
|
+
};
|
|
7683
|
+
const normalize = (value) => {
|
|
7684
|
+
if (value == null) return null;
|
|
7685
|
+
if (typeof value === "number") return value;
|
|
7686
|
+
if (value.endsWith("%")) {
|
|
7687
|
+
return parseFloat(value) / 100 * usableSize();
|
|
7688
|
+
}
|
|
7689
|
+
return parseFloat(value);
|
|
7690
|
+
};
|
|
7691
|
+
let initialized = false;
|
|
7692
|
+
const DELTA_ABS = 0.01;
|
|
7693
|
+
const layout = () => {
|
|
7694
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7695
|
+
if (!visible.length) return;
|
|
7696
|
+
const total = usableSize();
|
|
7697
|
+
if (!initialized) {
|
|
7698
|
+
initialized = true;
|
|
7699
|
+
const visible2 = panels.filter((p) => !p.hidden);
|
|
7700
|
+
const stored = loadSizes();
|
|
7701
|
+
if (stored && stored.length === visible2.length) {
|
|
7702
|
+
visible2.forEach((p, i) => {
|
|
7703
|
+
p.size = stored[i] * usableSize();
|
|
7704
|
+
p.explicit = true;
|
|
7705
|
+
});
|
|
7706
|
+
} else {
|
|
7707
|
+
const explicitTotal = visible2.filter((p) => p.explicit).reduce((sum, p) => sum + p.declaredSize, 0);
|
|
7708
|
+
const autoPanels = visible2.filter((p) => !p.explicit);
|
|
7709
|
+
const remaining = total - explicitTotal;
|
|
7710
|
+
const share = autoPanels.length ? remaining / autoPanels.length : 0;
|
|
7711
|
+
visible2.forEach((p) => {
|
|
7712
|
+
if (p.explicit) {
|
|
7713
|
+
p.size = p.declaredSize;
|
|
7714
|
+
} else {
|
|
7715
|
+
p.size = share;
|
|
7716
|
+
}
|
|
7717
|
+
p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
|
|
7718
|
+
});
|
|
7719
|
+
}
|
|
7720
|
+
}
|
|
7721
|
+
visible.forEach((p) => {
|
|
7722
|
+
if (p.size == null) {
|
|
7723
|
+
p.size = p.min ?? 0;
|
|
7724
|
+
}
|
|
7725
|
+
p.size = Math.min(Math.max(p.size, p.min), p.max);
|
|
7726
|
+
});
|
|
7727
|
+
let currentTotal = visible.reduce((sum, p) => sum + p.size, 0);
|
|
7728
|
+
let delta = total - currentTotal;
|
|
7729
|
+
if (Math.abs(delta) < DELTA_ABS) {
|
|
7730
|
+
visible.forEach((p) => p.apply());
|
|
7731
|
+
return;
|
|
7732
|
+
}
|
|
7733
|
+
let flexible = visible.filter((p) => {
|
|
7734
|
+
if (p.collapsed) return false;
|
|
7735
|
+
if (delta > 0) {
|
|
7736
|
+
return p.size < p.max;
|
|
7737
|
+
} else {
|
|
7738
|
+
return p.size > p.min;
|
|
7739
|
+
}
|
|
7740
|
+
});
|
|
7741
|
+
while (flexible.length && Math.abs(delta) > DELTA_ABS) {
|
|
7742
|
+
const share = delta / flexible.length;
|
|
7743
|
+
let consumed = 0;
|
|
7744
|
+
const nextFlexible = [];
|
|
7745
|
+
flexible.forEach((p) => {
|
|
7746
|
+
const proposed = p.size + share;
|
|
7747
|
+
const clamped = Math.min(Math.max(proposed, p.min), p.max);
|
|
7748
|
+
const actualChange = clamped - p.size;
|
|
7749
|
+
if (Math.abs(actualChange) > DELTA_ABS) {
|
|
7750
|
+
p.size = clamped;
|
|
7751
|
+
consumed += actualChange;
|
|
7752
|
+
}
|
|
7753
|
+
if (delta > 0) {
|
|
7754
|
+
if (p.size < p.max) nextFlexible.push(p);
|
|
7755
|
+
} else {
|
|
7756
|
+
if (p.size > p.min) nextFlexible.push(p);
|
|
7757
|
+
}
|
|
7758
|
+
});
|
|
7759
|
+
delta -= consumed;
|
|
7760
|
+
flexible = nextFlexible;
|
|
7761
|
+
if (Math.abs(consumed) < DELTA_ABS) break;
|
|
7762
|
+
}
|
|
7763
|
+
visible.forEach((p) => p.apply());
|
|
7764
|
+
};
|
|
7765
|
+
let layoutFrame = null;
|
|
7766
|
+
const queueLayout = () => {
|
|
7767
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7768
|
+
layoutFrame = requestAnimationFrame(() => {
|
|
7769
|
+
layout();
|
|
7770
|
+
saveSizes();
|
|
7771
|
+
layoutFrame = null;
|
|
7772
|
+
});
|
|
7773
|
+
};
|
|
7774
|
+
const refreshGutters = () => {
|
|
7775
|
+
panels.forEach((p, i) => p.setGutter(i === panels.length - 1));
|
|
7776
|
+
};
|
|
7777
|
+
el._h_split = {
|
|
7778
|
+
state,
|
|
7779
|
+
panels,
|
|
7780
|
+
addPanel(panel) {
|
|
7781
|
+
panels.push(panel);
|
|
7782
|
+
if (panel.size == null) {
|
|
7783
|
+
panel.size = null;
|
|
7784
|
+
}
|
|
7785
|
+
initialized = false;
|
|
7786
|
+
refreshGutters();
|
|
7787
|
+
queueLayout();
|
|
7788
|
+
},
|
|
7789
|
+
removePanel(panel) {
|
|
7790
|
+
const i = panels.indexOf(panel);
|
|
7791
|
+
if (i !== -1) panels.splice(i, 1);
|
|
7792
|
+
initialized = false;
|
|
7793
|
+
refreshGutters();
|
|
7794
|
+
queueLayout();
|
|
7795
|
+
},
|
|
7796
|
+
panelHidden() {
|
|
7797
|
+
initialized = false;
|
|
7798
|
+
refreshGutters();
|
|
7799
|
+
queueLayout();
|
|
7800
|
+
},
|
|
7801
|
+
panelChange() {
|
|
7802
|
+
queueLayout();
|
|
7803
|
+
},
|
|
7804
|
+
normalize,
|
|
7805
|
+
saveSizes
|
|
7806
|
+
};
|
|
7807
|
+
el.classList.add("flex", "flex-1", "min-w-0", "min-h-0", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
|
|
7808
|
+
const observer = new MutationObserver((mutations) => {
|
|
7809
|
+
mutations.forEach((mutation) => {
|
|
7810
|
+
if (mutation.attributeName === "data-orientation") {
|
|
7811
|
+
state.isHorizontal = el.getAttribute("data-orientation") === "horizontal";
|
|
7812
|
+
queueLayout();
|
|
7813
|
+
} else if (mutation.attributeName === "data-variant") {
|
|
7814
|
+
state.isBorder = el.getAttribute("data-variant") === "border";
|
|
7815
|
+
queueLayout();
|
|
7816
|
+
} else {
|
|
7817
|
+
panels.forEach((p) => p.setLocked(el.getAttribute("data-locked") === "true"));
|
|
7818
|
+
}
|
|
7819
|
+
});
|
|
7820
|
+
});
|
|
7821
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-orientation", "data-variant", "data-locked"] });
|
|
7822
|
+
const containerObserver = new ResizeObserver(queueLayout);
|
|
7823
|
+
containerObserver.observe(el);
|
|
7824
|
+
cleanup(() => {
|
|
7825
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7826
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7827
|
+
containerObserver.disconnect();
|
|
7828
|
+
observer.disconnect();
|
|
7829
|
+
});
|
|
7508
7830
|
});
|
|
7509
|
-
Alpine.directive("h-split-panel", (el) => {
|
|
7510
|
-
el.
|
|
7831
|
+
Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7832
|
+
const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
|
|
7833
|
+
if (!split) {
|
|
7834
|
+
throw new Error(`${original} must be inside an split element`);
|
|
7835
|
+
}
|
|
7836
|
+
el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
|
|
7511
7837
|
el.setAttribute("tabindex", "-1");
|
|
7512
7838
|
el.setAttribute("data-slot", "split-panel");
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
el.
|
|
7839
|
+
const gutter = document.createElement("span");
|
|
7840
|
+
gutter.setAttribute("data-slot", "split-gutter");
|
|
7841
|
+
gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
|
|
7842
|
+
gutter.setAttribute("tabindex", "-1");
|
|
7843
|
+
gutter.setAttribute("role", "separator");
|
|
7844
|
+
gutter.classList.add(
|
|
7845
|
+
"overflow-visible",
|
|
7516
7846
|
"relative",
|
|
7517
7847
|
"shrink-0",
|
|
7518
7848
|
"touch-none",
|
|
@@ -7520,15 +7850,8 @@
|
|
|
7520
7850
|
"outline-none",
|
|
7521
7851
|
"hover:bg-primary-hover",
|
|
7522
7852
|
"active:bg-primary-active",
|
|
7523
|
-
"before:absolute",
|
|
7524
|
-
"before:top-1/2",
|
|
7525
|
-
"before:left-1/2",
|
|
7526
|
-
"before:-translate-x-1/2",
|
|
7527
|
-
"before:-translate-y-1/2",
|
|
7528
|
-
"before:block",
|
|
7529
|
-
"before:bg-transparent",
|
|
7530
7853
|
"hover:before:bg-primary-hover",
|
|
7531
|
-
"
|
|
7854
|
+
"aria-disabled:pointer-events-none",
|
|
7532
7855
|
"[[data-orientation=horizontal]>&]:cursor-col-resize",
|
|
7533
7856
|
"[[data-orientation=vertical]>&]:cursor-row-resize"
|
|
7534
7857
|
);
|
|
@@ -7538,19 +7861,23 @@
|
|
|
7538
7861
|
"hover:bg-primary-hover",
|
|
7539
7862
|
"active:bg-primary-active",
|
|
7540
7863
|
"before:absolute",
|
|
7541
|
-
"before:top-1/2",
|
|
7542
|
-
"before:left-1/2",
|
|
7543
|
-
"before:-translate-x-1/2",
|
|
7544
|
-
"before:-translate-y-1/2",
|
|
7545
7864
|
"before:block",
|
|
7546
7865
|
"before:bg-transparent",
|
|
7547
7866
|
"hover:before:bg-primary-hover",
|
|
7867
|
+
"[[data-orientation=horizontal]>&]:before:-translate-x-1/2",
|
|
7868
|
+
"[[data-orientation=horizontal]>&[data-edge=end]]:before:-translate-x-1",
|
|
7869
|
+
"[[data-orientation=horizontal]>&[data-edge=start]]:before:translate-x-0",
|
|
7870
|
+
"[[data-orientation=horizontal]>&]:before:left-1/2",
|
|
7548
7871
|
"[[data-orientation=horizontal]>&]:!w-px",
|
|
7549
7872
|
"[[data-orientation=horizontal]>&]:before:h-full",
|
|
7550
|
-
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1
|
|
7873
|
+
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1)]",
|
|
7874
|
+
"[[data-orientation=vertical]>&]:before:-translate-y-1/2",
|
|
7875
|
+
"[[data-orientation=vertical]>&[data-edge=end]]:before:-translate-y-1",
|
|
7876
|
+
"[[data-orientation=vertical]>&[data-edge=start]]:before:translate-y-0",
|
|
7877
|
+
"[[data-orientation=vertical]>&]:before:top-1/2",
|
|
7551
7878
|
"[[data-orientation=vertical]>&]:!h-px",
|
|
7552
7879
|
"[[data-orientation=vertical]>&]:before:w-full",
|
|
7553
|
-
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1
|
|
7880
|
+
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1)]"
|
|
7554
7881
|
];
|
|
7555
7882
|
const handleClasses = [
|
|
7556
7883
|
"bg-transparent",
|
|
@@ -7599,24 +7926,175 @@
|
|
|
7599
7926
|
"[[data-orientation=vertical]>&]:after:w-5",
|
|
7600
7927
|
"[[data-orientation=vertical]>&]:after:h-2.5"
|
|
7601
7928
|
];
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
if (variant === "border") {
|
|
7607
|
-
el.classList.remove(...handleClasses);
|
|
7608
|
-
el.classList.add(...borderClasses);
|
|
7929
|
+
const setVariant = () => {
|
|
7930
|
+
if (split._h_split.state.isBorder) {
|
|
7931
|
+
gutter.classList.remove(...handleClasses);
|
|
7932
|
+
gutter.classList.add(...borderClasses);
|
|
7609
7933
|
} else {
|
|
7610
|
-
|
|
7611
|
-
|
|
7934
|
+
gutter.classList.remove(...borderClasses);
|
|
7935
|
+
gutter.classList.add(...handleClasses);
|
|
7612
7936
|
}
|
|
7613
|
-
}
|
|
7614
|
-
|
|
7615
|
-
|
|
7937
|
+
};
|
|
7938
|
+
setVariant();
|
|
7939
|
+
effect(setVariant);
|
|
7940
|
+
const initialSize = split._h_split.normalize(el.getAttribute("data-size"));
|
|
7941
|
+
let handleSize = 0;
|
|
7942
|
+
const panel = {
|
|
7943
|
+
el,
|
|
7944
|
+
gutter,
|
|
7945
|
+
hidden: el.getAttribute("data-hidden") === "true",
|
|
7946
|
+
declaredSize: initialSize,
|
|
7947
|
+
size: initialSize,
|
|
7948
|
+
explicit: initialSize != null,
|
|
7949
|
+
min: split._h_split.normalize(el.getAttribute("data-min")) ?? 0,
|
|
7950
|
+
max: split._h_split.normalize(el.getAttribute("data-max")) ?? Infinity,
|
|
7951
|
+
collapsed: false,
|
|
7952
|
+
prevSize: null,
|
|
7953
|
+
apply() {
|
|
7954
|
+
el.style.flexBasis = `${this.size.toFixed(2)}px`;
|
|
7955
|
+
if (split._h_split.state.isBorder) {
|
|
7956
|
+
this.setHandleOffset();
|
|
7957
|
+
}
|
|
7958
|
+
},
|
|
7959
|
+
setGutter(last) {
|
|
7960
|
+
if (this.hidden || last) {
|
|
7961
|
+
gutter.remove();
|
|
7962
|
+
} else if (!gutter.parentElement) {
|
|
7963
|
+
el.after(gutter);
|
|
7964
|
+
handleSize = this.getHandleSize();
|
|
7965
|
+
}
|
|
7966
|
+
},
|
|
7967
|
+
setHandleOffset() {
|
|
7968
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
7969
|
+
const index = panels.indexOf(panel);
|
|
7970
|
+
const next = panels[index + 1];
|
|
7971
|
+
if (!next) return;
|
|
7972
|
+
if (next.size < handleSize) {
|
|
7973
|
+
gutter.setAttribute("data-edge", "end");
|
|
7974
|
+
} else if (this.size < handleSize) {
|
|
7975
|
+
gutter.setAttribute("data-edge", "start");
|
|
7976
|
+
} else {
|
|
7977
|
+
gutter.removeAttribute("data-edge");
|
|
7978
|
+
}
|
|
7979
|
+
},
|
|
7980
|
+
getHandleSize() {
|
|
7981
|
+
if (split._h_split.state.isBorder) {
|
|
7982
|
+
const beforeStyle = window.getComputedStyle(gutter, "::before");
|
|
7983
|
+
return Number(beforeStyle[split._h_split.state.isHorizontal ? "width" : "height"].replace("px", "")) / 2;
|
|
7984
|
+
} else {
|
|
7985
|
+
return 0;
|
|
7986
|
+
}
|
|
7987
|
+
},
|
|
7988
|
+
setLocked(locked = false) {
|
|
7989
|
+
const panelLocked = el.getAttribute("data-locked") === "true";
|
|
7990
|
+
if (locked) {
|
|
7991
|
+
gutter.classList.add("pointer-events-none");
|
|
7992
|
+
} else if (panelLocked) {
|
|
7993
|
+
gutter.classList.add("pointer-events-none");
|
|
7994
|
+
} else {
|
|
7995
|
+
gutter.classList.remove("pointer-events-none");
|
|
7996
|
+
}
|
|
7997
|
+
}
|
|
7998
|
+
};
|
|
7999
|
+
split._h_split.addPanel(panel);
|
|
8000
|
+
const drag = (e) => {
|
|
8001
|
+
e.preventDefault();
|
|
8002
|
+
gutter.setPointerCapture(e.pointerId);
|
|
8003
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
8004
|
+
const index = panels.indexOf(panel);
|
|
8005
|
+
const next = panels[index + 1];
|
|
8006
|
+
if (!next) return;
|
|
8007
|
+
const startPos = split._h_split.state.isHorizontal ? e.clientX : e.clientY;
|
|
8008
|
+
const startA = panel.size;
|
|
8009
|
+
const startB = next.size;
|
|
8010
|
+
const minDelta = Math.max(
|
|
8011
|
+
panel.min - startA,
|
|
8012
|
+
// how much panel A can shrink
|
|
8013
|
+
startB - next.max
|
|
8014
|
+
// how much panel B can grow
|
|
8015
|
+
);
|
|
8016
|
+
const maxDelta = Math.min(
|
|
8017
|
+
panel.max - startA,
|
|
8018
|
+
// how much panel A can grow
|
|
8019
|
+
startB - next.min
|
|
8020
|
+
// how much panel B can shrink
|
|
8021
|
+
);
|
|
8022
|
+
const move = (e2) => {
|
|
8023
|
+
const currentPos = split._h_split.state.isHorizontal ? e2.clientX : e2.clientY;
|
|
8024
|
+
const delta = currentPos - startPos;
|
|
8025
|
+
const clamped = Math.min(maxDelta, Math.max(minDelta, delta));
|
|
8026
|
+
panel.size = startA + clamped;
|
|
8027
|
+
next.size = startB - clamped;
|
|
8028
|
+
panel.explicit = false;
|
|
8029
|
+
if (panel.collapsed) {
|
|
8030
|
+
panel.collapsed = false;
|
|
8031
|
+
}
|
|
8032
|
+
if (next.collapsed) {
|
|
8033
|
+
next.collapsed = false;
|
|
8034
|
+
}
|
|
8035
|
+
split._h_split.panelChange();
|
|
8036
|
+
};
|
|
8037
|
+
const up = () => {
|
|
8038
|
+
gutter.releasePointerCapture(e.pointerId);
|
|
8039
|
+
gutter.removeEventListener("pointermove", move);
|
|
8040
|
+
gutter.removeEventListener("pointerup", up);
|
|
8041
|
+
};
|
|
8042
|
+
gutter.addEventListener("pointermove", move);
|
|
8043
|
+
gutter.addEventListener("pointerup", up);
|
|
8044
|
+
};
|
|
8045
|
+
gutter.addEventListener("pointerdown", drag);
|
|
8046
|
+
const collapse = () => {
|
|
8047
|
+
if (panel.collapsed) return;
|
|
8048
|
+
panel.prevSize = panel.size;
|
|
8049
|
+
panel.size = panel.min ?? 0;
|
|
8050
|
+
panel.collapsed = true;
|
|
8051
|
+
panel.explicit = true;
|
|
8052
|
+
split._h_split.panelChange();
|
|
8053
|
+
};
|
|
8054
|
+
const expand = () => {
|
|
8055
|
+
if (!panel.collapsed) return;
|
|
8056
|
+
const target = panel.prevSize ?? panel.min ?? 0;
|
|
8057
|
+
const delta = target - panel.size;
|
|
8058
|
+
const visible = split._h_split.panels.filter((p) => !p.hidden && p !== panel);
|
|
8059
|
+
let remaining = delta;
|
|
8060
|
+
for (const p of visible) {
|
|
8061
|
+
const available = p.size - p.min;
|
|
8062
|
+
const take = Math.min(available, remaining);
|
|
8063
|
+
p.size -= take;
|
|
8064
|
+
remaining -= take;
|
|
8065
|
+
if (remaining <= 0) break;
|
|
8066
|
+
}
|
|
8067
|
+
panel.size = target - remaining;
|
|
8068
|
+
panel.collapsed = false;
|
|
8069
|
+
panel.explicit = true;
|
|
8070
|
+
split._h_split.panelChange();
|
|
8071
|
+
};
|
|
8072
|
+
const observer = new MutationObserver((mutations) => {
|
|
8073
|
+
mutations.forEach((mutation) => {
|
|
8074
|
+
if (mutation.attributeName === "data-hidden") {
|
|
8075
|
+
panel.hidden = el.getAttribute("data-hidden") === "true";
|
|
8076
|
+
if (panel.hidden) {
|
|
8077
|
+
el.classList.add("hidden");
|
|
8078
|
+
} else {
|
|
8079
|
+
el.classList.remove("hidden");
|
|
8080
|
+
}
|
|
8081
|
+
split._h_split.panelHidden();
|
|
8082
|
+
} else if (mutation.attributeName === "data-locked") {
|
|
8083
|
+
panel.setLocked();
|
|
8084
|
+
} else {
|
|
8085
|
+
if (el.getAttribute("data-collapse") === "true") {
|
|
8086
|
+
collapse();
|
|
8087
|
+
} else {
|
|
8088
|
+
expand();
|
|
8089
|
+
}
|
|
8090
|
+
}
|
|
8091
|
+
});
|
|
7616
8092
|
});
|
|
7617
|
-
observer.observe(el
|
|
7618
|
-
setVariant(el.parentElement.getAttribute("data-variant"));
|
|
8093
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
|
|
7619
8094
|
cleanup(() => {
|
|
8095
|
+
gutter.remove();
|
|
8096
|
+
gutter.removeEventListener("pointerdown", drag);
|
|
8097
|
+
split._h_split.removePanel(panel);
|
|
7620
8098
|
observer.disconnect();
|
|
7621
8099
|
});
|
|
7622
8100
|
});
|
|
@@ -7678,7 +8156,18 @@
|
|
|
7678
8156
|
function table_default(Alpine) {
|
|
7679
8157
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
7680
8158
|
if (modifiers.includes("scroll")) {
|
|
7681
|
-
el.classList.add(
|
|
8159
|
+
el.classList.add(
|
|
8160
|
+
"overflow-scroll",
|
|
8161
|
+
"[&_thead[data-slot|=table]]:sticky",
|
|
8162
|
+
"[&_thead[data-slot|=table]]:top-0",
|
|
8163
|
+
"[&_thead[data-slot|=table]]:z-2",
|
|
8164
|
+
"[&_tfoot[data-slot|=table]]:sticky",
|
|
8165
|
+
"[&_tfoot[data-slot|=table]]:bottom-0",
|
|
8166
|
+
"[&_tfoot[data-slot|=table]]:z-2",
|
|
8167
|
+
"[&_tbody_tr_th[data-slot|=table]]:sticky",
|
|
8168
|
+
"[&_tbody_tr_th[data-slot|=table]]:left-0",
|
|
8169
|
+
"[&_tbody_tr_th[data-slot|=table]]:z-1"
|
|
8170
|
+
);
|
|
7682
8171
|
} else {
|
|
7683
8172
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
7684
8173
|
}
|
|
@@ -7693,13 +8182,19 @@
|
|
|
7693
8182
|
el.setAttribute("data-slot", "table");
|
|
7694
8183
|
switch (el.getAttribute("data-borders")) {
|
|
7695
8184
|
case "rows":
|
|
7696
|
-
el.classList.add("[&_tr_td]:border-b", "[&_tr_th]:border-b", "first:[&_tfoot_tr_td]:border-t", "first:[&_tfoot_tr_th]:border-t");
|
|
8185
|
+
el.classList.add("[&_tr_td[data-slot|=table]]:border-b", "[&_tr_th[data-slot|=table]]:border-b", "first:[&_tfoot_tr_td[data-slot|=table]]:border-t", "first:[&_tfoot_tr_th[data-slot|=table]]:border-t");
|
|
7697
8186
|
break;
|
|
7698
8187
|
case "columns":
|
|
7699
|
-
el.classList.add("[&_tr]:divide-x");
|
|
8188
|
+
el.classList.add("[&_tr[data-slot|=table]]:divide-x");
|
|
7700
8189
|
break;
|
|
7701
8190
|
case "both":
|
|
7702
|
-
el.classList.add(
|
|
8191
|
+
el.classList.add(
|
|
8192
|
+
"[&_tr_td[data-slot|=table]]:border-b",
|
|
8193
|
+
"[&_tr_th[data-slot|=table]]:border-b",
|
|
8194
|
+
"first:[&_tfoot_tr_td[data-slot|=table]]:border-t",
|
|
8195
|
+
"first:[&_tfoot_tr_th[data-slot|=table]]:border-t",
|
|
8196
|
+
"[&_tr[data-slot|=table]]:divide-x"
|
|
8197
|
+
);
|
|
7703
8198
|
break;
|
|
7704
8199
|
}
|
|
7705
8200
|
});
|
|
@@ -7729,6 +8224,7 @@
|
|
|
7729
8224
|
Alpine.directive("h-table-cell", (el) => {
|
|
7730
8225
|
el.classList.add(
|
|
7731
8226
|
"p-2",
|
|
8227
|
+
"[&:has([data-slot|=cell-input])]:p-0",
|
|
7732
8228
|
"align-middle",
|
|
7733
8229
|
"whitespace-nowrap",
|
|
7734
8230
|
"[&:has([role=checkbox])]:pr-0",
|
|
@@ -7741,15 +8237,47 @@
|
|
|
7741
8237
|
);
|
|
7742
8238
|
el.setAttribute("data-slot", "table-cell");
|
|
7743
8239
|
});
|
|
8240
|
+
Alpine.directive("h-table-cell-button", (el) => {
|
|
8241
|
+
el.classList.add(
|
|
8242
|
+
"px-2",
|
|
8243
|
+
"size-full",
|
|
8244
|
+
"h-10",
|
|
8245
|
+
"cursor-pointer",
|
|
8246
|
+
"inline-flex",
|
|
8247
|
+
"items-center",
|
|
8248
|
+
"justify-between",
|
|
8249
|
+
"outline-none",
|
|
8250
|
+
"gap-2",
|
|
8251
|
+
"transition-[color,box-shadow]",
|
|
8252
|
+
"[&_svg]:pointer-events-none",
|
|
8253
|
+
"[&_svg]:opacity-70",
|
|
8254
|
+
"[&_svg]:text-foreground",
|
|
8255
|
+
"[&_svg]:transition-transform",
|
|
8256
|
+
"[&_svg]:duration-200",
|
|
8257
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
8258
|
+
"shrink-0",
|
|
8259
|
+
"[&_svg]:shrink-0",
|
|
8260
|
+
"focus-visible:inset-ring-ring/50",
|
|
8261
|
+
"focus-visible:inset-ring-2",
|
|
8262
|
+
"hover:bg-table-hover",
|
|
8263
|
+
"hover:text-table-hover-foreground",
|
|
8264
|
+
"active:!bg-table-active",
|
|
8265
|
+
"active:!text-table-active-foreground",
|
|
8266
|
+
"[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180",
|
|
8267
|
+
"[&[data-state=open]>svg:only-child]:rotate-180"
|
|
8268
|
+
);
|
|
8269
|
+
el.setAttribute("type", "button");
|
|
8270
|
+
el.setAttribute("data-slot", "cell-input-button");
|
|
8271
|
+
});
|
|
7744
8272
|
Alpine.directive("h-table-body", (el) => {
|
|
7745
8273
|
el.classList.add(
|
|
7746
|
-
"[&_tr:last-child_td]:border-b-0",
|
|
7747
|
-
"[&_tr:last-child_th]:border-b-0",
|
|
7748
|
-
"[&_tr_th]:bg-table-header",
|
|
7749
|
-
"[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
|
|
7750
|
-
"[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
|
|
7751
|
-
"[&_tr[data-activable=true]:active_th]:!bg-table-active",
|
|
7752
|
-
"[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
|
|
8274
|
+
"[&_tr:last-child_td[data-slot|=table]]:border-b-0",
|
|
8275
|
+
"[&_tr:last-child_th[data-slot|=table]]:border-b-0",
|
|
8276
|
+
"[&_tr_th[data-slot|=table]]:bg-table-header",
|
|
8277
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:bg-table-hover",
|
|
8278
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:text-table-hover-foreground",
|
|
8279
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!bg-table-active",
|
|
8280
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!text-table-active-foreground"
|
|
7753
8281
|
);
|
|
7754
8282
|
el.setAttribute("data-slot", "table-body");
|
|
7755
8283
|
});
|
|
@@ -7769,7 +8297,7 @@
|
|
|
7769
8297
|
el.setAttribute("data-slot", "table-caption");
|
|
7770
8298
|
});
|
|
7771
8299
|
Alpine.directive("h-table-footer", (el) => {
|
|
7772
|
-
el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td]:border-b-0", "last:[&>tr_th]:border-b-0");
|
|
8300
|
+
el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td[data-slot|=table]]:border-b-0", "last:[&>tr_th[data-slot|=table]]:border-b-0");
|
|
7773
8301
|
el.setAttribute("data-slot", "table-footer");
|
|
7774
8302
|
});
|
|
7775
8303
|
}
|
|
@@ -8174,7 +8702,7 @@
|
|
|
8174
8702
|
});
|
|
8175
8703
|
}
|
|
8176
8704
|
function timepicker_default(Alpine) {
|
|
8177
|
-
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8705
|
+
Alpine.directive("h-time-picker", (el, { expression, modifiers }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8178
8706
|
el._h_timepicker = Alpine2.reactive({
|
|
8179
8707
|
id: void 0,
|
|
8180
8708
|
controls: `htpc${v4_default()}`,
|
|
@@ -8204,39 +8732,55 @@
|
|
|
8204
8732
|
el.classList.add(
|
|
8205
8733
|
"cursor-pointer",
|
|
8206
8734
|
"border-input",
|
|
8207
|
-
"[&>input]:appearance-none",
|
|
8208
|
-
"has-[input:focus-visible]:border-ring",
|
|
8209
|
-
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8210
|
-
"has-[input:focus-visible]:ring-ring/50",
|
|
8211
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8212
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
8213
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8214
|
-
"has-[input:invalid]:ring-negative/20",
|
|
8215
|
-
"has-[input:invalid]:border-negative",
|
|
8216
|
-
"dark:has-[input:invalid]:ring-negative/40",
|
|
8217
8735
|
"hover:bg-secondary-hover",
|
|
8218
8736
|
"active:bg-secondary-active",
|
|
8219
8737
|
"flex",
|
|
8220
|
-
"w-full",
|
|
8221
8738
|
"items-center",
|
|
8222
8739
|
"justify-between",
|
|
8223
8740
|
"gap-2",
|
|
8224
|
-
"rounded-control",
|
|
8225
|
-
"border",
|
|
8226
|
-
"bg-input-inner",
|
|
8227
8741
|
"pl-3",
|
|
8228
8742
|
"pr-2",
|
|
8229
8743
|
"data-[size=sm]:pr-1",
|
|
8230
8744
|
"text-sm",
|
|
8231
8745
|
"whitespace-nowrap",
|
|
8232
|
-
"shadow-input",
|
|
8233
8746
|
"transition-[color,box-shadow]",
|
|
8234
8747
|
"duration-200",
|
|
8235
8748
|
"outline-none",
|
|
8236
8749
|
"has-[input:disabled]:pointer-events-none",
|
|
8750
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
8237
8751
|
"has-[input:disabled]:opacity-50"
|
|
8238
8752
|
);
|
|
8239
|
-
|
|
8753
|
+
if (modifiers.includes("table")) {
|
|
8754
|
+
el.classList.add(
|
|
8755
|
+
"size-full",
|
|
8756
|
+
"h-10",
|
|
8757
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
8758
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
8759
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
8760
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
8761
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
8762
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
8763
|
+
);
|
|
8764
|
+
el.setAttribute("data-slot", "cell-input-time");
|
|
8765
|
+
} else {
|
|
8766
|
+
el.classList.add(
|
|
8767
|
+
"w-full",
|
|
8768
|
+
"rounded-control",
|
|
8769
|
+
"border",
|
|
8770
|
+
"bg-input-inner",
|
|
8771
|
+
"shadow-input",
|
|
8772
|
+
"has-[input:focus-visible]:border-ring",
|
|
8773
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8774
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
8775
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8776
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
8777
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8778
|
+
"has-[input:invalid]:ring-negative/20",
|
|
8779
|
+
"has-[input:invalid]:border-negative",
|
|
8780
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
8781
|
+
);
|
|
8782
|
+
el.setAttribute("data-slot", "time-picker");
|
|
8783
|
+
}
|
|
8240
8784
|
el.setAttribute("tabindex", "-1");
|
|
8241
8785
|
el.appendChild(
|
|
8242
8786
|
createSvg({
|
|
@@ -8322,7 +8866,20 @@
|
|
|
8322
8866
|
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
8323
8867
|
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
8324
8868
|
}
|
|
8325
|
-
el.classList.add(
|
|
8869
|
+
el.classList.add(
|
|
8870
|
+
"appearance-none",
|
|
8871
|
+
"cursor-pointer",
|
|
8872
|
+
"bg-transparent",
|
|
8873
|
+
"text-transparent",
|
|
8874
|
+
"text-shadow-[0_0_0_var(--foreground)]",
|
|
8875
|
+
"placeholder:text-muted-foreground",
|
|
8876
|
+
"outline-none",
|
|
8877
|
+
"size-full",
|
|
8878
|
+
"border-0",
|
|
8879
|
+
"md:text-sm",
|
|
8880
|
+
"text-base",
|
|
8881
|
+
"truncate"
|
|
8882
|
+
);
|
|
8326
8883
|
el.setAttribute("aria-autocomplete", "none");
|
|
8327
8884
|
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
8328
8885
|
el.setAttribute("aria-expanded", "false");
|
|
@@ -8870,8 +9427,8 @@
|
|
|
8870
9427
|
"shrink-0",
|
|
8871
9428
|
"items-center",
|
|
8872
9429
|
"px-1",
|
|
8873
|
-
'has-[>[data-slot="avatar"]:last-
|
|
8874
|
-
'has-[>[data-slot="toolbar-image"]:first-
|
|
9430
|
+
'has-[>[data-slot="avatar"]:last-of-type]:pr-2',
|
|
9431
|
+
'has-[>[data-slot="toolbar-image"]:first-of-type]:pl-2',
|
|
8875
9432
|
"gap-1",
|
|
8876
9433
|
modifiers.includes("footer") ? "border-t" : "border-b",
|
|
8877
9434
|
"w-full",
|
|
@@ -9312,6 +9869,7 @@
|
|
|
9312
9869
|
Alpine2.initTree(clone);
|
|
9313
9870
|
});
|
|
9314
9871
|
cleanup(() => {
|
|
9872
|
+
Alpine2.destroyTree(clone);
|
|
9315
9873
|
clone.remove();
|
|
9316
9874
|
});
|
|
9317
9875
|
} else {
|
|
@@ -9333,7 +9891,7 @@
|
|
|
9333
9891
|
}
|
|
9334
9892
|
|
|
9335
9893
|
// package.json
|
|
9336
|
-
var version = "1.
|
|
9894
|
+
var version = "1.2.0";
|
|
9337
9895
|
|
|
9338
9896
|
// src/index.js
|
|
9339
9897
|
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };
|