@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.esm.js
CHANGED
|
@@ -1971,6 +1971,8 @@ var ChevronsRight = 6;
|
|
|
1971
1971
|
var Clock = 7;
|
|
1972
1972
|
var Search = 8;
|
|
1973
1973
|
var Ellipsis = 9;
|
|
1974
|
+
var Minus = 10;
|
|
1975
|
+
var Plus = 11;
|
|
1974
1976
|
function setCalendarContent(svg) {
|
|
1975
1977
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1976
1978
|
path.setAttributeNS(
|
|
@@ -2083,6 +2085,20 @@ function setEllipsisContent(svg) {
|
|
|
2083
2085
|
circle3.setAttributeNS(null, "r", "1.5");
|
|
2084
2086
|
svg.appendChild(circle3);
|
|
2085
2087
|
}
|
|
2088
|
+
function setMinusContent(svg) {
|
|
2089
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2090
|
+
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");
|
|
2091
|
+
svg.appendChild(path);
|
|
2092
|
+
}
|
|
2093
|
+
function setPlusContent(svg) {
|
|
2094
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2095
|
+
path.setAttributeNS(
|
|
2096
|
+
null,
|
|
2097
|
+
"d",
|
|
2098
|
+
"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"
|
|
2099
|
+
);
|
|
2100
|
+
svg.appendChild(path);
|
|
2101
|
+
}
|
|
2086
2102
|
function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
2087
2103
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2088
2104
|
svg.setAttributeNS(null, "width", "16");
|
|
@@ -2126,9 +2142,64 @@ function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
|
2126
2142
|
case Ellipsis:
|
|
2127
2143
|
setEllipsisContent(svg);
|
|
2128
2144
|
break;
|
|
2145
|
+
case Minus:
|
|
2146
|
+
setMinusContent(svg);
|
|
2147
|
+
break;
|
|
2148
|
+
case Plus:
|
|
2149
|
+
setPlusContent(svg);
|
|
2150
|
+
break;
|
|
2151
|
+
default:
|
|
2152
|
+
break;
|
|
2129
2153
|
}
|
|
2130
2154
|
return svg;
|
|
2131
2155
|
}
|
|
2156
|
+
function setSvgContent(svg, icon) {
|
|
2157
|
+
svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2158
|
+
svg.setAttribute("width", "16");
|
|
2159
|
+
svg.setAttribute("height", "16");
|
|
2160
|
+
svg.setAttribute("viewBox", "0 0 16 16");
|
|
2161
|
+
svg.setAttribute("fill", "currentColor");
|
|
2162
|
+
switch (icon) {
|
|
2163
|
+
case "calendar":
|
|
2164
|
+
setCalendarContent(svg);
|
|
2165
|
+
break;
|
|
2166
|
+
case "check":
|
|
2167
|
+
setCheckContent(svg);
|
|
2168
|
+
break;
|
|
2169
|
+
case "chevron-down":
|
|
2170
|
+
setChevronDownContent(svg);
|
|
2171
|
+
break;
|
|
2172
|
+
case "chevron-left":
|
|
2173
|
+
setChevronLeftContent(svg);
|
|
2174
|
+
break;
|
|
2175
|
+
case "chevron-right":
|
|
2176
|
+
setChevronRightContent(svg);
|
|
2177
|
+
break;
|
|
2178
|
+
case "chevrons-left":
|
|
2179
|
+
setChevronsLeftContent(svg);
|
|
2180
|
+
break;
|
|
2181
|
+
case "chevrons-right":
|
|
2182
|
+
setChevronsRightContent(svg);
|
|
2183
|
+
break;
|
|
2184
|
+
case "clock":
|
|
2185
|
+
setClockContent(svg);
|
|
2186
|
+
break;
|
|
2187
|
+
case "search":
|
|
2188
|
+
setSearchContent(svg);
|
|
2189
|
+
break;
|
|
2190
|
+
case "ellipsis":
|
|
2191
|
+
setEllipsisContent(svg);
|
|
2192
|
+
break;
|
|
2193
|
+
case "minus":
|
|
2194
|
+
setMinusContent(svg);
|
|
2195
|
+
break;
|
|
2196
|
+
case "plus":
|
|
2197
|
+
setPlusContent(svg);
|
|
2198
|
+
break;
|
|
2199
|
+
default:
|
|
2200
|
+
break;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2132
2203
|
|
|
2133
2204
|
// src/components/accordion.js
|
|
2134
2205
|
function accordion_default(Alpine) {
|
|
@@ -2365,7 +2436,7 @@ function avatar_default(Alpine) {
|
|
|
2365
2436
|
Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
|
|
2366
2437
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
2367
2438
|
if (!avatar) {
|
|
2368
|
-
throw new Error(`${original} must be inside an
|
|
2439
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
2369
2440
|
}
|
|
2370
2441
|
el.classList.add("aspect-square", "size-full");
|
|
2371
2442
|
el.setAttribute("data-slot", "avatar-image");
|
|
@@ -2399,7 +2470,7 @@ function avatar_default(Alpine) {
|
|
|
2399
2470
|
Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
|
|
2400
2471
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
2401
2472
|
if (!avatar) {
|
|
2402
|
-
throw new Error(`${original} must be inside an
|
|
2473
|
+
throw new Error(`${original} must be inside an avatar element`);
|
|
2403
2474
|
}
|
|
2404
2475
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
2405
2476
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
@@ -2876,6 +2947,62 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
|
2876
2947
|
}
|
|
2877
2948
|
return coords;
|
|
2878
2949
|
}
|
|
2950
|
+
async function detectOverflow(state, options) {
|
|
2951
|
+
var _await$platform$isEle;
|
|
2952
|
+
if (options === void 0) {
|
|
2953
|
+
options = {};
|
|
2954
|
+
}
|
|
2955
|
+
const {
|
|
2956
|
+
x,
|
|
2957
|
+
y,
|
|
2958
|
+
platform: platform2,
|
|
2959
|
+
rects,
|
|
2960
|
+
elements,
|
|
2961
|
+
strategy
|
|
2962
|
+
} = state;
|
|
2963
|
+
const {
|
|
2964
|
+
boundary = "clippingAncestors",
|
|
2965
|
+
rootBoundary = "viewport",
|
|
2966
|
+
elementContext = "floating",
|
|
2967
|
+
altBoundary = false,
|
|
2968
|
+
padding = 0
|
|
2969
|
+
} = evaluate(options, state);
|
|
2970
|
+
const paddingObject = getPaddingObject(padding);
|
|
2971
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2972
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
2973
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2974
|
+
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)),
|
|
2975
|
+
boundary,
|
|
2976
|
+
rootBoundary,
|
|
2977
|
+
strategy
|
|
2978
|
+
}));
|
|
2979
|
+
const rect = elementContext === "floating" ? {
|
|
2980
|
+
x,
|
|
2981
|
+
y,
|
|
2982
|
+
width: rects.floating.width,
|
|
2983
|
+
height: rects.floating.height
|
|
2984
|
+
} : rects.reference;
|
|
2985
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2986
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2987
|
+
x: 1,
|
|
2988
|
+
y: 1
|
|
2989
|
+
} : {
|
|
2990
|
+
x: 1,
|
|
2991
|
+
y: 1
|
|
2992
|
+
};
|
|
2993
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
2994
|
+
elements,
|
|
2995
|
+
rect,
|
|
2996
|
+
offsetParent,
|
|
2997
|
+
strategy
|
|
2998
|
+
}) : rect);
|
|
2999
|
+
return {
|
|
3000
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
3001
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
3002
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
3003
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
3004
|
+
};
|
|
3005
|
+
}
|
|
2879
3006
|
var computePosition = async (reference, floating, config) => {
|
|
2880
3007
|
const {
|
|
2881
3008
|
placement = "bottom",
|
|
@@ -2898,6 +3025,7 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2898
3025
|
let middlewareData = {};
|
|
2899
3026
|
let resetCount = 0;
|
|
2900
3027
|
for (let i = 0; i < validMiddleware.length; i++) {
|
|
3028
|
+
var _platform$detectOverf;
|
|
2901
3029
|
const {
|
|
2902
3030
|
name,
|
|
2903
3031
|
fn
|
|
@@ -2915,7 +3043,10 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2915
3043
|
strategy,
|
|
2916
3044
|
middlewareData,
|
|
2917
3045
|
rects,
|
|
2918
|
-
platform:
|
|
3046
|
+
platform: {
|
|
3047
|
+
...platform2,
|
|
3048
|
+
detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
3049
|
+
},
|
|
2919
3050
|
elements: {
|
|
2920
3051
|
reference,
|
|
2921
3052
|
floating
|
|
@@ -2959,62 +3090,6 @@ var computePosition = async (reference, floating, config) => {
|
|
|
2959
3090
|
middlewareData
|
|
2960
3091
|
};
|
|
2961
3092
|
};
|
|
2962
|
-
async function detectOverflow(state, options) {
|
|
2963
|
-
var _await$platform$isEle;
|
|
2964
|
-
if (options === void 0) {
|
|
2965
|
-
options = {};
|
|
2966
|
-
}
|
|
2967
|
-
const {
|
|
2968
|
-
x,
|
|
2969
|
-
y,
|
|
2970
|
-
platform: platform2,
|
|
2971
|
-
rects,
|
|
2972
|
-
elements,
|
|
2973
|
-
strategy
|
|
2974
|
-
} = state;
|
|
2975
|
-
const {
|
|
2976
|
-
boundary = "clippingAncestors",
|
|
2977
|
-
rootBoundary = "viewport",
|
|
2978
|
-
elementContext = "floating",
|
|
2979
|
-
altBoundary = false,
|
|
2980
|
-
padding = 0
|
|
2981
|
-
} = evaluate(options, state);
|
|
2982
|
-
const paddingObject = getPaddingObject(padding);
|
|
2983
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
2984
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
2985
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
2986
|
-
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)),
|
|
2987
|
-
boundary,
|
|
2988
|
-
rootBoundary,
|
|
2989
|
-
strategy
|
|
2990
|
-
}));
|
|
2991
|
-
const rect = elementContext === "floating" ? {
|
|
2992
|
-
x,
|
|
2993
|
-
y,
|
|
2994
|
-
width: rects.floating.width,
|
|
2995
|
-
height: rects.floating.height
|
|
2996
|
-
} : rects.reference;
|
|
2997
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
2998
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
2999
|
-
x: 1,
|
|
3000
|
-
y: 1
|
|
3001
|
-
} : {
|
|
3002
|
-
x: 1,
|
|
3003
|
-
y: 1
|
|
3004
|
-
};
|
|
3005
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
3006
|
-
elements,
|
|
3007
|
-
rect,
|
|
3008
|
-
offsetParent,
|
|
3009
|
-
strategy
|
|
3010
|
-
}) : rect);
|
|
3011
|
-
return {
|
|
3012
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
3013
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
3014
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
3015
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
3016
|
-
};
|
|
3017
|
-
}
|
|
3018
3093
|
var arrow = (options) => ({
|
|
3019
3094
|
name: "arrow",
|
|
3020
3095
|
options,
|
|
@@ -3116,7 +3191,7 @@ var flip = function(options) {
|
|
|
3116
3191
|
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
3117
3192
|
}
|
|
3118
3193
|
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
3119
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3194
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3120
3195
|
const overflows = [];
|
|
3121
3196
|
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
3122
3197
|
if (checkMainAxis) {
|
|
@@ -3265,7 +3340,8 @@ var shift = function(options) {
|
|
|
3265
3340
|
const {
|
|
3266
3341
|
x,
|
|
3267
3342
|
y,
|
|
3268
|
-
placement
|
|
3343
|
+
placement,
|
|
3344
|
+
platform: platform2
|
|
3269
3345
|
} = state;
|
|
3270
3346
|
const {
|
|
3271
3347
|
mainAxis: checkMainAxis = true,
|
|
@@ -3288,7 +3364,7 @@ var shift = function(options) {
|
|
|
3288
3364
|
x,
|
|
3289
3365
|
y
|
|
3290
3366
|
};
|
|
3291
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3367
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3292
3368
|
const crossAxis = getSideAxis(getSide(placement));
|
|
3293
3369
|
const mainAxis = getOppositeAxis(crossAxis);
|
|
3294
3370
|
let mainAxisCoord = coords[mainAxis];
|
|
@@ -3346,7 +3422,7 @@ var size = function(options) {
|
|
|
3346
3422
|
},
|
|
3347
3423
|
...detectOverflowOptions
|
|
3348
3424
|
} = evaluate(options, state);
|
|
3349
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
3425
|
+
const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
|
|
3350
3426
|
const side = getSide(placement);
|
|
3351
3427
|
const alignment = getAlignment(placement);
|
|
3352
3428
|
const isYAxis = getSideAxis(placement) === "y";
|
|
@@ -4178,7 +4254,7 @@ function calendar_default(Alpine) {
|
|
|
4178
4254
|
el.setAttribute("role", "dialog");
|
|
4179
4255
|
el.setAttribute("aria-modal", "true");
|
|
4180
4256
|
el.setAttribute("data-slot", "date-picker-calendar");
|
|
4181
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4257
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
4182
4258
|
} else {
|
|
4183
4259
|
el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
|
|
4184
4260
|
}
|
|
@@ -4244,7 +4320,7 @@ function calendar_default(Alpine) {
|
|
|
4244
4320
|
selected = new Date(focusedDay);
|
|
4245
4321
|
modelChange(true);
|
|
4246
4322
|
render();
|
|
4247
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
4323
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
4248
4324
|
}
|
|
4249
4325
|
function isDisabled(d) {
|
|
4250
4326
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
@@ -4554,7 +4630,7 @@ function calendar_default(Alpine) {
|
|
|
4554
4630
|
break;
|
|
4555
4631
|
case "Escape":
|
|
4556
4632
|
event.preventDefault();
|
|
4557
|
-
if (datepicker) datepicker._h_datepicker.expanded = false;
|
|
4633
|
+
if (datepicker) datepicker._h_datepicker.state.expanded = false;
|
|
4558
4634
|
return;
|
|
4559
4635
|
case "Enter":
|
|
4560
4636
|
case " ":
|
|
@@ -4618,8 +4694,8 @@ function calendar_default(Alpine) {
|
|
|
4618
4694
|
}
|
|
4619
4695
|
if (datepicker) {
|
|
4620
4696
|
effect(() => {
|
|
4621
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4622
|
-
if (datepicker._h_datepicker.expanded) {
|
|
4697
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
4698
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
4623
4699
|
autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
|
|
4624
4700
|
Alpine2.nextTick(() => {
|
|
4625
4701
|
focusDay();
|
|
@@ -4795,13 +4871,17 @@ function sizeObserver(el) {
|
|
|
4795
4871
|
|
|
4796
4872
|
// src/components/datepicker.js
|
|
4797
4873
|
function datepicker_default(Alpine) {
|
|
4798
|
-
Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2, cleanup }) => {
|
|
4799
|
-
|
|
4874
|
+
Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
4875
|
+
const state = Alpine2.reactive({
|
|
4876
|
+
expanded: false
|
|
4877
|
+
});
|
|
4878
|
+
el._h_datepicker = {
|
|
4800
4879
|
id: void 0,
|
|
4801
4880
|
controls: `hdpc${v4_default()}`,
|
|
4802
4881
|
input: void 0,
|
|
4803
|
-
|
|
4804
|
-
|
|
4882
|
+
state,
|
|
4883
|
+
inTable: modifiers.includes("table")
|
|
4884
|
+
};
|
|
4805
4885
|
el._h_datepicker.input = el.querySelector("input");
|
|
4806
4886
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
4807
4887
|
throw new Error(`${original} must contain an input`);
|
|
@@ -4813,30 +4893,50 @@ function datepicker_default(Alpine) {
|
|
|
4813
4893
|
el._h_datepicker.id = id;
|
|
4814
4894
|
}
|
|
4815
4895
|
el.classList.add(
|
|
4896
|
+
"overflow-hidden",
|
|
4816
4897
|
"border-input",
|
|
4817
|
-
"bg-input-inner",
|
|
4818
4898
|
"flex",
|
|
4819
|
-
"w-full",
|
|
4820
4899
|
"items-center",
|
|
4821
|
-
"rounded-control",
|
|
4822
|
-
"border",
|
|
4823
|
-
"shadow-input",
|
|
4824
4900
|
"transition-[color,box-shadow]",
|
|
4825
4901
|
"duration-200",
|
|
4826
4902
|
"outline-none",
|
|
4827
4903
|
"pl-3",
|
|
4828
4904
|
"min-w-0",
|
|
4829
|
-
"has-[input:
|
|
4830
|
-
"has-[input:
|
|
4831
|
-
"has-[input:
|
|
4832
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
4833
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
4834
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
4835
|
-
"has-[input:invalid]:ring-negative/20",
|
|
4836
|
-
"has-[input:invalid]:border-negative",
|
|
4837
|
-
"dark:has-[input:invalid]:ring-negative/40"
|
|
4905
|
+
"has-[input:disabled]:pointer-events-none",
|
|
4906
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
4907
|
+
"has-[input:disabled]:opacity-50"
|
|
4838
4908
|
);
|
|
4839
|
-
el.
|
|
4909
|
+
if (el._h_datepicker.inTable) {
|
|
4910
|
+
el.classList.add(
|
|
4911
|
+
"size-full",
|
|
4912
|
+
"h-10",
|
|
4913
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
4914
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
4915
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
4916
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
4917
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
4918
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
4919
|
+
);
|
|
4920
|
+
el.setAttribute("data-slot", "cell-input-date");
|
|
4921
|
+
} else {
|
|
4922
|
+
el.classList.add(
|
|
4923
|
+
"w-full",
|
|
4924
|
+
"rounded-control",
|
|
4925
|
+
"border",
|
|
4926
|
+
"bg-input-inner",
|
|
4927
|
+
"shadow-input",
|
|
4928
|
+
"has-[input:focus-visible]:border-ring",
|
|
4929
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
4930
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
4931
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
4932
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
4933
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
4934
|
+
"has-[input:invalid]:ring-negative/20",
|
|
4935
|
+
"has-[input:invalid]:border-negative",
|
|
4936
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
4937
|
+
);
|
|
4938
|
+
el.setAttribute("data-slot", "date-picker");
|
|
4939
|
+
}
|
|
4840
4940
|
el._h_datepicker.input.classList.add(
|
|
4841
4941
|
"bg-transparent",
|
|
4842
4942
|
"outline-none",
|
|
@@ -4872,28 +4972,29 @@ function datepicker_default(Alpine) {
|
|
|
4872
4972
|
if (!datepicker) {
|
|
4873
4973
|
throw new Error(`${original} must be inside an date-picker element`);
|
|
4874
4974
|
}
|
|
4875
|
-
el.classList.add(
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4975
|
+
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");
|
|
4976
|
+
if (datepicker._h_datepicker.inTable) {
|
|
4977
|
+
el.classList.add(
|
|
4978
|
+
"focus-visible:inset-ring-ring/50",
|
|
4979
|
+
"focus-visible:inset-ring-2",
|
|
4980
|
+
"[input[aria-invalid=true]~&]:inset-ring-negative/20",
|
|
4981
|
+
"dark:[input[aria-invalid=true]~&]:inset-ring-negative/40",
|
|
4982
|
+
"[input:invalid~&]:!inset-ring-negative/20",
|
|
4983
|
+
"dark:[input:invalid~&]:!inset-ring-negative/40"
|
|
4984
|
+
);
|
|
4985
|
+
} else {
|
|
4986
|
+
el.classList.add(
|
|
4987
|
+
"focus-visible:border-ring",
|
|
4988
|
+
"focus-visible:ring-ring/50",
|
|
4989
|
+
"focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
4990
|
+
"[input[aria-invalid=true]~&]:ring-negative/20",
|
|
4991
|
+
"[input[aria-invalid=true]~&]:border-negative",
|
|
4992
|
+
"dark:[input[aria-invalid=true]~&]:ring-negative/40",
|
|
4993
|
+
"[input:invalid~&]:ring-negative/20",
|
|
4994
|
+
"[input:invalid~&]:border-negative",
|
|
4995
|
+
"dark:[input:invalid~&]:ring-negative/40"
|
|
4996
|
+
);
|
|
4997
|
+
}
|
|
4897
4998
|
el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
|
|
4898
4999
|
el.setAttribute("aria-expanded", "false");
|
|
4899
5000
|
el.setAttribute("aria-haspopup", "dialog");
|
|
@@ -4910,17 +5011,16 @@ function datepicker_default(Alpine) {
|
|
|
4910
5011
|
})
|
|
4911
5012
|
);
|
|
4912
5013
|
effect(() => {
|
|
4913
|
-
el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
|
|
4914
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
5014
|
+
el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
|
|
5015
|
+
el.setAttribute("aria-expanded", datepicker._h_datepicker.state.expanded);
|
|
4915
5016
|
});
|
|
4916
5017
|
const close = () => {
|
|
4917
|
-
datepicker._h_datepicker.expanded = false;
|
|
5018
|
+
datepicker._h_datepicker.state.expanded = false;
|
|
4918
5019
|
};
|
|
4919
5020
|
const handler = () => {
|
|
4920
|
-
datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
|
|
4921
|
-
el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
|
|
5021
|
+
datepicker._h_datepicker.state.expanded = !datepicker._h_datepicker.state.expanded;
|
|
4922
5022
|
Alpine2.nextTick(() => {
|
|
4923
|
-
if (datepicker._h_datepicker.expanded) {
|
|
5023
|
+
if (datepicker._h_datepicker.state.expanded) {
|
|
4924
5024
|
top.addEventListener("click", close, { once: true });
|
|
4925
5025
|
} else {
|
|
4926
5026
|
top.removeEventListener("click", close);
|
|
@@ -5007,7 +5107,7 @@ function dialog_default(Alpine) {
|
|
|
5007
5107
|
el.setAttribute("data-slot", "dialog-header");
|
|
5008
5108
|
});
|
|
5009
5109
|
Alpine.directive("h-dialog-title", (el, _, { Alpine: Alpine2 }) => {
|
|
5010
|
-
el.classList.add("text-lg", "leading-none", "font-semibold");
|
|
5110
|
+
el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
|
|
5011
5111
|
el.setAttribute("data-slot", "dialog-title");
|
|
5012
5112
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5013
5113
|
if (dialog && (!dialog.hasAttribute("aria-labelledby") || !dialog.hasAttribute("aria-label"))) {
|
|
@@ -5020,6 +5120,7 @@ function dialog_default(Alpine) {
|
|
|
5020
5120
|
});
|
|
5021
5121
|
Alpine.directive("h-dialog-close", (el) => {
|
|
5022
5122
|
el.classList.add(
|
|
5123
|
+
"order-2",
|
|
5023
5124
|
"ring-offset-background",
|
|
5024
5125
|
"focus:ring-ring",
|
|
5025
5126
|
"rounded-xs",
|
|
@@ -5035,9 +5136,10 @@ function dialog_default(Alpine) {
|
|
|
5035
5136
|
"[&_svg:not([class*='size-'])]:size-4"
|
|
5036
5137
|
);
|
|
5037
5138
|
el.setAttribute("data-slot", "dialog-close");
|
|
5139
|
+
el.setAttribute("type", "button");
|
|
5038
5140
|
});
|
|
5039
5141
|
Alpine.directive("h-dialog-description", (el, _, { Alpine: Alpine2 }) => {
|
|
5040
|
-
el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
|
|
5142
|
+
el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
|
|
5041
5143
|
el.setAttribute("data-slot", "dialog-description");
|
|
5042
5144
|
const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
|
|
5043
5145
|
if (dialog && (!dialog.hasAttribute("aria-describedby") || !dialog.hasAttribute("aria-description"))) {
|
|
@@ -5148,7 +5250,7 @@ function fieldset_default(Alpine) {
|
|
|
5148
5250
|
|
|
5149
5251
|
// src/components/icon.js
|
|
5150
5252
|
function icon_default(Alpine) {
|
|
5151
|
-
Alpine.directive("h-icon", (el, { original }) => {
|
|
5253
|
+
Alpine.directive("h-icon", (el, { original, modifiers }) => {
|
|
5152
5254
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
5153
5255
|
throw new Error(`${original} works only on svg elements`);
|
|
5154
5256
|
} else if (!el.hasAttribute("role")) {
|
|
@@ -5172,6 +5274,8 @@ function icon_default(Alpine) {
|
|
|
5172
5274
|
}).catch((response) => {
|
|
5173
5275
|
console.error(response);
|
|
5174
5276
|
});
|
|
5277
|
+
} else if (modifiers[0]) {
|
|
5278
|
+
setSvgContent(el, modifiers[0]);
|
|
5175
5279
|
}
|
|
5176
5280
|
});
|
|
5177
5281
|
}
|
|
@@ -5248,6 +5352,18 @@ function input_default(Alpine) {
|
|
|
5248
5352
|
if (modifiers.includes("group")) {
|
|
5249
5353
|
el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
|
|
5250
5354
|
el.setAttribute("data-slot", "input-group-control");
|
|
5355
|
+
} else if (modifiers.includes("table")) {
|
|
5356
|
+
el.classList.add(
|
|
5357
|
+
"size-full",
|
|
5358
|
+
"h-10",
|
|
5359
|
+
"focus-visible:inset-ring-ring/50",
|
|
5360
|
+
"focus-visible:inset-ring-2",
|
|
5361
|
+
"aria-invalid:inset-ring-negative/20",
|
|
5362
|
+
"dark:aria-invalid:inset-ring-negative/40",
|
|
5363
|
+
"invalid:!inset-ring-negative/20",
|
|
5364
|
+
"dark:invalid:!inset-ring-negative/40"
|
|
5365
|
+
);
|
|
5366
|
+
el.setAttribute("data-slot", "cell-input");
|
|
5251
5367
|
} else {
|
|
5252
5368
|
el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
|
|
5253
5369
|
el.setAttribute("data-slot", "input");
|
|
@@ -5359,6 +5475,7 @@ function input_default(Alpine) {
|
|
|
5359
5475
|
});
|
|
5360
5476
|
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
5361
5477
|
el.classList.add(
|
|
5478
|
+
"overflow-hidden",
|
|
5362
5479
|
"group/input-number",
|
|
5363
5480
|
"border-input",
|
|
5364
5481
|
"bg-input-inner",
|
|
@@ -5372,12 +5489,18 @@ function input_default(Alpine) {
|
|
|
5372
5489
|
"transition-[color,box-shadow]",
|
|
5373
5490
|
"outline-none",
|
|
5374
5491
|
"min-w-0",
|
|
5375
|
-
"has-[
|
|
5376
|
-
"has-[
|
|
5377
|
-
"has-[
|
|
5378
|
-
"has-[[
|
|
5379
|
-
"has-[[
|
|
5380
|
-
"dark:has-[[
|
|
5492
|
+
"has-[input:focus-visible]:border-ring",
|
|
5493
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
5494
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
5495
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
5496
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
5497
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
5498
|
+
"has-[input:invalid]:ring-negative/20",
|
|
5499
|
+
"has-[input:invalid]:border-negative",
|
|
5500
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
5501
|
+
"has-[input:disabled]:pointer-events-none",
|
|
5502
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
5503
|
+
"has-[input:disabled]:opacity-50"
|
|
5381
5504
|
);
|
|
5382
5505
|
el.setAttribute("role", "group");
|
|
5383
5506
|
el.setAttribute("data-slot", "input-number");
|
|
@@ -5398,14 +5521,27 @@ function input_default(Alpine) {
|
|
|
5398
5521
|
input.setAttribute("autocorrect", "off");
|
|
5399
5522
|
input.setAttribute("spellcheck", "off");
|
|
5400
5523
|
input.setAttribute("data-slot", "input-number-control");
|
|
5401
|
-
input.classList.add("
|
|
5524
|
+
input.classList.add("size-full", "px-3", "py-1", "outline-none");
|
|
5402
5525
|
const stepDown = document.createElement("button");
|
|
5403
5526
|
stepDown.setAttribute("type", "button");
|
|
5404
5527
|
stepDown.setAttribute("tabIndex", "-1");
|
|
5405
5528
|
stepDown.setAttribute("aria-label", "Decrease");
|
|
5406
5529
|
stepDown.setAttribute("aria-controls", input.getAttribute("id"));
|
|
5407
5530
|
stepDown.setAttribute("data-slot", "step-up-trigger");
|
|
5531
|
+
stepDown.appendChild(
|
|
5532
|
+
createSvg({
|
|
5533
|
+
icon: Minus,
|
|
5534
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
5535
|
+
attrs: {
|
|
5536
|
+
"aria-hidden": true,
|
|
5537
|
+
role: "presentation"
|
|
5538
|
+
}
|
|
5539
|
+
})
|
|
5540
|
+
);
|
|
5408
5541
|
stepDown.classList.add(
|
|
5542
|
+
"inline-flex",
|
|
5543
|
+
"items-center",
|
|
5544
|
+
"justify-center",
|
|
5409
5545
|
"cursor-pointer",
|
|
5410
5546
|
"border-l",
|
|
5411
5547
|
"border-input",
|
|
@@ -5418,15 +5554,7 @@ function input_default(Alpine) {
|
|
|
5418
5554
|
"active:bg-secondary-active",
|
|
5419
5555
|
"outline-none",
|
|
5420
5556
|
"relative",
|
|
5421
|
-
"
|
|
5422
|
-
"before:opacity-70",
|
|
5423
|
-
"before:rounded-full",
|
|
5424
|
-
"before:h-0.5",
|
|
5425
|
-
"before:min-h-px",
|
|
5426
|
-
"before:w-3",
|
|
5427
|
-
"before:mx-auto",
|
|
5428
|
-
"before:bg-foreground",
|
|
5429
|
-
"before:hover:bg-secondary-foreground"
|
|
5557
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
5430
5558
|
);
|
|
5431
5559
|
el.appendChild(stepDown);
|
|
5432
5560
|
const onStepDown = () => {
|
|
@@ -5441,13 +5569,25 @@ function input_default(Alpine) {
|
|
|
5441
5569
|
stepUp.setAttribute("aria-label", "Increase");
|
|
5442
5570
|
stepUp.setAttribute("aria-controls", input.getAttribute("id"));
|
|
5443
5571
|
stepUp.setAttribute("data-slot", "step-up-trigger");
|
|
5572
|
+
stepUp.appendChild(
|
|
5573
|
+
createSvg({
|
|
5574
|
+
icon: Plus,
|
|
5575
|
+
classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
|
|
5576
|
+
attrs: {
|
|
5577
|
+
"aria-hidden": true,
|
|
5578
|
+
role: "presentation"
|
|
5579
|
+
}
|
|
5580
|
+
})
|
|
5581
|
+
);
|
|
5444
5582
|
stepUp.classList.add(
|
|
5583
|
+
"inline-flex",
|
|
5584
|
+
"items-center",
|
|
5585
|
+
"justify-center",
|
|
5445
5586
|
"cursor-pointer",
|
|
5446
5587
|
"border-l",
|
|
5447
5588
|
"border-input",
|
|
5448
5589
|
"[input[aria-invalid=true]~&]:border-negative",
|
|
5449
5590
|
"[input:invalid~&]:border-negative",
|
|
5450
|
-
"rounded-r-control",
|
|
5451
5591
|
"h-full",
|
|
5452
5592
|
"aspect-square",
|
|
5453
5593
|
"bg-transparent",
|
|
@@ -5455,32 +5595,7 @@ function input_default(Alpine) {
|
|
|
5455
5595
|
"active:bg-secondary-active",
|
|
5456
5596
|
"outline-none",
|
|
5457
5597
|
"relative",
|
|
5458
|
-
"
|
|
5459
|
-
"before:opacity-70",
|
|
5460
|
-
"before:absolute",
|
|
5461
|
-
"before:rounded-full",
|
|
5462
|
-
"before:h-0.5",
|
|
5463
|
-
"before:min-h-px",
|
|
5464
|
-
"before:w-3",
|
|
5465
|
-
"before:top-1/2",
|
|
5466
|
-
"before:left-1/2",
|
|
5467
|
-
"before:-translate-x-1/2",
|
|
5468
|
-
"before:-translate-y-1/2",
|
|
5469
|
-
"before:bg-foreground",
|
|
5470
|
-
"before:hover:bg-secondary-foreground",
|
|
5471
|
-
"after:block",
|
|
5472
|
-
"after:opacity-70",
|
|
5473
|
-
"after:absolute",
|
|
5474
|
-
"after:rounded-full",
|
|
5475
|
-
"after:h-3",
|
|
5476
|
-
"after:min-w-px",
|
|
5477
|
-
"after:w-0.5",
|
|
5478
|
-
"after:top-1/2",
|
|
5479
|
-
"after:left-1/2",
|
|
5480
|
-
"after:-translate-x-1/2",
|
|
5481
|
-
"after:-translate-y-1/2",
|
|
5482
|
-
"after:bg-foreground",
|
|
5483
|
-
"after:hover:bg-secondary-foreground"
|
|
5598
|
+
"[&:hover>svg]:text-secondary-foreground"
|
|
5484
5599
|
);
|
|
5485
5600
|
el.appendChild(stepUp);
|
|
5486
5601
|
const onStepUp = () => {
|
|
@@ -5688,10 +5803,17 @@ function list_default(Alpine) {
|
|
|
5688
5803
|
function menu_default(Alpine) {
|
|
5689
5804
|
Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
|
|
5690
5805
|
el._menu_trigger = {
|
|
5691
|
-
isDropdown: modifiers.includes("dropdown")
|
|
5806
|
+
isDropdown: modifiers.includes("dropdown"),
|
|
5807
|
+
setOpen(open) {
|
|
5808
|
+
el.setAttribute("data-state", open ? "open" : "closed");
|
|
5809
|
+
}
|
|
5692
5810
|
};
|
|
5811
|
+
el.setAttribute("data-state", "closed");
|
|
5693
5812
|
});
|
|
5694
5813
|
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
5814
|
+
if (el.tagName !== "UL") {
|
|
5815
|
+
throw new Error(`${original} must be an ul element`);
|
|
5816
|
+
}
|
|
5695
5817
|
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");
|
|
5696
5818
|
el.setAttribute("role", "menu");
|
|
5697
5819
|
el.setAttribute("aria-orientation", "vertical");
|
|
@@ -5740,6 +5862,9 @@ function menu_default(Alpine) {
|
|
|
5740
5862
|
} else {
|
|
5741
5863
|
listenForTrigger(true);
|
|
5742
5864
|
if (focusTrigger) menuTrigger.focus();
|
|
5865
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
5866
|
+
menuTrigger._menu_trigger.setOpen(false);
|
|
5867
|
+
}
|
|
5743
5868
|
}
|
|
5744
5869
|
}
|
|
5745
5870
|
el._menu = { close };
|
|
@@ -5890,6 +6015,9 @@ function menu_default(Alpine) {
|
|
|
5890
6015
|
}
|
|
5891
6016
|
}
|
|
5892
6017
|
function openDropdown() {
|
|
6018
|
+
if (menuTrigger._menu_trigger.isDropdown) {
|
|
6019
|
+
menuTrigger._menu_trigger.setOpen(true);
|
|
6020
|
+
}
|
|
5893
6021
|
open(menuTrigger);
|
|
5894
6022
|
}
|
|
5895
6023
|
function onContextmenu(event) {
|
|
@@ -5923,7 +6051,10 @@ function menu_default(Alpine) {
|
|
|
5923
6051
|
el.removeEventListener("keydown", onKeyDown);
|
|
5924
6052
|
});
|
|
5925
6053
|
});
|
|
5926
|
-
Alpine.directive("h-menu-item", (el,
|
|
6054
|
+
Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
6055
|
+
if (el.tagName !== "LI") {
|
|
6056
|
+
throw new Error(`${original} must be a li element`);
|
|
6057
|
+
}
|
|
5927
6058
|
el.classList.add(
|
|
5928
6059
|
"focus:bg-secondary-hover",
|
|
5929
6060
|
"focus:text-secondary-foreground",
|
|
@@ -6102,7 +6233,10 @@ function menu_default(Alpine) {
|
|
|
6102
6233
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
6103
6234
|
el.setAttribute("data-slot", "menu-label");
|
|
6104
6235
|
});
|
|
6105
|
-
Alpine.directive("h-menu-checkbox-item", (el,
|
|
6236
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
6237
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
6238
|
+
throw new Error(`${original} must be a li or div element`);
|
|
6239
|
+
}
|
|
6106
6240
|
el.classList.add(
|
|
6107
6241
|
"focus:bg-secondary-hover",
|
|
6108
6242
|
"hover:bg-secondary-hover",
|
|
@@ -6167,7 +6301,10 @@ function menu_default(Alpine) {
|
|
|
6167
6301
|
el.removeEventListener("mouseleave", focusOut);
|
|
6168
6302
|
});
|
|
6169
6303
|
});
|
|
6170
|
-
Alpine.directive("h-menu-radio-item", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
6304
|
+
Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
6305
|
+
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
6306
|
+
throw new Error(`${original} must be a li or div element`);
|
|
6307
|
+
}
|
|
6171
6308
|
el.classList.add(
|
|
6172
6309
|
"focus:bg-secondary-hover",
|
|
6173
6310
|
"hover:bg-secondary-hover",
|
|
@@ -6556,7 +6693,7 @@ var FilterType = Object.freeze({
|
|
|
6556
6693
|
none: 3
|
|
6557
6694
|
});
|
|
6558
6695
|
function select_default(Alpine) {
|
|
6559
|
-
Alpine.directive("h-select", (el,
|
|
6696
|
+
Alpine.directive("h-select", (el, { modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
6560
6697
|
el._h_select = Alpine2.reactive({
|
|
6561
6698
|
id: void 0,
|
|
6562
6699
|
controls: `hsc${v4_default()}`,
|
|
@@ -6573,38 +6710,37 @@ function select_default(Alpine) {
|
|
|
6573
6710
|
set: void 0,
|
|
6574
6711
|
get: void 0
|
|
6575
6712
|
};
|
|
6576
|
-
el.classList.add(
|
|
6577
|
-
|
|
6578
|
-
"
|
|
6579
|
-
"
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
"
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
});
|
|
6713
|
+
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");
|
|
6714
|
+
if (modifiers.includes("table")) {
|
|
6715
|
+
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");
|
|
6716
|
+
el.setAttribute("data-slot", "cell-input-select");
|
|
6717
|
+
} else {
|
|
6718
|
+
el.classList.add(
|
|
6719
|
+
"border-input",
|
|
6720
|
+
"has-focus-visible:border-ring",
|
|
6721
|
+
"has-focus-visible:ring-[calc(var(--spacing)*0.75)]",
|
|
6722
|
+
"has-focus-visible:ring-ring/50",
|
|
6723
|
+
"dark:has-[aria-invalid=true]:ring-negative/40",
|
|
6724
|
+
"dark:has-[input:invalid]:ring-negative/40",
|
|
6725
|
+
"has-[aria-invalid=true]:border-negative",
|
|
6726
|
+
"has-[aria-invalid=true]:ring-negative/20",
|
|
6727
|
+
"has-[input:invalid]:border-negative",
|
|
6728
|
+
"has-[input:invalid]:ring-negative/20",
|
|
6729
|
+
"hover:bg-secondary-hover",
|
|
6730
|
+
"active:bg-secondary-active",
|
|
6731
|
+
"rounded-control",
|
|
6732
|
+
"border",
|
|
6733
|
+
"bg-input-inner",
|
|
6734
|
+
"text-sm",
|
|
6735
|
+
"whitespace-nowrap",
|
|
6736
|
+
"shadow-input"
|
|
6737
|
+
);
|
|
6738
|
+
el.setAttribute("data-slot", "select");
|
|
6739
|
+
const observer = sizeObserver(el);
|
|
6740
|
+
cleanup(() => {
|
|
6741
|
+
observer.disconnect();
|
|
6742
|
+
});
|
|
6743
|
+
}
|
|
6608
6744
|
});
|
|
6609
6745
|
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6610
6746
|
if (el.tagName !== "INPUT") {
|
|
@@ -7432,7 +7568,7 @@ function sidebar_default(Alpine) {
|
|
|
7432
7568
|
el.setAttribute("role", "none");
|
|
7433
7569
|
});
|
|
7434
7570
|
Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
|
|
7435
|
-
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar
|
|
7571
|
+
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
|
|
7436
7572
|
if (!modifiers.includes("flat")) {
|
|
7437
7573
|
el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
|
|
7438
7574
|
}
|
|
@@ -7548,18 +7684,212 @@ function spinner_default(Alpine) {
|
|
|
7548
7684
|
|
|
7549
7685
|
// src/components/split.js
|
|
7550
7686
|
function split_default(Alpine) {
|
|
7551
|
-
Alpine.directive("h-split", (el) => {
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7687
|
+
Alpine.directive("h-split", (el, {}, { cleanup, Alpine: Alpine2 }) => {
|
|
7688
|
+
const panels = [];
|
|
7689
|
+
const state = Alpine2.reactive({
|
|
7690
|
+
isHorizontal: el.getAttribute("data-orientation") === "horizontal",
|
|
7691
|
+
isBorder: el.getAttribute("data-variant") === "border"
|
|
7692
|
+
});
|
|
7693
|
+
const storageKey = el.getAttribute("data-key");
|
|
7694
|
+
const loadSizes = () => {
|
|
7695
|
+
if (!storageKey) return null;
|
|
7696
|
+
try {
|
|
7697
|
+
const raw = localStorage.getItem(storageKey);
|
|
7698
|
+
if (!raw) return null;
|
|
7699
|
+
return JSON.parse(raw);
|
|
7700
|
+
} catch {
|
|
7701
|
+
return null;
|
|
7702
|
+
}
|
|
7703
|
+
};
|
|
7704
|
+
let saveTimer = null;
|
|
7705
|
+
const SAVE_DELAY = 200;
|
|
7706
|
+
const saveSizes = () => {
|
|
7707
|
+
if (!storageKey) return;
|
|
7708
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7709
|
+
saveTimer = setTimeout(() => {
|
|
7710
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7711
|
+
const sizes = visible.map((p) => p.size / usableSize());
|
|
7712
|
+
localStorage.setItem(storageKey, JSON.stringify(sizes));
|
|
7713
|
+
saveTimer = null;
|
|
7714
|
+
}, SAVE_DELAY);
|
|
7715
|
+
};
|
|
7716
|
+
const sizeProp = () => state.isHorizontal ? "width" : "height";
|
|
7717
|
+
const containerSize = () => state.isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
|
|
7718
|
+
const gutterSize = () => {
|
|
7719
|
+
const panel = panels.find((p) => p.gutter.parentElement);
|
|
7720
|
+
if (panel) {
|
|
7721
|
+
return panel.gutter.getBoundingClientRect()[sizeProp()] ?? 0;
|
|
7722
|
+
}
|
|
7723
|
+
return 0;
|
|
7724
|
+
};
|
|
7725
|
+
const usableSize = () => {
|
|
7726
|
+
const visiblePanels = panels.filter((p) => !p.hidden);
|
|
7727
|
+
const gutters = Math.max(0, visiblePanels.length - 1);
|
|
7728
|
+
return containerSize() - gutters * gutterSize();
|
|
7729
|
+
};
|
|
7730
|
+
const normalize = (value) => {
|
|
7731
|
+
if (value == null) return null;
|
|
7732
|
+
if (typeof value === "number") return value;
|
|
7733
|
+
if (value.endsWith("%")) {
|
|
7734
|
+
return parseFloat(value) / 100 * usableSize();
|
|
7735
|
+
}
|
|
7736
|
+
return parseFloat(value);
|
|
7737
|
+
};
|
|
7738
|
+
let initialized = false;
|
|
7739
|
+
const DELTA_ABS = 0.01;
|
|
7740
|
+
const layout = () => {
|
|
7741
|
+
const visible = panels.filter((p) => !p.hidden);
|
|
7742
|
+
if (!visible.length) return;
|
|
7743
|
+
const total = usableSize();
|
|
7744
|
+
if (!initialized) {
|
|
7745
|
+
initialized = true;
|
|
7746
|
+
const visible2 = panels.filter((p) => !p.hidden);
|
|
7747
|
+
const stored = loadSizes();
|
|
7748
|
+
if (stored && stored.length === visible2.length) {
|
|
7749
|
+
visible2.forEach((p, i) => {
|
|
7750
|
+
p.size = stored[i] * usableSize();
|
|
7751
|
+
p.explicit = true;
|
|
7752
|
+
});
|
|
7753
|
+
} else {
|
|
7754
|
+
const explicitTotal = visible2.filter((p) => p.explicit).reduce((sum, p) => sum + p.declaredSize, 0);
|
|
7755
|
+
const autoPanels = visible2.filter((p) => !p.explicit);
|
|
7756
|
+
const remaining = total - explicitTotal;
|
|
7757
|
+
const share = autoPanels.length ? remaining / autoPanels.length : 0;
|
|
7758
|
+
visible2.forEach((p) => {
|
|
7759
|
+
if (p.explicit) {
|
|
7760
|
+
p.size = p.declaredSize;
|
|
7761
|
+
} else {
|
|
7762
|
+
p.size = share;
|
|
7763
|
+
}
|
|
7764
|
+
p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
|
|
7765
|
+
});
|
|
7766
|
+
}
|
|
7767
|
+
}
|
|
7768
|
+
visible.forEach((p) => {
|
|
7769
|
+
if (p.size == null) {
|
|
7770
|
+
p.size = p.min ?? 0;
|
|
7771
|
+
}
|
|
7772
|
+
p.size = Math.min(Math.max(p.size, p.min), p.max);
|
|
7773
|
+
});
|
|
7774
|
+
let currentTotal = visible.reduce((sum, p) => sum + p.size, 0);
|
|
7775
|
+
let delta = total - currentTotal;
|
|
7776
|
+
if (Math.abs(delta) < DELTA_ABS) {
|
|
7777
|
+
visible.forEach((p) => p.apply());
|
|
7778
|
+
return;
|
|
7779
|
+
}
|
|
7780
|
+
let flexible = visible.filter((p) => {
|
|
7781
|
+
if (p.collapsed) return false;
|
|
7782
|
+
if (delta > 0) {
|
|
7783
|
+
return p.size < p.max;
|
|
7784
|
+
} else {
|
|
7785
|
+
return p.size > p.min;
|
|
7786
|
+
}
|
|
7787
|
+
});
|
|
7788
|
+
while (flexible.length && Math.abs(delta) > DELTA_ABS) {
|
|
7789
|
+
const share = delta / flexible.length;
|
|
7790
|
+
let consumed = 0;
|
|
7791
|
+
const nextFlexible = [];
|
|
7792
|
+
flexible.forEach((p) => {
|
|
7793
|
+
const proposed = p.size + share;
|
|
7794
|
+
const clamped = Math.min(Math.max(proposed, p.min), p.max);
|
|
7795
|
+
const actualChange = clamped - p.size;
|
|
7796
|
+
if (Math.abs(actualChange) > DELTA_ABS) {
|
|
7797
|
+
p.size = clamped;
|
|
7798
|
+
consumed += actualChange;
|
|
7799
|
+
}
|
|
7800
|
+
if (delta > 0) {
|
|
7801
|
+
if (p.size < p.max) nextFlexible.push(p);
|
|
7802
|
+
} else {
|
|
7803
|
+
if (p.size > p.min) nextFlexible.push(p);
|
|
7804
|
+
}
|
|
7805
|
+
});
|
|
7806
|
+
delta -= consumed;
|
|
7807
|
+
flexible = nextFlexible;
|
|
7808
|
+
if (Math.abs(consumed) < DELTA_ABS) break;
|
|
7809
|
+
}
|
|
7810
|
+
visible.forEach((p) => p.apply());
|
|
7811
|
+
};
|
|
7812
|
+
let layoutFrame = null;
|
|
7813
|
+
const queueLayout = () => {
|
|
7814
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7815
|
+
layoutFrame = requestAnimationFrame(() => {
|
|
7816
|
+
layout();
|
|
7817
|
+
saveSizes();
|
|
7818
|
+
layoutFrame = null;
|
|
7819
|
+
});
|
|
7820
|
+
};
|
|
7821
|
+
const refreshGutters = () => {
|
|
7822
|
+
panels.forEach((p, i) => p.setGutter(i === panels.length - 1));
|
|
7823
|
+
};
|
|
7824
|
+
el._h_split = {
|
|
7825
|
+
state,
|
|
7826
|
+
panels,
|
|
7827
|
+
addPanel(panel) {
|
|
7828
|
+
panels.push(panel);
|
|
7829
|
+
if (panel.size == null) {
|
|
7830
|
+
panel.size = null;
|
|
7831
|
+
}
|
|
7832
|
+
initialized = false;
|
|
7833
|
+
refreshGutters();
|
|
7834
|
+
queueLayout();
|
|
7835
|
+
},
|
|
7836
|
+
removePanel(panel) {
|
|
7837
|
+
const i = panels.indexOf(panel);
|
|
7838
|
+
if (i !== -1) panels.splice(i, 1);
|
|
7839
|
+
initialized = false;
|
|
7840
|
+
refreshGutters();
|
|
7841
|
+
queueLayout();
|
|
7842
|
+
},
|
|
7843
|
+
panelHidden() {
|
|
7844
|
+
initialized = false;
|
|
7845
|
+
refreshGutters();
|
|
7846
|
+
queueLayout();
|
|
7847
|
+
},
|
|
7848
|
+
panelChange() {
|
|
7849
|
+
queueLayout();
|
|
7850
|
+
},
|
|
7851
|
+
normalize,
|
|
7852
|
+
saveSizes
|
|
7853
|
+
};
|
|
7854
|
+
el.classList.add("flex", "flex-1", "min-w-0", "min-h-0", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
|
|
7855
|
+
const observer = new MutationObserver((mutations) => {
|
|
7856
|
+
mutations.forEach((mutation) => {
|
|
7857
|
+
if (mutation.attributeName === "data-orientation") {
|
|
7858
|
+
state.isHorizontal = el.getAttribute("data-orientation") === "horizontal";
|
|
7859
|
+
queueLayout();
|
|
7860
|
+
} else if (mutation.attributeName === "data-variant") {
|
|
7861
|
+
state.isBorder = el.getAttribute("data-variant") === "border";
|
|
7862
|
+
queueLayout();
|
|
7863
|
+
} else {
|
|
7864
|
+
panels.forEach((p) => p.setLocked(el.getAttribute("data-locked") === "true"));
|
|
7865
|
+
}
|
|
7866
|
+
});
|
|
7867
|
+
});
|
|
7868
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-orientation", "data-variant", "data-locked"] });
|
|
7869
|
+
const containerObserver = new ResizeObserver(queueLayout);
|
|
7870
|
+
containerObserver.observe(el);
|
|
7871
|
+
cleanup(() => {
|
|
7872
|
+
if (layoutFrame) cancelAnimationFrame(layoutFrame);
|
|
7873
|
+
if (saveTimer) clearTimeout(saveTimer);
|
|
7874
|
+
containerObserver.disconnect();
|
|
7875
|
+
observer.disconnect();
|
|
7876
|
+
});
|
|
7555
7877
|
});
|
|
7556
|
-
Alpine.directive("h-split-panel", (el) => {
|
|
7557
|
-
el.
|
|
7878
|
+
Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7879
|
+
const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
|
|
7880
|
+
if (!split) {
|
|
7881
|
+
throw new Error(`${original} must be inside an split element`);
|
|
7882
|
+
}
|
|
7883
|
+
el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
|
|
7558
7884
|
el.setAttribute("tabindex", "-1");
|
|
7559
7885
|
el.setAttribute("data-slot", "split-panel");
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
el.
|
|
7886
|
+
const gutter = document.createElement("span");
|
|
7887
|
+
gutter.setAttribute("data-slot", "split-gutter");
|
|
7888
|
+
gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
|
|
7889
|
+
gutter.setAttribute("tabindex", "-1");
|
|
7890
|
+
gutter.setAttribute("role", "separator");
|
|
7891
|
+
gutter.classList.add(
|
|
7892
|
+
"overflow-visible",
|
|
7563
7893
|
"relative",
|
|
7564
7894
|
"shrink-0",
|
|
7565
7895
|
"touch-none",
|
|
@@ -7567,15 +7897,8 @@ function split_default(Alpine) {
|
|
|
7567
7897
|
"outline-none",
|
|
7568
7898
|
"hover:bg-primary-hover",
|
|
7569
7899
|
"active:bg-primary-active",
|
|
7570
|
-
"before:absolute",
|
|
7571
|
-
"before:top-1/2",
|
|
7572
|
-
"before:left-1/2",
|
|
7573
|
-
"before:-translate-x-1/2",
|
|
7574
|
-
"before:-translate-y-1/2",
|
|
7575
|
-
"before:block",
|
|
7576
|
-
"before:bg-transparent",
|
|
7577
7900
|
"hover:before:bg-primary-hover",
|
|
7578
|
-
"
|
|
7901
|
+
"aria-disabled:pointer-events-none",
|
|
7579
7902
|
"[[data-orientation=horizontal]>&]:cursor-col-resize",
|
|
7580
7903
|
"[[data-orientation=vertical]>&]:cursor-row-resize"
|
|
7581
7904
|
);
|
|
@@ -7585,19 +7908,23 @@ function split_default(Alpine) {
|
|
|
7585
7908
|
"hover:bg-primary-hover",
|
|
7586
7909
|
"active:bg-primary-active",
|
|
7587
7910
|
"before:absolute",
|
|
7588
|
-
"before:top-1/2",
|
|
7589
|
-
"before:left-1/2",
|
|
7590
|
-
"before:-translate-x-1/2",
|
|
7591
|
-
"before:-translate-y-1/2",
|
|
7592
7911
|
"before:block",
|
|
7593
7912
|
"before:bg-transparent",
|
|
7594
7913
|
"hover:before:bg-primary-hover",
|
|
7914
|
+
"[[data-orientation=horizontal]>&]:before:-translate-x-1/2",
|
|
7915
|
+
"[[data-orientation=horizontal]>&[data-edge=end]]:before:-translate-x-1",
|
|
7916
|
+
"[[data-orientation=horizontal]>&[data-edge=start]]:before:translate-x-0",
|
|
7917
|
+
"[[data-orientation=horizontal]>&]:before:left-1/2",
|
|
7595
7918
|
"[[data-orientation=horizontal]>&]:!w-px",
|
|
7596
7919
|
"[[data-orientation=horizontal]>&]:before:h-full",
|
|
7597
|
-
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1
|
|
7920
|
+
"[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1)]",
|
|
7921
|
+
"[[data-orientation=vertical]>&]:before:-translate-y-1/2",
|
|
7922
|
+
"[[data-orientation=vertical]>&[data-edge=end]]:before:-translate-y-1",
|
|
7923
|
+
"[[data-orientation=vertical]>&[data-edge=start]]:before:translate-y-0",
|
|
7924
|
+
"[[data-orientation=vertical]>&]:before:top-1/2",
|
|
7598
7925
|
"[[data-orientation=vertical]>&]:!h-px",
|
|
7599
7926
|
"[[data-orientation=vertical]>&]:before:w-full",
|
|
7600
|
-
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1
|
|
7927
|
+
"[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1)]"
|
|
7601
7928
|
];
|
|
7602
7929
|
const handleClasses = [
|
|
7603
7930
|
"bg-transparent",
|
|
@@ -7646,24 +7973,175 @@ function split_default(Alpine) {
|
|
|
7646
7973
|
"[[data-orientation=vertical]>&]:after:w-5",
|
|
7647
7974
|
"[[data-orientation=vertical]>&]:after:h-2.5"
|
|
7648
7975
|
];
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
if (variant === "border") {
|
|
7654
|
-
el.classList.remove(...handleClasses);
|
|
7655
|
-
el.classList.add(...borderClasses);
|
|
7976
|
+
const setVariant = () => {
|
|
7977
|
+
if (split._h_split.state.isBorder) {
|
|
7978
|
+
gutter.classList.remove(...handleClasses);
|
|
7979
|
+
gutter.classList.add(...borderClasses);
|
|
7656
7980
|
} else {
|
|
7657
|
-
|
|
7658
|
-
|
|
7981
|
+
gutter.classList.remove(...borderClasses);
|
|
7982
|
+
gutter.classList.add(...handleClasses);
|
|
7659
7983
|
}
|
|
7660
|
-
}
|
|
7661
|
-
|
|
7662
|
-
|
|
7984
|
+
};
|
|
7985
|
+
setVariant();
|
|
7986
|
+
effect(setVariant);
|
|
7987
|
+
const initialSize = split._h_split.normalize(el.getAttribute("data-size"));
|
|
7988
|
+
let handleSize = 0;
|
|
7989
|
+
const panel = {
|
|
7990
|
+
el,
|
|
7991
|
+
gutter,
|
|
7992
|
+
hidden: el.getAttribute("data-hidden") === "true",
|
|
7993
|
+
declaredSize: initialSize,
|
|
7994
|
+
size: initialSize,
|
|
7995
|
+
explicit: initialSize != null,
|
|
7996
|
+
min: split._h_split.normalize(el.getAttribute("data-min")) ?? 0,
|
|
7997
|
+
max: split._h_split.normalize(el.getAttribute("data-max")) ?? Infinity,
|
|
7998
|
+
collapsed: false,
|
|
7999
|
+
prevSize: null,
|
|
8000
|
+
apply() {
|
|
8001
|
+
el.style.flexBasis = `${this.size.toFixed(2)}px`;
|
|
8002
|
+
if (split._h_split.state.isBorder) {
|
|
8003
|
+
this.setHandleOffset();
|
|
8004
|
+
}
|
|
8005
|
+
},
|
|
8006
|
+
setGutter(last) {
|
|
8007
|
+
if (this.hidden || last) {
|
|
8008
|
+
gutter.remove();
|
|
8009
|
+
} else if (!gutter.parentElement) {
|
|
8010
|
+
el.after(gutter);
|
|
8011
|
+
handleSize = this.getHandleSize();
|
|
8012
|
+
}
|
|
8013
|
+
},
|
|
8014
|
+
setHandleOffset() {
|
|
8015
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
8016
|
+
const index = panels.indexOf(panel);
|
|
8017
|
+
const next = panels[index + 1];
|
|
8018
|
+
if (!next) return;
|
|
8019
|
+
if (next.size < handleSize) {
|
|
8020
|
+
gutter.setAttribute("data-edge", "end");
|
|
8021
|
+
} else if (this.size < handleSize) {
|
|
8022
|
+
gutter.setAttribute("data-edge", "start");
|
|
8023
|
+
} else {
|
|
8024
|
+
gutter.removeAttribute("data-edge");
|
|
8025
|
+
}
|
|
8026
|
+
},
|
|
8027
|
+
getHandleSize() {
|
|
8028
|
+
if (split._h_split.state.isBorder) {
|
|
8029
|
+
const beforeStyle = window.getComputedStyle(gutter, "::before");
|
|
8030
|
+
return Number(beforeStyle[split._h_split.state.isHorizontal ? "width" : "height"].replace("px", "")) / 2;
|
|
8031
|
+
} else {
|
|
8032
|
+
return 0;
|
|
8033
|
+
}
|
|
8034
|
+
},
|
|
8035
|
+
setLocked(locked = false) {
|
|
8036
|
+
const panelLocked = el.getAttribute("data-locked") === "true";
|
|
8037
|
+
if (locked) {
|
|
8038
|
+
gutter.classList.add("pointer-events-none");
|
|
8039
|
+
} else if (panelLocked) {
|
|
8040
|
+
gutter.classList.add("pointer-events-none");
|
|
8041
|
+
} else {
|
|
8042
|
+
gutter.classList.remove("pointer-events-none");
|
|
8043
|
+
}
|
|
8044
|
+
}
|
|
8045
|
+
};
|
|
8046
|
+
split._h_split.addPanel(panel);
|
|
8047
|
+
const drag = (e) => {
|
|
8048
|
+
e.preventDefault();
|
|
8049
|
+
gutter.setPointerCapture(e.pointerId);
|
|
8050
|
+
const panels = split._h_split.panels.filter((p) => !p.hidden);
|
|
8051
|
+
const index = panels.indexOf(panel);
|
|
8052
|
+
const next = panels[index + 1];
|
|
8053
|
+
if (!next) return;
|
|
8054
|
+
const startPos = split._h_split.state.isHorizontal ? e.clientX : e.clientY;
|
|
8055
|
+
const startA = panel.size;
|
|
8056
|
+
const startB = next.size;
|
|
8057
|
+
const minDelta = Math.max(
|
|
8058
|
+
panel.min - startA,
|
|
8059
|
+
// how much panel A can shrink
|
|
8060
|
+
startB - next.max
|
|
8061
|
+
// how much panel B can grow
|
|
8062
|
+
);
|
|
8063
|
+
const maxDelta = Math.min(
|
|
8064
|
+
panel.max - startA,
|
|
8065
|
+
// how much panel A can grow
|
|
8066
|
+
startB - next.min
|
|
8067
|
+
// how much panel B can shrink
|
|
8068
|
+
);
|
|
8069
|
+
const move = (e2) => {
|
|
8070
|
+
const currentPos = split._h_split.state.isHorizontal ? e2.clientX : e2.clientY;
|
|
8071
|
+
const delta = currentPos - startPos;
|
|
8072
|
+
const clamped = Math.min(maxDelta, Math.max(minDelta, delta));
|
|
8073
|
+
panel.size = startA + clamped;
|
|
8074
|
+
next.size = startB - clamped;
|
|
8075
|
+
panel.explicit = false;
|
|
8076
|
+
if (panel.collapsed) {
|
|
8077
|
+
panel.collapsed = false;
|
|
8078
|
+
}
|
|
8079
|
+
if (next.collapsed) {
|
|
8080
|
+
next.collapsed = false;
|
|
8081
|
+
}
|
|
8082
|
+
split._h_split.panelChange();
|
|
8083
|
+
};
|
|
8084
|
+
const up = () => {
|
|
8085
|
+
gutter.releasePointerCapture(e.pointerId);
|
|
8086
|
+
gutter.removeEventListener("pointermove", move);
|
|
8087
|
+
gutter.removeEventListener("pointerup", up);
|
|
8088
|
+
};
|
|
8089
|
+
gutter.addEventListener("pointermove", move);
|
|
8090
|
+
gutter.addEventListener("pointerup", up);
|
|
8091
|
+
};
|
|
8092
|
+
gutter.addEventListener("pointerdown", drag);
|
|
8093
|
+
const collapse = () => {
|
|
8094
|
+
if (panel.collapsed) return;
|
|
8095
|
+
panel.prevSize = panel.size;
|
|
8096
|
+
panel.size = panel.min ?? 0;
|
|
8097
|
+
panel.collapsed = true;
|
|
8098
|
+
panel.explicit = true;
|
|
8099
|
+
split._h_split.panelChange();
|
|
8100
|
+
};
|
|
8101
|
+
const expand = () => {
|
|
8102
|
+
if (!panel.collapsed) return;
|
|
8103
|
+
const target = panel.prevSize ?? panel.min ?? 0;
|
|
8104
|
+
const delta = target - panel.size;
|
|
8105
|
+
const visible = split._h_split.panels.filter((p) => !p.hidden && p !== panel);
|
|
8106
|
+
let remaining = delta;
|
|
8107
|
+
for (const p of visible) {
|
|
8108
|
+
const available = p.size - p.min;
|
|
8109
|
+
const take = Math.min(available, remaining);
|
|
8110
|
+
p.size -= take;
|
|
8111
|
+
remaining -= take;
|
|
8112
|
+
if (remaining <= 0) break;
|
|
8113
|
+
}
|
|
8114
|
+
panel.size = target - remaining;
|
|
8115
|
+
panel.collapsed = false;
|
|
8116
|
+
panel.explicit = true;
|
|
8117
|
+
split._h_split.panelChange();
|
|
8118
|
+
};
|
|
8119
|
+
const observer = new MutationObserver((mutations) => {
|
|
8120
|
+
mutations.forEach((mutation) => {
|
|
8121
|
+
if (mutation.attributeName === "data-hidden") {
|
|
8122
|
+
panel.hidden = el.getAttribute("data-hidden") === "true";
|
|
8123
|
+
if (panel.hidden) {
|
|
8124
|
+
el.classList.add("hidden");
|
|
8125
|
+
} else {
|
|
8126
|
+
el.classList.remove("hidden");
|
|
8127
|
+
}
|
|
8128
|
+
split._h_split.panelHidden();
|
|
8129
|
+
} else if (mutation.attributeName === "data-locked") {
|
|
8130
|
+
panel.setLocked();
|
|
8131
|
+
} else {
|
|
8132
|
+
if (el.getAttribute("data-collapse") === "true") {
|
|
8133
|
+
collapse();
|
|
8134
|
+
} else {
|
|
8135
|
+
expand();
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
});
|
|
7663
8139
|
});
|
|
7664
|
-
observer.observe(el
|
|
7665
|
-
setVariant(el.parentElement.getAttribute("data-variant"));
|
|
8140
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
|
|
7666
8141
|
cleanup(() => {
|
|
8142
|
+
gutter.remove();
|
|
8143
|
+
gutter.removeEventListener("pointerdown", drag);
|
|
8144
|
+
split._h_split.removePanel(panel);
|
|
7667
8145
|
observer.disconnect();
|
|
7668
8146
|
});
|
|
7669
8147
|
});
|
|
@@ -7725,7 +8203,18 @@ function switch_default(Alpine) {
|
|
|
7725
8203
|
function table_default(Alpine) {
|
|
7726
8204
|
Alpine.directive("h-table-container", (el, { modifiers }) => {
|
|
7727
8205
|
if (modifiers.includes("scroll")) {
|
|
7728
|
-
el.classList.add(
|
|
8206
|
+
el.classList.add(
|
|
8207
|
+
"overflow-scroll",
|
|
8208
|
+
"[&_thead[data-slot|=table]]:sticky",
|
|
8209
|
+
"[&_thead[data-slot|=table]]:top-0",
|
|
8210
|
+
"[&_thead[data-slot|=table]]:z-2",
|
|
8211
|
+
"[&_tfoot[data-slot|=table]]:sticky",
|
|
8212
|
+
"[&_tfoot[data-slot|=table]]:bottom-0",
|
|
8213
|
+
"[&_tfoot[data-slot|=table]]:z-2",
|
|
8214
|
+
"[&_tbody_tr_th[data-slot|=table]]:sticky",
|
|
8215
|
+
"[&_tbody_tr_th[data-slot|=table]]:left-0",
|
|
8216
|
+
"[&_tbody_tr_th[data-slot|=table]]:z-1"
|
|
8217
|
+
);
|
|
7729
8218
|
} else {
|
|
7730
8219
|
el.classList.add("relative", "w-full", "overflow-x-auto");
|
|
7731
8220
|
}
|
|
@@ -7740,13 +8229,19 @@ function table_default(Alpine) {
|
|
|
7740
8229
|
el.setAttribute("data-slot", "table");
|
|
7741
8230
|
switch (el.getAttribute("data-borders")) {
|
|
7742
8231
|
case "rows":
|
|
7743
|
-
el.classList.add("[&_tr_td]:border-b", "[&_tr_th]:border-b", "first:[&_tfoot_tr_td]:border-t", "first:[&_tfoot_tr_th]:border-t");
|
|
8232
|
+
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");
|
|
7744
8233
|
break;
|
|
7745
8234
|
case "columns":
|
|
7746
|
-
el.classList.add("[&_tr]:divide-x");
|
|
8235
|
+
el.classList.add("[&_tr[data-slot|=table]]:divide-x");
|
|
7747
8236
|
break;
|
|
7748
8237
|
case "both":
|
|
7749
|
-
el.classList.add(
|
|
8238
|
+
el.classList.add(
|
|
8239
|
+
"[&_tr_td[data-slot|=table]]:border-b",
|
|
8240
|
+
"[&_tr_th[data-slot|=table]]:border-b",
|
|
8241
|
+
"first:[&_tfoot_tr_td[data-slot|=table]]:border-t",
|
|
8242
|
+
"first:[&_tfoot_tr_th[data-slot|=table]]:border-t",
|
|
8243
|
+
"[&_tr[data-slot|=table]]:divide-x"
|
|
8244
|
+
);
|
|
7750
8245
|
break;
|
|
7751
8246
|
}
|
|
7752
8247
|
});
|
|
@@ -7776,6 +8271,7 @@ function table_default(Alpine) {
|
|
|
7776
8271
|
Alpine.directive("h-table-cell", (el) => {
|
|
7777
8272
|
el.classList.add(
|
|
7778
8273
|
"p-2",
|
|
8274
|
+
"[&:has([data-slot|=cell-input])]:p-0",
|
|
7779
8275
|
"align-middle",
|
|
7780
8276
|
"whitespace-nowrap",
|
|
7781
8277
|
"[&:has([role=checkbox])]:pr-0",
|
|
@@ -7788,15 +8284,47 @@ function table_default(Alpine) {
|
|
|
7788
8284
|
);
|
|
7789
8285
|
el.setAttribute("data-slot", "table-cell");
|
|
7790
8286
|
});
|
|
8287
|
+
Alpine.directive("h-table-cell-button", (el) => {
|
|
8288
|
+
el.classList.add(
|
|
8289
|
+
"px-2",
|
|
8290
|
+
"size-full",
|
|
8291
|
+
"h-10",
|
|
8292
|
+
"cursor-pointer",
|
|
8293
|
+
"inline-flex",
|
|
8294
|
+
"items-center",
|
|
8295
|
+
"justify-between",
|
|
8296
|
+
"outline-none",
|
|
8297
|
+
"gap-2",
|
|
8298
|
+
"transition-[color,box-shadow]",
|
|
8299
|
+
"[&_svg]:pointer-events-none",
|
|
8300
|
+
"[&_svg]:opacity-70",
|
|
8301
|
+
"[&_svg]:text-foreground",
|
|
8302
|
+
"[&_svg]:transition-transform",
|
|
8303
|
+
"[&_svg]:duration-200",
|
|
8304
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
8305
|
+
"shrink-0",
|
|
8306
|
+
"[&_svg]:shrink-0",
|
|
8307
|
+
"focus-visible:inset-ring-ring/50",
|
|
8308
|
+
"focus-visible:inset-ring-2",
|
|
8309
|
+
"hover:bg-table-hover",
|
|
8310
|
+
"hover:text-table-hover-foreground",
|
|
8311
|
+
"active:!bg-table-active",
|
|
8312
|
+
"active:!text-table-active-foreground",
|
|
8313
|
+
"[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180",
|
|
8314
|
+
"[&[data-state=open]>svg:only-child]:rotate-180"
|
|
8315
|
+
);
|
|
8316
|
+
el.setAttribute("type", "button");
|
|
8317
|
+
el.setAttribute("data-slot", "cell-input-button");
|
|
8318
|
+
});
|
|
7791
8319
|
Alpine.directive("h-table-body", (el) => {
|
|
7792
8320
|
el.classList.add(
|
|
7793
|
-
"[&_tr:last-child_td]:border-b-0",
|
|
7794
|
-
"[&_tr:last-child_th]:border-b-0",
|
|
7795
|
-
"[&_tr_th]:bg-table-header",
|
|
7796
|
-
"[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
|
|
7797
|
-
"[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
|
|
7798
|
-
"[&_tr[data-activable=true]:active_th]:!bg-table-active",
|
|
7799
|
-
"[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
|
|
8321
|
+
"[&_tr:last-child_td[data-slot|=table]]:border-b-0",
|
|
8322
|
+
"[&_tr:last-child_th[data-slot|=table]]:border-b-0",
|
|
8323
|
+
"[&_tr_th[data-slot|=table]]:bg-table-header",
|
|
8324
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:bg-table-hover",
|
|
8325
|
+
"[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:text-table-hover-foreground",
|
|
8326
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!bg-table-active",
|
|
8327
|
+
"[&_tr[data-activable=true]:active_th[data-slot|=table]]:!text-table-active-foreground"
|
|
7800
8328
|
);
|
|
7801
8329
|
el.setAttribute("data-slot", "table-body");
|
|
7802
8330
|
});
|
|
@@ -7816,7 +8344,7 @@ function table_default(Alpine) {
|
|
|
7816
8344
|
el.setAttribute("data-slot", "table-caption");
|
|
7817
8345
|
});
|
|
7818
8346
|
Alpine.directive("h-table-footer", (el) => {
|
|
7819
|
-
el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td]:border-b-0", "last:[&>tr_th]:border-b-0");
|
|
8347
|
+
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");
|
|
7820
8348
|
el.setAttribute("data-slot", "table-footer");
|
|
7821
8349
|
});
|
|
7822
8350
|
}
|
|
@@ -8221,7 +8749,7 @@ function scrollIntoCenter(container, element, behavior = "instant") {
|
|
|
8221
8749
|
});
|
|
8222
8750
|
}
|
|
8223
8751
|
function timepicker_default(Alpine) {
|
|
8224
|
-
Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8752
|
+
Alpine.directive("h-time-picker", (el, { expression, modifiers }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
|
|
8225
8753
|
el._h_timepicker = Alpine2.reactive({
|
|
8226
8754
|
id: void 0,
|
|
8227
8755
|
controls: `htpc${v4_default()}`,
|
|
@@ -8251,39 +8779,55 @@ function timepicker_default(Alpine) {
|
|
|
8251
8779
|
el.classList.add(
|
|
8252
8780
|
"cursor-pointer",
|
|
8253
8781
|
"border-input",
|
|
8254
|
-
"[&>input]:appearance-none",
|
|
8255
|
-
"has-[input:focus-visible]:border-ring",
|
|
8256
|
-
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8257
|
-
"has-[input:focus-visible]:ring-ring/50",
|
|
8258
|
-
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8259
|
-
"has-[input[aria-invalid=true]]:border-negative",
|
|
8260
|
-
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8261
|
-
"has-[input:invalid]:ring-negative/20",
|
|
8262
|
-
"has-[input:invalid]:border-negative",
|
|
8263
|
-
"dark:has-[input:invalid]:ring-negative/40",
|
|
8264
8782
|
"hover:bg-secondary-hover",
|
|
8265
8783
|
"active:bg-secondary-active",
|
|
8266
8784
|
"flex",
|
|
8267
|
-
"w-full",
|
|
8268
8785
|
"items-center",
|
|
8269
8786
|
"justify-between",
|
|
8270
8787
|
"gap-2",
|
|
8271
|
-
"rounded-control",
|
|
8272
|
-
"border",
|
|
8273
|
-
"bg-input-inner",
|
|
8274
8788
|
"pl-3",
|
|
8275
8789
|
"pr-2",
|
|
8276
8790
|
"data-[size=sm]:pr-1",
|
|
8277
8791
|
"text-sm",
|
|
8278
8792
|
"whitespace-nowrap",
|
|
8279
|
-
"shadow-input",
|
|
8280
8793
|
"transition-[color,box-shadow]",
|
|
8281
8794
|
"duration-200",
|
|
8282
8795
|
"outline-none",
|
|
8283
8796
|
"has-[input:disabled]:pointer-events-none",
|
|
8797
|
+
"has-[input:disabled]:cursor-not-allowed",
|
|
8284
8798
|
"has-[input:disabled]:opacity-50"
|
|
8285
8799
|
);
|
|
8286
|
-
|
|
8800
|
+
if (modifiers.includes("table")) {
|
|
8801
|
+
el.classList.add(
|
|
8802
|
+
"size-full",
|
|
8803
|
+
"h-10",
|
|
8804
|
+
"has-[input:focus-visible]:inset-ring-ring/50",
|
|
8805
|
+
"has-[input:focus-visible]:inset-ring-2",
|
|
8806
|
+
"has-[input[aria-invalid=true]]:inset-ring-negative/20",
|
|
8807
|
+
"dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
|
|
8808
|
+
"has-[input:invalid]:!inset-ring-negative/20",
|
|
8809
|
+
"dark:has-[input:invalid]:!inset-ring-negative/40"
|
|
8810
|
+
);
|
|
8811
|
+
el.setAttribute("data-slot", "cell-input-time");
|
|
8812
|
+
} else {
|
|
8813
|
+
el.classList.add(
|
|
8814
|
+
"w-full",
|
|
8815
|
+
"rounded-control",
|
|
8816
|
+
"border",
|
|
8817
|
+
"bg-input-inner",
|
|
8818
|
+
"shadow-input",
|
|
8819
|
+
"has-[input:focus-visible]:border-ring",
|
|
8820
|
+
"has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
|
|
8821
|
+
"has-[input:focus-visible]:ring-ring/50",
|
|
8822
|
+
"has-[input[aria-invalid=true]]:ring-negative/20",
|
|
8823
|
+
"has-[input[aria-invalid=true]]:border-negative",
|
|
8824
|
+
"dark:has-[input[aria-invalid=true]]:ring-negative/40",
|
|
8825
|
+
"has-[input:invalid]:ring-negative/20",
|
|
8826
|
+
"has-[input:invalid]:border-negative",
|
|
8827
|
+
"dark:has-[input:invalid]:ring-negative/40"
|
|
8828
|
+
);
|
|
8829
|
+
el.setAttribute("data-slot", "time-picker");
|
|
8830
|
+
}
|
|
8287
8831
|
el.setAttribute("tabindex", "-1");
|
|
8288
8832
|
el.appendChild(
|
|
8289
8833
|
createSvg({
|
|
@@ -8369,7 +8913,20 @@ function timepicker_default(Alpine) {
|
|
|
8369
8913
|
timepicker._h_timepicker.id = `htp${v4_default()}`;
|
|
8370
8914
|
el.setAttribute("id", timepicker._h_timepicker.id);
|
|
8371
8915
|
}
|
|
8372
|
-
el.classList.add(
|
|
8916
|
+
el.classList.add(
|
|
8917
|
+
"appearance-none",
|
|
8918
|
+
"cursor-pointer",
|
|
8919
|
+
"bg-transparent",
|
|
8920
|
+
"text-transparent",
|
|
8921
|
+
"text-shadow-[0_0_0_var(--foreground)]",
|
|
8922
|
+
"placeholder:text-muted-foreground",
|
|
8923
|
+
"outline-none",
|
|
8924
|
+
"size-full",
|
|
8925
|
+
"border-0",
|
|
8926
|
+
"md:text-sm",
|
|
8927
|
+
"text-base",
|
|
8928
|
+
"truncate"
|
|
8929
|
+
);
|
|
8373
8930
|
el.setAttribute("aria-autocomplete", "none");
|
|
8374
8931
|
el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
|
|
8375
8932
|
el.setAttribute("aria-expanded", "false");
|
|
@@ -8917,8 +9474,8 @@ function toolbar_default(Alpine) {
|
|
|
8917
9474
|
"shrink-0",
|
|
8918
9475
|
"items-center",
|
|
8919
9476
|
"px-1",
|
|
8920
|
-
'has-[>[data-slot="avatar"]:last-
|
|
8921
|
-
'has-[>[data-slot="toolbar-image"]:first-
|
|
9477
|
+
'has-[>[data-slot="avatar"]:last-of-type]:pr-2',
|
|
9478
|
+
'has-[>[data-slot="toolbar-image"]:first-of-type]:pl-2',
|
|
8922
9479
|
"gap-1",
|
|
8923
9480
|
modifiers.includes("footer") ? "border-t" : "border-b",
|
|
8924
9481
|
"w-full",
|
|
@@ -9257,7 +9814,7 @@ function tree_default(Alpine) {
|
|
|
9257
9814
|
}
|
|
9258
9815
|
|
|
9259
9816
|
// package.json
|
|
9260
|
-
var version = "1.
|
|
9817
|
+
var version = "1.2.0";
|
|
9261
9818
|
|
|
9262
9819
|
// src/utils/breakpoint-listener.js
|
|
9263
9820
|
function getBreakpointListener(handler, breakpoint = 768) {
|
|
@@ -9374,6 +9931,7 @@ function template_default(Alpine) {
|
|
|
9374
9931
|
Alpine2.initTree(clone);
|
|
9375
9932
|
});
|
|
9376
9933
|
cleanup(() => {
|
|
9934
|
+
Alpine2.destroyTree(clone);
|
|
9377
9935
|
clone.remove();
|
|
9378
9936
|
});
|
|
9379
9937
|
} else {
|