@codbex/harmonia 1.10.1 → 1.11.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 +1 -1
- package/dist/harmonia.esm.js +186 -39
- package/dist/harmonia.esm.min.js +2 -2
- package/dist/harmonia.esm.min.js.map +4 -4
- package/dist/harmonia.js +185 -39
- package/dist/harmonia.min.js +2 -2
- package/dist/harmonia.min.js.map +4 -4
- package/package.json +1 -1
package/dist/harmonia.esm.js
CHANGED
|
@@ -1948,6 +1948,7 @@ var CircleError = 25;
|
|
|
1948
1948
|
var CircleSuccess = 26;
|
|
1949
1949
|
var CircleUnknown = 27;
|
|
1950
1950
|
var CircleUser = 28;
|
|
1951
|
+
var Home = 29;
|
|
1951
1952
|
function setCalendarContent(svg) {
|
|
1952
1953
|
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1953
1954
|
path.setAttributeNS(
|
|
@@ -2290,6 +2291,15 @@ function setCircleUserContent(svg) {
|
|
|
2290
2291
|
);
|
|
2291
2292
|
svg.appendChild(path2);
|
|
2292
2293
|
}
|
|
2294
|
+
function setHomeContent(svg) {
|
|
2295
|
+
const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2296
|
+
path.setAttributeNS(
|
|
2297
|
+
null,
|
|
2298
|
+
"d",
|
|
2299
|
+
"m8 0.8252c-0.51124 0-1.0243 0.19615-1.416 0.58789l-4.4316 4.4297c-0.27162 0.2733-0.65234 0.7207-0.65234 1.6055v5.7266c0 1.108 0.892 2 2 2h9c1.108 0 2-0.892 2-2v-5.7266c0-0.88477-0.38073-1.3322-0.65234-1.6055l-4.4316-4.4297c-0.39174-0.39174-0.90478-0.58789-1.416-0.58789zm0 1.4258c0.25431-2.91e-4 0.5101 0.096117 0.70703 0.29297l4.2207 4.2188v0.00195c0.17404 0.1851 0.27111 0.42951 0.27148 0.68359v5.4277c0 0.554-0.446 1-1 1h-1.5078v-4.1289c0-1.108-0.892-2-2-2h-1.3828c-1.108 0-2 0.892-2 2v4.1289h-1.5078c-0.554 0-1-0.446-1-1v-5.4277c3.752e-4 -0.25408 0.09744-0.4985 0.27148-0.68359v-0.00195l4.2207-4.2188c0.19693-0.19685 0.45273-0.29326 0.70703-0.29297zm-0.58984 6.7949h1.1797c0.44244-4.323e-4 0.80121 0.35834 0.80078 0.80078v4.0293h-2.7812v-4.0293c-4.322e-4 -0.44244 0.35834-0.80121 0.80078-0.80078z"
|
|
2300
|
+
);
|
|
2301
|
+
svg.appendChild(path);
|
|
2302
|
+
}
|
|
2293
2303
|
function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
2294
2304
|
const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2295
2305
|
svg.setAttributeNS(null, "width", "16");
|
|
@@ -2390,6 +2400,9 @@ function createSvg({ icon, classes = "size-4", attrs } = {}) {
|
|
|
2390
2400
|
case CircleUser:
|
|
2391
2401
|
setCircleUserContent(svg);
|
|
2392
2402
|
break;
|
|
2403
|
+
case Home:
|
|
2404
|
+
setHomeContent(svg);
|
|
2405
|
+
break;
|
|
2393
2406
|
default:
|
|
2394
2407
|
break;
|
|
2395
2408
|
}
|
|
@@ -2489,6 +2502,9 @@ function setSvgContent(svg, icon) {
|
|
|
2489
2502
|
case "circle-user":
|
|
2490
2503
|
setCircleUserContent(svg);
|
|
2491
2504
|
break;
|
|
2505
|
+
case "home":
|
|
2506
|
+
setHomeContent(svg);
|
|
2507
|
+
break;
|
|
2492
2508
|
default:
|
|
2493
2509
|
break;
|
|
2494
2510
|
}
|
|
@@ -2923,6 +2939,113 @@ function badge_default(Alpine) {
|
|
|
2923
2939
|
});
|
|
2924
2940
|
}
|
|
2925
2941
|
|
|
2942
|
+
// src/components/breadcrumb.js
|
|
2943
|
+
function breadcrumb_default(Alpine) {
|
|
2944
|
+
Alpine.directive("h-breadcrumb", (el, _, { Alpine: Alpine2, cleanup }) => {
|
|
2945
|
+
el.classList.add("flex", "items-center", "break-words", "text-sm", "text-muted-foreground", "rounded-control");
|
|
2946
|
+
el.setAttribute("role", "navigation");
|
|
2947
|
+
el.setAttribute("aria-label", "breadcrumb");
|
|
2948
|
+
el.setAttribute("data-slot", "breadcrumb");
|
|
2949
|
+
const variants = {
|
|
2950
|
+
outline: ["border"]
|
|
2951
|
+
};
|
|
2952
|
+
const allVariantClasses = Object.values(variants).flat();
|
|
2953
|
+
const sizes = {
|
|
2954
|
+
default: ["h-9", "px-3"],
|
|
2955
|
+
md: ["h-8", "px-2.5"],
|
|
2956
|
+
sm: ["h-6.5", "px-2"]
|
|
2957
|
+
};
|
|
2958
|
+
const allSizeClasses = Object.values(sizes).flat();
|
|
2959
|
+
function applyClasses() {
|
|
2960
|
+
const variant = el.getAttribute("data-variant");
|
|
2961
|
+
const size3 = el.getAttribute("data-size") ?? "default";
|
|
2962
|
+
el.classList.remove(...allVariantClasses, ...allSizeClasses);
|
|
2963
|
+
if (variant && Object.prototype.hasOwnProperty.call(variants, variant)) {
|
|
2964
|
+
el.classList.add(...variants[variant]);
|
|
2965
|
+
el.classList.add(...sizes[size3] ?? sizes.default);
|
|
2966
|
+
} else {
|
|
2967
|
+
el.classList.add("px-2");
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
applyClasses();
|
|
2971
|
+
const observer = new MutationObserver(() => applyClasses());
|
|
2972
|
+
observer.observe(el, { attributes: true, attributeFilter: ["data-variant", "data-size"] });
|
|
2973
|
+
if (el.getAttribute("data-overflow") === "scroll") {
|
|
2974
|
+
el.classList.add("overflow-x-scroll", "scrollbar-none");
|
|
2975
|
+
let preserveScroll = false;
|
|
2976
|
+
const scrollToEnd = () => {
|
|
2977
|
+
el.scrollLeft = el.scrollWidth;
|
|
2978
|
+
};
|
|
2979
|
+
Alpine2.nextTick(scrollToEnd);
|
|
2980
|
+
const handleScroll = () => {
|
|
2981
|
+
preserveScroll = el.scrollLeft < el.scrollWidth - el.clientWidth - 1;
|
|
2982
|
+
};
|
|
2983
|
+
const handleResize = () => {
|
|
2984
|
+
if (!preserveScroll) scrollToEnd();
|
|
2985
|
+
};
|
|
2986
|
+
el.addEventListener("scroll", handleScroll);
|
|
2987
|
+
window.addEventListener("resize", handleResize);
|
|
2988
|
+
cleanup(() => {
|
|
2989
|
+
el.removeEventListener("scroll", handleScroll);
|
|
2990
|
+
window.removeEventListener("resize", handleResize);
|
|
2991
|
+
observer.disconnect();
|
|
2992
|
+
});
|
|
2993
|
+
} else if (el.getAttribute("data-overflow") === "nowrap") {
|
|
2994
|
+
el.classList.add("flex-nowrap");
|
|
2995
|
+
cleanup(() => observer.disconnect());
|
|
2996
|
+
} else {
|
|
2997
|
+
el.classList.add("flex-wrap");
|
|
2998
|
+
cleanup(() => observer.disconnect());
|
|
2999
|
+
}
|
|
3000
|
+
});
|
|
3001
|
+
Alpine.directive("h-breadcrumb-list", (el, _, { Alpine: Alpine2 }) => {
|
|
3002
|
+
el.classList.add("flex", "items-center", "gap-1.5");
|
|
3003
|
+
el.setAttribute("data-slot", "breadcrumb-list");
|
|
3004
|
+
const nav = Alpine2.findClosest(el, (node) => node.getAttribute("data-slot") === "breadcrumb");
|
|
3005
|
+
const overflow = nav?.getAttribute("data-overflow");
|
|
3006
|
+
if (overflow === "scroll" || overflow === "nowrap") {
|
|
3007
|
+
el.classList.add("flex-nowrap");
|
|
3008
|
+
} else {
|
|
3009
|
+
el.classList.add("flex-wrap");
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
Alpine.directive("h-breadcrumb-item", (el) => {
|
|
3013
|
+
el.classList.add("group", "inline-flex", "items-center", "gap-1.5");
|
|
3014
|
+
el.setAttribute("data-slot", "breadcrumb-item");
|
|
3015
|
+
const separator = createSvg({
|
|
3016
|
+
icon: ChevronRight,
|
|
3017
|
+
classes: "size-3.5 group-first-of-type:hidden",
|
|
3018
|
+
attrs: { "aria-hidden": "true", role: "presentation" }
|
|
3019
|
+
});
|
|
3020
|
+
el.prepend(separator);
|
|
3021
|
+
});
|
|
3022
|
+
Alpine.directive("h-breadcrumb-link", (el) => {
|
|
3023
|
+
el.classList.add(
|
|
3024
|
+
"cursor-pointer",
|
|
3025
|
+
"hbox",
|
|
3026
|
+
"gap-1.5",
|
|
3027
|
+
"items-center",
|
|
3028
|
+
"whitespace-nowrap",
|
|
3029
|
+
"text-primary",
|
|
3030
|
+
"transition-colors",
|
|
3031
|
+
"underline-offset-4",
|
|
3032
|
+
"hover:underline",
|
|
3033
|
+
"hover:text-primary-hover",
|
|
3034
|
+
"active:text-primary-active",
|
|
3035
|
+
"[&>svg]:size-4",
|
|
3036
|
+
"[&>svg]:text-current"
|
|
3037
|
+
);
|
|
3038
|
+
el.setAttribute("data-slot", "breadcrumb-link");
|
|
3039
|
+
});
|
|
3040
|
+
Alpine.directive("h-breadcrumb-page", (el) => {
|
|
3041
|
+
el.classList.add("hbox", "gap-1.5", "items-center", "whitespace-nowrap", "text-foreground", "font-normal", "[&>svg]:size-4", "[&>svg]:text-current");
|
|
3042
|
+
el.setAttribute("role", "link");
|
|
3043
|
+
el.setAttribute("aria-current", "page");
|
|
3044
|
+
el.setAttribute("aria-disabled", "true");
|
|
3045
|
+
el.setAttribute("data-slot", "breadcrumb-page");
|
|
3046
|
+
});
|
|
3047
|
+
}
|
|
3048
|
+
|
|
2926
3049
|
// src/components/button.js
|
|
2927
3050
|
var buttonVariants = {
|
|
2928
3051
|
default: [
|
|
@@ -5324,7 +5447,9 @@ function chip_default(Alpine) {
|
|
|
5324
5447
|
"has-[>[data-slot=chip-close]]:pr-0",
|
|
5325
5448
|
"has-[>[data-slot=spinner]]:px-2",
|
|
5326
5449
|
"text-secondary-foreground",
|
|
5327
|
-
"border"
|
|
5450
|
+
"border",
|
|
5451
|
+
"[&>:is(div,span:not([data-slot=chip-close]),p)]:py-1",
|
|
5452
|
+
"[&>:is(div,span:not([data-slot=chip-close]),p)]:truncate"
|
|
5328
5453
|
);
|
|
5329
5454
|
if (!el.hasAttribute("type")) {
|
|
5330
5455
|
el.setAttribute("type", "button");
|
|
@@ -5397,8 +5522,8 @@ function chip_default(Alpine) {
|
|
|
5397
5522
|
});
|
|
5398
5523
|
});
|
|
5399
5524
|
Alpine.directive("h-chip-close", (el, { original }, { effect, cleanup }) => {
|
|
5400
|
-
if (el.tagName
|
|
5401
|
-
throw new Error(`${original} must
|
|
5525
|
+
if (el.tagName !== "SPAN") {
|
|
5526
|
+
throw new Error(`${original} must be a span element`);
|
|
5402
5527
|
}
|
|
5403
5528
|
const chip = Alpine.findClosest(el.parentElement, (parent) => Object.prototype.hasOwnProperty.call(parent, "_h_chip"));
|
|
5404
5529
|
el.classList.add(
|
|
@@ -6733,6 +6858,10 @@ function menu_default(Alpine) {
|
|
|
6733
6858
|
}
|
|
6734
6859
|
function close(closeParent = false, focusTrigger = false) {
|
|
6735
6860
|
el.pauseKeyEvents = false;
|
|
6861
|
+
if (autoUpdateCleanup) {
|
|
6862
|
+
autoUpdateCleanup();
|
|
6863
|
+
autoUpdateCleanup = null;
|
|
6864
|
+
}
|
|
6736
6865
|
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
6737
6866
|
el.classList.add("hidden", "scale-95", "opacity-0");
|
|
6738
6867
|
Object.assign(el.style, {
|
|
@@ -6862,6 +6991,7 @@ function menu_default(Alpine) {
|
|
|
6862
6991
|
}
|
|
6863
6992
|
}
|
|
6864
6993
|
}
|
|
6994
|
+
let autoUpdateCleanup;
|
|
6865
6995
|
function open(parent) {
|
|
6866
6996
|
if (el.classList.contains("hidden")) {
|
|
6867
6997
|
let getPlacement = function() {
|
|
@@ -6871,41 +7001,52 @@ function menu_default(Alpine) {
|
|
|
6871
7001
|
return el.getAttribute("data-align") || "bottom-start";
|
|
6872
7002
|
}
|
|
6873
7003
|
return "right-start";
|
|
7004
|
+
}, updatePosition = function() {
|
|
7005
|
+
const isFirst = firstOpen;
|
|
7006
|
+
firstOpen = false;
|
|
7007
|
+
computePosition2(parent, el, {
|
|
7008
|
+
placement: getPlacement(),
|
|
7009
|
+
strategy: "fixed",
|
|
7010
|
+
middleware: [
|
|
7011
|
+
offset2(isSubmenu ? 0 : 4),
|
|
7012
|
+
flip2(),
|
|
7013
|
+
shift2({ padding: 4 }),
|
|
7014
|
+
size2({
|
|
7015
|
+
apply({ availableWidth, availableHeight, elements }) {
|
|
7016
|
+
Object.assign(elements.floating.style, {
|
|
7017
|
+
maxWidth: `${Math.max(0, availableWidth) - 4}px`,
|
|
7018
|
+
maxHeight: `${Math.max(0, availableHeight) - 4}px`
|
|
7019
|
+
});
|
|
7020
|
+
}
|
|
7021
|
+
})
|
|
7022
|
+
]
|
|
7023
|
+
}).then(({ x, y }) => {
|
|
7024
|
+
if (isFirst) {
|
|
7025
|
+
if (!isSubmenu) {
|
|
7026
|
+
Alpine2.nextTick(() => el.focus());
|
|
7027
|
+
listenForTrigger(false);
|
|
7028
|
+
}
|
|
7029
|
+
Alpine2.nextTick(() => {
|
|
7030
|
+
top.addEventListener("contextmenu", onClick);
|
|
7031
|
+
top.addEventListener("click", onClick);
|
|
7032
|
+
el.addEventListener("keydown", onKeyDown);
|
|
7033
|
+
});
|
|
7034
|
+
}
|
|
7035
|
+
Object.assign(el.style, {
|
|
7036
|
+
left: `${x}px`,
|
|
7037
|
+
top: `${y}px`
|
|
7038
|
+
});
|
|
7039
|
+
el.classList.remove("scale-95", "opacity-0");
|
|
7040
|
+
});
|
|
6874
7041
|
};
|
|
6875
7042
|
el.classList.remove("hidden");
|
|
6876
7043
|
el.pauseKeyEvents = false;
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
shift2({ padding: 4 }),
|
|
6884
|
-
size2({
|
|
6885
|
-
apply({ availableWidth, availableHeight, elements }) {
|
|
6886
|
-
Object.assign(elements.floating.style, {
|
|
6887
|
-
maxWidth: `${Math.max(0, availableWidth) - 4}px`,
|
|
6888
|
-
maxHeight: `${Math.max(0, availableHeight) - 4}px`
|
|
6889
|
-
});
|
|
6890
|
-
}
|
|
6891
|
-
})
|
|
6892
|
-
]
|
|
6893
|
-
}).then(({ x, y }) => {
|
|
6894
|
-
if (!isSubmenu) {
|
|
6895
|
-
Alpine2.nextTick(() => el.focus());
|
|
6896
|
-
listenForTrigger(false);
|
|
6897
|
-
}
|
|
6898
|
-
Alpine2.nextTick(() => {
|
|
6899
|
-
top.addEventListener("contextmenu", onClick);
|
|
6900
|
-
top.addEventListener("click", onClick);
|
|
6901
|
-
el.addEventListener("keydown", onKeyDown);
|
|
6902
|
-
});
|
|
6903
|
-
Object.assign(el.style, {
|
|
6904
|
-
left: `${x}px`,
|
|
6905
|
-
top: `${y}px`
|
|
6906
|
-
});
|
|
6907
|
-
el.classList.remove("scale-95", "opacity-0");
|
|
6908
|
-
});
|
|
7044
|
+
let firstOpen = true;
|
|
7045
|
+
if (!isSubmenu && menuTrigger._menu_trigger.isDropdown) {
|
|
7046
|
+
autoUpdateCleanup = autoUpdate(parent, el, updatePosition);
|
|
7047
|
+
} else {
|
|
7048
|
+
updatePosition();
|
|
7049
|
+
}
|
|
6909
7050
|
}
|
|
6910
7051
|
}
|
|
6911
7052
|
function openDropdown() {
|
|
@@ -6949,6 +7090,7 @@ function menu_default(Alpine) {
|
|
|
6949
7090
|
}
|
|
6950
7091
|
el.addEventListener("transitionend", onTransitionEnd);
|
|
6951
7092
|
cleanup(() => {
|
|
7093
|
+
if (autoUpdateCleanup) autoUpdateCleanup();
|
|
6952
7094
|
if (menuTrigger) listenForTrigger(false);
|
|
6953
7095
|
top.removeEventListener("click", onClick);
|
|
6954
7096
|
top.removeEventListener("contextmenu", onClick);
|
|
@@ -6988,7 +7130,10 @@ function menu_default(Alpine) {
|
|
|
6988
7130
|
"data-[inset=true]:pl-8",
|
|
6989
7131
|
"[&_svg]:pointer-events-none",
|
|
6990
7132
|
"[&_svg]:shrink-0",
|
|
6991
|
-
"[&_svg:not([class*='size-'])]:size-4"
|
|
7133
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
7134
|
+
"[&>a]:no-underline",
|
|
7135
|
+
"[&>a]:text-inherit",
|
|
7136
|
+
"[&>a]:size-full"
|
|
6992
7137
|
);
|
|
6993
7138
|
el.setAttribute("role", "menuitem");
|
|
6994
7139
|
el.setAttribute("tabindex", "-1");
|
|
@@ -7402,8 +7547,8 @@ function notifications_default(Alpine) {
|
|
|
7402
7547
|
el.setAttribute("aria-atomic", "false");
|
|
7403
7548
|
el.setAttribute("data-slot", "notification-overlay");
|
|
7404
7549
|
const commonListClasses = ["flex", "flex-col", "py-4", "p-10", "gap-4", "overflow-visible", "size-full"];
|
|
7405
|
-
const commonTopClasses = ["
|
|
7406
|
-
const commonBottomClasses = ["
|
|
7550
|
+
const commonTopClasses = ["mask-[linear-gradient(to_bottom,black_85%,transparent)]", "row-1"];
|
|
7551
|
+
const commonBottomClasses = ["mask-[linear-gradient(to_top,black_85%,transparent)]", "row-2"];
|
|
7407
7552
|
const olTopLeft = document.createElement("ol");
|
|
7408
7553
|
olTopLeft.classList.add(...commonListClasses, ...commonTopClasses, "max-lg:hidden", "items-start");
|
|
7409
7554
|
olTopLeft.setAttribute("tabindex", "-1");
|
|
@@ -11434,7 +11579,7 @@ function tree_default(Alpine) {
|
|
|
11434
11579
|
}
|
|
11435
11580
|
|
|
11436
11581
|
// package.json
|
|
11437
|
-
var version = "1.
|
|
11582
|
+
var version = "1.11.0";
|
|
11438
11583
|
|
|
11439
11584
|
// src/utils/theme.js
|
|
11440
11585
|
var colorSchemeKey = "codbex.harmonia.colorMode";
|
|
@@ -11627,6 +11772,7 @@ var registerComponents = (registerPlugin) => {
|
|
|
11627
11772
|
registerPlugin(alert_default);
|
|
11628
11773
|
registerPlugin(avatar_default);
|
|
11629
11774
|
registerPlugin(badge_default);
|
|
11775
|
+
registerPlugin(breadcrumb_default);
|
|
11630
11776
|
registerPlugin(button_default);
|
|
11631
11777
|
registerPlugin(calendar_default);
|
|
11632
11778
|
registerPlugin(card_default);
|
|
@@ -11675,6 +11821,7 @@ export {
|
|
|
11675
11821
|
alert_default as Alert,
|
|
11676
11822
|
avatar_default as Avatar,
|
|
11677
11823
|
badge_default as Badge,
|
|
11824
|
+
breadcrumb_default as Breadcrumb,
|
|
11678
11825
|
button_default as Button,
|
|
11679
11826
|
calendar_default as Calendar,
|
|
11680
11827
|
card_default as Card,
|