@codbex/harmonia 1.2.0 → 1.2.1

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, 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(`${original} must be inside an accordion`);
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(`${original} must be a header element`);
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(`${original} must have an accordion and accordion item parent elements`);
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(`${original} must be inside an avatar element`);
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(`${original} must be inside an avatar element`);
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(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
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
  }
@@ -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, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
2342
+ Alpine.directive("h-calendar", (el, { original: original2, 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(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
2386
+ console.error(`${original2}: 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(`${original}: input value is not a valid date - ${el._x_model.get()}`);
2403
+ console.error(`${original2}: 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, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
2912
+ Alpine.directive("h-collapsible-trigger", (el, { original: original2, 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(`${original} must be inside a collapsible element`);
2915
+ throw new Error(`${original2} 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 }, { effect, Alpine: Alpine2 }) => {
2934
+ Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
2935
2935
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
2936
2936
  if (!collapsible) {
2937
- throw new Error(`${original} must be inside an h-collapsible element`);
2937
+ throw new Error(`${original2} 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, modifiers }, { Alpine: Alpine2, cleanup }) => {
2968
+ Alpine.directive("h-date-picker", (el, { original: original2, 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(`${original} must contain an input`);
2981
+ throw new Error(`${original2} 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 }, { effect, cleanup, Alpine: Alpine2 }) => {
3058
+ Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
3059
3059
  if (el.tagName !== "BUTTON") {
3060
- throw new Error(`${original} must be a button`);
3060
+ throw new Error(`${original2} must be a button`);
3061
3061
  }
3062
3062
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3063
- throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
3063
+ throw new Error(`${original2}: 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(`${original} must be inside an date-picker element`);
3067
+ throw new Error(`${original2} 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, modifiers }) => {
3347
+ Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
3348
3348
  if (el.tagName.toLowerCase() !== "svg") {
3349
- throw new Error(`${original} works only on svg elements`);
3349
+ throw new Error(`${original2} works only on svg elements`);
3350
3350
  } else if (!el.hasAttribute("role")) {
3351
- throw new Error(`${original} must have a role`);
3351
+ throw new Error(`${original2} must have a role`);
3352
3352
  } else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
3353
- throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
3353
+ throw new Error(`${original2}: 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 }, { cleanup }) => {
3570
+ Alpine.directive("h-input-number", (el, { original: original2 }, { 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(`${original} must contain an input of type 'number'`);
3603
+ throw new Error(`${original2} 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 }, { Alpine: Alpine2 }) => {
3849
+ Alpine.directive("h-list-header", (el, { original: original2 }, { 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(`${original} must be placed inside a list element`);
3855
+ throw new Error(`${original2} 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, modifiers }, { cleanup, Alpine: Alpine2 }) => {
3907
+ Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
3908
3908
  if (el.tagName !== "UL") {
3909
- throw new Error(`${original} must be an ul element`);
3909
+ throw new Error(`${original2} 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(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
3917
+ throw new Error(`${original2} 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(`${original} menu must be placed after a menu trigger element`);
3929
+ throw new Error(`${original2} 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 }, { cleanup, Alpine: Alpine2 }) => {
4148
+ Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
4149
4149
  if (el.tagName !== "LI") {
4150
- throw new Error(`${original} must be a li element`);
4150
+ throw new Error(`${original2} 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 }, { cleanup, Alpine: Alpine2 }) => {
4204
+ Alpine.directive("h-menu-sub", (el, { original: original2 }, { 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(`${original} must have a parent`);
4236
+ if (!parentMenu) throw new Error(`${original2} 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 }, { cleanup, Alpine: Alpine2 }) => {
4330
+ Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
4331
4331
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
4332
- throw new Error(`${original} must be a li or div element`);
4332
+ throw new Error(`${original2} 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, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4398
+ Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4399
4399
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
4400
- throw new Error(`${original} must be a li or div element`);
4400
+ throw new Error(`${original2} must be a li or div element`);
4401
4401
  }
4402
4402
  el.classList.add(
4403
4403
  "focus:bg-secondary-hover",
@@ -4625,7 +4625,7 @@
4625
4625
  });
4626
4626
  }
4627
4627
  });
4628
- Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
4628
+ Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
4629
4629
  const popover = (() => {
4630
4630
  let sibling = el.previousElementSibling;
4631
4631
  while (sibling && !sibling.hasOwnProperty("_popover")) {
@@ -4634,7 +4634,7 @@
4634
4634
  return sibling;
4635
4635
  })();
4636
4636
  if (!popover) {
4637
- throw new Error(`${original} must be placed after a popover element`);
4637
+ throw new Error(`${original2} must be placed after a popover element`);
4638
4638
  }
4639
4639
  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
4640
  el.setAttribute("data-slot", "popover");
@@ -6695,13 +6695,13 @@
6695
6695
  });
6696
6696
  }
6697
6697
  });
6698
- Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
6698
+ Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
6699
6699
  if (el.tagName !== "INPUT") {
6700
- throw new Error(`${original} must be a readonly input of type "text"`);
6700
+ throw new Error(`${original2} must be a readonly input of type "text"`);
6701
6701
  }
6702
6702
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6703
6703
  if (!select) {
6704
- throw new Error(`${original} must be inside a select element`);
6704
+ throw new Error(`${original2} must be inside a select element`);
6705
6705
  } else if (el.hasOwnProperty("_x_model")) {
6706
6706
  select._h_select.multiple = Array.isArray(el._x_model.get());
6707
6707
  select._h_model.set = (value) => {
@@ -6954,10 +6954,10 @@
6954
6954
  observer.disconnect();
6955
6955
  });
6956
6956
  });
6957
- Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
6957
+ Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
6958
6958
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6959
6959
  if (!select) {
6960
- throw new Error(`${original} must be inside a select element`);
6960
+ throw new Error(`${original2} must be inside a select element`);
6961
6961
  }
6962
6962
  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
6963
  el.setAttribute("data-slot", "select-content");
@@ -6968,7 +6968,7 @@
6968
6968
  el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
6969
6969
  const control = select.querySelector(`#${select._h_select.id}`);
6970
6970
  if (!control) {
6971
- throw new Error(`${original}: trigger not found`);
6971
+ throw new Error(`${original2}: trigger not found`);
6972
6972
  }
6973
6973
  let autoUpdateCleanup;
6974
6974
  function updatePosition() {
@@ -7010,10 +7010,10 @@
7010
7010
  }
7011
7011
  });
7012
7012
  });
7013
- Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7013
+ Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7014
7014
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7015
7015
  if (!select) {
7016
- throw new Error(`${original} must be inside an h-select element`);
7016
+ throw new Error(`${original2} must be inside an h-select element`);
7017
7017
  } else {
7018
7018
  select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
7019
7019
  }
@@ -7085,10 +7085,10 @@
7085
7085
  selectGroup._h_selectGroup.labelledby = id;
7086
7086
  }
7087
7087
  });
7088
- Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
7088
+ Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
7089
7089
  const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7090
7090
  if (!select) {
7091
- throw new Error(`${original} must be inside an h-select element`);
7091
+ throw new Error(`${original2} must be inside an h-select element`);
7092
7092
  }
7093
7093
  el.classList.add(
7094
7094
  "focus:bg-primary",
@@ -7373,6 +7373,11 @@
7373
7373
  "md:after:hidden",
7374
7374
  "group-data-[collapsed=true]/sidebar:hidden"
7375
7375
  );
7376
+ if (el.tagName !== "BUTTON") {
7377
+ el.setAttribute("role", "button");
7378
+ } else {
7379
+ el.setAttribute("type", "button");
7380
+ }
7376
7381
  el.setAttribute("data-slot", "sidebar-group-action");
7377
7382
  });
7378
7383
  Alpine.directive("h-sidebar-group-content", (el) => {
@@ -7383,11 +7388,18 @@
7383
7388
  el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
7384
7389
  el.setAttribute("data-slot", "sidebar-menu");
7385
7390
  });
7386
- Alpine.directive("h-sidebar-menu-item", (el) => {
7391
+ Alpine.directive("h-sidebar-menu-item", (el, { original: original2 }) => {
7392
+ if (el.tagName !== "BUTTON") {
7393
+ throw new Error(`${original2} must be a button`);
7394
+ }
7387
7395
  el.classList.add("group/menu-item", "relative");
7396
+ el.setAttribute("type", "button");
7388
7397
  el.setAttribute("data-slot", "sidebar-menu-item");
7389
7398
  });
7390
7399
  Alpine.directive("h-sidebar-menu-button", (el) => {
7400
+ if (el.tagName !== "BUTTON") {
7401
+ throw new Error(`${original} must be a button`);
7402
+ }
7391
7403
  el.classList.add(
7392
7404
  "peer/menu-button",
7393
7405
  "flex",
@@ -7427,6 +7439,7 @@
7427
7439
  "[&>svg]:shrink-0",
7428
7440
  "[&>svg:not(:first-child):last-child]:ml-auto"
7429
7441
  );
7442
+ el.setAttribute("type", "button");
7430
7443
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "sidebar-menu-button");
7431
7444
  const sizes = {
7432
7445
  default: ["h-8", "text-sm"],
@@ -7474,6 +7487,11 @@
7474
7487
  if (modifiers.includes("autohide")) {
7475
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");
7476
7489
  }
7490
+ if (el.tagName !== "BUTTON") {
7491
+ el.setAttribute("role", "button");
7492
+ } else {
7493
+ el.setAttribute("type", "button");
7494
+ }
7477
7495
  el.setAttribute("data-slot", "sidebar-menu-action");
7478
7496
  });
7479
7497
  Alpine.directive("h-sidebar-menu-badge", (el) => {
@@ -7532,6 +7550,9 @@
7532
7550
  el.setAttribute("data-slot", "sidebar-menu-sub-item");
7533
7551
  });
7534
7552
  Alpine.directive("h-sidebar-menu-sub-button", (el) => {
7553
+ if (el.tagName !== "BUTTON") {
7554
+ throw new Error(`${original} must be a button`);
7555
+ }
7535
7556
  el.classList.add(
7536
7557
  "text-sidebar-foreground",
7537
7558
  "ring-sidebar-ring",
@@ -7566,6 +7587,7 @@
7566
7587
  "data-[active=true]:text-sidebar-primary-foreground",
7567
7588
  "group-data-[collapsed=true]/sidebar:hidden"
7568
7589
  );
7590
+ el.setAttribute("type", "button");
7569
7591
  el.setAttribute("data-slot", "sidebar-menu-sub-button");
7570
7592
  const sizes = {
7571
7593
  sm: ["text-xs"],
@@ -7828,10 +7850,10 @@
7828
7850
  observer.disconnect();
7829
7851
  });
7830
7852
  });
7831
- Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7853
+ Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7832
7854
  const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
7833
7855
  if (!split) {
7834
- throw new Error(`${original} must be inside an split element`);
7856
+ throw new Error(`${original2} must be inside an split element`);
7835
7857
  }
7836
7858
  el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
7837
7859
  el.setAttribute("tabindex", "-1");
@@ -8351,7 +8373,7 @@
8351
8373
  el.setAttribute("role", "tablist");
8352
8374
  el.setAttribute("data-slot", "tab-list");
8353
8375
  });
