@codbex/harmonia 1.4.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2210,10 +2210,10 @@ function accordion_default(Alpine) {
2210
2210
  }) : { single: false };
2211
2211
  el.setAttribute("data-slot", "accordion");
2212
2212
  });
2213
- Alpine.directive("h-accordion-item", (el, { original, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
2213
+ Alpine.directive("h-accordion-item", (el, { original: original2, expression, modifiers }, { effect, Alpine: Alpine2 }) => {
2214
2214
  const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
2215
2215
  if (!accordion) {
2216
- throw new Error(`${original} must be inside an accordion`);
2216
+ throw new Error(`${original2} must be inside an accordion`);
2217
2217
  }
2218
2218
  el.classList.add("border-b", "last:border-b-0", "[[data-variant=header]_&]:data-[state=closed]:border-b-0");
2219
2219
  el.setAttribute("data-slot", "accordion-item");
@@ -2241,14 +2241,14 @@ function accordion_default(Alpine) {
2241
2241
  setAttributes();
2242
2242
  effect(setAttributes);
2243
2243
  });
2244
- Alpine.directive("h-accordion-trigger", (el, { original, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
2244
+ Alpine.directive("h-accordion-trigger", (el, { original: original2, expression }, { effect, evaluateLater, Alpine: Alpine2, cleanup }) => {
2245
2245
  if (el.tagName.length !== 2 && !el.tagName.startsWith("H")) {
2246
- throw new Error(`${original} must be a header element`);
2246
+ throw new Error(`${original2} must be a header element`);
2247
2247
  }
2248
2248
  const accordion = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordion"));
2249
2249
  const accordionItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_accordionItem"));
2250
2250
  if (!accordionItem || !accordion) {
2251
- throw new Error(`${original} must have an accordion and accordion item parent elements`);
2251
+ throw new Error(`${original2} must have an accordion and accordion item parent elements`);
2252
2252
  }
2253
2253
  el.classList.add(
2254
2254
  "flex",
@@ -2433,10 +2433,10 @@ function avatar_default(Alpine) {
2433
2433
  el.classList.add("cursor-pointer", "hover:bg-secondary-hover", "active:bg-secondary-active");
2434
2434
  }
2435
2435
  });
2436
- Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
2436
+ Alpine.directive("h-avatar-image", (el, { original: original2 }, { cleanup }) => {
2437
2437
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
2438
2438
  if (!avatar) {
2439
- throw new Error(`${original} must be inside an avatar element`);
2439
+ throw new Error(`${original2} must be inside an avatar element`);
2440
2440
  }
2441
2441
  el.classList.add("aspect-square", "size-full");
2442
2442
  el.setAttribute("data-slot", "avatar-image");
@@ -2467,10 +2467,10 @@ function avatar_default(Alpine) {
2467
2467
  observer.disconnect();
2468
2468
  });
2469
2469
  });
2470
- Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
2470
+ Alpine.directive("h-avatar-fallback", (el, { original: original2 }, { effect }) => {
2471
2471
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
2472
2472
  if (!avatar) {
2473
- throw new Error(`${original} must be inside an avatar element`);
2473
+ throw new Error(`${original2} must be inside an avatar element`);
2474
2474
  }
2475
2475
  el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
2476
2476
  el.setAttribute("data-slot", "avatar-fallback");
@@ -2679,7 +2679,7 @@ var getButtonSize = (size3, isAddon = false) => {
2679
2679
  }
2680
2680
  };
2681
2681
  function button_default(Alpine) {
2682
- Alpine.directive("h-button", (el, { original, modifiers }, { cleanup }) => {
2682
+ Alpine.directive("h-button", (el, { original: original2, modifiers }, { cleanup }) => {
2683
2683
  setButtonClasses(el);
2684
2684
  if (!el.hasAttribute("data-slot")) {
2685
2685
  el.setAttribute("data-slot", "button");
@@ -2696,7 +2696,7 @@ function button_default(Alpine) {
2696
2696
  el.classList.remove(...getButtonSize(lastSize, isAddon));
2697
2697
  el.classList.add(...getButtonSize(size3, isAddon));
2698
2698
  if (size3.startsWith("icon") && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
2699
- console.error(`${original}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
2699
+ console.error(`${original2}: Icon-only buttons must have an "aria-label" or "aria-labelledby" attribute`, el);
2700
2700
  }
2701
2701
  lastSize = size3;
2702
2702
  }
@@ -4250,7 +4250,7 @@ var computePosition2 = (reference, floating, options) => {
4250
4250
 
4251
4251
  // src/components/calendar.js
4252
4252
  function calendar_default(Alpine) {
4253
- Alpine.directive("h-calendar", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4253
+ Alpine.directive("h-calendar", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4254
4254
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
4255
4255
  el.classList.add("border", "rounded-control", "gap-2", "p-2");
4256
4256
  el.setAttribute("tabindex", "-1");
@@ -4294,7 +4294,7 @@ function calendar_default(Alpine) {
4294
4294
  const onInputChange = () => {
4295
4295
  const newValue = new Date(datepicker._h_datepicker.input.value);
4296
4296
  if (isNaN(newValue)) {
4297
- console.error(`${original}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
4297
+ console.error(`${original2}: input value is not a valid date - ${datepicker._h_datepicker.input.value}`);
4298
4298
  datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
4299
4299
  return;
4300
4300
  } else if (selected.getTime() !== newValue.getTime()) {
@@ -4311,7 +4311,7 @@ function calendar_default(Alpine) {
4311
4311
  if (el.hasOwnProperty("_x_model") && el._x_model.get()) {
4312
4312
  selected = new Date(el._x_model.get());
4313
4313
  if (isNaN(selected)) {
4314
- console.error(`${original}: input value is not a valid date - ${el._x_model.get()}`);
4314
+ console.error(`${original2}: input value is not a valid date - ${el._x_model.get()}`);
4315
4315
  if (datepicker) datepicker._h_datepicker.input.setCustomValidity("Input value is not a valid date.");
4316
4316
  else el.setAttribute("data-invalid", "true");
4317
4317
  } else if (datepicker) {
@@ -4820,10 +4820,10 @@ function collapsible_default(Alpine) {
4820
4820
  });
4821
4821
  }
4822
4822
  });
4823
- Alpine.directive("h-collapsible-trigger", (el, { original, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
4823
+ Alpine.directive("h-collapsible-trigger", (el, { original: original2, modifiers }, { effect, Alpine: Alpine2, cleanup }) => {
4824
4824
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
4825
4825
  if (!collapsible) {
4826
- throw new Error(`${original} must be inside a collapsible element`);
4826
+ throw new Error(`${original2} must be inside a collapsible element`);
4827
4827
  }
4828
4828
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-trigger");
4829
4829
  if (modifiers.includes("chevron")) {
@@ -4842,10 +4842,10 @@ function collapsible_default(Alpine) {
4842
4842
  el.removeEventListener("click", handler);
4843
4843
  });
4844
4844
  });
4845
- Alpine.directive("h-collapsible-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
4845
+ Alpine.directive("h-collapsible-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
4846
4846
  const collapsible = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_collapsible"));
4847
4847
  if (!collapsible) {
4848
- throw new Error(`${original} must be inside an h-collapsible element`);
4848
+ throw new Error(`${original2} must be inside an h-collapsible element`);
4849
4849
  }
4850
4850
  if (!el.hasAttribute("data-slot")) el.setAttribute("data-slot", "collapsible-content");
4851
4851
  el.classList.add("data-[state=closed]:!hidden");
@@ -4876,7 +4876,7 @@ function sizeObserver(el) {
4876
4876
 
4877
4877
  // src/components/datepicker.js
4878
4878
  function datepicker_default(Alpine) {
4879
- Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
4879
+ Alpine.directive("h-date-picker", (el, { original: original2, modifiers }, { Alpine: Alpine2, cleanup }) => {
4880
4880
  const state = Alpine2.reactive({
4881
4881
  expanded: false
4882
4882
  });
@@ -4889,7 +4889,7 @@ function datepicker_default(Alpine) {
4889
4889
  };
4890
4890
  el._h_datepicker.input = el.querySelector("input");
4891
4891
  if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
4892
- throw new Error(`${original} must contain an input`);
4892
+ throw new Error(`${original2} must contain an input`);
4893
4893
  } else if (el._h_datepicker.input.hasAttribute("id")) {
4894
4894
  el._h_datepicker.id = el._h_datepicker.input.getAttribute("id");
4895
4895
  } else {
@@ -4966,16 +4966,16 @@ function datepicker_default(Alpine) {
4966
4966
  observer.disconnect();
4967
4967
  });
4968
4968
  });
4969
- Alpine.directive("h-date-picker-trigger", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
4969
+ Alpine.directive("h-date-picker-trigger", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
4970
4970
  if (el.tagName !== "BUTTON") {
4971
- throw new Error(`${original} must be a button`);
4971
+ throw new Error(`${original2} must be a button`);
4972
4972
  }
4973
4973
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
4974
- throw new Error(`${original}: must have an "aria-label" or "aria-labelledby" attribute`);
4974
+ throw new Error(`${original2}: must have an "aria-label" or "aria-labelledby" attribute`);
4975
4975
  }
4976
4976
  const datepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_datepicker"));
4977
4977
  if (!datepicker) {
4978
- throw new Error(`${original} must be inside an date-picker element`);
4978
+ throw new Error(`${original2} must be inside an date-picker element`);
4979
4979
  }
4980
4980
  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");
4981
4981
  if (datepicker._h_datepicker.inTable) {
@@ -5255,13 +5255,13 @@ function fieldset_default(Alpine) {
5255
5255
 
5256
5256
  // src/components/icon.js
5257
5257
  function icon_default(Alpine) {
5258
- Alpine.directive("h-icon", (el, { original, modifiers }) => {
5258
+ Alpine.directive("h-icon", (el, { original: original2, modifiers }) => {
5259
5259
  if (el.tagName.toLowerCase() !== "svg") {
5260
- throw new Error(`${original} works only on svg elements`);
5260
+ throw new Error(`${original2} works only on svg elements`);
5261
5261
  } else if (!el.hasAttribute("role")) {
5262
- throw new Error(`${original} must have a role`);
5262
+ throw new Error(`${original2} must have a role`);
5263
5263
  } else if (el.getAttribute("role") === "img" && !el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
5264
- throw new Error(`${original}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
5264
+ throw new Error(`${original2}: svg images with the role of img must have an "aria-label" or "aria-labelledby" attribute`);
5265
5265
  }
5266
5266
  el.classList.add("fill-current");
5267
5267
  el.setAttribute("data-slot", "icon");
@@ -5478,7 +5478,7 @@ function input_default(Alpine) {
5478
5478
  el.classList.add("text-muted-foreground", "flex", "items-center", "gap-2", "text-sm", "[&_svg]:pointer-events-none", "[&_svg:not([class*='size-'])]:size-4");
5479
5479
  el.setAttribute("data-slot", "label");
5480
5480
  });
5481
- Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
5481
+ Alpine.directive("h-input-number", (el, { original: original2 }, { cleanup }) => {
5482
5482
  el.classList.add(
5483
5483
  "overflow-hidden",
5484
5484
  "group/input-number",
@@ -5511,7 +5511,7 @@ function input_default(Alpine) {
5511
5511
  el.setAttribute("data-slot", "input-number");
5512
5512
  const input = el.querySelector("input");
5513
5513
  if (!input || input.getAttribute("type") !== "number") {
5514
- throw new Error(`${original} must contain an input of type 'number'`);
5514
+ throw new Error(`${original2} must contain an input of type 'number'`);
5515
5515
  }
5516
5516
  if (!input.hasAttribute("type")) input.setAttribute("type", "number");
5517
5517
  if (!input.hasAttribute("inputmode")) input.setAttribute("inputmode", "numeric");
@@ -5757,13 +5757,13 @@ function list_default(Alpine) {
5757
5757
  el.setAttribute("data-slot", "list");
5758
5758
  el.setAttribute("role", "group");
5759
5759
  });
5760
- Alpine.directive("h-list-header", (el, { original }, { Alpine: Alpine2 }) => {
5760
+ Alpine.directive("h-list-header", (el, { original: original2 }, { Alpine: Alpine2 }) => {
5761
5761
  el.classList.add("font-medium", "flex", "items-center", "p-2", "gap-2", "align-middle", "bg-table-header", "text-table-header-foreground");
5762
5762
  el.setAttribute("role", "presentation");
5763
5763
  el.setAttribute("data-slot", "list-header");
5764
5764
  const list = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "list");
5765
5765
  if (!list) {
5766
- throw new Error(`${original} must be placed inside a list element`);
5766
+ throw new Error(`${original2} must be placed inside a list element`);
5767
5767
  }
5768
5768
  if (!el.hasAttribute("id")) {
5769
5769
  const id = `lbh${v4_default()}`;
@@ -5815,9 +5815,9 @@ function menu_default(Alpine) {
5815
5815
  };
5816
5816
  el.setAttribute("data-state", "closed");
5817
5817
  });
5818
- Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
5818
+ Alpine.directive("h-menu", (el, { original: original2, modifiers }, { cleanup, Alpine: Alpine2 }) => {
5819
5819
  if (el.tagName !== "UL") {
5820
- throw new Error(`${original} must be an ul element`);
5820
+ throw new Error(`${original2} must be an ul element`);
5821
5821
  }
5822
5822
  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");
5823
5823
  el.setAttribute("role", "menu");
@@ -5825,7 +5825,7 @@ function menu_default(Alpine) {
5825
5825
  el.setAttribute("tabindex", "-1");
5826
5826
  el.setAttribute("data-slot", "menu");
5827
5827
  if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) {
5828
- throw new Error(`${original} must have an "aria-label" or "aria-labelledby" attribute`);
5828
+ throw new Error(`${original2} must have an "aria-label" or "aria-labelledby" attribute`);
5829
5829
  }
5830
5830
  const isSubmenu = modifiers.includes("sub");
5831
5831
  const menuTrigger = (() => {
@@ -5837,7 +5837,7 @@ function menu_default(Alpine) {
5837
5837
  return sibling;
5838
5838
  })();
5839
5839
  if (!isSubmenu && !menuTrigger) {
5840
- throw new Error(`${original} menu must be placed after a menu trigger element`);
5840
+ throw new Error(`${original2} menu must be placed after a menu trigger element`);
5841
5841
  }
5842
5842
  let menuSubItem;
5843
5843
  if (isSubmenu) menuSubItem = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("data-slot") === "menu-sub");
@@ -6056,9 +6056,9 @@ function menu_default(Alpine) {
6056
6056
  el.removeEventListener("keydown", onKeyDown);
6057
6057
  });
6058
6058
  });
6059
- Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6059
+ Alpine.directive("h-menu-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6060
6060
  if (el.tagName !== "LI") {
6061
- throw new Error(`${original} must be a li element`);
6061
+ throw new Error(`${original2} must be a li element`);
6062
6062
  }
6063
6063
  el.classList.add(
6064
6064
  "focus:bg-secondary-hover",
@@ -6112,7 +6112,7 @@ function menu_default(Alpine) {
6112
6112
  el.removeEventListener("mouseleave", focusOut);
6113
6113
  });
6114
6114
  });
6115
- Alpine.directive("h-menu-sub", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6115
+ Alpine.directive("h-menu-sub", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6116
6116
  el.classList.add(
6117
6117
  "focus:bg-secondary-hover",
6118
6118
  "hover:bg-secondary-hover",
@@ -6144,7 +6144,7 @@ function menu_default(Alpine) {
6144
6144
  const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
6145
6145
  el.appendChild(chevronRight);
6146
6146
  const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
6147
- if (!parentMenu) throw new Error(`${original} must have a parent`);
6147
+ if (!parentMenu) throw new Error(`${original2} must have a parent`);
6148
6148
  el._menu_sub = {
6149
6149
  open: void 0,
6150
6150
  close: void 0,
@@ -6238,9 +6238,9 @@ function menu_default(Alpine) {
6238
6238
  el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
6239
6239
  el.setAttribute("data-slot", "menu-label");
6240
6240
  });
6241
- Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
6241
+ Alpine.directive("h-menu-checkbox-item", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
6242
6242
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
6243
- throw new Error(`${original} must be a li or div element`);
6243
+ throw new Error(`${original2} must be a li or div element`);
6244
6244
  }
6245
6245
  el.classList.add(
6246
6246
  "focus:bg-secondary-hover",
@@ -6306,9 +6306,9 @@ function menu_default(Alpine) {
6306
6306
  el.removeEventListener("mouseleave", focusOut);
6307
6307
  });
6308
6308
  });
6309
- Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
6309
+ Alpine.directive("h-menu-radio-item", (el, { original: original2, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
6310
6310
  if (el.tagName !== "LI" && el.tagName !== "DIV") {
6311
- throw new Error(`${original} must be a li or div element`);
6311
+ throw new Error(`${original2} must be a li or div element`);
6312
6312
  }
6313
6313
  el.classList.add(
6314
6314
  "focus:bg-secondary-hover",
@@ -6537,7 +6537,7 @@ function popover_default(Alpine) {
6537
6537
  });
6538
6538
  }
6539
6539
  });
6540
- Alpine.directive("h-popover", (el, { original, modifiers }, { effect }) => {
6540
+ Alpine.directive("h-popover", (el, { original: original2, modifiers }, { effect }) => {
6541
6541
  const popover = (() => {
6542
6542
  let sibling = el.previousElementSibling;
6543
6543
  while (sibling && !sibling.hasOwnProperty("_popover")) {
@@ -6546,7 +6546,7 @@ function popover_default(Alpine) {
6546
6546
  return sibling;
6547
6547
  })();
6548
6548
  if (!popover) {
6549
- throw new Error(`${original} must be placed after a popover element`);
6549
+ throw new Error(`${original2} must be placed after a popover element`);
6550
6550
  }
6551
6551
  el.classList.add("absolute", "bg-popover", "text-popover-foreground", "data-[state=closed]:hidden", "top-0", "left-0", "z-50", "min-w-[1rem]", "rounded-md", "border", "shadow-md", "outline-hidden", "overflow-auto");
6552
6552
  el.setAttribute("data-slot", "popover");
@@ -6749,9 +6749,9 @@ function select_default(Alpine) {
6749
6749
  });
6750
6750
  }
6751
6751
  });
6752
- Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
6752
+ Alpine.directive("h-select-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
6753
6753
  if (el.tagName !== "INPUT") {
6754
- throw new Error(`${original} must be an input of type "text"`);
6754
+ throw new Error(`${original2} must be an input of type "text"`);
6755
6755
  }
6756
6756
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
6757
6757
  const label = (() => {
@@ -6762,7 +6762,7 @@ function select_default(Alpine) {
6762
6762
  return;
6763
6763
  })();
6764
6764
  if (!select) {
6765
- throw new Error(`${original} must be inside a select element`);
6765
+ throw new Error(`${original2} must be inside a select element`);
6766
6766
  } else if (el.hasOwnProperty("_x_model")) {
6767
6767
  select._h_select.multiple = Array.isArray(el._x_model.get());
6768
6768
  select._h_model.set = (value) => {
@@ -6782,6 +6782,7 @@ function select_default(Alpine) {
6782
6782
  } else {
6783
6783
  el._x_model.set("");
6784
6784
  }
6785
+ el.dispatchEvent(new Event("change", { bubbles: true }));
6785
6786
  };
6786
6787
  select._h_model.get = el._x_model.get;
6787
6788
  } else {
@@ -7022,10 +7023,10 @@ function select_default(Alpine) {
7022
7023
  }
7023
7024
  });
7024
7025
  });
7025
- Alpine.directive("h-select-content", (el, { original }, { effect, Alpine: Alpine2 }) => {
7026
+ Alpine.directive("h-select-content", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
7026
7027
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7027
7028
  if (!select) {
7028
- throw new Error(`${original} must be inside a select element`);
7029
+ throw new Error(`${original2} must be inside a select element`);
7029
7030
  }
7030
7031
  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");
7031
7032
  el.setAttribute("data-slot", "select-content");
@@ -7034,7 +7035,7 @@ function select_default(Alpine) {
7034
7035
  el.setAttribute("tabindex", "-1");
7035
7036
  el.setAttribute("data-state", select._h_select.expanded ? "open" : "closed");
7036
7037
  if (!select._h_select.trigger) {
7037
- throw new Error(`${original}: trigger not found`);
7038
+ throw new Error(`${original2}: trigger not found`);
7038
7039
  }
7039
7040
  let autoUpdateCleanup;
7040
7041
  function updatePosition() {
@@ -7076,10 +7077,10 @@ function select_default(Alpine) {
7076
7077
  }
7077
7078
  });
7078
7079
  });
7079
- Alpine.directive("h-select-search", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7080
+ Alpine.directive("h-select-search", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
7080
7081
  const select = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7081
7082
  if (!select) {
7082
- throw new Error(`${original} must be inside an h-select element`);
7083
+ throw new Error(`${original2} must be inside an h-select element`);
7083
7084
  } else {
7084
7085
  select._h_select.filterType = FilterType[el.getAttribute("data-filter")] ?? FilterType["starts-with"];
7085
7086
  }
@@ -7151,10 +7152,10 @@ function select_default(Alpine) {
7151
7152
  selectGroup._h_selectGroup.labelledby = id;
7152
7153
  }
7153
7154
  });
7154
- Alpine.directive("h-select-option", (el, { original, expression }, { effect, evaluateLater, cleanup }) => {
7155
+ Alpine.directive("h-select-option", (el, { original: original2, expression }, { effect, evaluateLater, cleanup }) => {
7155
7156
  const select = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_select"));
7156
7157
  if (!select) {
7157
- throw new Error(`${original} must be inside an h-select element`);
7158
+ throw new Error(`${original2} must be inside an h-select element`);
7158
7159
  }
7159
7160
  el.classList.add(
7160
7161
  "focus:bg-primary",
@@ -7408,10 +7409,10 @@ function sidebar_default(Alpine) {
7408
7409
  });
7409
7410
  }
7410
7411
  });
7411
- Alpine.directive("h-sidebar-group-label", (el, { original }, { cleanup }) => {
7412
+ Alpine.directive("h-sidebar-group-label", (el, { original: original2 }, { cleanup }) => {
7412
7413
  const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7413
7414
  if (!group) {
7414
- throw new Error(`${original} must be placed inside a sidebar group`);
7415
+ throw new Error(`${original2} must be placed inside a sidebar group`);
7415
7416
  }
7416
7417
  el.classList.add(
7417
7418
  "ring-sidebar-ring",
@@ -7498,10 +7499,10 @@ function sidebar_default(Alpine) {
7498
7499
  }
7499
7500
  el.setAttribute("data-slot", "sidebar-group-action");
7500
7501
  });
7501
- Alpine.directive("h-sidebar-group-content", (el, { original }, { effect }) => {
7502
+ Alpine.directive("h-sidebar-group-content", (el, { original: original2 }, { effect }) => {
7502
7503
  const group = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_group"));
7503
7504
  if (!group) {
7504
- throw new Error(`${original} must be placed inside a sidebar group`);
7505
+ throw new Error(`${original2} must be placed inside a sidebar group`);
7505
7506
  }
7506
7507
  el.classList.add("w-full", "text-sm", "data-[collapsed=true]:hidden", "group-data-[collapsed=true]/sidebar:!block");
7507
7508
  el.setAttribute("data-slot", "sidebar-group-content");
@@ -7514,16 +7515,16 @@ function sidebar_default(Alpine) {
7514
7515
  });
7515
7516
  }
7516
7517
  });
7517
- Alpine.directive("h-sidebar-menu", (el, { original }) => {
7518
+ Alpine.directive("h-sidebar-menu", (el, { original: original2 }) => {
7518
7519
  if (el.tagName !== "UL") {
7519
- throw new Error(`${original} must be an ul element`);
7520
+ throw new Error(`${original2} must be an ul element`);
7520
7521
  }
7521
7522
  el.classList.add("vbox", "w-full", "min-w-0", "gap-1");
7522
7523
  el.setAttribute("data-slot", "sidebar-menu");
7523
7524
  });
7524
- Alpine.directive("h-sidebar-menu-item", (el, { original, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7525
+ Alpine.directive("h-sidebar-menu-item", (el, { original: original2, expression, modifiers }, { effect, evaluate: evaluate2, evaluateLater, Alpine: Alpine2 }) => {
7525
7526
  if (el.tagName !== "LI") {
7526
- throw new Error(`${original} must be a li element`);
7527
+ throw new Error(`${original2} must be a li element`);
7527
7528
  }
7528
7529
  el._h_sidebar_menu_item = {
7529
7530
  isSub: false,
@@ -7559,9 +7560,9 @@ function sidebar_default(Alpine) {
7559
7560
  });
7560
7561
  }
7561
7562
  });
7562
- Alpine.directive("h-sidebar-menu-button", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
7563
+ Alpine.directive("h-sidebar-menu-button", (el, { original: original2 }, { cleanup, Alpine: Alpine2 }) => {
7563
7564
  if (el.tagName !== "BUTTON" && el.tagName !== "A") {
7564
- throw new Error(`${original} must be a button or a link`);
7565
+ throw new Error(`${original2} must be a button or a link`);
7565
7566
  } else if (el.tagName === "BUTTON") {
7566
7567
  el.setAttribute("type", "button");
7567
7568
  }
@@ -7697,9 +7698,9 @@ function sidebar_default(Alpine) {
7697
7698
  }
7698
7699
  el.setAttribute("data-slot", "sidebar-menu-action");
7699
7700
  });
7700
- Alpine.directive("h-sidebar-menu-badge", (el, { original }) => {
7701
+ Alpine.directive("h-sidebar-menu-badge", (el, { original: original2 }) => {
7701
7702
  if (el.tagName !== "SPAN") {
7702
- throw new Error(`${original} must be a span element`);
7703
+ throw new Error(`${original2} must be a span element`);
7703
7704
  }
7704
7705
  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");
7705
7706
  el.setAttribute("data-slot", "sidebar-menu-badge");
@@ -7725,13 +7726,13 @@ function sidebar_default(Alpine) {
7725
7726
  el.setAttribute("data-slot", "sidebar-separator");
7726
7727
  el.setAttribute("role", "none");
7727
7728
  });
7728
- Alpine.directive("h-sidebar-menu-sub", (el, { original }, { effect, Alpine: Alpine2 }) => {
7729
+ Alpine.directive("h-sidebar-menu-sub", (el, { original: original2 }, { effect, Alpine: Alpine2 }) => {
7729
7730
  if (el.tagName !== "UL") {
7730
- throw new Error(`${original} must be an ul element`);
7731
+ throw new Error(`${original2} must be an ul element`);
7731
7732
  }
7732
7733
  const menuItem = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_sidebar_menu_item"));
7733
7734
  if (!menuItem) {
7734
- throw new Error(`${original} must be placed inside a sidebar menu item`);
7735
+ throw new Error(`${original2} must be placed inside a sidebar menu item`);
7735
7736
  }
7736
7737
  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");
7737
7738
  if (el.getAttribute("data-line") !== "false") {
@@ -8000,10 +8001,10 @@ function split_default(Alpine) {
8000
8001
  observer.disconnect();
8001
8002
  });
8002
8003
  });
8003
- Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
8004
+ Alpine.directive("h-split-panel", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
8004
8005
  const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
8005
8006
  if (!split) {
8006
- throw new Error(`${original} must be inside an split element`);
8007
+ throw new Error(`${original2} must be inside an split element`);
8007
8008
  }
8008
8009
  el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
8009
8010
  el.setAttribute("tabindex", "-1");
@@ -8527,7 +8528,7 @@ function tabs_default(Alpine) {
8527
8528
  el.setAttribute("role", "tablist");
8528
8529
  el.setAttribute("data-slot", "tab-list");
8529
8530
  });
8530
- Alpine.directive("h-tab", (el, { original }) => {
8531
+ Alpine.directive("h-tab", (el, { original: original2 }) => {
8531
8532
  el.classList.add(
8532
8533
  "cursor-pointer",
8533
8534
  "focus-visible:border-ring",
@@ -8574,8 +8575,8 @@ function tabs_default(Alpine) {
8574
8575
  );
8575
8576
  el.setAttribute("role", "tab");
8576
8577
  el.setAttribute("data-slot", "tab");
8577
- if (!el.hasAttribute("id")) throw new Error(`${original}: Tabs must have an id`);
8578
- if (!el.hasAttribute("aria-controls")) throw new Error(`${original}: aria-controls must be set to the tab-content id.`);
8578
+ if (!el.hasAttribute("id")) throw new Error(`${original2}: Tabs must have an id`);
8579
+ if (!el.hasAttribute("aria-controls")) throw new Error(`${original2}: aria-controls must be set to the tab-content id.`);
8579
8580
  });
8580
8581
  Alpine.directive("h-tab-action", (el) => {
8581
8582
  el.classList.add("cursor-pointer", "ml-auto", "rounded-md", "text-foreground", "hover:bg-secondary", "hover:text-secondary-foreground", "active:bg-secondary-active");
@@ -8609,13 +8610,13 @@ function tabs_default(Alpine) {
8609
8610
  el.setAttribute("role", "button");
8610
8611
  el.setAttribute("data-slot", "tab-list-action");
8611
8612
  });
8612
- Alpine.directive("h-tabs-content", (el, { original }) => {
8613
+ Alpine.directive("h-tabs-content", (el, { original: original2 }) => {
8613
8614
  el.classList.add("flex-1", "outline-none");
8614
8615
  el.setAttribute("role", "tabpanel");
8615
8616
  el.setAttribute("tabindex", "0");
8616
8617
  el.setAttribute("data-slot", "tabs-content");
8617
- if (!el.hasAttribute("id")) throw new Error(`${original}: Tab content must have an id`);
8618
- if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original}: aria-labelledby must be set to the tab id.`);
8618
+ if (!el.hasAttribute("id")) throw new Error(`${original2}: Tab content must have an id`);
8619
+ if (!el.hasAttribute("aria-labelledby")) throw new Error(`${original2}: aria-labelledby must be set to the tab id.`);
8619
8620
  });
8620
8621
  }
8621
8622
 
@@ -9008,13 +9009,13 @@ function timepicker_default(Alpine) {
9008
9009
  top.removeEventListener("click", el._h_timepicker.close);
9009
9010
  });
9010
9011
  });
9011
- Alpine.directive("h-time-picker-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
9012
+ Alpine.directive("h-time-picker-input", (el, { original: original2 }, { effect, cleanup, Alpine: Alpine2 }) => {
9012
9013
  if (el.tagName !== "INPUT") {
9013
- throw new Error(`${original} must be a readonly input of type "text"`);
9014
+ throw new Error(`${original2} must be a readonly input of type "text"`);
9014
9015
  }
9015
9016
  const timepicker = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_timepicker"));
9016
9017
  if (!timepicker) {
9017
- throw new Error(`${original} must be inside a time-picker element`);
9018
+ throw new Error(`${original2} must be inside a time-picker element`);
9018
9019
  }
9019
9020
  timepicker._h_timepicker.focusInput = () => {
9020
9021
  el.focus();
@@ -9663,7 +9664,7 @@ function tooltip_default(Alpine) {
9663
9664
  el.removeEventListener("pointerleave", handler);
9664
9665
  });
9665
9666
  });
9666
- Alpine.directive("h-tooltip", (el, { original }, { effect }) => {
9667
+ Alpine.directive("h-tooltip", (el, { original: original2 }, { effect }) => {
9667
9668
  const tooltip = (() => {
9668
9669
  let sibling = el.previousElementSibling;
9669
9670
  while (sibling && !sibling.hasOwnProperty("_tooltip")) {
@@ -9672,7 +9673,7 @@ function tooltip_default(Alpine) {
9672
9673
  return sibling;
9673
9674
  })();
9674
9675
  if (!tooltip) {
9675
- throw new Error(`${original} must be placed after a tooltip trigger element`);
9676
+ throw new Error(`${original2} must be placed after a tooltip trigger element`);
9676
9677
  }
9677
9678
  el.classList.add("absolute", "bg-foreground", "text-background", "z-50", "w-fit", "rounded-md", "px-3", "py-1.5", "text-xs", "text-balance");
9678
9679
  el.setAttribute("data-slot", "tooltip");
@@ -9878,9 +9879,9 @@ function tree_default(Alpine) {
9878
9879
  });
9879
9880
  }
9880
9881
  });
9881
- Alpine.directive("h-tree-button", (el, { original }, { effect }) => {
9882
+ Alpine.directive("h-tree-button", (el, { original: original2 }, { effect }) => {
9882
9883
  const treeItem = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_tree_item"));
9883
- if (!treeItem) throw new Error(`${original} must be inside a tree item`);
9884
+ if (!treeItem) throw new Error(`${original2} must be inside a tree item`);
9884
9885
  el.classList.add(
9885
9886
  "flex",
9886
9887
  "w-full",
@@ -9943,7 +9944,7 @@ function tree_default(Alpine) {
9943
9944
  }
9944
9945
 
9945
9946
  // package.json
9946
- var version = "1.4.2";
9947
+ var version = "1.5.0";
9947
9948
 
9948
9949
  // src/utils/breakpoint-listener.js
9949
9950
  function getBreakpointListener(handler, breakpoint = 768) {
@@ -10023,6 +10024,12 @@ var getColorScheme = () => {
10023
10024
  }
10024
10025
  return "light";
10025
10026
  };
10027
+ var getSystemColorScheme = () => {
10028
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
10029
+ return "dark";
10030
+ }
10031
+ return "light";
10032
+ };
10026
10033
  var addColorSchemeListener = (callback) => {
10027
10034
  callbacks.push(callback);
10028
10035
  };
@@ -10048,9 +10055,53 @@ function focus_default(Alpine) {
10048
10055
  });
10049
10056
  }
10050
10057
 
10058
+ // src/utils/include.js
10059
+ function include_default(Alpine) {
10060
+ Alpine.directive("h-include", (el, { modifiers, expression }, { evaluateLater, effect }) => {
10061
+ const getUrl = evaluateLater(expression);
10062
+ function getHtml(url) {
10063
+ const parsed = new URL(url, window.location.origin);
10064
+ if (parsed.origin === window.location.origin) {
10065
+ fetch(url).then((response) => {
10066
+ if (response.status === 200) return response.text();
10067
+ throw response;
10068
+ }).then((content) => {
10069
+ if (modifiers.includes("js")) {
10070
+ const container = document.createElement("div");
10071
+ container.innerHTML = content;
10072
+ let staticScript = container.querySelector("script");
10073
+ const script = document.createElement("script");
10074
+ for (let a = 0; a < staticScript.attributes.length; a++) {
10075
+ script.setAttribute(staticScript.attributes[a].name, staticScript.attributes[a].value);
10076
+ }
10077
+ script.appendChild(document.createTextNode(staticScript.innerHTML));
10078
+ staticScript.remove();
10079
+ while (container.childNodes.length > 0) {
10080
+ el.appendChild(container.childNodes[0]);
10081
+ }
10082
+ el.appendChild(script);
10083
+ } else {
10084
+ el.innerHTML = content;
10085
+ }
10086
+ }).catch((response) => {
10087
+ console.error(response);
10088
+ });
10089
+ } else {
10090
+ throw new Error(`${original}: external requests not allowed`);
10091
+ }
10092
+ }
10093
+ effect(() => {
10094
+ getUrl((url) => {
10095
+ if (url) getHtml(url);
10096
+ else el.innerHTML = "";
10097
+ });
10098
+ });
10099
+ }).before("bind");
10100
+ }
10101
+
10051
10102
  // src/utils/template.js
10052
10103
  function template_default(Alpine) {
10053
- Alpine.directive("h-template", (el, { original, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
10104
+ Alpine.directive("h-template", (el, { original: original2, expression }, { evaluate: evaluate2, Alpine: Alpine2, cleanup }) => {
10054
10105
  if (el.hasAttribute(Alpine2.prefixed("data"))) {
10055
10106
  const template = evaluate2(expression);
10056
10107
  const clone = template.content.cloneNode(true).firstElementChild;
@@ -10064,7 +10115,7 @@ function template_default(Alpine) {
10064
10115
  clone.remove();
10065
10116
  });
10066
10117
  } else {
10067
- console.error(`${original}: ${Alpine2.prefixed("data")} directive is missing`);
10118
+ console.error(`${original2}: ${Alpine2.prefixed("data")} directive is missing`);
10068
10119
  }
10069
10120
  });
10070
10121
  }
@@ -10085,6 +10136,7 @@ var registerComponents = (registerPlugin) => {
10085
10136
  registerPlugin(fieldset_default);
10086
10137
  registerPlugin(focus_default);
10087
10138
  registerPlugin(icon_default);
10139
+ registerPlugin(include_default);
10088
10140
  registerPlugin(info_page_default);
10089
10141
  registerPlugin(input_default);
10090
10142
  registerPlugin(label_default);
@@ -10131,6 +10183,7 @@ export {
10131
10183
  fieldset_default as Fieldset,
10132
10184
  focus_default as Focus,
10133
10185
  icon_default as Icon,
10186
+ include_default as Include,
10134
10187
  info_page_default as InfoPage,
10135
10188
  input_default as Input,
10136
10189
  label_default as Label,
@@ -10164,6 +10217,7 @@ export {
10164
10217
  module_default as default,
10165
10218
  getBreakpointListener,
10166
10219
  getColorScheme,
10220
+ getSystemColorScheme,
10167
10221
  registerComponents,
10168
10222
  removeColorSchemeListener,
10169
10223
  setColorScheme,