@codbex/harmonia 1.2.1 → 1.3.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.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: original2, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
307
+ Alpine.directive("h-accordion-item", (el, { original, 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(`${original2} must be inside an accordion`);
310
+ throw new Error(`${original} 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: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
338
+ Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
339
339
  if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
340
- throw new Error(`${original2} must be a header element`);
340
+ throw new Error(`${original} 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(`${original2} must have an accordion and accordion item parent elements`);
345
+ throw new Error(`${original} 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: original2 }, { cleanup }) => {
530
+ Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
531
531
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
532
532
  if (!avatar) {
533
- throw new Error(`${original2} must be inside an avatar element`);
533
+ throw new Error(`${original} 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: original2 }, { effect }) => {
564
+ Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
565
565
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
566
566
  if (!avatar) {
567
- throw new Error(`${original2} must be inside an avatar element`);
567
+ throw new Error(`${original} 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: original2, modifiers }, { cleanup }) => {
776
+ Alpine.directive("h-button", (el, { original, 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(`${original2}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
793
+ console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
794
794
  }
795
795
  lastSize = size3;
796
796
  }
@@ -2339,7 +2339,7 @@
2339
2339
 
2340
2340
  // src/components/calendar.js
2341
2341
  function calendar_default(Alpine) {
2342
- Alpine.directive("h-calendar", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
2342
+ Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
2343
2343
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
2344
2344
  el.classList.add("border", "rounded-control", "gap-2", "p-2");
2345
2345
  el.setAttribute("tabindex", "-1");
@@ -2383,7 +2383,7 @@
2383
2383
  const onInputChange = () => {
2384
2384
  const newValue = new Date(datepicker._h_datepicker.input.value);
2385
2385
  if (isNaN(newValue)) {
2386
- console.error(`${original2}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
2386
+ console.error(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
2387
2387
  datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
2388
2388
  return;
2389
2389
  } else if (selected.getTime() !== newValue.getTime()) {
@@ -2400,7 +2400,7 @@
2400
2400
  if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
2401
2401
  selected = new Date(el._x_model.get());
2402
2402
  if (isNaN(selected)) {
2403
- console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
2403
+ console.error(`${original}: input value is not a valid date - ${el._x_model.get()}`);
2404
2404
  if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
2405
2405
  else el.setAttribute("data-invalid", "true");
2406
2406
  } else if (datepicker) {
@@ -2909,10 +2909,10 @@
2909
2909
  });
2910
2910
  }
2911
2911
  });
2912
- Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
2912
+ Alpine.directive("h-collapsible-trigger", (el, { original, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
2913
2913
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
2914
2914
  if (!collapsible) {
2915
- throw new Error(`${original2} must be inside a collapsible element`);
2915
+ throw new Error(`${original} must be inside a collapsible element`);
2916
2916
  }
2917
2917
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
2918
2918
  if (modifiers.includes("chevron")) {
@@ -2931,10 +2931,10 @@
2931
2931
  el.removeEventListener("click", handler);
2932
2932
  });
2933
2933
  });
2934
- Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
2934
+ Alpine.directive("h-collapsible-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
2935
2935
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
2936
2936
  if (!collapsible) {
2937
- throw new Error(`${original2} must be inside an h-collapsible element`);
2937
+ throw new Error(`${original} must be inside an h-collapsible element`);
2938
2938
  }
2939
2939
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
2940
2940
  el.classList.add("data-[state=closed]:!hidden");
@@ -2965,7 +2965,7 @@
2965
2965
 
2966
2966
  // src/components/datepicker.js
2967
2967
  function datepicker_default(Alpine) {
2968
- Alpine.directive("h-date-picker", (el, { original: original2, modifiers }, { Alpine: Alpine2, cleanup }) => {
2968
+ Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
2969
2969
  const state = Alpine2.reactive({
2970
2970
  expanded: false
2971
2971
  });
@@ -2978,7 +2978,7 @@
2978
2978
  };
2979
2979
  el._h_datepicker.input = el.querySelector("input");
2980
2980
  if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
2981
- throw new Error(`${original2} must contain an input`);
2981
+ throw new Error(`${original} must contain an input`);
2982
2982
  } else if (el._h_datepicker.input.hasAttribute("id")) {
2983
2983
  el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
2984
2984
  } else {
@@ -3055,16 +3055,16 @@
3055
3055
  observer.disconnect();
3056
3056
  });
3057
3057
  });
3058
- Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
3058
+ Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
3059
3059
  if (el.tagName !== "BUTTON") {
3060
- throw new Error(`${original2} must be a button`);
3060
+ throw new Error(`${original} must be a button`);
3061
3061
  }
3062
3062
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3063
- throw new Error(`${original2}: must have an "aria-label" or "aria-labelledby" attribute`);
3063
+ throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
3064
3064
  }
3065
3065
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
3066
3066
  if (!datepicker) {
3067
- throw new Error(`${original2} must be inside an date-picker element`);
3067
+ throw new Error(`${original} must be inside an date-picker element`);
3068
3068
  }
3069
3069
  el.classList.add("cursor-pointer", "inline-flex", "items-center", "justify-center", "h-full", "aspect-square", "bg-transparent", "hover:bg-secondary", "active:bg-secondary-active", "outline-none");
3070
3070
  if (datepicker._h_datepicker.inTable) {
@@ -3344,13 +3344,13 @@
3344
3344
 
3345
3345
  // src/components/icon.js
3346
3346
  function icon_default(Alpine) {
3347
- Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
3347
+ Alpine.directive("h-icon", (el, { original, modifiers }) => {
3348
3348
  if (el.tagName.toLowerCase() !== "svg") {
3349
- throw new Error(`${original2} works only on svg elements`);
3349
+ throw new Error(`${original} works only on svg elements`);
3350
3350
  } else if (!el.hasAttribute("role")) {
3351
- throw new Error(`${original2} must have a role`);
3351
+ throw new Error(`${original} must have a role`);
3352
3352
  } else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3353
- throw new Error(`${original2}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
3353
+ throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
3354
3354
  }
3355
3355
  el.classList.add("fill-current");
3356
3356
  el.setAttribute("data-slot", "icon");
@@ -3567,7 +3567,7 @@
3567
3567
  el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
3568
3568
  el.setAttribute("data-slot", "label");
3569
3569
  });
3570
- Alpine.directive("h-input-number", (el, { original: original2 }, { cleanup }) => {
3570
+ Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
3571
3571
  el.classList.add(
3572
3572
  "overflow-hidden",
3573
3573
  "group/input-number",
@@ -3600,7 +3600,7 @@
3600
3600
  el.setAttribute("data-slot", "input-number");
3601
3601
  const input = el.querySelector("input");
3602
3602
  if (!input || input.getAttribute("type") !== "number") {
3603
- throw new Error(`${original2} must contain an input of type 'number'`);
3603
+ throw new Error(`${original} must contain an input of type 'number'`);
3604
3604
  }
3605
3605
  if (!input.hasAttribute("type")) input.setAttribute("type", "number");
3606
3606
  if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
@@ -3846,13 +3846,13 @@
3846
3846
  el.setAttribute("data-slot", "list");
3847
3847
  el.setAttribute("role", "group");
3848
3848
  });
3849
- Alpine.directive("h-list-header", (el, { original: original2 }, { Alpine: Alpine2 }) => {
3849
+ Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
3850
3850
  el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
3851
3851
  el.setAttribute("role", "presentation");
3852
3852
  el.setAttribute("data-slot", "list-header");
3853
3853
  const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
3854
3854
  if (!list) {
3855
- throw new Error(`${original2} must be placed inside a list element`);
3855
+ throw new Error(`${original} must be placed inside a list element`);
3856
3856
  }
3857
3857
  if (!el.hasAttribute("id")) {
3858
3858
  const id = `lbh${v4_default()}`;
@@ -3904,9 +3904,9 @@
3904
3904
  };
3905
3905
  el.setAttribute("data-state", "closed");
3906
3906
  });
3907
- Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
3907
+ Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
3908
3908
  if (el.tagName !== "UL") {
3909
- throw new Error(`${original2} must be an ul element`);
3909
+ throw new Error(`${original} must be an ul element`);
3910
3910
  }
3911
3911
  el.classList.add("hidden", "fixed", "bg-popover", "text-popover-foreground", "font-normal", "z-50", "min-w-[8rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "p-1", "shadow-md", "border", "outline-none");
3912
3912
  el.setAttribute("role", "menu");
@@ -3914,7 +3914,7 @@
3914
3914
  el.setAttribute("tabindex", "-1");
3915
3915
  el.setAttribute("data-slot", "menu");
3916
3916
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3917
- throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
3917
+ throw new Error(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
3918
3918
  }
3919
3919
  const isSubmenu = modifiers.includes("sub");
3920
3920
  const menuTrigger = (() => {
@@ -3926,7 +3926,7 @@
3926
3926
  return sibling;
3927
3927
  })();
3928
3928
  if (!isSubmenu && !menuTrigger) {
3929
- throw new Error(`${original2} menu must be placed after a menu trigger element`);
3929
+ throw new Error(`${original} menu must be placed after a menu trigger element`);
3930
3930
  }
3931
3931
  let menuSubItem;
3932
3932
  if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
@@ -4145,9 +4145,9 @@
4145
4145
  el.removeEventListener("keydown", onKeyDown);
4146
4146
  });
4147
4147
  });
4148
- Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
4148
+ Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
4149
4149
  if (el.tagName !== "LI") {
4150
- throw new Error(`${original2} must be a li element`);
4150
+ throw new Error(`${original} must be a li element`);
4151
4151
  }
4152
4152
  el.classList.add(
4153
4153
  "focus:bg-secondary-hover",
@@ -4201,7 +4201,7 @@
4201
4201
  el.removeEventListener("mouseleave", focusOut);
4202
4202
  });
4203
4203
  });
4204
- Alpine.directive("h-menu-sub", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
4204
+ Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
4205
4205
  el.classList.add(
4206
4206
  "focus:bg-secondary-hover",
4207
4207
  "hover:bg-secondary-hover",
@@ -4233,7 +4233,7 @@
4233
4233
  const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
4234
4234
  el.appendChild(chevronRight);
4235
4235
  const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
4236
- if (!parentMenu) throw new Error(`${original2} must have a parent`);
4236
+ if (!parentMenu) throw new Error(`${original} must have a parent`);
4237
4237
  el._menu_sub = {
4238
4238
  open: void 0,
4239
4239
  close: void 0,
@@ -4327,9 +4327,9 @@
4327
4327
  el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
4328
4328
  el.setAttribute("data-slot", "menu-label");
4329
4329
  });
4330
- Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
4330
+ Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
4331
4331
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
4332
- throw new Error(`${original2} must be a li or div element`);
4332
+ throw new Error(`${original} must be a li or div element`);
4333
4333
  }
4334
4334
  el.classList.add(
4335
4335
  "focus:bg-secondary-hover",
@@ -4395,9 +4395,9 @@
4395
4395
  el.removeEventListener("mouseleave", focusOut);
4396
4396
  });