8354
- Alpine.directive("h-tab", (el, { original }) => {
8376
+ Alpine.directive("h-tab", (el, { original: original2 }) => {
8355
8377
  el.classList.add(
8356
8378
  "cursor-pointer",
8357
8379
  "focus-visible:border-ring",
@@ -8398,8 +8420,8 @@
8398
8420
  );
8399
8421
  el.setAttribute("role", "tab");
8400
8422
  el.setAttribute("data-slot", "tab");
8401
- if (!el.hasAttribute("id")) throw new Error(`${original}: Tabs must have an id`);
8402
- if (!el.hasAttribute("aria-controls")) throw new Error(`${original}: aria-controls must be set to the tab-content id.`);
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.`);
8403
8425
  });
8404
8426
  Alpine.directive("h-tab-action", (el) => {
8405
8427
  el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
@@ -8433,13 +8455,13 @@
8433
8455
  el.setAttribute("role", "button");
8434
8456
  el.setAttribute("data-slot", "tab-list-action");
8435
8457
  });
8436
- Alpine.directive("h-tabs-content", (el, { original }) => {
8458
+ Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
8437
8459
  el.classList.add("flex-1", "outline-none");
8438
8460
  el.setAttribute("role", "tabpanel");
8439
8461
  el.setAttribute("tabindex", "0");
8440
8462
  el.setAttribute("data-slot", "tabs-content");
8441
- if (!el.hasAttribute("id")) throw new Error(`${original}: Tab content must have an id`);
8442
- if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original}: aria-labelledby must be set to the tab id.`);
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.`);
8443
8465
  });
8444
8466
  }
8445
8467
 
@@ -8832,13 +8854,13 @@
8832
8854
  top.removeEventListener("click", el._h_timepicker.close);
8833
8855
  });
8834
8856
  });
8835
- Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
8857
+ Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
8836
8858
  if (el.tagName !== "INPUT") {
8837
- throw new Error(`${original} must be a readonly input of type "text"`);
8859
+ throw new Error(`${original2} must be a readonly input of type "text"`);
8838
8860
  }
8839
8861
  const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
8840
8862
  if (!timepicker) {
8841
- throw new Error(`${original} must be inside a time-picker element`);
8863
+ throw new Error(`${original2} must be inside a time-picker element`);
8842
8864
  }
8843
8865
  timepicker._h_timepicker.focusInput = () => {
8844
8866
  el.focus();
@@ -9487,7 +9509,7 @@
9487
9509
  el.removeEventListener("pointerleave", handler);
9488
9510
  });
9489
9511
  });
9490
- Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
9512
+ Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
9491
9513
  const tooltip = (() => {
9492
9514
  let sibling = el.previousElementSibling;
9493
9515
  while (sibling && !sibling.hasOwnProperty("_tooltip")) {
@@ -9496,7 +9518,7 @@
9496
9518
  return sibling;
9497
9519
  })();
9498
9520
  if (!tooltip) {
9499
- throw new Error(`${original} must be placed after a tooltip trigger element`);
9521
+ throw new Error(`${original2} must be placed after a tooltip trigger element`);
9500
9522
  }
9501
9523
  el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
9502
9524
  el.setAttribute("data-slot", "tooltip");
@@ -9702,9 +9724,9 @@
9702
9724
  });
9703
9725
  }
9704
9726
  });
9705
- Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
9727
+ Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
9706
9728
  const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
9707
- if (!treeItem) throw new Error(`${original} must be inside a tree item`);
9729
+ if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
9708
9730
  el.classList.add(
9709
9731
  "flex",
9710
9732
  "w-full",
@@ -9859,7 +9881,7 @@
9859
9881
 
9860
9882
  // src/utils/template.js
9861
9883
  function template_default(Alpine) {
9862
- Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
9884
+ Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
9863
9885
  if (el.hasAttribute(Alpine2.prefixed("data"))) {
9864
9886
  const template = evaluate2(expression);
9865
9887
  const clone = template.content.cloneNode(true).firstElementChild;
@@ -9873,7 +9895,7 @@
9873
9895
  clone.remove();
9874
9896
  });
9875
9897
  } else {
9876
- console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
9898
+ console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
9877
9899
  }
9878
9900
  });
9879
9901
  }
@@ -9891,7 +9913,7 @@
9891
9913
  }
9892
9914
 
9893
9915
  // package.json
9894
- var version = "1.2.0";
9916
+ var version = "1.2.1";
9895
9917
 
9896
9918
  // src/index.js
9897
9919
  window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };