@threadlabs/looma 0.53.9 → 0.53.10

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.
Files changed (36) hide show
  1. package/README.md +16 -0
  2. package/blocks/editor-workspace.html +53 -0
  3. package/blocks/editor-workspace.js +15 -0
  4. package/blocks/list-detail.html +54 -0
  5. package/blocks/list-detail.js +62 -0
  6. package/blocks/search-and-open.html +33 -0
  7. package/blocks/search-and-open.js +53 -0
  8. package/blocks/settings-form.html +26 -0
  9. package/blocks/settings-form.js +16 -0
  10. package/components/shared/behaviors.d.ts +2 -0
  11. package/components/shared/behaviors.js +2 -0
  12. package/components/shared/collection-navigation.d.ts +28 -0
  13. package/components/shared/collection-navigation.js +40 -0
  14. package/components/shared/deferred-focus.d.ts +8 -0
  15. package/components/shared/deferred-focus.js +21 -0
  16. package/components/shared/form-reset.js +14 -6
  17. package/components/shared/menu-navigation.js +19 -22
  18. package/components/shared/overlay-dismissal.js +7 -0
  19. package/components/shared/overlay.js +3 -2
  20. package/components/ui-combobox/ui-combobox.js +6 -6
  21. package/components/ui-date-picker/ui-date-picker.js +5 -6
  22. package/components/ui-date-range-picker/ui-date-range-picker.js +6 -8
  23. package/components/ui-editor-toolbar/ui-editor-toolbar.js +8 -6
  24. package/components/ui-listbox/ui-listbox.js +10 -16
  25. package/components/ui-search-shell/ui-search-shell.js +4 -5
  26. package/components/ui-sidebar/ui-sidebar.html +7 -0
  27. package/components/ui-switcher/ui-switcher.html +28 -1
  28. package/components/ui-tabs/ui-tabs.js +5 -3
  29. package/dist/index.js +1 -1
  30. package/docs/catalog.json +49 -4
  31. package/editor/index.js +77 -43
  32. package/package.json +8 -1
  33. package/styles/ui-sidebar.css +12 -1
  34. package/styles/ui-switcher.css +22 -1
  35. package/vanilla/UiSwitcher.d.ts +2 -1
  36. package/vanilla/UiSwitcher.js +96 -16
package/docs/catalog.json CHANGED
@@ -683,7 +683,7 @@
683
683
  "tag": "ui-switcher",
684
684
  "package": "@threadlabs/looma",
685
685
  "root": "div",
686
- "angularHost": "div",
686
+ "angularHost": "ng-template",
687
687
  "resource": "@threadlabs/looma/components/ui-switcher/ui-switcher.html"
688
688
  },
689
689
  {
@@ -780,7 +780,7 @@
780
780
  ],
781
781
  "schemaVersion": 1,
782
782
  "package": "@threadlabs/looma",
783
- "version": "0.53.9",
783
+ "version": "0.53.10",
784
784
  "groups": [
785
785
  {
786
786
  "id": "layout",
@@ -31651,11 +31651,11 @@
31651
31651
  ]
31652
31652
  },
31653
31653
  {
31654
- "angularHost": "div",
31654
+ "angularHost": "ng-template",
31655
31655
  "tag": "ui-switcher",
31656
31656
  "package": "@threadlabs/looma",
31657
31657
  "root": "div",
31658
- "description": "Intrinsic equal-column layout that stacks when its own container becomes too narrow.",
31658
+ "description": "Intrinsic layout that stacks when its container becomes too narrow, with equal columns or a narrower rail beside the detail.",
31659
31659
  "designTokens": {
31660
31660
  "sources": [
31661
31661
  "packages/looma/src/components/ui-switcher/ui-switcher.html"
@@ -31716,6 +31716,22 @@
31716
31716
  "stretch"
31717
31717
  ]
31718
31718
  },
31719
+ {
31720
+ "name": "balance",
31721
+ "property": "balance",
31722
+ "description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
31723
+ "type": "keyword",
31724
+ "valueType": {
31725
+ "kind": "terminal",
31726
+ "name": "keyword"
31727
+ },
31728
+ "default": "equal",
31729
+ "options": [
31730
+ "equal",
31731
+ "narrow-start",
31732
+ "narrow-end"
31733
+ ]
31734
+ },
31719
31735
  {
31720
31736
  "name": "gap",
31721
31737
  "property": "gap",
@@ -31772,6 +31788,17 @@
31772
31788
  "stretch"
31773
31789
  ]
31774
31790
  },
31791
+ {
31792
+ "name": "balance",
31793
+ "description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
31794
+ "type": "\"equal\" | \"narrow-start\" | \"narrow-end\"",
31795
+ "default": "equal",
31796
+ "options": [
31797
+ "equal",
31798
+ "narrow-start",
31799
+ "narrow-end"
31800
+ ]
31801
+ },
31775
31802
  {
31776
31803
  "name": "gap",
31777
31804
  "description": "Space between items, on the spacing scale: xs is 0.5rem, s 0.75rem, m 1rem (also the default), l 1.5rem, and xl 2rem. The --ui-switcher-gap custom property, set on :root, an ancestor, or the component itself, overrides it.",
@@ -31806,6 +31833,14 @@
31806
31833
  {
31807
31834
  "name": "default",
31808
31835
  "description": "Default child content."
31836
+ },
31837
+ {
31838
+ "name": "start",
31839
+ "description": "Named content for the start region."
31840
+ },
31841
+ {
31842
+ "name": "end",
31843
+ "description": "Named content for the end region."
31809
31844
  }
31810
31845
  ],
31811
31846
  "group": "layout",
@@ -31850,6 +31885,16 @@
31850
31885
  "resizable": true,
31851
31886
  "bindings": "",
31852
31887
  "frameworks": {}
31888
+ },
31889
+ {
31890
+ "id": "@threadlabs/looma/ui-switcher/04-list-and-detail",
31891
+ "name": "04-list-and-detail",
31892
+ "title": "A rail beside the detail",
31893
+ "description": "The first pane takes about a third of the room in a row. Resize this example to see both panes stack in reading order.",
31894
+ "markup": "<ui-switcher balance=\"narrow-start\" threshold=\"sm\" align=\"start\">\n <ui-card slot=\"start\" padding=\"sm\">Report index</ui-card>\n <ui-card slot=\"end\" padding=\"sm\">The footbridge is open. The lower path is still muddy after rain.</ui-card>\n</ui-switcher>",
31895
+ "resizable": true,
31896
+ "bindings": "",
31897
+ "frameworks": {}
31853
31898
  }
31854
31899
  ]
31855
31900
  },
package/editor/index.js CHANGED
@@ -267,6 +267,14 @@ function updateSurfaceMaterial$1(element, role) {
267
267
  if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
268
268
  }
269
269
  //#endregion
270
+ //#region src/components/shared/overlay-dismissal.js
271
+ function overlayDismissalTarget$1(records, reason) {
272
+ const top = records.at(-1);
273
+ if (!top) return void 0;
274
+ if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
275
+ return top.canClose?.(reason) === false ? void 0 : top;
276
+ }
277
+ //#endregion
270
278
  //#region src/components/shared/overlay.js
271
279
  function stateFor$1(document) {
272
280
  const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
@@ -290,8 +298,8 @@ function syncModalBackdrops$1(state) {
290
298
  for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
291
299
  }
292
300
  function requestClose$1(document, reason, trigger) {
293
- const record = stateFor$1(document).records.at(-1);
294
- if (!record || record.dismissible === false && (reason === "escape" || reason === "light-dismiss") || record.canClose?.(reason) === false) return false;
301
+ const record = overlayDismissalTarget$1(stateFor$1(document).records, reason);
302
+ if (!record) return false;
295
303
  record.requestClose(reason, trigger);
296
304
  return true;
297
305
  }
@@ -3944,6 +3952,14 @@ function updateSurfaceMaterial(element, role) {
3944
3952
  if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
3945
3953
  }
3946
3954
  //#endregion
3955
+ //#region components/shared/overlay-dismissal.js
3956
+ function overlayDismissalTarget(records, reason) {
3957
+ const top = records.at(-1);
3958
+ if (!top) return void 0;
3959
+ if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
3960
+ return top.canClose?.(reason) === false ? void 0 : top;
3961
+ }
3962
+ //#endregion
3947
3963
  //#region components/shared/overlay.js
3948
3964
  function stateFor(document) {
3949
3965
  const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
@@ -3967,8 +3983,8 @@ function syncModalBackdrops(state) {
3967
3983
  for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
3968
3984
  }
3969
3985
  function requestClose(document, reason, trigger) {
3970
- const record = stateFor(document).records.at(-1);
3971
- if (!record || record.dismissible === false && (reason === "escape" || reason === "light-dismiss") || record.canClose?.(reason) === false) return false;
3986
+ const record = overlayDismissalTarget(stateFor(document).records, reason);
3987
+ if (!record) return false;
3972
3988
  record.requestClose(reason, trigger);
3973
3989
  return true;
3974
3990
  }
@@ -7925,6 +7941,32 @@ function focusAndRevealItem(root, item) {
7925
7941
  revealActiveItem(root, item);
7926
7942
  }
7927
7943
  //#endregion
7944
+ //#region components/shared/collection-navigation.js
7945
+ /** Keys used by vertical collection navigation. Horizontal widgets translate their arrow keys.
7946
+ * @type {readonly string[]}
7947
+ */
7948
+ var collectionNavigationKeys = Object.freeze([
7949
+ "ArrowDown",
7950
+ "ArrowUp",
7951
+ "Home",
7952
+ "End"
7953
+ ]);
7954
+ /** Move through an already filtered collection without allocating an index array.
7955
+ * @param {number} length Number of eligible items.
7956
+ * @param {number} current Position in the eligible collection, or -1.
7957
+ * @param {string} key A collection navigation key.
7958
+ * @param {boolean} wrap Whether to wrap at either edge.
7959
+ */
7960
+ function nextCollectionPosition(length, current, key, wrap) {
7961
+ const last = length - 1;
7962
+ if (last < 0) return -1;
7963
+ if (key === "Home") return 0;
7964
+ if (key === "End") return last;
7965
+ if (key === "ArrowDown") return current === last && wrap ? 0 : Math.min(current + 1, last);
7966
+ if (key === "ArrowUp") return current < 0 || current === 0 && wrap ? last : Math.max(current - 1, 0);
7967
+ return -1;
7968
+ }
7969
+ //#endregion
7928
7970
  //#region components/shared/menu-navigation.js
7929
7971
  var itemSelector = "[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]";
7930
7972
  var searches = /* @__PURE__ */ new WeakMap();
@@ -7943,39 +7985,26 @@ function navigateMenu(event, menu) {
7943
7985
  if (!items.length) return false;
7944
7986
  const current = menuItemFrom(event.target);
7945
7987
  const index = items.indexOf(current);
7946
- let next = -1;
7947
- switch (event.key) {
7948
- case "ArrowDown":
7949
- next = index < 0 ? 0 : (index + 1) % items.length;
7950
- break;
7951
- case "ArrowUp":
7952
- next = index < 0 ? items.length - 1 : (index - 1 + items.length) % items.length;
7953
- break;
7954
- case "Home":
7955
- next = 0;
7956
- break;
7957
- case "End":
7958
- next = items.length - 1;
7959
- break;
7960
- default: {
7961
- if (event.key.length !== 1 || event.key === " " || event.altKey || event.ctrlKey || event.metaKey) return false;
7962
- const now = Date.now();
7963
- const previous = searches.get(menu);
7964
- const query = `${previous && now - previous.time < 700 ? previous.query : ""}${event.key.toLocaleLowerCase()}`;
7965
- searches.set(menu, {
7966
- query,
7967
- time: now
7968
- });
7969
- const find = (prefix) => {
7970
- for (let offset = 1; offset <= items.length; offset += 1) {
7971
- const candidate = (index + offset + items.length) % items.length;
7972
- if (label(items[candidate]).startsWith(prefix)) return candidate;
7973
- }
7974
- return -1;
7975
- };
7976
- next = find(query);
7977
- if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
7978
- }
7988
+ let next;
7989
+ if (collectionNavigationKeys.includes(event.key)) next = nextCollectionPosition(items.length, index, event.key, true);
7990
+ else {
7991
+ if (event.key.length !== 1 || event.key === " " || event.altKey || event.ctrlKey || event.metaKey) return false;
7992
+ const now = Date.now();
7993
+ const previous = searches.get(menu);
7994
+ const query = `${previous && now - previous.time < 700 ? previous.query : ""}${event.key.toLocaleLowerCase()}`;
7995
+ searches.set(menu, {
7996
+ query,
7997
+ time: now
7998
+ });
7999
+ const find = (prefix) => {
8000
+ for (let offset = 1; offset <= items.length; offset += 1) {
8001
+ const candidate = (index + offset + items.length) % items.length;
8002
+ if (label(items[candidate]).startsWith(prefix)) return candidate;
8003
+ }
8004
+ return -1;
8005
+ };
8006
+ next = find(query);
8007
+ if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
7979
8008
  }
7980
8009
  event.preventDefault();
7981
8010
  if (next >= 0) focusAndRevealItem(menu, items[next]);
@@ -11912,17 +11941,22 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
11912
11941
  * @lifecycle Returns the function that stops listening.
11913
11942
  */
11914
11943
  function afterFormReset(control, callback) {
11915
- const document = control.ownerDocument;
11916
- let timer;
11944
+ const tree = control.getRootNode();
11945
+ const root = tree.host ? tree : control.ownerDocument;
11946
+ const pending = /* @__PURE__ */ new Set();
11917
11947
  const onReset = (event) => {
11918
- if (event.target === control.form) timer = setTimeout(() => {
11948
+ if (event.target !== control.form) return;
11949
+ const timer = setTimeout(() => {
11950
+ pending.delete(timer);
11919
11951
  if (!event.defaultPrevented) callback();
11920
11952
  });
11953
+ pending.add(timer);
11921
11954
  };
11922
- document.addEventListener("reset", onReset);
11955
+ root.addEventListener("reset", onReset, { capture: true });
11923
11956
  return () => {
11924
- clearTimeout(timer);
11925
- document.removeEventListener("reset", onReset);
11957
+ root.removeEventListener("reset", onReset, { capture: true });
11958
+ for (const timer of pending) clearTimeout(timer);
11959
+ pending.clear();
11926
11960
  };
11927
11961
  }
11928
11962
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.53.9",
3
+ "version": "0.53.10",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -53,6 +53,7 @@
53
53
  "./vanilla": "./vanilla/index.js",
54
54
  "./vanilla/*": "./vanilla/*",
55
55
  "./components/*": "./components/*",
56
+ "./blocks/*": "./blocks/*",
56
57
  "./tokens.css": "./tokens.css",
57
58
  "./theme-light.css": "./theme-light.css",
58
59
  "./theme-dark.css": "./theme-dark.css",
@@ -75,6 +76,11 @@
75
76
  "import": "./components/shared/input-modality.js",
76
77
  "default": "./components/shared/input-modality.js"
77
78
  },
79
+ "./behaviors": {
80
+ "types": "./components/shared/behaviors.d.ts",
81
+ "import": "./components/shared/behaviors.js",
82
+ "default": "./components/shared/behaviors.js"
83
+ },
78
84
  "./docs/examples/*": "./docs/examples/*"
79
85
  },
80
86
  "files": [
@@ -83,6 +89,7 @@
83
89
  "markdown/",
84
90
  "vanilla/",
85
91
  "components/",
92
+ "blocks/",
86
93
  "styles/",
87
94
  "*.css",
88
95
  "README.md",
@@ -25,6 +25,13 @@
25
25
  transition: inline-size var(--ui-motion-layout) var(--ui-motion-layout-ease), visibility var(--ui-motion-layout);
26
26
  }
27
27
 
28
+ /* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
29
+ @media (scripting: none) {
30
+ :scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) {
31
+ max-inline-size: 33%;
32
+ }
33
+ }
34
+
28
35
  :scope:where(:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component])))[data-ui-sidebar-state~="side=end"] {
29
36
  border-inline-end: 0;
30
37
  border-inline-start: var(--ui-border-width) solid var(--ui-sidebar-border, var(--ui-border-divider));
@@ -202,7 +209,11 @@
202
209
  }
203
210
  }
204
211
  @scope (:is([component~="ui-sidebar"]:not(template), [data-component~="ui-sidebar"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
205
- /* The panel's content scrolls, and each edge that hides content fades: the scroll fade every
212
+ /* Without a drawer controller, keep navigation in flow and reserve most of the row for content. */
213
+ @media (scripting: none) {
214
+ }
215
+
216
+ /* The panel's content scrolls, and each edge that hides content fades: the scroll fade every
206
217
  Looma scroller uses (see ui-scroll-area). */
207
218
 
208
219
  /* Collapsed while docked. */
@@ -26,6 +26,24 @@
26
26
  grid-template-columns: minmax(0, 1fr);
27
27
  }
28
28
 
29
+ /* Reuse the width threshold as the flex basis. Below it, each full-width item
30
+ gets its own line. Above it, grow factors divide the available space. */
31
+ :scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))):is([data-ui-switcher-state~="balance=narrow-start"], [data-ui-switcher-state~="balance=narrow-end"]):not([data-ui-switcher-state~="overLimit"]):not([hidden]) {
32
+ display: flex !important;
33
+ flex-flow: row wrap !important;
34
+ }
35
+
36
+ .start,
37
+ .end {
38
+ flex: 2 1 var(--_switcher-track) !important;
39
+ min-inline-size: 0;
40
+ }
41
+
42
+ :scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-start"] > .start,
43
+ :scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="balance=narrow-end"] > .end {
44
+ flex-grow: 1 !important;
45
+ }
46
+
29
47
  :scope:where(:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component])))[data-ui-switcher-state~="gap=xs"] {
30
48
  --_switcher-gap: var(--ui-space-2);
31
49
  }
@@ -66,5 +84,8 @@
66
84
  }
67
85
  }
68
86
  @scope (:is([component~="ui-switcher"]:not(template), [data-component~="ui-switcher"]:not([component]))) to (:is([component]:not(template), [data-component]:not([component]))) {
69
- /* A component that sets its display still honours the hidden attribute on its root. */
87
+ /* Reuse the width threshold as the flex basis. Below it, each full-width item
88
+ gets its own line. Above it, grow factors divide the available space. */
89
+
90
+ /* A component that sets its display still honours the hidden attribute on its root. */
70
91
  }
@@ -1,7 +1,7 @@
1
1
  // Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
2
2
  export interface UiSwitcherEventMap {
3
3
  }
4
- export interface UiSwitcherElement extends HTMLDivElement {
4
+ export interface UiSwitcherElement extends HTMLElement {
5
5
  addEventListener<K extends keyof UiSwitcherEventMap>(type: K, listener: (this: UiSwitcherElement, event: UiSwitcherEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
6
6
  addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UiSwitcherElement, event: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
7
7
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -11,6 +11,7 @@ export interface UiSwitcherElement extends HTMLDivElement {
11
11
  }
12
12
  export interface UiSwitcherProps {
13
13
  align?: "start" | "center" | "end" | "stretch" | null;
14
+ balance?: "equal" | "narrow-start" | "narrow-end" | null;
14
15
  gap?: "xs" | "s" | "m" | "l" | "xl" | null;
15
16
  limit?: number | null;
16
17
  threshold?: "xs" | "sm" | "md" | "lg" | null;
@@ -1,23 +1,35 @@
1
1
  // Generated by HTML Next 1.0.0-alpha.92 for Vanilla DOM. Do not edit.
2
- import { attachGeneratedController, buildTemplate, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, checkFormat, checkInteger, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
2
+ import { attachGeneratedController, equalValue, buildTemplate, truthy, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, armElement, replaceRoot, checkFormat, checkInteger, forwardAttributes, resetForwardedAttributes, defineComponent, activateModule } from "@nextwebwg/html-next/generated-runtime";
3
3
  import * as controller from "../components/ui-switcher/ui-switcher.js";
4
4
  import "../styles/ui-switcher.css";
5
5
 
6
6
  const T0 = ["",[],4];
7
7
  const T1 = ["",[]];
8
- let P0, P1;
8
+ const T2 = ["",[],"\n ",["div",["class","start"],4],"\n ",["div",["class","end"],4],"\n "];
9
+ const T3 = ["",[]];
10
+ const T4 = ["",[]];
11
+ let P0, P1, P2, P3, P4;
9
12
  const S = { n: ["overLimit"], t: ["b"], f: import.meta.url, g: "ui-switcher", a: (host, I) => C(host, I), b: generatedInputs, i: [false] };
10
- const D = { g: "ui-switcher", props: { "align": { "required":false,"values":["start","center","end","stretch"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "gap": { "required":false,"values":["xs","s","m","l","xl"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "limit": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" }, "threshold": { "required":false,"values":["xs","sm","md","lg"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
13
+ const A = [["div",{},[],"",[],["data-ui-switcher-state","data-ui-switcher-prop-align","data-ui-switcher-prop-balance","data-ui-switcher-prop-gap","data-ui-switcher-prop-limit","data-ui-switcher-prop-threshold"]],["div",{},[],"",[],["data-ui-switcher-state","data-ui-switcher-prop-align","data-ui-switcher-prop-balance","data-ui-switcher-prop-gap","data-ui-switcher-prop-limit","data-ui-switcher-prop-threshold"]]];
14
+ const Q = [[],[]];
15
+ const D = { g: "ui-switcher", props: { "align": { "required":false,"values":["start","center","end","stretch"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "balance": { "required":false,"values":["equal","narrow-start","narrow-end"],"default":"equal", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "gap": { "required":false,"values":["xs","s","m","l","xl"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "limit": { "required":false, c: checkInteger, t: "integer", j: 0, m: "i" }, "threshold": { "required":false,"values":["xs","sm","md","lg"], c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
11
16
  const C = (host) => activateModule(controller, host);
12
17
 
13
18
  export function createUiSwitcher(options = {}, html) {
14
19
  const { attributes: authoredAttributes = {}, children = [], slots = {}, ...componentProps } = options;
15
- const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => !["align","gap","limit","threshold"].includes(name)));
16
- const element = document.createElement("div");
17
- element.setAttribute("component", "ui-switcher");
18
- element.append((P0 ??= buildTemplate(T0)).cloneNode(true));
19
- const v = [false, null, null, null, null];
20
- const B = acceptProps(element, D, S.n, v, componentProps, [], html);
20
+ const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => !["align","balance","gap","limit","threshold"].includes(name)));
21
+ const v = [false, null, null, null, null, null];
22
+ let B = acceptProps(undefined, D, S.n, v, componentProps, [], html);
23
+ let a = (truthy(equalValue(v[2], "equal")) ? 0 : 1);
24
+ let element;
25
+ if (a === 0) {
26
+ element = document.createElement("div");
27
+ element.setAttribute("component", "ui-switcher");
28
+ } else {
29
+ element = document.createElement("div");
30
+ element.setAttribute("component", "ui-switcher");
31
+ }
32
+ B = acceptProps(element, D, S.n, v, componentProps, Q[a], html);
21
33
  const m1 = (d) => {
22
34
  const n = (P1 ??= buildTemplate(T1)).cloneNode(true);
23
35
  const r = { n };
@@ -26,13 +38,36 @@ export function createUiSwitcher(options = {}, html) {
26
38
  };
27
39
  const p1 = (r, c, d) => {
28
40
  };
41
+ const m3 = (d) => {
42
+ const n = (P3 ??= buildTemplate(T3)).cloneNode(true);
43
+ const r = { n };
44
+ p3(r, -1, d);
45
+ return r;
46
+ };
47
+ const p3 = (r, c, d) => {
48
+ };
49
+ const m4 = (d) => {
50
+ const n = (P4 ??= buildTemplate(T4)).cloneNode(true);
51
+ const r = { n };
52
+ p4(r, -1, d);
53
+ return r;
54
+ };
55
+ const p4 = (r, c, d) => {
56
+ };
57
+ const m0 = (n, d) => {
58
+ n.append((P0 ??= buildTemplate(T0)).cloneNode(true));
59
+ const t0 = n.firstChild;
60
+ const r = { n, v0: undefined, v1: undefined, a1: t0, e0: t0.nextSibling, b0: undefined, f0: undefined };
61
+ p0(r, -1, d);
62
+ return r;
63
+ };
29
64
  const p0 = (r, c, d) => {
30
65
  if (c === -1) {
31
66
  resetForwardedAttributes(r.n, attributes, r.v0);
32
67
  r.v0 = forwardAttributes(r.n, attributes);
33
68
  }
34
- if (c & 23) {
35
- const x0 = hostState(["overLimit","gap","threshold","align"], [v[0], v[2], v[4], v[1]]);
69
+ if (c & 47) {
70
+ const x0 = hostState(["overLimit","balance","gap","threshold","align"], [v[0], v[2], v[3], v[5], v[1]]);
36
71
  const s1 = x0;
37
72
  if (s1 !== r.v1) writeAttribute(r.n, "data-ui-switcher-state", (r.v1 = s1) === "" ? null : s1);
38
73
  }
@@ -40,14 +75,59 @@ export function createUiSwitcher(options = {}, html) {
40
75
  if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m1(d); at.before(r.b0.n); } }
41
76
  else if (r.b0 !== undefined) p1(r.b0, c, d);
42
77
  };
43
- const t0 = element.firstChild;
44
- const R = { n: element, v0: undefined, v1: undefined, a1: t0, e0: t0.nextSibling, b0: undefined, f0: undefined };
78
+ const m2 = (n, d) => {
79
+ n.append((P2 ??= buildTemplate(T2)).cloneNode(true));
80
+ const t0 = n.firstChild.nextSibling;
81
+ const t1 = t0.firstChild;
82
+ const t2 = t0.nextSibling.nextSibling.firstChild;
83
+ const r = { n, v0: undefined, v1: undefined, a1: t1, e0: t1.nextSibling, b0: undefined, f0: undefined, a2: t2, e1: t2.nextSibling, b1: undefined, f1: undefined };
84
+ p2(r, -1, d);
85
+ return r;
86
+ };
87
+ const p2 = (r, c, d) => {
88
+ if (c === -1) {
89
+ resetForwardedAttributes(r.n, attributes, r.v0);
90
+ r.v0 = forwardAttributes(r.n, attributes);
91
+ }
92
+ if (c & 47) {
93
+ const x0 = hostState(["overLimit","balance","gap","threshold","align"], [v[0], v[2], v[3], v[5], v[1]]);
94
+ const s1 = x0;
95
+ if (s1 !== r.v1) writeAttribute(r.n, "data-ui-switcher-state", (r.v1 = s1) === "" ? null : s1);
96
+ }
97
+ if (r.f0 === undefined) { r.f0 = 1; const at = fillSlot(r.a1, r.e0, "start", J, false, undefined, d);
98
+ if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b0 = m3(d); at.before(r.b0.n); } }
99
+ else if (r.b0 !== undefined) p3(r.b0, c, d);
100
+ if (r.f1 === undefined) { r.f1 = 1; const at = fillSlot(r.a2, r.e1, "end", J, false, undefined, d);
101
+ if (Array.isArray(at)) (r.z ??= []).push(() => { at[0].l.delete(at[1]); dispose(at[1]); }); else if (at !== undefined) { r.b1 = m4(d); at.before(r.b1.n); } }
102
+ else if (r.b1 !== undefined) p4(r.b1, c, d);
103
+ };
104
+ const M = [m0, m2], N = [p0, p2];
105
+ let R;
106
+ const p = (c, d) => {
107
+ if (R === null) return;
108
+ if (R === undefined) { R = M[a](element, d); return; }
109
+ if (c & 4) {
110
+ const t = (truthy(equalValue(v[2], "equal")) ? 0 : 1);
111
+ if (t !== a) {
112
+ dispose(R);
113
+ for (const key in I.r) delete I.r[key];
114
+ const previous = I.e, next = armElement(previous, A[a], A[t]);
115
+ I.B.b = Q[t];
116
+ a = t;
117
+ R = null;
118
+ R = M[t](next, d);
119
+ replaceRoot(I, previous, next);
120
+ return;
121
+ }
122
+ }
123
+ N[a](R, c, d);
124
+ };
45
125
  const I = { B };
46
126
  const J = project(I, children, slots);
47
127
  I.R = new Set();
48
- I.F = { values: attributes, draw: () => ((c, d) => p0(R, c, d))(-1) };
49
- attachGeneratedController(element, S, v, (c, d) => { ((c, d) => p0(R, c, d))(c, d); for (const f of I.R) f(c, d); }, undefined, undefined, I);
128
+ I.F = { values: attributes, draw: () => p(-1) };
129
+ attachGeneratedController(element, S, v, (c, d) => { p(c, d); for (const f of I.R) f(c, d); }, undefined, undefined, I);
50
130
  manageProps(I);
51
131
  return element;
52
132
  }
53
- defineComponent("ui-switcher", createUiSwitcher, ["align","gap","limit","threshold"]);
133
+ defineComponent("ui-switcher", createUiSwitcher, ["align","balance","gap","limit","threshold"]);