4397
4397
  });
4398
- Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4398
+ Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4399
4399
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
4400
- throw new Error(`${original2} must be a li or div element`);
4400
+ throw new Error(`${original} must be a li or div element`);
4401
4401
  }
4402
4402
  el.classList.add(
4403
4403
  "focus:bg-secondary-hover",
@@ -4601,6 +4601,7 @@
4601
4601
  const close = () => {
4602
4602
  el._popover.expanded = false;
4603
4603
  el.addEventListener("click", handler);
4604
+ setAttributes();
4604
4605
  };
4605
4606
  const handler = () => {
4606
4607
  el._popover.expanded = !el._popover.expanded;
@@ -4625,7 +4626,7 @@
4625
4626
  });
4626
4627
  }
4627
4628
  });
4628
- Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
4629
+ Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
4629
4630
  const popover = (() => {
4630
4631
  let sibling = el.previousElementSibling;
4631
4632
  while (sibling && !sibling.hasOwnProperty("_popover")) {
@@ -4634,7 +4635,7 @@
4634
4635
  return sibling;
4635
4636
  })();
4636
4637
  if (!popover) {
4637
- throw new Error(`${original2} must be placed after a popover element`);
4638
+ throw new Error(`${original} must be placed after a popover element`);
4638
4639
  }
4639
4640
  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-scroll");
4640
4641
  el.setAttribute("data-slot", "popover");
@@ -6695,13 +6696,13 @@
6695
6696
  });
6696
6697
  }
6697
6698
  });
6698
- Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
6699
+ Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
6699
6700
  if (el.tagName !== "INPUT") {
6700
- throw new Error(`${original2} must be a readonly input of type "text"`);
6701
+ throw new Error(`${original} must be a readonly input of type "text"`);
6701
6702
  }
6702
6703
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6703
6704
  if (!select) {
6704
- throw new Error(`${original2} must be inside a select element`);
6705
+ throw new Error(`${original} must be inside a select element`);
6705
6706
  } else if (el.hasOwnProperty("_x_model")) {
6706
6707
  select._h_select.multiple = Array.isArray(el._x_model.get());
6707
6708
  select._h_model.set = (value) => {
@@ -6954,10 +6955,10 @@
6954
6955
  observer.disconnect();
6955
6956
  });
6956
6957
  });
6957
- Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
6958
+ Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
6958
6959
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6959
6960
  if (!select) {
6960
- throw new Error(`${original2} must be inside a select element`);
6961
+ throw new Error(`${original} must be inside a select element`);
6961
6962
  }
6962
6963
  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");
6963
6964
  el.setAttribute("data-slot", "select-content");
@@ -6968,7 +6969,7 @@
6968
6969
  el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
6969
6970
  const control = select.querySelector(`#${select._h_select.id}`);
6970
6971
  if (!control) {
6971
- throw new Error(`${original2}: trigger not found`);
6972
+ throw new Error(`${original}: trigger not found`);
6972
6973
  }
6973
6974
  let autoUpdateCleanup;
6974
6975
  function updatePosition() {
@@ -7010,10 +7011,10 @@
7010
7011
  }
7011
7012
  });
7012
7013
  });
7013
- Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7014
+ Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7014
7015
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7015
7016
  if (!select) {
7016
- throw new Error(`${original2} must be inside an h-select element`);
7017
+ throw new Error(`${original} must be inside an h-select element`);
7017
7018
  } else {
7018
7019
  select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
7019
7020
  }
@@ -7085,10 +7086,10 @@
7085
7086
  selectGroup._h_selectGroup.labelledby = id;
7086
7087
  }
7087
7088
  });
7088
- Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
7089
+ Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
7089
7090
  const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7090
7091
  if (!select) {
7091
- throw new Error(`${original2} must be inside an h-select element`);
7092
+ throw new Error(`${original} must be inside an h-select element`);
7092
7093
  }
7093
7094
  el.classList.add(
7094
7095
  "focus:bg-primary",
@@ -7319,13 +7320,35 @@
7319
7320
  el.classList.add("vbox", "min-h-0", "flex-1", "gap-2", "overflow-auto", "group-data-[collapsed=true]/sidebar:overflow-hidden");
7320
7321
  el.setAttribute("data-slot", "sidebar-content");
7321
7322
  });
