@codbex/harmonia 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harmonia.css +2 -2
- package/dist/harmonia.esm.js +224 -157
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +223 -158
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +9 -9
package/dist/harmonia.js
CHANGED
|
@@ -304,10 +304,10 @@
|
|
|
304
304
|
}) : { single: false };
|
|
305
305
|
el.setAttribute("data-slot", "accordion");
|
|
306
306
|
});
|
|
307
|
-
Alpine.directive("h-accordion-item", (el, { original, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
|
|
307
|
+
Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
|
|
308
308
|
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
309
309
|
if (!accordion) {
|
|
310
|
-
throw new Error(`${
|
|
310
|
+
throw new Error(`${original2} must be inside an accordion`);
|
|
311
311
|
}
|
|
312
312
|
el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
|
|
313
313
|
el.setAttribute("data-slot", "accordion-item");
|
|
@@ -335,14 +335,14 @@
|
|
|
335
335
|
setAttributes();
|
|
336
336
|
effect(setAttributes);
|
|
337
337
|
});
|
|
338
|
-
Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
338
|
+
Alpine.directive("h-accordion-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
|
|
339
339
|
if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
|
|
340
|
-
throw new Error(`${
|
|
340
|
+
throw new Error(`${original2} must be a header element`);
|
|
341
341
|
}
|
|
342
342
|
const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
|
|
343
343
|
const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordionItem"));
|
|
344
344
|
if (!accordionItem || !accordion) {
|
|
345
|
-
throw new Error(`${
|
|
345
|
+
throw new Error(`${original2} must have an accordion and accordion item parent elements`);
|
|
346
346
|
}
|
|
347
347
|
el.classList.add(
|
|
348
348
|
"flex",
|
|
@@ -527,10 +527,10 @@
|
|
|
527
527
|
el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
|
|
528
528
|
}
|
|
529
529
|
});
|
|
530
|
-
Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
|
|
530
|
+
Alpine.directive("h-avatar-image", (el, { original: original2 }, { cleanup }) => {
|
|
531
531
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
532
532
|
if (!avatar) {
|
|
533
|
-
throw new Error(`${
|
|
533
|
+
throw new Error(`${original2} must be inside an avatar element`);
|
|
534
534
|
}
|
|
535
535
|
el.classList.add("aspect-square", "size-full");
|
|
536
536
|
el.setAttribute("data-slot", "avatar-image");
|
|
@@ -561,10 +561,10 @@
|
|
|
561
561
|
observer.disconnect();
|
|
562
562
|
});
|
|
563
563
|
});
|
|
564
|
-
Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
|
|
564
|
+
Alpine.directive("h-avatar-fallback", (el, { original: original2 }, { effect }) => {
|
|
565
565
|
const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
|
|
566
566
|
if (!avatar) {
|
|
567
|
-
throw new Error(`${
|
|
567
|
+
throw new Error(`${original2} must be inside an avatar element`);
|
|
568
568
|
}
|
|
569
569
|
el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
|
|
570
570
|
el.setAttribute("data-slot", "avatar-fallback");
|
|
@@ -773,7 +773,7 @@
|
|
|
773
773
|
}
|
|
774
774
|
};
|
|
775
775
|
function button_default(Alpine) {
|
|
776
|
-
Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
|
|
776
|
+
Alpine.directive("h-button", (el, { original: original2, modifiers }, { cleanup }) => {
|
|
777
777
|
setButtonClasses(el);
|
|
778
778
|
if (!el.hasAttribute("data-slot")) {
|
|
779
779
|
el.setAttribute("data-slot", "button");
|
|
@@ -790,7 +790,7 @@
|
|
|
790
790
|
el.classList.remove(...getButtonSize(lastSize, isAddon));
|
|
791
791
|
el.classList.add(...getButtonSize(size3, isAddon));
|
|
792
792
|
if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
793
|
-
console.error(`${
|
|
793
|
+
console.error(`${original2}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
|
|
794
794
|
}
|
|
795
795
|
lastSize = size3;
|
|
796
796
|
}
|
|
@@ -869,10 +869,6 @@
|
|
|
869
869
|
bottom: "top",
|
|
870
870
|
top: "bottom"
|
|
871
871
|
};
|
|
872
|
-
var oppositeAlignmentMap = {
|
|
873
|
-
start: "end",
|
|
874
|
-
end: "start"
|
|
875
|
-
};
|
|
876
872
|
function clamp(start, value, end2) {
|
|
877
873
|
return max(start, min(value, end2));
|
|
878
874
|
}
|
|
@@ -891,9 +887,9 @@
|
|
|
891
887
|
function getAxisLength(axis) {
|
|
892
888
|
return axis === "y" ? "height" : "width";
|
|
893
889
|
}
|
|
894
|
-
var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
895
890
|
function getSideAxis(placement) {
|
|
896
|
-
|
|
891
|
+
const firstChar = placement[0];
|
|
892
|
+
return firstChar === "t" || firstChar === "b" ? "y" : "x";
|
|
897
893
|
}
|
|
898
894
|
function getAlignmentAxis(placement) {
|
|
899
895
|
return getOppositeAxis(getSideAxis(placement));
|
|
@@ -916,7 +912,7 @@
|
|
|
916
912
|
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
917
913
|
}
|
|
918
914
|
function getOppositeAlignmentPlacement(placement) {
|
|
919
|
-
return placement.replace(
|
|
915
|
+
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
|
|
920
916
|
}
|
|
921
917
|
var lrPlacement = ["left", "right"];
|
|
922
918
|
var rlPlacement = ["right", "left"];
|
|
@@ -947,7 +943,8 @@
|
|
|
947
943
|
return list;
|
|
948
944
|
}
|
|
949
945
|
function getOppositePlacement(placement) {
|
|
950
|
-
|
|
946
|
+
const side = getSide(placement);
|
|
947
|
+
return oppositeSideMap[side] + placement.slice(side.length);
|
|
951
948
|
}
|
|
952
949
|
function expandPaddingObject(padding) {
|
|
953
950
|
return {
|
|
@@ -1097,6 +1094,7 @@
|
|
|
1097
1094
|
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1098
1095
|
};
|
|
1099
1096
|
}
|
|
1097
|
+
var MAX_RESET_COUNT = 50;
|
|
1100
1098
|
var computePosition = async (reference, floating, config) => {
|
|
1101
1099
|
const {
|
|
1102
1100
|
placement = "bottom",
|
|
@@ -1104,7 +1102,10 @@
|
|
|
1104
1102
|
middleware = [],
|
|
1105
1103
|
platform: platform2
|
|
1106
1104
|
} = config;
|
|
1107
|
-
const
|
|
1105
|
+
const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
|
|
1106
|
+
...platform2,
|
|
1107
|
+
detectOverflow
|
|
1108
|
+
};
|
|
1108
1109
|
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
1109
1110
|
let rects = await platform2.getElementRects({
|
|
1110
1111
|
reference,
|
|
@@ -1116,14 +1117,17 @@
|
|
|
1116
1117
|
y
|
|
1117
1118
|
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1118
1119
|
let statefulPlacement = placement;
|
|
1119
|
-
let middlewareData = {};
|
|
1120
1120
|
let resetCount = 0;
|
|
1121
|
-
|
|
1122
|
-
|
|
1121
|
+
const middlewareData = {};
|
|
1122
|
+
for (let i = 0; i < middleware.length; i++) {
|
|
1123
|
+
const currentMiddleware = middleware[i];
|
|
1124
|
+
if (!currentMiddleware) {
|
|
1125
|
+
continue;
|
|
1126
|
+
}
|
|
1123
1127
|
const {
|
|
1124
1128
|
name,
|
|
1125
1129
|
fn
|
|
1126
|
-
} =
|
|
1130
|
+
} = currentMiddleware;
|
|
1127
1131
|
const {
|
|
1128
1132
|
x: nextX,
|
|
1129
1133
|
y: nextY,
|
|
@@ -1137,10 +1141,7 @@
|
|
|
1137
1141
|
strategy,
|
|
1138
1142
|
middlewareData,
|
|
1139
1143
|
rects,
|
|
1140
|
-
platform:
|
|
1141
|
-
...platform2,
|
|
1142
|
-
detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
1143
|
-
},
|
|
1144
|
+
platform: platformWithDetectOverflow,
|
|
1144
1145
|
elements: {
|
|
1145
1146
|
reference,
|
|
1146
1147
|
floating
|
|
@@ -1148,14 +1149,11 @@
|
|
|
1148
1149
|
});
|
|
1149
1150
|
x = nextX != null ? nextX : x;
|
|
1150
1151
|
y = nextY != null ? nextY : y;
|
|
1151
|
-
middlewareData = {
|
|
1152
|
-
...middlewareData,
|
|
1153
|
-
|
|
1154
|
-
...middlewareData[name],
|
|
1155
|
-
...data
|
|
1156
|
-
}
|
|
1152
|
+
middlewareData[name] = {
|
|
1153
|
+
...middlewareData[name],
|
|
1154
|
+
...data
|
|
1157
1155
|
};
|
|
1158
|
-
if (reset && resetCount
|
|
1156
|
+
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
1159
1157
|
resetCount++;
|
|
1160
1158
|
if (typeof reset === "object") {
|
|
1161
1159
|
if (reset.placement) {
|
|
@@ -1617,7 +1615,6 @@
|
|
|
1617
1615
|
}
|
|
1618
1616
|
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1619
1617
|
}
|
|
1620
|
-
var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
1621
1618
|
function isOverflowElement(element) {
|
|
1622
1619
|
const {
|
|
1623
1620
|
overflow,
|
|
@@ -1625,29 +1622,31 @@
|
|
|
1625
1622
|
overflowY,
|
|
1626
1623
|
display
|
|
1627
1624
|
} = getComputedStyle2(element);
|
|
1628
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) &&
|
|
1625
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
|
|
1629
1626
|
}
|
|
1630
|
-
var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
1631
1627
|
function isTableElement(element) {
|
|
1632
|
-
return
|
|
1628
|
+
return /^(table|td|th)$/.test(getNodeName(element));
|
|
1633
1629
|
}
|
|
1634
|
-
var topLayerSelectors = [":popover-open", ":modal"];
|
|
1635
1630
|
function isTopLayer(element) {
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
return
|
|
1639
|
-
} catch (_e) {
|
|
1640
|
-
return false;
|
|
1631
|
+
try {
|
|
1632
|
+
if (element.matches(":popover-open")) {
|
|
1633
|
+
return true;
|
|
1641
1634
|
}
|
|
1642
|
-
})
|
|
1635
|
+
} catch (_e) {
|
|
1636
|
+
}
|
|
1637
|
+
try {
|
|
1638
|
+
return element.matches(":modal");
|
|
1639
|
+
} catch (_e) {
|
|
1640
|
+
return false;
|
|
1641
|
+
}
|
|
1643
1642
|
}
|
|
1644
|
-
var
|
|
1645
|
-
var
|
|
1646
|
-
var
|
|
1643
|
+
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
1644
|
+
var containRe = /paint|layout|strict|content/;
|
|
1645
|
+
var isNotNone = (value) => !!value && value !== "none";
|
|
1646
|
+
var isWebKitValue;
|
|
1647
1647
|
function isContainingBlock(elementOrCss) {
|
|
1648
|
-
const webkit = isWebKit();
|
|
1649
1648
|
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
1650
|
-
return
|
|
1649
|
+
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
|
|
1651
1650
|
}
|
|
1652
1651
|
function getContainingBlock(element) {
|
|
1653
1652
|
let currentNode = getParentNode(element);
|
|
@@ -1662,12 +1661,13 @@
|
|
|
1662
1661
|
return null;
|
|
1663
1662
|
}
|
|
1664
1663
|
function isWebKit() {
|
|
1665
|
-
if (
|
|
1666
|
-
|
|
1664
|
+
if (isWebKitValue == null) {
|
|
1665
|
+
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
|
|
1666
|
+
}
|
|
1667
|
+
return isWebKitValue;
|
|
1667
1668
|
}
|
|
1668
|
-
var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
1669
1669
|
function isLastTraversableNode(node) {
|
|
1670
|
-
return
|
|
1670
|
+
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
1671
1671
|
}
|
|
1672
1672
|
function getComputedStyle2(element) {
|
|
1673
1673
|
return getWindow(element).getComputedStyle(element);
|
|
@@ -1721,8 +1721,9 @@
|
|
|
1721
1721
|
if (isBody) {
|
|
1722
1722
|
const frameElement = getFrameElement(win);
|
|
1723
1723
|
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1724
|
+
} else {
|
|
1725
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1724
1726
|
}
|
|
1725
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1726
1727
|
}
|
|
1727
1728
|
function getFrameElement(win) {
|
|
1728
1729
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
@@ -1886,7 +1887,7 @@
|
|
|
1886
1887
|
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1887
1888
|
scroll = getNodeScroll(offsetParent);
|
|
1888
1889
|
}
|
|
1889
|
-
if (
|
|
1890
|
+
if (isOffsetParentAnElement) {
|
|
1890
1891
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1891
1892
|
scale = getScale(offsetParent);
|
|
1892
1893
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
@@ -1960,7 +1961,6 @@
|
|
|
1960
1961
|
y
|
|
1961
1962
|
};
|
|
1962
1963
|
}
|
|
1963
|
-
var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
1964
1964
|
function getInnerBoundingClientRect(element, strategy) {
|
|
1965
1965
|
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
1966
1966
|
const top2 = clientRect.top + element.clientTop;
|
|
@@ -2018,7 +2018,7 @@
|
|
|
2018
2018
|
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
2019
2019
|
currentContainingBlockComputedStyle = null;
|
|
2020
2020
|
}
|
|
2021
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle &&
|
|
2021
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2022
2022
|
if (shouldDropCurrentNode) {
|
|
2023
2023
|
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2024
2024
|
} else {
|
|
@@ -2038,20 +2038,23 @@
|
|
|
2038
2038
|
} = _ref;
|
|
2039
2039
|
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2040
2040
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2041
|
+
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
2042
|
+
let top2 = firstRect.top;
|
|
2043
|
+
let right = firstRect.right;
|
|
2044
|
+
let bottom = firstRect.bottom;
|
|
2045
|
+
let left = firstRect.left;
|
|
2046
|
+
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
2047
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
2048
|
+
top2 = max(rect.top, top2);
|
|
2049
|
+
right = min(rect.right, right);
|
|
2050
|
+
bottom = min(rect.bottom, bottom);
|
|
2051
|
+
left = max(rect.left, left);
|
|
2052
|
+
}
|
|
2050
2053
|
return {
|
|
2051
|
-
width:
|
|
2052
|
-
height:
|
|
2053
|
-
x:
|
|
2054
|
-
y:
|
|
2054
|
+
width: right - left,
|
|
2055
|
+
height: bottom - top2,
|
|
2056
|
+
x: left,
|
|
2057
|
+
y: top2
|
|
2055
2058
|
};
|
|
2056
2059
|
}
|
|
2057
2060
|
function getDimensions(element) {
|
|
@@ -2260,7 +2263,7 @@
|
|
|
2260
2263
|
animationFrame = false
|
|
2261
2264
|
} = options;
|
|
2262
2265
|
const referenceEl = unwrapElement(reference);
|
|
2263
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
2266
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
|
|
2264
2267
|
ancestors.forEach((ancestor) => {
|
|
2265
2268
|
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
2266
2269
|
passive: true
|
|
@@ -2273,7 +2276,7 @@
|
|
|
2273
2276
|
if (elementResize) {
|
|
2274
2277
|
resizeObserver = new ResizeObserver((_ref) => {
|
|
2275
2278
|
let [firstEntry] = _ref;
|
|
2276
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
2279
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
2277
2280
|
resizeObserver.unobserve(floating);
|
|
2278
2281
|
cancelAnimationFrame(reobserveFrame);
|
|
2279
2282
|
reobserveFrame = requestAnimationFrame(() => {
|
|
@@ -2286,7 +2289,9 @@
|
|
|
2286
2289
|
if (referenceEl && !animationFrame) {
|
|
2287
2290
|
resizeObserver.observe(referenceEl);
|
|
2288
2291
|
}
|
|
2289
|
-
|
|
2292
|
+
if (floating) {
|
|
2293
|
+
resizeObserver.observe(floating);
|
|
2294
|
+
}
|
|
2290
2295
|
}
|
|
2291
2296
|
let frameId;
|
|
2292
2297
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
@@ -2339,7 +2344,7 @@
|
|
|
2339
2344
|
|
|
2340
2345
|
// src/components/calendar.js
|
|
2341
2346
|
function calendar_default(Alpine) {
|
|
2342
|
-
Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
2347
|
+
Alpine.directive("h-calendar", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
2343
2348
|
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
2344
2349
|
el.classList.add("border", "rounded-control", "gap-2", "p-2");
|
|
2345
2350
|
el.setAttribute("tabindex", "-1");
|
|
@@ -2383,7 +2388,7 @@
|
|
|
2383
2388
|
const onInputChange = () => {
|
|
2384
2389
|
const newValue = new Date(datepicker._h_datepicker.input.value);
|
|
2385
2390
|
if (isNaN(newValue)) {
|
|
2386
|
-
console.error(`${
|
|
2391
|
+
console.error(`${original2}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
|
|
2387
2392
|
datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2388
2393
|
return;
|
|
2389
2394
|
} else if (selected.getTime() !== newValue.getTime()) {
|
|
@@ -2400,7 +2405,7 @@
|
|
|
2400
2405
|
if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
|
|
2401
2406
|
selected = new Date(el._x_model.get());
|
|
2402
2407
|
if (isNaN(selected)) {
|
|
2403
|
-
console.error(`${
|
|
2408
|
+
console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
|
|
2404
2409
|
if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
|
|
2405
2410
|
else el.setAttribute("data-invalid", "true");
|
|
2406
2411
|
} else if (datepicker) {
|
|
@@ -2909,10 +2914,10 @@
|
|
|
2909
2914
|
});
|
|
2910
2915
|
}
|
|
2911
2916
|
});
|
|
2912
|
-
Alpine.directive("h-collapsible-trigger", (el, { original, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
2917
|
+
Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
|
|
2913
2918
|
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
2914
2919
|
if (!collapsible) {
|
|
2915
|
-
throw new Error(`${
|
|
2920
|
+
throw new Error(`${original2} must be inside a collapsible element`);
|
|
2916
2921
|
}
|
|
2917
2922
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
|
|
2918
2923
|
if (modifiers.includes("chevron")) {
|
|
@@ -2931,10 +2936,10 @@
|
|
|
2931
2936
|
el.removeEventListener("click", handler);
|
|
2932
2937
|
});
|
|
2933
2938
|
});
|
|
2934
|
-
Alpine.directive("h-collapsible-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
2939
|
+
Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
2935
2940
|
const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
|
|
2936
2941
|
if (!collapsible) {
|
|
2937
|
-
throw new Error(`${
|
|
2942
|
+
throw new Error(`${original2} must be inside an h-collapsible element`);
|
|
2938
2943
|
}
|
|
2939
2944
|
if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
|
|
2940
2945
|
el.classList.add("data-[state=closed]:!hidden");
|
|
@@ -2965,7 +2970,7 @@
|
|
|
2965
2970
|
|
|
2966
2971
|
// src/components/datepicker.js
|
|
2967
2972
|
function datepicker_default(Alpine) {
|
|
2968
|
-
Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
2973
|
+
Alpine.directive("h-date-picker", (el, { original: original2, modifiers }, { Alpine: Alpine2, cleanup }) => {
|
|
2969
2974
|
const state = Alpine2.reactive({
|
|
2970
2975
|
expanded: false
|
|
2971
2976
|
});
|
|
@@ -2978,7 +2983,7 @@
|
|
|
2978
2983
|
};
|
|
2979
2984
|
el._h_datepicker.input = el.querySelector("input");
|
|
2980
2985
|
if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
|
|
2981
|
-
throw new Error(`${
|
|
2986
|
+
throw new Error(`${original2} must contain an input`);
|
|
2982
2987
|
} else if (el._h_datepicker.input.hasAttribute("id")) {
|
|
2983
2988
|
el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
|
|
2984
2989
|
} else {
|
|
@@ -3055,16 +3060,16 @@
|
|
|
3055
3060
|
observer.disconnect();
|
|
3056
3061
|
});
|
|
3057
3062
|
});
|
|
3058
|
-
Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
3063
|
+
Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
3059
3064
|
if (el.tagName !== "BUTTON") {
|
|
3060
|
-
throw new Error(`${
|
|
3065
|
+
throw new Error(`${original2} must be a button`);
|
|
3061
3066
|
}
|
|
3062
3067
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3063
|
-
throw new Error(`${
|
|
3068
|
+
throw new Error(`${original2}: must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3064
3069
|
}
|
|
3065
3070
|
const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
|
|
3066
3071
|
if (!datepicker) {
|
|
3067
|
-
throw new Error(`${
|
|
3072
|
+
throw new Error(`${original2} must be inside an date-picker element`);
|
|
3068
3073
|
}
|
|
3069
3074
|
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
3075
|
if (datepicker._h_datepicker.inTable) {
|
|
@@ -3344,13 +3349,13 @@
|
|
|
3344
3349
|
|
|
3345
3350
|
// src/components/icon.js
|
|
3346
3351
|
function icon_default(Alpine) {
|
|
3347
|
-
Alpine.directive("h-icon", (el, { original, modifiers }) => {
|
|
3352
|
+
Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
|
|
3348
3353
|
if (el.tagName.toLowerCase() !== "svg") {
|
|
3349
|
-
throw new Error(`${
|
|
3354
|
+
throw new Error(`${original2} works only on svg elements`);
|
|
3350
3355
|
} else if (!el.hasAttribute("role")) {
|
|
3351
|
-
throw new Error(`${
|
|
3356
|
+
throw new Error(`${original2} must have a role`);
|
|
3352
3357
|
} else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3353
|
-
throw new Error(`${
|
|
3358
|
+
throw new Error(`${original2}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3354
3359
|
}
|
|
3355
3360
|
el.classList.add("fill-current");
|
|
3356
3361
|
el.setAttribute("data-slot", "icon");
|
|
@@ -3567,7 +3572,7 @@
|
|
|
3567
3572
|
el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
|
|
3568
3573
|
el.setAttribute("data-slot", "label");
|
|
3569
3574
|
});
|
|
3570
|
-
Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
|
|
3575
|
+
Alpine.directive("h-input-number", (el, { original: original2 }, { cleanup }) => {
|
|
3571
3576
|
el.classList.add(
|
|
3572
3577
|
"overflow-hidden",
|
|
3573
3578
|
"group/input-number",
|
|
@@ -3600,7 +3605,7 @@
|
|
|
3600
3605
|
el.setAttribute("data-slot", "input-number");
|
|
3601
3606
|
const input = el.querySelector("input");
|
|
3602
3607
|
if (!input || input.getAttribute("type") !== "number") {
|
|
3603
|
-
throw new Error(`${
|
|
3608
|
+
throw new Error(`${original2} must contain an input of type 'number'`);
|
|
3604
3609
|
}
|
|
3605
3610
|
if (!input.hasAttribute("type")) input.setAttribute("type", "number");
|
|
3606
3611
|
if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
|
|
@@ -3846,13 +3851,13 @@
|
|
|
3846
3851
|
el.setAttribute("data-slot", "list");
|
|
3847
3852
|
el.setAttribute("role", "group");
|
|
3848
3853
|
});
|
|
3849
|
-
Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
|
|
3854
|
+
Alpine.directive("h-list-header", (el, { original: original2 }, { Alpine: Alpine2 }) => {
|
|
3850
3855
|
el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
|
|
3851
3856
|
el.setAttribute("role", "presentation");
|
|
3852
3857
|
el.setAttribute("data-slot", "list-header");
|
|
3853
3858
|
const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
|
|
3854
3859
|
if (!list) {
|
|
3855
|
-
throw new Error(`${
|
|
3860
|
+
throw new Error(`${original2} must be placed inside a list element`);
|
|
3856
3861
|
}
|
|
3857
3862
|
if (!el.hasAttribute("id")) {
|
|
3858
3863
|
const id = `lbh${v4_default()}`;
|
|
@@ -3904,9 +3909,9 @@
|
|
|
3904
3909
|
};
|
|
3905
3910
|
el.setAttribute("data-state", "closed");
|
|
3906
3911
|
});
|
|
3907
|
-
Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
3912
|
+
Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
|
|
3908
3913
|
if (el.tagName !== "UL") {
|
|
3909
|
-
throw new Error(`${
|
|
3914
|
+
throw new Error(`${original2} must be an ul element`);
|
|
3910
3915
|
}
|
|
3911
3916
|
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");
|
|
3912
3917
|
el.setAttribute("role", "menu");
|
|
@@ -3914,7 +3919,7 @@
|
|
|
3914
3919
|
el.setAttribute("tabindex", "-1");
|
|
3915
3920
|
el.setAttribute("data-slot", "menu");
|
|
3916
3921
|
if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
|
|
3917
|
-
throw new Error(`${
|
|
3922
|
+
throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
|
|
3918
3923
|
}
|
|
3919
3924
|
const isSubmenu = modifiers.includes("sub");
|
|
3920
3925
|
const menuTrigger = (() => {
|
|
@@ -3926,7 +3931,7 @@
|
|
|
3926
3931
|
return sibling;
|
|
3927
3932
|
})();
|
|
3928
3933
|
if (!isSubmenu && !menuTrigger) {
|
|
3929
|
-
throw new Error(`${
|
|
3934
|
+
throw new Error(`${original2} menu must be placed after a menu trigger element`);
|
|
3930
3935
|
}
|
|
3931
3936
|
let menuSubItem;
|
|
3932
3937
|
if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
|
|
@@ -4145,9 +4150,9 @@
|
|
|
4145
4150
|
el.removeEventListener("keydown", onKeyDown);
|
|
4146
4151
|
});
|
|
4147
4152
|
});
|
|
4148
|
-
Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4153
|
+
Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
4149
4154
|
if (el.tagName !== "LI") {
|
|
4150
|
-
throw new Error(`${
|
|
4155
|
+
throw new Error(`${original2} must be a li element`);
|
|
4151
4156
|
}
|
|
4152
4157
|
el.classList.add(
|
|
4153
4158
|
"focus:bg-secondary-hover",
|
|
@@ -4201,7 +4206,7 @@
|
|
|
4201
4206
|
el.removeEventListener("mouseleave", focusOut);
|
|
4202
4207
|
});
|
|
4203
4208
|
});
|
|
4204
|
-
Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4209
|
+
Alpine.directive("h-menu-sub", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
4205
4210
|
el.classList.add(
|
|
4206
4211
|
"focus:bg-secondary-hover",
|
|
4207
4212
|
"hover:bg-secondary-hover",
|
|
@@ -4233,7 +4238,7 @@
|
|
|
4233
4238
|
const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
|
|
4234
4239
|
el.appendChild(chevronRight);
|
|
4235
4240
|
const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
|
|
4236
|
-
if (!parentMenu) throw new Error(`${
|
|
4241
|
+
if (!parentMenu) throw new Error(`${original2} must have a parent`);
|
|
4237
4242
|
el._menu_sub = {
|
|
4238
4243
|
open: void 0,
|
|
4239
4244
|
close: void 0,
|
|
@@ -4327,9 +4332,9 @@
|
|
|
4327
4332
|
el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
|
|
4328
4333
|
el.setAttribute("data-slot", "menu-label");
|
|
4329
4334
|
});
|
|
4330
|
-
Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
4335
|
+
Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
4331
4336
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
4332
|
-
throw new Error(`${
|
|
4337
|
+
throw new Error(`${original2} must be a li or div element`);
|
|
4333
4338
|
}
|
|
4334
4339
|
el.classList.add(
|
|
4335
4340
|
"focus:bg-secondary-hover",
|
|
@@ -4395,9 +4400,9 @@
|
|
|
4395
4400
|
el.removeEventListener("mouseleave", focusOut);
|
|
4396
4401
|
});
|
|
4397
4402
|
});
|
|
4398
|
-
Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4403
|
+
Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
|
|
4399
4404
|
if (el.tagName !== "LI" && el.tagName !== "DIV") {
|
|
4400
|
-
throw new Error(`${
|
|
4405
|
+
throw new Error(`${original2} must be a li or div element`);
|
|
4401
4406
|
}
|
|
4402
4407
|
el.classList.add(
|
|
4403
4408
|
"focus:bg-secondary-hover",
|
|
@@ -4626,7 +4631,7 @@
|
|
|
4626
4631
|
});
|
|
4627
4632
|
}
|
|
4628
4633
|
});
|
|
4629
|
-
Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
|
|
4634
|
+
Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
|
|
4630
4635
|
const popover = (() => {
|
|
4631
4636
|
let sibling = el.previousElementSibling;
|
|
4632
4637
|
while (sibling && !sibling.hasOwnProperty("_popover")) {
|
|
@@ -4635,7 +4640,7 @@
|
|
|
4635
4640
|
return sibling;
|
|
4636
4641
|
})();
|
|
4637
4642
|
if (!popover) {
|
|
4638
|
-
throw new Error(`${
|
|
4643
|
+
throw new Error(`${original2} must be placed after a popover element`);
|
|
4639
4644
|
}
|
|
4640
4645
|
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-md", "border", "shadow-md", "outline-hidden", "overflow-auto");
|
|
4641
4646
|
el.setAttribute("data-slot", "popover");
|
|
@@ -6697,9 +6702,9 @@
|
|
|
6697
6702
|
});
|
|
6698
6703
|
}
|
|
6699
6704
|
});
|
|
6700
|
-
Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6705
|
+
Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
6701
6706
|
if (el.tagName !== "INPUT") {
|
|
6702
|
-
throw new Error(`${
|
|
6707
|
+
throw new Error(`${original2} must be an input of type "text"`);
|
|
6703
6708
|
}
|
|
6704
6709
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
6705
6710
|
const label = (() => {
|
|
@@ -6710,7 +6715,7 @@
|
|
|
6710
6715
|
return;
|
|
6711
6716
|
})();
|
|
6712
6717
|
if (!select) {
|
|
6713
|
-
throw new Error(`${
|
|
6718
|
+
throw new Error(`${original2} must be inside a select element`);
|
|
6714
6719
|
} else if (el.hasOwnProperty("_x_model")) {
|
|
6715
6720
|
select._h_select.multiple = Array.isArray(el._x_model.get());
|
|
6716
6721
|
select._h_model.set = (value) => {
|
|
@@ -6730,6 +6735,7 @@
|
|
|
6730
6735
|
} else {
|
|
6731
6736
|
el._x_model.set("");
|
|
6732
6737
|
}
|
|
6738
|
+
el.dispatchEvent(new Event("change", { bubbles: true }));
|
|
6733
6739
|
};
|
|
6734
6740
|
select._h_model.get = el._x_model.get;
|
|
6735
6741
|
} else {
|
|
@@ -6970,10 +6976,10 @@
|
|
|
6970
6976
|
}
|
|
6971
6977
|
});
|
|
6972
6978
|
});
|
|
6973
|
-
Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
6979
|
+
Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
6974
6980
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
6975
6981
|
if (!select) {
|
|
6976
|
-
throw new Error(`${
|
|
6982
|
+
throw new Error(`${original2} must be inside a select element`);
|
|
6977
6983
|
}
|
|
6978
6984
|
el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "p-1", "top-0", "left-0", "z-50", "min-w-[1rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "border", "shadow-md");
|
|
6979
6985
|
el.setAttribute("data-slot", "select-content");
|
|
@@ -6982,7 +6988,7 @@
|
|
|
6982
6988
|
el.setAttribute("tabindex", "-1");
|
|
6983
6989
|
el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
|
|
6984
6990
|
if (!select._h_select.trigger) {
|
|
6985
|
-
throw new Error(`${
|
|
6991
|
+
throw new Error(`${original2}: trigger not found`);
|
|
6986
6992
|
}
|
|
6987
6993
|
let autoUpdateCleanup;
|
|
6988
6994
|
function updatePosition() {
|
|
@@ -7024,10 +7030,10 @@
|
|
|
7024
7030
|
}
|
|
7025
7031
|
});
|
|
7026
7032
|
});
|
|
7027
|
-
Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7033
|
+
Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7028
7034
|
const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
7029
7035
|
if (!select) {
|
|
7030
|
-
throw new Error(`${
|
|
7036
|
+
throw new Error(`${original2} must be inside an h-select element`);
|
|
7031
7037
|
} else {
|
|
7032
7038
|
select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
|
|
7033
7039
|
}
|
|
@@ -7099,10 +7105,10 @@
|
|
|
7099
7105
|
selectGroup._h_selectGroup.labelledby = id;
|
|
7100
7106
|
}
|
|
7101
7107
|
});
|
|
7102
|
-
Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
|
|
7108
|
+
Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
|
|
7103
7109
|
const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
|
|
7104
7110
|
if (!select) {
|
|
7105
|
-
throw new Error(`${
|
|
7111
|
+
throw new Error(`${original2} must be inside an h-select element`);
|
|
7106
7112
|
}
|
|
7107
7113
|
el.classList.add(
|
|
7108
7114
|
"focus:bg-primary",
|
|
@@ -7356,10 +7362,10 @@
|
|
|
7356
7362
|
});
|
|
7357
7363
|
}
|
|
7358
7364
|
});
|
|
7359
|
-
Alpine.directive("h-sidebar-group-label", (el, { original }, { cleanup }) => {
|
|
7365
|
+
Alpine.directive("h-sidebar-group-label", (el, { original: original2 }, { cleanup }) => {
|
|
7360
7366
|
const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
|
|
7361
7367
|
if (!group) {
|
|
7362
|
-
throw new Error(`${
|
|
7368
|
+
throw new Error(`${original2} must be placed inside a sidebar group`);
|
|
7363
7369
|
}
|
|
7364
7370
|
el.classList.add(
|
|
7365
7371
|
"ring-sidebar-ring",
|
|
@@ -7446,10 +7452,10 @@
|
|
|
7446
7452
|
}
|
|
7447
7453
|
el.setAttribute("data-slot", "sidebar-group-action");
|
|
7448
7454
|
});
|
|
7449
|
-
Alpine.directive("h-sidebar-group-content", (el, { original }, { effect }) => {
|
|
7455
|
+
Alpine.directive("h-sidebar-group-content", (el, { original: original2 }, { effect }) => {
|
|
7450
7456
|
const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
|
|
7451
7457
|
if (!group) {
|
|
7452
|
-
throw new Error(`${
|
|
7458
|
+
throw new Error(`${original2} must be placed inside a sidebar group`);
|
|
7453
7459
|
}
|
|
7454
7460
|
el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
|
|
7455
7461
|
el.setAttribute("data-slot", "sidebar-group-content");
|
|
@@ -7462,16 +7468,16 @@
|
|
|
7462
7468
|
});
|
|
7463
7469
|
}
|
|
7464
7470
|
});
|
|
7465
|
-
Alpine.directive("h-sidebar-menu", (el, { original }) => {
|
|
7471
|
+
Alpine.directive("h-sidebar-menu", (el, { original: original2 }) => {
|
|
7466
7472
|
if (el.tagName !== "UL") {
|
|
7467
|
-
throw new Error(`${
|
|
7473
|
+
throw new Error(`${original2} must be an ul element`);
|
|
7468
7474
|
}
|
|
7469
7475
|
el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
|
|
7470
7476
|
el.setAttribute("data-slot", "sidebar-menu");
|
|
7471
7477
|
});
|
|
7472
|
-
Alpine.directive("h-sidebar-menu-item", (el, { original, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
7478
|
+
Alpine.directive("h-sidebar-menu-item", (el, { original: original2, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
|
|
7473
7479
|
if (el.tagName !== "LI") {
|
|
7474
|
-
throw new Error(`${
|
|
7480
|
+
throw new Error(`${original2} must be a li element`);
|
|
7475
7481
|
}
|
|
7476
7482
|
el._h_sidebar_menu_item = {
|
|
7477
7483
|
isSub: false,
|
|
@@ -7507,9 +7513,9 @@
|
|
|
7507
7513
|
});
|
|
7508
7514
|
}
|
|
7509
7515
|
});
|
|
7510
|
-
Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
|
|
7516
|
+
Alpine.directive("h-sidebar-menu-button", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
|
|
7511
7517
|
if (el.tagName !== "BUTTON" && el.tagName !== "A") {
|
|
7512
|
-
throw new Error(`${
|
|
7518
|
+
throw new Error(`${original2} must be a button or a link`);
|
|
7513
7519
|
} else if (el.tagName === "BUTTON") {
|
|
7514
7520
|
el.setAttribute("type", "button");
|
|
7515
7521
|
}
|
|
@@ -7645,9 +7651,9 @@
|
|
|
7645
7651
|
}
|
|
7646
7652
|
el.setAttribute("data-slot", "sidebar-menu-action");
|
|
7647
7653
|
});
|
|
7648
|
-
Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
|
|
7654
|
+
Alpine.directive("h-sidebar-menu-badge", (el, { original: original2 }) => {
|
|
7649
7655
|
if (el.tagName !== "SPAN") {
|
|
7650
|
-
throw new Error(`${
|
|
7656
|
+
throw new Error(`${original2} must be a span element`);
|
|
7651
7657
|
}
|
|
7652
7658
|
el.classList.add("flex-1", "pointer-events-none", "flex", "h-full", "min-w-min", "items-center", "justify-end", "text-xs", "font-medium", "tabular-nums", "select-none", "group-data-[collapsed=true]/sidebar:hidden");
|
|
7653
7659
|
el.setAttribute("data-slot", "sidebar-menu-badge");
|
|
@@ -7673,13 +7679,13 @@
|
|
|
7673
7679
|
el.setAttribute("data-slot", "sidebar-separator");
|
|
7674
7680
|
el.setAttribute("role", "none");
|
|
7675
7681
|
});
|
|
7676
|
-
Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
|
|
7682
|
+
Alpine.directive("h-sidebar-menu-sub", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
|
|
7677
7683
|
if (el.tagName !== "UL") {
|
|
7678
|
-
throw new Error(`${
|
|
7684
|
+
throw new Error(`${original2} must be an ul element`);
|
|
7679
7685
|
}
|
|
7680
7686
|
const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
|
|
7681
7687
|
if (!menuItem) {
|
|
7682
|
-
throw new Error(`${
|
|
7688
|
+
throw new Error(`${original2} must be placed inside a sidebar menu item`);
|
|
7683
7689
|
}
|
|
7684
7690
|
el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "pl-2.5", "py-0.5", "ml-3.5", "data-[collapsed=true]:!hidden", "group-data-[collapsed=true]/sidebar:!hidden");
|
|
7685
7691
|
if (el.getAttribute("data-line") !== "false") {
|
|
@@ -7914,6 +7920,10 @@
|
|
|
7914
7920
|
refreshGutters();
|
|
7915
7921
|
queueLayout();
|
|
7916
7922
|
},
|
|
7923
|
+
gutterHidden() {
|
|
7924
|
+
refreshGutters();
|
|
7925
|
+
queueLayout();
|
|
7926
|
+
},
|
|
7917
7927
|
panelChange() {
|
|
7918
7928
|
queueLayout();
|
|
7919
7929
|
},
|
|
@@ -7944,14 +7954,15 @@
|
|
|
7944
7954
|
observer.disconnect();
|
|
7945
7955
|
});
|
|
7946
7956
|
});
|
|
7947
|
-
Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7957
|
+
Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
7948
7958
|
const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
|
|
7949
7959
|
if (!split) {
|
|
7950
|
-
throw new Error(`${
|
|
7960
|
+
throw new Error(`${original2} must be inside an split element`);
|
|
7951
7961
|
}
|
|
7952
7962
|
el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
|
|
7953
7963
|
el.setAttribute("tabindex", "-1");
|
|
7954
7964
|
el.setAttribute("data-slot", "split-panel");
|
|
7965
|
+
let gutterless = el.getAttribute("data-gutterless") === "true";
|
|
7955
7966
|
const gutter = document.createElement("span");
|
|
7956
7967
|
gutter.setAttribute("data-slot", "split-gutter");
|
|
7957
7968
|
gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
|
|
@@ -8073,7 +8084,7 @@
|
|
|
8073
8084
|
}
|
|
8074
8085
|
},
|
|
8075
8086
|
setGutter(last) {
|
|
8076
|
-
if (this.hidden || last) {
|
|
8087
|
+
if (this.hidden || gutterless || last) {
|
|
8077
8088
|
gutter.remove();
|
|
8078
8089
|
} else if (!gutter.parentElement) {
|
|
8079
8090
|
el.after(gutter);
|
|
@@ -8187,7 +8198,10 @@
|
|
|
8187
8198
|
};
|
|
8188
8199
|
const observer = new MutationObserver((mutations) => {
|
|
8189
8200
|
mutations.forEach((mutation) => {
|
|
8190
|
-
if (mutation.attributeName === "data-
|
|
8201
|
+
if (mutation.attributeName === "data-gutterless") {
|
|
8202
|
+
gutterless = el.getAttribute("data-gutterless") === "true";
|
|
8203
|
+
split._h_split.gutterHidden();
|
|
8204
|
+
} else if (mutation.attributeName === "data-hidden") {
|
|
8191
8205
|
panel.hidden = el.getAttribute("data-hidden") === "true";
|
|
8192
8206
|
if (panel.hidden) {
|
|
8193
8207
|
el.classList.add("hidden");
|
|
@@ -8206,7 +8220,7 @@
|
|
|
8206
8220
|
}
|
|
8207
8221
|
});
|
|
8208
8222
|
});
|
|
8209
|
-
observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
|
|
8223
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse", "data-gutterless"] });
|
|
8210
8224
|
cleanup(() => {
|
|
8211
8225
|
gutter.remove();
|
|
8212
8226
|
gutter.removeEventListener("pointerdown", drag);
|
|
@@ -8467,7 +8481,7 @@
|
|
|
8467
8481
|
el.setAttribute("role", "tablist");
|
|
8468
8482
|
el.setAttribute("data-slot", "tab-list");
|
|
8469
8483
|
});
|
|
8470
|
-
Alpine.directive("h-tab", (el, { original }) => {
|
|
8484
|
+
Alpine.directive("h-tab", (el, { original: original2 }) => {
|
|
8471
8485
|
el.classList.add(
|
|
8472
8486
|
"cursor-pointer",
|
|
8473
8487
|
"focus-visible:border-ring",
|
|
@@ -8514,8 +8528,8 @@
|
|
|
8514
8528
|
);
|
|
8515
8529
|
el.setAttribute("role", "tab");
|
|
8516
8530
|
el.setAttribute("data-slot", "tab");
|
|
8517
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
8518
|
-
if (!el.hasAttribute("aria-controls")) throw new Error(`${
|
|
8531
|
+
if (!el.hasAttribute("id")) throw new Error(`${original2}: Tabs must have an id`);
|
|
8532
|
+
if (!el.hasAttribute("aria-controls")) throw new Error(`${original2}: aria-controls must be set to the tab-content id.`);
|
|
8519
8533
|
});
|
|
8520
8534
|
Alpine.directive("h-tab-action", (el) => {
|
|
8521
8535
|
el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
|
|
@@ -8549,13 +8563,13 @@
|
|
|
8549
8563
|
el.setAttribute("role", "button");
|
|
8550
8564
|
el.setAttribute("data-slot", "tab-list-action");
|
|
8551
8565
|
});
|
|
8552
|
-
Alpine.directive("h-tabs-content", (el, { original }) => {
|
|
8566
|
+
Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
|
|
8553
8567
|
el.classList.add("flex-1", "outline-none");
|
|
8554
8568
|
el.setAttribute("role", "tabpanel");
|
|
8555
8569
|
el.setAttribute("tabindex", "0");
|
|
8556
8570
|
el.setAttribute("data-slot", "tabs-content");
|
|
8557
|
-
if (!el.hasAttribute("id")) throw new Error(`${
|
|
8558
|
-
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${
|
|
8571
|
+
if (!el.hasAttribute("id")) throw new Error(`${original2}: Tab content must have an id`);
|
|
8572
|
+
if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original2}: aria-labelledby must be set to the tab id.`);
|
|
8559
8573
|
});
|
|
8560
8574
|
}
|
|
8561
8575
|
|
|
@@ -8948,13 +8962,13 @@
|
|
|
8948
8962
|
top.removeEventListener("click", el._h_timepicker.close);
|
|
8949
8963
|
});
|
|
8950
8964
|
});
|
|
8951
|
-
Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8965
|
+
Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
|
|
8952
8966
|
if (el.tagName !== "INPUT") {
|
|
8953
|
-
throw new Error(`${
|
|
8967
|
+
throw new Error(`${original2} must be a readonly input of type "text"`);
|
|
8954
8968
|
}
|
|
8955
8969
|
const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
|
|
8956
8970
|
if (!timepicker) {
|
|
8957
|
-
throw new Error(`${
|
|
8971
|
+
throw new Error(`${original2} must be inside a time-picker element`);
|
|
8958
8972
|
}
|
|
8959
8973
|
timepicker._h_timepicker.focusInput = () => {
|
|
8960
8974
|
el.focus();
|
|
@@ -9564,7 +9578,7 @@
|
|
|
9564
9578
|
el.setAttribute("data-slot", "toolbar-image");
|
|
9565
9579
|
});
|
|
9566
9580
|
Alpine.directive("h-toolbar-title", (el) => {
|
|
9567
|
-
el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
|
|
9581
|
+
el.classList.add("text", "[[data-size=sm]_&]:text-sm", "[[data-size=md]_&]:text-sm", "first-of-type:pl-2", "font-medium", "whitespace-nowrap", "text-ellipsis", "overflow-hidden");
|
|
9568
9582
|
el.setAttribute("data-slot", "toolbar-title");
|
|
9569
9583
|
});
|
|
9570
9584
|
Alpine.directive("h-toolbar-spacer", (el) => {
|
|
@@ -9603,7 +9617,7 @@
|
|
|
9603
9617
|
el.removeEventListener("pointerleave", handler);
|
|
9604
9618
|
});
|
|
9605
9619
|
});
|
|
9606
|
-
Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
|
|
9620
|
+
Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
|
|
9607
9621
|
const tooltip = (() => {
|
|
9608
9622
|
let sibling = el.previousElementSibling;
|
|
9609
9623
|
while (sibling && !sibling.hasOwnProperty("_tooltip")) {
|
|
@@ -9612,7 +9626,7 @@
|
|
|
9612
9626
|
return sibling;
|
|
9613
9627
|
})();
|
|
9614
9628
|
if (!tooltip) {
|
|
9615
|
-
throw new Error(`${
|
|
9629
|
+
throw new Error(`${original2} must be placed after a tooltip trigger element`);
|
|
9616
9630
|
}
|
|
9617
9631
|
el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
|
|
9618
9632
|
el.setAttribute("data-slot", "tooltip");
|
|
@@ -9818,9 +9832,9 @@
|
|
|
9818
9832
|
});
|
|
9819
9833
|
}
|
|
9820
9834
|
});
|
|
9821
|
-
Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
|
|
9835
|
+
Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
|
|
9822
9836
|
const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
|
|
9823
|
-
if (!treeItem) throw new Error(`${
|
|
9837
|
+
if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
|
|
9824
9838
|
el.classList.add(
|
|
9825
9839
|
"flex",
|
|
9826
9840
|
"w-full",
|
|
@@ -9943,6 +9957,12 @@
|
|
|
9943
9957
|
}
|
|
9944
9958
|
return "light";
|
|
9945
9959
|
};
|
|
9960
|
+
var getSystemColorScheme = () => {
|
|
9961
|
+
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
9962
|
+
return "dark";
|
|
9963
|
+
}
|
|
9964
|
+
return "light";
|
|
9965
|
+
};
|
|
9946
9966
|
var addColorSchemeListener = (callback) => {
|
|
9947
9967
|
callbacks.push(callback);
|
|
9948
9968
|
};
|
|
@@ -9975,7 +9995,7 @@
|
|
|
9975
9995
|
|
|
9976
9996
|
// src/utils/template.js
|
|
9977
9997
|
function template_default(Alpine) {
|
|
9978
|
-
Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
9998
|
+
Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
|
|
9979
9999
|
if (el.hasAttribute(Alpine2.prefixed("data"))) {
|
|
9980
10000
|
const template = evaluate2(expression);
|
|
9981
10001
|
const clone = template.content.cloneNode(true).firstElementChild;
|
|
@@ -9989,11 +10009,55 @@
|
|
|
9989
10009
|
clone.remove();
|
|
9990
10010
|
});
|
|
9991
10011
|
} else {
|
|
9992
|
-
console.error(`${
|
|
10012
|
+
console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
|
|
9993
10013
|
}
|
|
9994
10014
|
});
|
|
9995
10015
|
}
|
|
9996
10016
|
|
|
10017
|
+
// src/utils/include.js
|
|
10018
|
+
function include_default(Alpine) {
|
|
10019
|
+
Alpine.directive("h-include", (el, { modifiers, expression }, { evaluateLater, effect }) => {
|
|
10020
|
+
const getUrl = evaluateLater(expression);
|
|
10021
|
+
function getHtml(url) {
|
|
10022
|
+
const parsed = new URL(url, window.location.origin);
|
|
10023
|
+
if (parsed.origin === window.location.origin) {
|
|
10024
|
+
fetch(url).then((response) => {
|
|
10025
|
+
if (response.status === 200) return response.text();
|
|
10026
|
+
throw response;
|
|
10027
|
+
}).then((content) => {
|
|
10028
|
+
if (modifiers.includes("js")) {
|
|
10029
|
+
const container = document.createElement("div");
|
|
10030
|
+
container.innerHTML = content;
|
|
10031
|
+
let staticScript = container.querySelector("script");
|
|
10032
|
+
const script = document.createElement("script");
|
|
10033
|
+
for (let a = 0; a < staticScript.attributes.length; a++) {
|
|
10034
|
+
script.setAttribute(staticScript.attributes[a].name, staticScript.attributes[a].value);
|
|
10035
|
+
}
|
|
10036
|
+
script.appendChild(document.createTextNode(staticScript.innerHTML));
|
|
10037
|
+
staticScript.remove();
|
|
10038
|
+
while (container.childNodes.length > 0) {
|
|
10039
|
+
el.appendChild(container.childNodes[0]);
|
|
10040
|
+
}
|
|
10041
|
+
el.appendChild(script);
|
|
10042
|
+
} else {
|
|
10043
|
+
el.innerHTML = content;
|
|
10044
|
+
}
|
|
10045
|
+
}).catch((response) => {
|
|
10046
|
+
console.error(response);
|
|
10047
|
+
});
|
|
10048
|
+
} else {
|
|
10049
|
+
throw new Error(`${original}: external requests not allowed`);
|
|
10050
|
+
}
|
|
10051
|
+
}
|
|
10052
|
+
effect(() => {
|
|
10053
|
+
getUrl((url) => {
|
|
10054
|
+
if (url) getHtml(url);
|
|
10055
|
+
else el.innerHTML = "";
|
|
10056
|
+
});
|
|
10057
|
+
});
|
|
10058
|
+
}).before("bind");
|
|
10059
|
+
}
|
|
10060
|
+
|
|
9997
10061
|
// src/utils/focus.js
|
|
9998
10062
|
function focus_default(Alpine) {
|
|
9999
10063
|
Alpine.directive("h-focus", (el, { expression }, { effect, evaluateLater }) => {
|
|
@@ -10007,10 +10071,10 @@
|
|
|
10007
10071
|
}
|
|
10008
10072
|
|
|
10009
10073
|
// package.json
|
|
10010
|
-
var version = "1.
|
|
10074
|
+
var version = "1.5.0";
|
|
10011
10075
|
|
|
10012
10076
|
// src/index.js
|
|
10013
|
-
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };
|
|
10077
|
+
window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, getSystemColorScheme, version };
|
|
10014
10078
|
document.addEventListener("alpine:init", () => {
|
|
10015
10079
|
window.Alpine.plugin(accordion_default);
|
|
10016
10080
|
window.Alpine.plugin(alert_default);
|
|
@@ -10055,5 +10119,6 @@
|
|
|
10055
10119
|
window.Alpine.plugin(tree_default);
|
|
10056
10120
|
window.Alpine.plugin(focus_default);
|
|
10057
10121
|
window.Alpine.plugin(template_default);
|
|
10122
|
+
window.Alpine.plugin(include_default);
|
|
10058
10123
|
});
|
|
10059
10124
|
})();
|