7322
- Alpine.directive("h-sidebar-group", (el) => {
7323
+ Alpine.directive("h-sidebar-group", (el, { expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7323
7324
  el.classList.add("relative", "vbox", "w-full", "min-w-0", "p-2");
7324
7325
  el.setAttribute("data-slot", "sidebar-group");
7326
+ el._h_sidebar_group = {
7327
+ collapsable: modifiers.includes("collapsed"),
7328
+ controlId: void 0,
7329
+ controls: void 0,
7330
+ state: Alpine2.reactive({
7331
+ collapsed: evaluate2(expression || "false")
7332
+ })
7333
+ };
7334
+ if (expression) {
7335
+ el._h_sidebar_group.state = Alpine2.reactive({
7336
+ collapsed: evaluate2(expression || "false")
7337
+ });
7338
+ const getCollapsed = evaluateLater(expression);
7339
+ effect(() => {
7340
+ getCollapsed((collapsed) => {
7341
+ el._h_sidebar_group.state.collapsed = collapsed;
7342
+ });
7343
+ });
7344
+ }
7325
7345
  });
7326
- Alpine.directive("h-sidebar-group-label", (el, { modifiers }) => {
7346
+ Alpine.directive("h-sidebar-group-label", (el, { original }, { cleanup }) => {
7347
+ const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7348
+ if (!group) {
7349
+ throw new Error(`${original} must be placed inside a sidebar group`);
7350
+ }
7327
7351
  el.classList.add(
7328
- "text-sidebar-foreground/70",
7329
7352
  "ring-sidebar-ring",
7330
7353
  "flex",
7331
7354
  "h-8",
@@ -7333,7 +7356,6 @@
7333
7356
  "items-center",
7334
7357
  "rounded-md",
7335
7358
  "px-2",
7336
- "text-xs",
7337
7359
  "font-medium",
7338
7360
  "outline-hidden",
7339
7361
  "transition-[margin,opacity]",
@@ -7344,8 +7366,39 @@
7344
7366
  "[&>svg]:shrink-0",
7345
7367
  "group-data-[collapsed=true]/sidebar:!hidden"
7346
7368
  );
7347
- if (modifiers.includes("action")) el.classList.add("hover:bg-secondary-hover", "active:bg-secondary-active");
7348
7369
  el.setAttribute("data-slot", "sidebar-group-label");
7370
+ if (group._h_sidebar_group.collapsable) {
7371
+ el.classList.add("text-sidebar-foreground", "text-sm", "hover:bg-secondary-hover", "active:bg-secondary-active");
7372
+ if (el.hasAttribute("id")) {
7373
+ group._h_sidebar_group.controlId = el.getAttribute("id");
7374
+ } else {
7375
+ group._h_sidebar_group.controlId = `sgl${v4_default()}`;
7376
+ el.setAttribute("id", group._h_sidebar_group.controlId);
7377
+ }
7378
+ group._h_sidebar_group.controls = `sgc${v4_default()}`;
7379
+ el.setAttribute("aria-controls", group._h_sidebar_group.controls);
7380
+ el.setAttribute("aria-expanded", !group._h_sidebar_group.state.collapsed);
7381
+ const handler = () => {
7382
+ group._h_sidebar_group.state.collapsed = !group._h_sidebar_group.state.collapsed;
7383
+ el.setAttribute("aria-expanded", !group._h_sidebar_group.state.collapsed);
7384
+ };
7385
+ el.appendChild(
7386
+ createSvg({
7387
+ icon: ChevronRight,
7388
+ classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
7389
+ attrs: {
7390
+ "aria-hidden": true,
7391
+ role: "presentation"
7392
+ }
7393
+ })
7394
+ );
7395
+ el.addEventListener("click", handler);
7396
+ cleanup(() => {
7397
+ el.removeEventListener("click", handler);
7398
+ });
7399
+ } else {
7400
+ el.classList.add("text-sidebar-foreground/70", "text-xs");
7401
+ }
7349
7402
  });
7350
7403
  Alpine.directive("h-sidebar-group-action", (el) => {
7351
7404
  el.classList.add(
@@ -7380,41 +7433,85 @@
7380
7433
  }
7381
7434
  el.setAttribute("data-slot", "sidebar-group-action");
7382
7435
  });
7383
- Alpine.directive("h-sidebar-group-content", (el) => {
7384
- el.classList.add("w-full", "text-sm");
7436
+ Alpine.directive("h-sidebar-group-content", (el, { original }, { effect }) => {
7437
+ const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7438
+ if (!group) {
7439
+ throw new Error(`${original} must be placed inside a sidebar group`);
7440
+ }
7441
+ el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
7385
7442
  el.setAttribute("data-slot", "sidebar-group-content");
7443
+ if (group._h_sidebar_group.collapsable) {
7444
+ el.setAttribute("id", group._h_sidebar_group.controls);
7445
+ el.setAttribute("aria-labelledby", group._h_sidebar_group.controlId);
7446
+ el.setAttribute("data-collapsed", group._h_sidebar_group.state.collapsed);
7447
+ effect(() => {
7448
+ el.setAttribute("data-collapsed", group._h_sidebar_group.state.collapsed);
7449
+ });
7450
+ }
7386
7451
  });
7387
- Alpine.directive("h-sidebar-menu", (el) => {
7452
+ Alpine.directive("h-sidebar-menu", (el, { original }) => {
7453
+ if (el.tagName !== "UL") {
7454
+ throw new Error(`${original} must be an ul element`);
7455
+ }
7388
7456
  el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
7389
7457
  el.setAttribute("data-slot", "sidebar-menu");
7390
7458
  });
7391
- Alpine.directive("h-sidebar-menu-item", (el, { original: original2 }) => {
7392
- if (el.tagName !== "BUTTON") {
7393
- throw new Error(`${original2} must be a button`);
7459
+ Alpine.directive("h-sidebar-menu-item", (el, { original, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7460
+ if (el.tagName !== "LI") {
7461
+ throw new Error(`${original} must be a li element`);
7462
+ }
7463
+ el._h_sidebar_menu_item = {
7464
+ isSub: false,
7465
+ collapsable: modifiers.includes("collapsed"),
7466
+ controlId: void 0,
7467
+ controls: void 0,
7468
+ state: Alpine2.reactive({
7469
+ collapsed: evaluate2(expression || "false")
7470
+ })
7471
+ };
7472
+ let parent = el.parentElement;
7473
+ while (parent) {
7474
+ if (parent.getAttribute("data-slot") === "sidebar-menu-sub") {
7475
+ el._h_sidebar_menu_item.isSub = true;
7476
+ break;
7477
+ } else if (parent.getAttribute("data-slot") === "sidebar") {
7478
+ break;
7479
+ }
7480
+ parent = parent.parentElement;
7481
+ }
7482
+ if (!el._h_sidebar_menu_item.isSub) {
7483
+ el.classList.add("group/menu-item", "relative");
7484
+ } else {
7485
+ el.classList.add("relative");
7394
7486
  }
7395
- el.classList.add("group/menu-item", "relative");
7396
- el.setAttribute("type", "button");
7397
7487
  el.setAttribute("data-slot", "sidebar-menu-item");
7488
+ if (expression) {
7489
+ const getCollapsed = evaluateLater(expression);
7490
+ effect(() => {
7491
+ getCollapsed((collapsed) => {
7492
+ el._h_sidebar_menu_item.state.collapsed = collapsed;
7493
+ });
7494
+ });
7495
+ }
7398
7496
  });
7399
- Alpine.directive("h-sidebar-menu-button", (el) => {
7400
- if (el.tagName !== "BUTTON") {
7401
- throw new Error(`${original} must be a button`);
7497
+ Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
7498
+ if (el.tagName !== "BUTTON" && el.tagName !== "A") {
7499
+ throw new Error(`${original} must be a button or a link`);
7500
+ } else if (el.tagName === "BUTTON") {
7501
+ el.setAttribute("type", "button");
7402
7502
  }
7503
+ const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
7403
7504
  el.classList.add(
7404
- "peer/menu-button",
7405
7505
  "flex",
7406
7506
  "w-full",
7407
7507
  "items-center",
7408
7508
  "gap-2",
7409
7509
  "overflow-hidden",
7410
7510
  "rounded-md",
7411
- "p-2",
7412
- "text-left",
7413
- "text-sm",
7414
7511
  "align-middle",
7512
+ "[&>span]:align-middle",
7415
7513
  "outline-hidden",
7416
7514
  "ring-sidebar-ring",
7417
- "transition-[width,height,padding]",
7418
7515
  "hover:bg-sidebar-secondary",
7419
7516
  "hover:text-sidebar-secondary-foreground",
7420
7517
  "focus-visible:ring-2",
@@ -7422,25 +7519,14 @@
7422
7519
  "active:text-sidebar-primary-foreground",
7423
7520
  "disabled:pointer-events-none",
7424
7521
  "disabled:opacity-50",
7425
- "group-has-data-[sidebar=menu-action]/menu-item:pr-8",
7426
7522
  "aria-disabled:pointer-events-none",
7427
7523
  "aria-disabled:opacity-50",
7428
7524
  "data-[active=true]:bg-sidebar-primary",
7429
- "data-[active=true]:font-medium",
7430
7525
  "data-[active=true]:text-sidebar-primary-foreground",
7431
- "data-[state=open]:hover:bg-sidebar-secondary",
7432
- "data-[state=open]:hover:text-sidebar-secondary-foreground",
7433
- "group-data-[collapsed=true]/sidebar:!size-8",
7434
- "group-data-[collapsed=true]/sidebar:!p-2",
7435
- "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden",
7436
7526
  "[&>span]:truncate",
7437
- "[&>span]:align-middle",
7438
7527
  "[&>svg]:size-4",
7439
- "[&>svg]:shrink-0",
7440
- "[&>svg:not(:first-child):last-child]:ml-auto"
7528
+ "[&>svg]:shrink-0"
7441
7529
  );
7442
- el.setAttribute("type", "button");
7443
- if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
7444
7530
  const sizes = {
7445
7531
  default: ["h-8", "text-sm"],
7446
7532
  sm: ["h-7", "text-xs"],
@@ -7451,22 +7537,77 @@
7451
7537
  el.classList.add(...sizes[size3]);
7452
7538
  }
7453
7539
  }
7454
- if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "default");
7455
- setSize2(el.getAttribute("data-size"));
7540
+ setSize2(el.getAttribute("data-size") || "default");
7541
+ if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
7542
+ if (menuItem && menuItem._h_sidebar_menu_item.isSub) {
7543
+ el.classList.add("text-sidebar-foreground", "h-7", "min-w-0", "-translate-x-px", "px-2", "[&>svg:not(:first-child):last-child]:ml-auto", "group-data-[collapsed=true]/sidebar:hidden");
7544
+ if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-sub-button");
7545
+ } else {
7546
+ el.classList.add(
7547
+ "peer/menu-button",
7548
+ "p-2",
7549
+ "text-left",
7550
+ "text-sm",
7551
+ "duration-200",
7552
+ "transition-[width,height,padding]",
7553
+ "group-has-data-[sidebar=menu-action]/menu-item:pr-8",
7554
+ "data-[active=true]:font-medium",
7555
+ "data-[state=open]:hover:bg-sidebar-secondary",
7556
+ "data-[state=open]:hover:text-sidebar-secondary-foreground",
7557
+ "group-data-[collapsed=true]/sidebar:!size-8",
7558
+ "group-data-[collapsed=true]/sidebar:!p-2",
7559
+ "group-data-[collapsed=true]/sidebar:[&>*:not(svg:first-child):not([data-slot=menu])]:!hidden"
7560
+ );
7561
+ }
7562
+ if (menuItem && menuItem._h_sidebar_menu_item.collapsable) {
7563
+ if (el.hasAttribute("id")) {
7564
+ menuItem._h_sidebar_menu_item.controlId = el.getAttribute("id");
7565
+ } else {
7566
+ menuItem._h_sidebar_menu_item.controlId = `sgl${v4_default()}`;
7567
+ el.setAttribute("id", menuItem._h_sidebar_menu_item.controlId);
7568
+ }
7569
+ menuItem._h_sidebar_menu_item.controls = `sgc${v4_default()}`;
7570
+ el.setAttribute("aria-controls", menuItem._h_sidebar_menu_item.controls);
7571
+ el.setAttribute("aria-expanded", !menuItem._h_sidebar_menu_item.state.collapsed);
7572
+ const handler = () => {
7573
+ menuItem._h_sidebar_menu_item.state.collapsed = !menuItem._h_sidebar_menu_item.state.collapsed;
7574
+ el.setAttribute("aria-expanded", !menuItem._h_sidebar_menu_item.state.collapsed);
7575
+ };
7576
+ el.appendChild(
7577
+ createSvg({
7578
+ icon: ChevronRight,
7579
+ classes: "ml-auto pointer-events-none size-4 shrink-0 transition-transform duration-200 [[aria-expanded=true]>&]:rotate-90",
7580
+ attrs: {
7581
+ "aria-hidden": true,
7582
+ role: "presentation"
7583
+ }
7584
+ })
7585
+ );
7586
+ el.addEventListener("click", handler);
7587
+ cleanup(() => {
7588
+ el.removeEventListener("click", handler);
7589
+ });
7590
+ } else {
7591
+ el.classList.add("[&>svg:not(:first-child):last-child]:ml-auto");
7592
+ }
7456
7593
  });
7457
7594
  Alpine.directive("h-sidebar-menu-action", (el, { modifiers }) => {
7458
7595
  el.classList.add(
7459
7596
  "text-sidebar-foreground",
7460
7597
  "ring-sidebar-ring",
7461
7598
  "hover:bg-sidebar-secondary",
7599
+ "active:bg-sidebar-secondary/70",
7462
7600
  "hover:text-sidebar-secondary-foreground",
7463
7601
  "peer-hover/menu-button:text-sidebar-secondary-foreground",
7602
+ "peer-active/menu-button:text-sidebar-primary-foreground",
7603
+ "peer-data-[active=true]/menu-button:text-sidebar-primary-foreground",
7464
7604
  "absolute",
7465
- "top-1.5",
7466
- "right-1.5",
7605
+ "top-0.5",
7606
+ "right-0.5",
7607
+ "bottom-0.5",
7467
7608
  "flex",
7468
7609
  "aspect-square",
7469
- "w-5",
7610
+ "h-auto",
7470
7611
  "items-center",
7471
7612
  "justify-center",
7472
7613
  "rounded-md",
@@ -7479,13 +7620,10 @@
7479
7620
  "after:absolute",
7480
7621
  "after:-inset-2",
7481
7622
  "md:after:hidden",
7482
- "peer-data-[size=sm]/menu-button:top-1",
7483
- "peer-data-[size=default]/menu-button:top-1.5",
7484
- "peer-data-[size=lg]/menu-button:top-2.5",
7485
7623
  "group-data-[collapsed=true]/sidebar:hidden"
7486
7624
  );
7487
7625
  if (modifiers.includes("autohide")) {
7488
- el.classList.add("peer-data-[active=true]/menu-button:text-sidebar-secondary-foreground", "group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
7626
+ el.classList.add("group-focus-within/menu-item:opacity-100", "group-hover/menu-item:opacity-100", "data-[state=open]:opacity-100", "md:opacity-0");
7489
7627
  }
7490
7628
  if (el.tagName !== "BUTTON") {
7491
7629
  el.setAttribute("role", "button");
@@ -7494,30 +7632,11 @@
7494
7632
  }
7495
7633
  el.setAttribute("data-slot", "sidebar-menu-action");
7496
7634
  });
7497
- Alpine.directive("h-sidebar-menu-badge", (el) => {
7498
- el.classList.add(
7499
- "text-sidebar-foreground",
7500
- "pointer-events-none",
7501
- "absolute",
7502
- "right-1.5",
7503
- "flex",
7504
- "h-5",
7505
- "min-w-5",
7506
- "items-center",
7507
- "justify-center",
7508
- "rounded-md",
7509
- "px-1",
7510
- "text-xs",
7511
- "font-medium",
7512
- "tabular-nums",
7513
- "select-none",
7514
- "peer-hover/menu-button:text-sidebar-secondary-foreground",
7515
- "peer-data-[active=true]/menu-button:text-sidebar-primary-foreground",
7516
- "peer-data-[size=sm]/menu-button:top-1",
7517
- "peer-data-[size=default]/menu-button:top-1.5",
7518
- "peer-data-[size=lg]/menu-button:top-2.5",
7519
- "group-data-[collapsed=true]/sidebar:hidden"
7520
- );
7635
+ Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
7636
+ if (el.tagName !== "SPAN") {
7637
+ throw new Error(`${original} must be a span element`);
7638
+ }
7639
+ 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");
7521
7640
  el.setAttribute("data-slot", "sidebar-menu-badge");
7522
7641
  });
7523
7642
  Alpine.directive("h-sidebar-menu-skeleton", (el, { modifiers }) => {
@@ -7538,68 +7657,27 @@
7538
7657
  el.setAttribute("data-slot", "sidebar-separator");
7539
7658
  el.setAttribute("role", "none");
7540
7659
  });
7541
- Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
7542
- el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
7543
- if (!modifiers.includes("flat")) {
7544
- el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
7660
+ Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
7661
+ if (el.tagName !== "UL") {
7662
+ throw new Error(`${original} must be an ul element`);
7545
7663
  }
7546
- el.setAttribute("data-slot", "sidebar-menu-sub");
7547
- });
7548
- Alpine.directive("h-sidebar-menu-sub-item", (el) => {
7549
- el.classList.add("group/menu-sub-item", "relative");
7550
- el.setAttribute("data-slot", "sidebar-menu-sub-item");
7551
- });
7552
- Alpine.directive("h-sidebar-menu-sub-button", (el) => {
7553
- if (el.tagName !== "BUTTON") {
7554
- throw new Error(`${original} must be a button`);
7664
+ const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
7665
+ if (!menuItem) {
7666
+ throw new Error(`${original} must be placed inside a sidebar menu item`);
7555
7667
  }
7556
- el.classList.add(
7557
- "text-sidebar-foreground",
7558
- "ring-sidebar-ring",
7559
- "hover:bg-sidebar-secondary",
7560
- "hover:text-sidebar-secondary-foreground",
7561
- "active:bg-primary-secondary",
7562
- "active:text-sidebar-primary-foreground",
7563
- "[&>svg]:text-sidebar-secondary-foreground",
7564
- "flex",
7565
- "h-7",
7566
- "w-full",
7567
- "min-w-0",
7568
- "-translate-x-px",
7569
- "items-center",
7570
- "gap-2",
7571
- "overflow-hidden",
7572
- "rounded-md",
7573
- "px-2",
7574
- "align-middle",
7575
- "outline-hidden",
7576
- "focus-visible:ring-2",
7577
- "disabled:pointer-events-none",
7578
- "disabled:opacity-50",
7579
- "aria-disabled:pointer-events-none",
7580
- "aria-disabled:opacity-50",
7581
- "[&>span]:truncate",
7582
- "[&>span]:align-middle",
7583
- "[&>svg]:size-4",
7584
- "[&>svg]:shrink-0",
7585
- "[&>svg:not(:first-child):last-child]:ml-auto",
7586
- "data-[active=true]:bg-sidebar-primary",
7587
- "data-[active=true]:text-sidebar-primary-foreground",
7588
- "group-data-[collapsed=true]/sidebar:hidden"
7589
- );
7590
- el.setAttribute("type", "button");
7591
- el.setAttribute("data-slot", "sidebar-menu-sub-button");
7592
- const sizes = {
7593
- sm: ["text-xs"],
7594
- md: ["text-sm"]
7595
- };
7596
- function setSize2(size3) {
7597
- if (sizes.hasOwnProperty(size3)) {
7598
- el.classList.add(...sizes[size3]);
7599
- }
7668
+ 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");
7669
+ if (el.getAttribute("data-line") !== "false") {
7670
+ el.classList.add("border-sidebar-border", "border-l");
7671
+ }
7672
+ el.setAttribute("data-slot", "sidebar-menu-sub");
7673
+ if (menuItem._h_sidebar_menu_item.collapsable) {
7674
+ el.setAttribute("id", menuItem._h_sidebar_menu_item.controls);
7675
+ el.setAttribute("aria-labelledby", menuItem._h_sidebar_menu_item.controlId);
7676
+ el.setAttribute("data-collapsed", menuItem._h_sidebar_menu_item.state.collapsed);
7677
+ effect(() => {
7678
+ el.setAttribute("data-collapsed", menuItem._h_sidebar_menu_item.state.collapsed);
7679
+ });
7600
7680
  }
7601
- if (!el.hasAttribute("data-size")) el.setAttribute("data-size", "md");
7602
- setSize2(el.getAttribute("data-size"));
7603
7681
  });
7604
7682
  Alpine.directive("h-sidebar-footer", (el) => {
7605
7683
  el.classList.add("vbox", "gap-2", "px-2", "h-12", "justify-center", "border-t");
@@ -7850,10 +7928,10 @@
7850
7928
  observer.disconnect();
7851
7929
  });
7852
7930
  });
7853
- Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7931
+ Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7854
7932
  const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
7855
7933
  if (!split) {
7856
- throw new Error(`${original2} must be inside an split element`);
7934
+ throw new Error(`${original} must be inside an split element`);
7857
7935
  }
7858
7936
  el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
7859
7937
  el.setAttribute("tabindex", "-1");
@@ -8373,7 +8451,7 @@
8373
8451
  el.setAttribute("role", "tablist");
8374
8452
  el.setAttribute("data-slot", "tab-list");
8375
8453
  });
8376
- Alpine.directive("h-tab", (el, { original: original2 }) => {
8454
+ Alpine.directive("h-tab", (el, { original }) => {
8377
8455
  el.classList.add(
8378
8456
  "cursor-pointer",
8379
8457
  "focus-visible:border-ring",
@@ -8420,8 +8498,8 @@
8420
8498
  );
8421
8499
  el.setAttribute("role", "tab");
8422
8500
  el.setAttribute("data-slot", "tab");
8423
- if (!el.hasAttribute("id")) throw new Error(`${original2}: Tabs must have an id`);
8424
- if (!el.hasAttribute("aria-controls")) throw new Error(`${original2}: aria-controls must be set to the tab-content id.`);
8501
+ if (!el.hasAttribute("id")) throw new Error(`${original}: Tabs must have an id`);
8502
+ if (!el.hasAttribute("aria-controls")) throw new Error(`${original}: aria-controls must be set to the tab-content id.`);
8425
8503
  });
8426
8504
  Alpine.directive("h-tab-action", (el) => {
8427
8505
  el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
@@ -8455,13 +8533,13 @@
8455
8533
  el.setAttribute("role", "button");
8456
8534
  el.setAttribute("data-slot", "tab-list-action");
8457
8535
  });
8458
- Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
8536
+ Alpine.directive("h-tabs-content", (el, { original }) => {
8459
8537
  el.classList.add("flex-1", "outline-none");
8460
8538
  el.setAttribute("role", "tabpanel");
8461
8539
  el.setAttribute("tabindex", "0");
8462
8540
  el.setAttribute("data-slot", "tabs-content");
8463
- if (!el.hasAttribute("id")) throw new Error(`${original2}: Tab content must have an id`);
8464
- if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original2}: aria-labelledby must be set to the tab id.`);
8541
+ if (!el.hasAttribute("id")) throw new Error(`${original}: Tab content must have an id`);
8542
+ if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original}: aria-labelledby must be set to the tab id.`);
8465
8543
  });
8466
8544
  }
8467
8545
 
@@ -8854,13 +8932,13 @@
8854
8932
  top.removeEventListener("click", el._h_timepicker.close);
8855
8933
  });
8856
8934
  });
8857
- Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
8935
+ Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
8858
8936
  if (el.tagName !== "INPUT") {
8859
- throw new Error(`${original2} must be a readonly input of type "text"`);
8937
+ throw new Error(`${original} must be a readonly input of type "text"`);
8860
8938
  }
8861
8939
  const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
8862
8940
  if (!timepicker) {
8863
- throw new Error(`${original2} must be inside a time-picker element`);
8941
+ throw new Error(`${original} must be inside a time-picker element`);
8864
8942
  }
8865
8943
  timepicker._h_timepicker.focusInput = () => {
8866
8944
  el.focus();
@@ -9509,7 +9587,7 @@
9509
9587
  el.removeEventListener("pointerleave", handler);
9510
9588
  });
9511
9589
  });
9512
- Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
9590
+ Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
9513
9591
  const tooltip = (() => {
9514
9592
  let sibling = el.previousElementSibling;
9515
9593
  while (sibling && !sibling.hasOwnProperty("_tooltip")) {
@@ -9518,7 +9596,7 @@
9518
9596
  return sibling;
9519
9597
  })();
9520
9598
  if (!tooltip) {
9521
- throw new Error(`${original2} must be placed after a tooltip trigger element`);
9599
+ throw new Error(`${original} must be placed after a tooltip trigger element`);
9522
9600
  }
9523
9601
  el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
9524
9602
  el.setAttribute("data-slot", "tooltip");
@@ -9724,9 +9802,9 @@
9724
9802
  });
9725
9803
  }
9726
9804
  });
9727
- Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
9805
+ Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
9728
9806
  const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
9729
- if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
9807
+ if (!treeItem) throw new Error(`${original} must be inside a tree item`);
9730
9808
  el.classList.add(
9731
9809
  "flex",
9732
9810
  "w-full",
@@ -9881,7 +9959,7 @@
9881
9959
 
9882
9960
  // src/utils/template.js
9883
9961
  function template_default(Alpine) {
9884
- Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
9962
+ Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
9885
9963
  if (el.hasAttribute(Alpine2.prefixed("data"))) {
9886
9964
  const template = evaluate2(expression);
9887
9965
  const clone = template.content.cloneNode(true).firstElementChild;
@@ -9895,7 +9973,7 @@
9895
9973
  clone.remove();
9896
9974
  });
9897
9975
  } else {
9898
- console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
9976
+ console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
9899
9977
  }
9900
9978
  });
9901
9979
  }
@@ -9913,7 +9991,7 @@
9913
9991
  }
9914
9992
 
9915
9993
  // package.json
9916
- var version = "1.2.1";
9994
+ var version = "1.3.0";
9917
9995
 
9918
9996
  // src/index.js
9919
9997
  window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };