@tachui/viewport 0.8.23 → 0.8.25

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/index.js CHANGED
@@ -1,11 +1,11 @@
1
- var ke = Object.defineProperty;
2
- var xe = (n, e, t) => e in n ? ke(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => xe(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { createSignal as k, mountComponentTree as Pe, createRoot as Te, withComponentContext as Ie, createContext as Oe, useContext as ze } from "@tachui/core";
5
- import { getOwner as He, onCleanup as De } from "@tachui/core/reactive";
6
- import { registerModifierWithMetadata as Z } from "@tachui/modifiers";
7
- function Q(n = {}) {
8
- const e = Ae(), t = Ne(e, n), i = Re(), s = $e(), a = je();
1
+ var We = Object.defineProperty;
2
+ var Se = (n, e, t) => e in n ? We(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var o = (n, e, t) => Se(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { createSignal as M, mountComponentTree as Ee, createRoot as Ce, withComponentContext as Me, useContext as ke, createContext as Pe } from "@tachui/core";
5
+ import { getOwner as Te, onCleanup as xe } from "@tachui/core/reactive";
6
+ import { registerModifierWithMetadata as Q } from "@tachui/modifiers";
7
+ function $(n = {}) {
8
+ const e = Ie(), t = Ae(e, n), i = _e(), s = Le(), a = Ve();
9
9
  return {
10
10
  platform: e,
11
11
  capabilities: t,
@@ -14,20 +14,20 @@ function Q(n = {}) {
14
14
  isTouch: a
15
15
  };
16
16
  }
17
- function Ae() {
18
- return _e() ? "electron" : Fe() ? "mobile" : Ve() ? "embedded" : "web";
17
+ function Ie() {
18
+ return He() ? "electron" : ze() ? "mobile" : Oe() ? "embedded" : "web";
19
19
  }
20
- function _e() {
20
+ function He() {
21
21
  return typeof window < "u" ? !!window.electronAPI || !!window.electron || !!window.require || navigator.userAgent.toLowerCase().includes("electron") : typeof process < "u" ? !!process.electron || !!process.versions?.electron || process.env.ELECTRON === "true" : !1;
22
22
  }
23
- function Fe() {
23
+ function ze() {
24
24
  if (typeof window > "u") return !1;
25
25
  const n = "ontouchstart" in window && !("onmousedown" in window), e = window.innerWidth <= 768 || window.innerHeight <= 768, t = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
26
26
  navigator.userAgent
27
27
  ), i = window.matchMedia?.("(pointer: coarse)")?.matches, s = window.matchMedia?.("(max-width: 768px)")?.matches;
28
28
  return n || e && t || i || s;
29
29
  }
30
- function Ve() {
30
+ function Oe() {
31
31
  if (typeof window > "u") return !1;
32
32
  try {
33
33
  return window.self !== window.top;
@@ -35,7 +35,7 @@ function Ve() {
35
35
  return !0;
36
36
  }
37
37
  }
38
- function Ne(n, e) {
38
+ function Ae(n, e) {
39
39
  const t = {
40
40
  multiWindow: !1,
41
41
  nativeWindows: !1,
@@ -61,9 +61,9 @@ function Ne(n, e) {
61
61
  case "web":
62
62
  return {
63
63
  ...t,
64
- multiWindow: e.enablePopupTest ? Ge() : !1,
65
- crossWindowCommunication: Le() || Ue(),
66
- fullscreenSupport: Y(),
64
+ multiWindow: e.enablePopupTest ? De() : !1,
65
+ crossWindowCommunication: Fe() || Ge(),
66
+ fullscreenSupport: K(),
67
67
  windowResizing: !1,
68
68
  // Browser windows can't be resized programmatically
69
69
  windowMinimizing: !1
@@ -71,7 +71,7 @@ function Ne(n, e) {
71
71
  case "mobile":
72
72
  return {
73
73
  ...t,
74
- fullscreenSupport: Y(),
74
+ fullscreenSupport: K(),
75
75
  modalOverlays: !0
76
76
  };
77
77
  case "embedded":
@@ -83,7 +83,7 @@ function Ne(n, e) {
83
83
  return t;
84
84
  }
85
85
  }
86
- function Ge() {
86
+ function De() {
87
87
  if (typeof window > "u" || typeof window.navigator < "u" && window.navigator.userAgent.includes("jsdom"))
88
88
  return !1;
89
89
  try {
@@ -93,28 +93,28 @@ function Ge() {
93
93
  return !1;
94
94
  }
95
95
  }
96
- function Le() {
96
+ function Fe() {
97
97
  return typeof window < "u" && "BroadcastChannel" in window;
98
98
  }
99
- function Ue() {
99
+ function Ge() {
100
100
  return typeof window < "u" && "MessageChannel" in window;
101
101
  }
102
- function Y() {
102
+ function K() {
103
103
  return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
104
104
  }
105
- function Re() {
105
+ function _e() {
106
106
  return typeof navigator > "u" ? "unknown" : navigator.userAgent;
107
107
  }
108
- function $e() {
108
+ function Le() {
109
109
  return typeof window > "u" ? { width: 1920, height: 1080 } : {
110
110
  width: window.screen?.width || window.innerWidth || 1920,
111
111
  height: window.screen?.height || window.innerHeight || 1080
112
112
  };
113
113
  }
114
- function je() {
114
+ function Ve() {
115
115
  return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
116
116
  }
117
- function Be() {
117
+ function Ne() {
118
118
  if (typeof navigator > "u")
119
119
  return {
120
120
  name: "unknown",
@@ -142,7 +142,7 @@ function Be() {
142
142
  }
143
143
  return { name: e, version: t, engine: i };
144
144
  }
145
- function qe() {
145
+ function Ue() {
146
146
  if (typeof navigator > "u")
147
147
  return {
148
148
  name: "unknown",
@@ -169,7 +169,7 @@ function qe() {
169
169
  }
170
170
  return { name: e, version: t };
171
171
  }
172
- function Qe() {
172
+ function Re() {
173
173
  return typeof window > "u" ? {
174
174
  webgl: !1,
175
175
  webgl2: !1,
@@ -190,7 +190,7 @@ function Qe() {
190
190
  resizeObserver: "ResizeObserver" in window
191
191
  };
192
192
  }
193
- function $(n) {
193
+ function L(n) {
194
194
  return {
195
195
  canOpenWindow: (e = !1) => e ? n.capabilities.nativeWindows : n.capabilities.multiWindow || n.capabilities.modalOverlays,
196
196
  canCommunicateBetweenWindows: () => n.capabilities.crossWindowCommunication,
@@ -201,7 +201,7 @@ function $(n) {
201
201
  getOptimalViewportType: (e = !1) => e && n.capabilities.nativeWindows ? "window" : n.capabilities.modalOverlays ? "modal" : n.platform === "mobile" ? "sheet" : "portal"
202
202
  };
203
203
  }
204
- class Ke {
204
+ class $e {
205
205
  // Fallback strategies
206
206
  createModal(e) {
207
207
  throw new Error("Modal fallback not implemented");
@@ -210,7 +210,7 @@ class Ke {
210
210
  throw new Error("Portal fallback not implemented");
211
211
  }
212
212
  }
213
- class j extends Ke {
213
+ class V extends $e {
214
214
  constructor(t = {}) {
215
215
  super();
216
216
  o(this, "environment");
@@ -219,7 +219,7 @@ class j extends Ke {
219
219
  o(this, "popups", /* @__PURE__ */ new Map());
220
220
  o(this, "portalContainer", null);
221
221
  o(this, "broadcastChannel", null);
222
- this.environment = Q(t), this.initializePortalContainer();
222
+ this.environment = $(t), this.initializePortalContainer();
223
223
  }
224
224
  /**
225
225
  * Check if we can create a window with given config
@@ -323,21 +323,21 @@ class j extends Ke {
323
323
  * Create popup window (native browser window)
324
324
  */
325
325
  createPopupWindow(t) {
326
- const i = new Xe(t);
326
+ const i = new Be(t);
327
327
  return this.popups.set(t.id, i), i;
328
328
  }
329
329
  /**
330
330
  * Create modal overlay
331
331
  */
332
332
  createModal(t) {
333
- const i = new Je(t);
333
+ const i = new je(t);
334
334
  return this.modals.set(t.id, i), i;
335
335
  }
336
336
  /**
337
337
  * Create portal
338
338
  */
339
339
  createPortal(t) {
340
- const i = new Ze(t, this.portalContainer);
340
+ const i = new Qe(t, this.portalContainer);
341
341
  return this.portals.set(t.id, i), i;
342
342
  }
343
343
  /**
@@ -430,7 +430,7 @@ class j extends Ke {
430
430
  `, document.head.appendChild(i);
431
431
  }
432
432
  }
433
- class Xe {
433
+ class Be {
434
434
  constructor(e) {
435
435
  o(this, "id");
436
436
  o(this, "type", "window");
@@ -441,7 +441,7 @@ class Xe {
441
441
  o(this, "eventHandlers", /* @__PURE__ */ new Map());
442
442
  o(this, "setState");
443
443
  this.id = e.id, this.config = e;
444
- const [t, i] = k({
444
+ const [t, i] = M({
445
445
  id: e.id,
446
446
  title: e.title || e.id,
447
447
  isVisible: !1,
@@ -639,7 +639,7 @@ class Xe {
639
639
  removeChildWindow(e) {
640
640
  }
641
641
  }
642
- class Je {
642
+ class je {
643
643
  constructor(e) {
644
644
  o(this, "id");
645
645
  o(this, "type", "modal");
@@ -657,7 +657,7 @@ class Je {
657
657
  o(this, "parentWindow", null);
658
658
  o(this, "tabContainer", null);
659
659
  this.id = e.id, this.config = e;
660
- const [t, i] = k({
660
+ const [t, i] = M({
661
661
  id: e.id,
662
662
  title: e.title || e.id,
663
663
  isVisible: !1,
@@ -861,7 +861,7 @@ class Je {
861
861
  e && e.remove();
862
862
  }
863
863
  }
864
- class Ze {
864
+ class Qe {
865
865
  constructor(e, t) {
866
866
  o(this, "id");
867
867
  o(this, "type", "portal");
@@ -879,7 +879,7 @@ class Ze {
879
879
  o(this, "parentWindow", null);
880
880
  o(this, "tabContainer", null);
881
881
  this.container = t, this.id = e.id, this.config = e;
882
- const [i, s] = k({
882
+ const [i, s] = M({
883
883
  id: e.id,
884
884
  title: e.title || e.id,
885
885
  isVisible: !1,
@@ -906,7 +906,7 @@ class Ze {
906
906
  if (this.portalElement) {
907
907
  this.portalElement.innerHTML = "";
908
908
  try {
909
- const t = Pe(e, this.portalElement);
909
+ const t = Ee(e, this.portalElement);
910
910
  this.cleanupFunction = t;
911
911
  } catch (t) {
912
912
  console.error("Error during mountComponentTree:", t);
@@ -1086,7 +1086,7 @@ class Ze {
1086
1086
  e && e.remove();
1087
1087
  }
1088
1088
  }
1089
- class K {
1089
+ class B {
1090
1090
  constructor(e, t = {}) {
1091
1091
  o(this, "adapter");
1092
1092
  o(this, "windows", /* @__PURE__ */ new Map());
@@ -1097,7 +1097,7 @@ class K {
1097
1097
  o(this, "globalStateCallbacks", /* @__PURE__ */ new Map());
1098
1098
  o(this, "environment");
1099
1099
  o(this, "platformConfig");
1100
- this.platformConfig = t, this.environment = Q(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
1100
+ this.platformConfig = t, this.environment = $(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
1101
1101
  }
1102
1102
  /**
1103
1103
  * Open a new window/viewport
@@ -1144,20 +1144,20 @@ class K {
1144
1144
  createWindowGroup(e) {
1145
1145
  if (this.windowGroups.has(e))
1146
1146
  return this.windowGroups.get(e);
1147
- const t = new Ye(e, this);
1147
+ const t = new Ke(e, this);
1148
1148
  return this.windowGroups.set(e, t), t;
1149
1149
  }
1150
1150
  /**
1151
1151
  * Check if we can open a window with given options
1152
1152
  */
1153
1153
  canOpenWindow(e = {}) {
1154
- return $(this.environment).canOpenWindow(e.preferNativeWindow);
1154
+ return L(this.environment).canOpenWindow(e.preferNativeWindow);
1155
1155
  }
1156
1156
  /**
1157
1157
  * Get optimal window type for given options
1158
1158
  */
1159
1159
  getOptimalWindowType(e = {}) {
1160
- const t = $(this.environment);
1160
+ const t = L(this.environment);
1161
1161
  return e.preferNativeWindow && this.environment.capabilities.nativeWindows ? "window" : e.modal !== !1 && this.environment.capabilities.modalOverlays ? "modal" : t.getOptimalViewportType(e.preferNativeWindow);
1162
1162
  }
1163
1163
  /**
@@ -1202,9 +1202,9 @@ class K {
1202
1202
  createDefaultAdapter() {
1203
1203
  switch (this.environment.platform) {
1204
1204
  case "electron":
1205
- return new j(this.platformConfig);
1205
+ return new V(this.platformConfig);
1206
1206
  default:
1207
- return new j(this.platformConfig);
1207
+ return new V(this.platformConfig);
1208
1208
  }
1209
1209
  }
1210
1210
  // ==================== Phase 2: Global State Management ====================
@@ -1268,7 +1268,7 @@ class K {
1268
1268
  });
1269
1269
  }
1270
1270
  }
1271
- class Ye {
1271
+ class Ke {
1272
1272
  constructor(e, t, i = "any") {
1273
1273
  o(this, "windows", /* @__PURE__ */ new Map());
1274
1274
  o(this, "defaultOptions", {});
@@ -1557,13 +1557,13 @@ class Ye {
1557
1557
  arrangeWindowsAsTiles(e) {
1558
1558
  const t = typeof window < "u" ? window.screen.width : 1920, i = typeof window < "u" ? window.screen.height : 1080, s = Math.ceil(Math.sqrt(e.length)), a = Math.ceil(e.length / s), r = t / s, c = i / a;
1559
1559
  e.forEach((d, l) => {
1560
- const h = l % s, b = Math.floor(l / s);
1560
+ const h = l % s, g = Math.floor(l / s);
1561
1561
  this.setWindowGroupMetadata(d, {
1562
1562
  tilePosition: {
1563
1563
  col: h,
1564
- row: b,
1564
+ row: g,
1565
1565
  x: h * r,
1566
- y: b * c,
1566
+ y: g * c,
1567
1567
  width: r,
1568
1568
  height: c
1569
1569
  },
@@ -1616,17 +1616,17 @@ class Ye {
1616
1616
  }
1617
1617
  }
1618
1618
  }
1619
- let g = null;
1620
- function p(n = {}) {
1621
- return g || (g = new K(void 0, n)), g;
1619
+ let m = null;
1620
+ function u(n = {}) {
1621
+ return m || (m = new B(void 0, n)), m;
1622
1622
  }
1623
- function ce(n) {
1624
- g?.dispose(), g = n;
1623
+ function oe(n) {
1624
+ m?.dispose(), m = n;
1625
1625
  }
1626
- function et() {
1627
- g?.dispose(), g = null;
1626
+ function qe() {
1627
+ m?.dispose(), m = null;
1628
1628
  }
1629
- function S(n) {
1629
+ function W(n) {
1630
1630
  return {
1631
1631
  type: "window-scene",
1632
1632
  sceneType: "window",
@@ -1651,17 +1651,17 @@ function S(n) {
1651
1651
  },
1652
1652
  // Open this window
1653
1653
  async open() {
1654
- const e = p(), t = Te(() => Ie((i) => n.children(), `Window-${n.id}`)({}));
1654
+ const e = u(), t = Ce(() => Me((i) => n.children(), `Window-${n.id}`)({}));
1655
1655
  await e.openWindow(n.id, t, n);
1656
1656
  },
1657
1657
  // Close this window
1658
1658
  async close() {
1659
- await p().dismissWindow(n.id);
1659
+ await u().dismissWindow(n.id);
1660
1660
  }
1661
1661
  };
1662
1662
  }
1663
- function L(n) {
1664
- const e = p(), t = e.createWindowGroup(n.id);
1663
+ function G(n) {
1664
+ const e = u(), t = e.createWindowGroup(n.id);
1665
1665
  n.groupingStrategy && t.setGroupingStrategy(n.groupingStrategy), n.tabConfig && t.configureTabbing(n.tabConfig), n.poolConfig && t.configurePool(n.poolConfig), n.stateSyncScope && t.enableStateSync(n.stateSyncScope), n.maxInstances && t.setMaxInstances(n.maxInstances);
1666
1666
  const {
1667
1667
  groupingStrategy: i,
@@ -1749,7 +1749,7 @@ function L(n) {
1749
1749
  }
1750
1750
  };
1751
1751
  }
1752
- function H(n) {
1752
+ function x(n) {
1753
1753
  return {
1754
1754
  type: "app",
1755
1755
  scenes: n.children,
@@ -1769,8 +1769,8 @@ function H(n) {
1769
1769
  },
1770
1770
  // Initialize all scenes
1771
1771
  async initialize() {
1772
- if (!p(n.platformConfig)) {
1773
- const { initializeViewportSystem: t } = await Promise.resolve().then(() => rn);
1772
+ if (!u(n.platformConfig)) {
1773
+ const { initializeViewportSystem: t } = await Promise.resolve().then(() => _t);
1774
1774
  t();
1775
1775
  }
1776
1776
  },
@@ -1787,12 +1787,12 @@ function H(n) {
1787
1787
  }
1788
1788
  };
1789
1789
  }
1790
- const D = {
1790
+ const I = {
1791
1791
  /**
1792
1792
  * Create a document window group
1793
1793
  */
1794
1794
  documentGroup(n, e, t, i) {
1795
- return L({
1795
+ return G({
1796
1796
  id: n,
1797
1797
  title: e,
1798
1798
  for: t,
@@ -1806,7 +1806,7 @@ const D = {
1806
1806
  * Create a settings window
1807
1807
  */
1808
1808
  settingsWindow(n) {
1809
- return S({
1809
+ return W({
1810
1810
  id: "settings",
1811
1811
  title: "Settings",
1812
1812
  width: 600,
@@ -1819,7 +1819,7 @@ const D = {
1819
1819
  * Create an inspector window
1820
1820
  */
1821
1821
  inspectorWindow(n) {
1822
- return S({
1822
+ return W({
1823
1823
  id: "inspector",
1824
1824
  title: "Inspector",
1825
1825
  width: 300,
@@ -1833,7 +1833,7 @@ const D = {
1833
1833
  * Create a palette window
1834
1834
  */
1835
1835
  paletteWindow(n, e, t) {
1836
- return S({
1836
+ return W({
1837
1837
  id: n,
1838
1838
  title: e,
1839
1839
  width: 250,
@@ -1843,13 +1843,13 @@ const D = {
1843
1843
  children: t
1844
1844
  });
1845
1845
  }
1846
- }, ue = {
1846
+ }, re = {
1847
1847
  /**
1848
1848
  * Basic app with main window and settings
1849
1849
  */
1850
- basicApp: () => H({
1850
+ basicApp: () => x({
1851
1851
  children: [
1852
- S({
1852
+ W({
1853
1853
  id: "main",
1854
1854
  title: "My App",
1855
1855
  children: () => ({
@@ -1865,7 +1865,7 @@ const D = {
1865
1865
  })
1866
1866
  })
1867
1867
  }),
1868
- D.settingsWindow(() => ({
1868
+ I.settingsWindow(() => ({
1869
1869
  type: "component",
1870
1870
  id: "settings-content",
1871
1871
  props: {},
@@ -1882,9 +1882,9 @@ const D = {
1882
1882
  /**
1883
1883
  * Document-based app
1884
1884
  */
1885
- documentApp: () => H({
1885
+ documentApp: () => x({
1886
1886
  children: [
1887
- L({
1887
+ G({
1888
1888
  id: "document",
1889
1889
  title: "Document",
1890
1890
  for: class {
@@ -1906,7 +1906,7 @@ const D = {
1906
1906
  })
1907
1907
  })
1908
1908
  }),
1909
- D.settingsWindow(() => ({
1909
+ I.settingsWindow(() => ({
1910
1910
  type: "component",
1911
1911
  id: "settings",
1912
1912
  props: {},
@@ -1920,12 +1920,12 @@ const D = {
1920
1920
  }))
1921
1921
  ]
1922
1922
  })
1923
- }, he = Oe(null);
1924
- function pe({
1923
+ }, ae = Pe(null);
1924
+ function de({
1925
1925
  children: n,
1926
1926
  manager: e
1927
1927
  }) {
1928
- const t = e || p(), i = {
1928
+ const t = e || u(), i = {
1929
1929
  openWindow: async (s, a, r) => await t.openWindow(s, a, r),
1930
1930
  dismissWindow: async (s) => await t.dismissWindow(s),
1931
1931
  viewportEnvironment: t.environment,
@@ -1934,47 +1934,47 @@ function pe({
1934
1934
  };
1935
1935
  return {
1936
1936
  type: "context-provider",
1937
- context: he,
1937
+ context: ae,
1938
1938
  value: i,
1939
1939
  children: Array.isArray(n) ? n : [n]
1940
1940
  };
1941
1941
  }
1942
- function C() {
1943
- const n = ze(he);
1942
+ function S() {
1943
+ const n = ke(ae);
1944
1944
  if (!n)
1945
1945
  throw new Error(
1946
1946
  "useViewportEnvironment must be used within a ViewportEnvironmentProvider"
1947
1947
  );
1948
1948
  return n();
1949
1949
  }
1950
- function A() {
1951
- const { openWindow: n } = C();
1950
+ function H() {
1951
+ const { openWindow: n } = S();
1952
1952
  return n;
1953
1953
  }
1954
- function _() {
1955
- const { dismissWindow: n } = C();
1954
+ function z() {
1955
+ const { dismissWindow: n } = S();
1956
1956
  return n;
1957
1957
  }
1958
- function X() {
1959
- const { viewportEnvironment: n } = C();
1958
+ function j() {
1959
+ const { viewportEnvironment: n } = S();
1960
1960
  return n;
1961
1961
  }
1962
- function tt() {
1963
- const { currentWindow: n } = C();
1962
+ function Xe() {
1963
+ const { currentWindow: n } = S();
1964
1964
  return n;
1965
1965
  }
1966
- function nt() {
1967
- return p();
1966
+ function Je() {
1967
+ return u();
1968
1968
  }
1969
- function it(n, e) {
1970
- return (t) => pe({
1969
+ function Ze(n, e) {
1970
+ return (t) => de({
1971
1971
  children: n(t),
1972
1972
  manager: e
1973
1973
  });
1974
1974
  }
1975
- function st(n) {
1975
+ function Ye(n) {
1976
1976
  return (e) => {
1977
- const t = A(), i = _(), s = X();
1977
+ const t = H(), i = z(), s = j();
1978
1978
  return n({
1979
1979
  ...e,
1980
1980
  openWindow: t,
@@ -1983,110 +1983,107 @@ function st(n) {
1983
1983
  });
1984
1984
  };
1985
1985
  }
1986
- const ot = {
1986
+ const et = {
1987
1987
  openWindow: "openWindow",
1988
1988
  dismissWindow: "dismissWindow",
1989
1989
  viewportEnvironment: "viewportEnvironment",
1990
1990
  currentWindow: "currentWindow"
1991
1991
  };
1992
- function rt(n) {
1993
- return C()[n];
1992
+ function tt(n) {
1993
+ return S()[n];
1994
1994
  }
1995
- function at() {
1995
+ function nt() {
1996
1996
  return typeof window > "u" ? 0 : window.innerWidth;
1997
1997
  }
1998
- function lt() {
1998
+ function it() {
1999
1999
  return typeof window > "u" ? 0 : window.innerHeight;
2000
2000
  }
2001
- let F, V, we, fe, I = 0, N = !1;
2002
- function me() {
2003
- typeof window > "u" || (we?.(window.innerWidth), fe?.(window.innerHeight));
2001
+ let O, A, le, ce, T = 0, D = !1;
2002
+ function he() {
2003
+ typeof window > "u" || (le?.(window.innerWidth), ce?.(window.innerHeight));
2004
2004
  }
2005
- function dt() {
2006
- if (F && V) return;
2007
- const [n, e] = k(at()), [t, i] = k(lt());
2008
- F = n, V = t, we = e, fe = i;
2005
+ function st() {
2006
+ if (O && A) return;
2007
+ const [n, e] = M(nt()), [t, i] = M(it());
2008
+ O = n, A = t, le = e, ce = i;
2009
2009
  }
2010
- function ct() {
2011
- typeof window > "u" || N || (window.addEventListener("resize", me), N = !0);
2010
+ function ot() {
2011
+ typeof window > "u" || D || (window.addEventListener("resize", he), D = !0);
2012
2012
  }
2013
- function ut() {
2014
- typeof window > "u" || !N || I > 0 || (window.removeEventListener("resize", me), N = !1);
2013
+ function rt() {
2014
+ typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", he), D = !1);
2015
2015
  }
2016
- function ge() {
2017
- if (dt(), I += 1, typeof window > "u")
2016
+ function ue() {
2017
+ if (st(), T += 1, typeof window > "u")
2018
2018
  return {
2019
- width: F,
2020
- height: V,
2019
+ width: O,
2020
+ height: A,
2021
2021
  dispose: () => {
2022
2022
  }
2023
2023
  };
2024
- ct();
2024
+ ot();
2025
2025
  let n = !1;
2026
2026
  const e = () => {
2027
- n || (n = !0, I = Math.max(0, I - 1), ut());
2027
+ n || (n = !0, T = Math.max(0, T - 1), rt());
2028
2028
  };
2029
- return He() && De(e), {
2030
- width: F,
2031
- height: V,
2029
+ return Te() && xe(e), {
2030
+ width: O,
2031
+ height: A,
2032
2032
  dispose: e
2033
2033
  };
2034
2034
  }
2035
- const ht = "0.8.23", pt = ht, u = {
2035
+ const at = "0.8.25", dt = at, b = {
2036
2036
  Clean: 0,
2037
2037
  Check: 1,
2038
2038
  Dirty: 2,
2039
2039
  Disposed: 3
2040
2040
  };
2041
- var wt = Object.defineProperty, ft = (n, e, t) => e in n ? wt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, f = (n, e, t) => ft(n, typeof e != "symbol" ? e + "" : e, t);
2042
- let mt = 0;
2043
- const gt = Math.random().toString(36).substr(2, 6);
2044
- let ee = null, te = null;
2045
- const bt = /* @__PURE__ */ new Set();
2046
- bt.add(gt);
2047
- const E = {
2041
+ var lt = Object.defineProperty, ct = (n, e, t) => e in n ? lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => ct(n, typeof e != "symbol" ? e + "" : e, t);
2042
+ let ht = 0;
2043
+ const ut = Math.random().toString(36).substr(2, 6);
2044
+ let q = null, X = null;
2045
+ const wt = /* @__PURE__ */ new Set();
2046
+ wt.add(ut);
2047
+ const C = {
2048
2048
  get currentComputation() {
2049
- return ee;
2049
+ return q;
2050
2050
  },
2051
2051
  set currentComputation(n) {
2052
- ee = n;
2052
+ q = n;
2053
2053
  },
2054
2054
  get currentOwner() {
2055
- return te;
2055
+ return X;
2056
2056
  },
2057
2057
  set currentOwner(n) {
2058
- te = n;
2058
+ X = n;
2059
2059
  }
2060
2060
  };
2061
- function be() {
2062
- return E.currentComputation;
2061
+ function we() {
2062
+ return C.currentOwner;
2063
2063
  }
2064
- function J() {
2065
- return E.currentOwner;
2066
- }
2067
- let ye = class {
2064
+ class pt {
2068
2065
  constructor(e, t = null) {
2069
- f(this, "id"), f(this, "owner"), f(this, "fn"), f(this, "sources", /* @__PURE__ */ new Set()), f(this, "observers", /* @__PURE__ */ new Set()), f(this, "state", u.Dirty), f(this, "value"), this.id = ++mt, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2066
+ p(this, "id"), p(this, "owner"), p(this, "fn"), p(this, "sources", /* @__PURE__ */ new Set()), p(this, "observers", /* @__PURE__ */ new Set()), p(this, "state", b.Dirty), p(this, "value"), this.id = ++ht, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2070
2067
  }
2071
2068
  execute() {
2072
- if (this.state === u.Disposed)
2069
+ if (this.state === b.Disposed)
2073
2070
  return this.value;
2074
2071
  for (const t of this.sources)
2075
2072
  t && typeof t == "object" && "removeObserver" in t && t.removeObserver(this);
2076
2073
  this.sources.clear();
2077
- const e = E.currentComputation;
2078
- E.currentComputation = this;
2074
+ const e = C.currentComputation;
2075
+ C.currentComputation = this;
2079
2076
  try {
2080
- return this.state = u.Clean, this.value = this.fn(), this.value;
2077
+ return this.state = b.Clean, this.value = this.fn(), this.value;
2081
2078
  } catch (t) {
2082
- throw this.state = u.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
2079
+ throw this.state = b.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
2083
2080
  } finally {
2084
- E.currentComputation = e;
2081
+ C.currentComputation = e;
2085
2082
  }
2086
2083
  }
2087
2084
  dispose() {
2088
- if (this.state !== u.Disposed) {
2089
- this.state = u.Disposed;
2085
+ if (this.state !== b.Disposed) {
2086
+ this.state = b.Disposed;
2090
2087
  for (const e of this.sources)
2091
2088
  e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
2092
2089
  this.sources.clear();
@@ -2095,107 +2092,27 @@ let ye = class {
2095
2092
  this.observers.clear(), this.owner && !this.owner.disposed && this.owner.sources.delete(this);
2096
2093
  }
2097
2094
  }
2098
- };
2099
- function yt() {
2100
- return E.currentOwner;
2101
- }
2102
- var vt = Object.defineProperty, Wt = (n, e, t) => e in n ? vt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, U = (n, e, t) => Wt(n, typeof e != "symbol" ? e + "" : e, t);
2103
- let St = 0, Et = class {
2104
- constructor(e) {
2105
- U(this, "id"), U(this, "observers", /* @__PURE__ */ new Set()), U(this, "_value"), this.id = ++St, this._value = e;
2106
- }
2107
- /**
2108
- * Get the current value and track dependency
2109
- */
2110
- getValue() {
2111
- const e = be();
2112
- return e && e.state !== u.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
2113
- }
2114
- /**
2115
- * Get the current value without tracking dependency
2116
- */
2117
- peek() {
2118
- return this._value;
2119
- }
2120
- /**
2121
- * Set a new value and notify observers
2122
- */
2123
- set(e) {
2124
- const t = typeof e == "function" ? e(this._value) : e;
2125
- return t !== this._value && (this._value = t, this.notify()), t;
2126
- }
2127
- /**
2128
- * Notify all observers that this signal has changed
2129
- */
2130
- notify() {
2131
- for (const e of this.observers)
2132
- e.state !== u.Disposed && (e.state = u.Dirty, Ct(e));
2133
- }
2134
- /**
2135
- * Remove an observer (cleanup)
2136
- */
2137
- removeObserver(e) {
2138
- this.observers.delete(e);
2139
- }
2140
- /**
2141
- * Get debug information about this signal
2142
- */
2143
- [Symbol.for("tachui.debug")]() {
2144
- return {
2145
- id: this.id,
2146
- value: this._value,
2147
- observerCount: this.observers.size,
2148
- type: "Signal"
2149
- };
2150
- }
2151
- };
2152
- const O = /* @__PURE__ */ new Set();
2153
- let z = !1;
2154
- function Ct(n) {
2155
- O.add(n), !z && queueMicrotask(Mt);
2156
- }
2157
- function Mt() {
2158
- if (!z) {
2159
- z = !0;
2160
- try {
2161
- for (; O.size > 0; ) {
2162
- const n = Array.from(O).sort((e, t) => e.id - t.id);
2163
- O.clear();
2164
- for (const e of n)
2165
- e.state === u.Dirty && e.execute();
2166
- }
2167
- } finally {
2168
- z = !1;
2169
- }
2170
- }
2171
2095
  }
2172
- function kt(n) {
2173
- const e = new Et(n), t = e.getValue.bind(e);
2174
- t.peek = e.peek.bind(e);
2175
- const i = e.set.bind(e);
2176
- return Object.defineProperty(t, Symbol.for("tachui.signal"), {
2177
- value: e,
2178
- enumerable: !1
2179
- }), [t, i];
2096
+ function ft() {
2097
+ return C.currentOwner;
2180
2098
  }
2181
- function ne(n) {
2099
+ function J(n) {
2182
2100
  return typeof n == "function" && Symbol.for("tachui.signal") in n;
2183
2101
  }
2184
- const xt = (n, e) => n === e;
2185
- var Pt = Object.defineProperty, Tt = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e, t) => Tt(n, typeof e != "symbol" ? e + "" : e, t), x = /* @__PURE__ */ ((n) => (n[n.Immediate = 0] = "Immediate", n[n.High = 1] = "High", n[n.Normal = 2] = "Normal", n[n.Low = 3] = "Low", n[n.Idle = 4] = "Idle", n))(x || {});
2186
- class It extends Error {
2102
+ var mt = Object.defineProperty, gt = (n, e, t) => e in n ? mt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e, t) => gt(n, typeof e != "symbol" ? e + "" : e, t), N = /* @__PURE__ */ ((n) => (n[n.Immediate = 0] = "Immediate", n[n.High = 1] = "High", n[n.Normal = 2] = "Normal", n[n.Low = 3] = "Low", n[n.Idle = 4] = "Idle", n))(N || {});
2103
+ let bt = class extends Error {
2187
2104
  constructor(e, t, i) {
2188
2105
  super(e), this.cause = t, this.node = i, this.name = "ReactiveError";
2189
2106
  }
2190
- }
2191
- const Ot = class v {
2107
+ };
2108
+ const yt = class y {
2192
2109
  constructor() {
2193
2110
  w(this, "updateQueues", /* @__PURE__ */ new Map()), w(this, "isFlushPending", !1), w(this, "isDestroyed", !1), w(this, "errorHandlers", /* @__PURE__ */ new Set()), w(this, "maxRetries", 3), w(this, "totalUpdateCycles", 0), w(this, "totalUpdateTime", 0), w(this, "errorCount", 0), w(this, "nodeRegistry", /* @__PURE__ */ new WeakSet());
2194
- for (const e of Object.values(x))
2111
+ for (const e of Object.values(N))
2195
2112
  typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
2196
2113
  }
2197
2114
  static getInstance() {
2198
- return v.instance || (v.instance = new v()), v.instance;
2115
+ return y.instance || (y.instance = new y()), y.instance;
2199
2116
  }
2200
2117
  /**
2201
2118
  * Schedule reactive node for update
@@ -2228,7 +2145,7 @@ const Ot = class v {
2228
2145
  await this.updateNodeWithRetry(a);
2229
2146
  } catch (r) {
2230
2147
  this.handleReactiveError(
2231
- new It(`Failed to update ${a.type} node ${a.id}`, r, a)
2148
+ new bt(`Failed to update ${a.type} node ${a.id}`, r, a)
2232
2149
  );
2233
2150
  }
2234
2151
  if (this.hasHigherPriorityWork(t))
@@ -2374,7 +2291,7 @@ const Ot = class v {
2374
2291
  }
2375
2292
  e.clear();
2376
2293
  }
2377
- this.updateQueues.clear(), this.errorHandlers.clear(), v.instance = null;
2294
+ this.updateQueues.clear(), this.errorHandlers.clear(), y.instance = null;
2378
2295
  }
2379
2296
  /**
2380
2297
  * Get debug information
@@ -2382,7 +2299,7 @@ const Ot = class v {
2382
2299
  getDebugInfo() {
2383
2300
  const e = {};
2384
2301
  for (const [t, i] of this.updateQueues)
2385
- e[x[t]] = i.size;
2302
+ e[N[t]] = i.size;
2386
2303
  return {
2387
2304
  isFlushPending: this.isFlushPending,
2388
2305
  isDestroyed: this.isDestroyed,
@@ -2392,263 +2309,140 @@ const Ot = class v {
2392
2309
  };
2393
2310
  }
2394
2311
  };
2395
- w(Ot, "instance", null);
2396
- var zt = Object.defineProperty, Ht = (n, e, t) => e in n ? zt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, y = (n, e, t) => Ht(n, typeof e != "symbol" ? e + "" : e, t);
2397
- class Dt extends ye {
2398
- constructor(e, t = {}, i = J()) {
2399
- super(e, i), y(this, "type", "computed"), y(this, "priority"), y(this, "_hasValue", !1), y(this, "_error", null), y(this, "equalsFn"), y(this, "options"), this.priority = t.priority ?? x.Normal, this.equalsFn = t.equals ?? xt, this.options = t;
2400
- }
2401
- /**
2402
- * Get the computed value, tracking dependency and lazily computing
2403
- */
2404
- getValue() {
2405
- const e = be();
2406
- return e && e.state !== u.Disposed && (this.observers.add(e), e.sources.add(this)), (this.state === u.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
2407
- }
2408
- /**
2409
- * Get the current value without tracking dependency
2410
- */
2411
- peek() {
2412
- return (this.state === u.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
2413
- }
2414
- /**
2415
- * Remove an observer (cleanup)
2416
- */
2417
- removeObserver(e) {
2418
- this.observers.delete(e), this.options.releaseOnNoObservers === !0 && this.observers.size === 0 && e.state === u.Disposed && this.releaseSources();
2419
- }
2420
- releaseSources() {
2421
- for (const e of this.sources)
2422
- "removeObserver" in e && e.removeObserver(this);
2423
- this.sources.clear(), this._hasValue = !1, this.state = u.Dirty;
2424
- }
2425
- /**
2426
- * Execute the computation and notify observers
2427
- */
2428
- execute() {
2429
- const e = this._hasValue ? this.value : void 0, t = super.execute();
2430
- if (!this._hasValue || !this.equalsFn(e, t))
2431
- for (const i of this.observers)
2432
- i.state !== u.Disposed && (i.state = u.Dirty, "execute" in i && typeof i.execute == "function" && queueMicrotask(() => {
2433
- i.state === u.Dirty && i.execute();
2434
- }));
2435
- return t;
2436
- }
2437
- /**
2438
- * Notify method for ReactiveNode compatibility
2439
- */
2440
- notify() {
2441
- this.execute();
2442
- }
2443
- /**
2444
- * Complete cleanup for memory management
2445
- */
2446
- cleanup() {
2447
- for (const e of this.sources)
2448
- "removeObserver" in e && e.removeObserver(this);
2449
- this.sources.clear();
2450
- for (const e of this.observers)
2451
- e.sources.delete(this);
2452
- this.observers.clear(), this._hasValue = !1, this._error = null, this.state = u.Disposed;
2453
- }
2454
- /**
2455
- * Dispose the computed value
2456
- */
2457
- dispose() {
2458
- this.cleanup(), super.dispose();
2459
- }
2460
- /**
2461
- * Debug information
2462
- */
2463
- [Symbol.for("tachui.debug")]() {
2464
- return {
2465
- id: this.id,
2466
- type: this.type,
2467
- value: this._hasValue ? this.value : void 0,
2468
- hasValue: this._hasValue,
2469
- error: this._error?.message,
2470
- state: this.state,
2471
- sourceCount: this.sources.size,
2472
- observerCount: this.observers.size,
2473
- priority: x[this.priority],
2474
- debugName: this.options.debugName,
2475
- equalsFn: this.equalsFn.name || "anonymous"
2476
- };
2477
- }
2478
- toString() {
2479
- return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
2480
- }
2481
- }
2482
- function At(n, e) {
2483
- const t = new Dt(n, e), i = t.getValue.bind(t);
2484
- return i.peek = t.peek.bind(t), Object.defineProperty(i, Symbol.for("tachui.computed"), {
2485
- value: t,
2486
- enumerable: !1
2487
- }), i;
2488
- }
2489
- function B(n) {
2312
+ w(yt, "instance", null);
2313
+ function U(n) {
2490
2314
  return typeof n == "function" && Symbol.for("tachui.computed") in n;
2491
2315
  }
2492
- function _t(n) {
2316
+ function vt(n) {
2493
2317
  return n[Symbol.for("tachui.computed")] || null;
2494
2318
  }
2495
- function Ft(n) {
2496
- const e = _t(n);
2319
+ function Wt(n) {
2320
+ const e = vt(n);
2497
2321
  !e || e.observers.size !== 0 || e.releaseSources();
2498
2322
  }
2499
- const [Vt, wn] = kt("light");
2500
- At(() => {
2501
- const n = Vt();
2502
- return n === "system" ? Nt() : n;
2503
- });
2504
- function Nt() {
2505
- return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2506
- }
2507
- function Gt(n) {
2508
- const e = J();
2509
- e && !e.disposed ? e.cleanups.push(n) : __DEV__ && console.warn("onCleanup called outside of reactive context");
2510
- }
2511
- typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
2512
- var Lt = Object.defineProperty, Ut = (n, e, t) => e in n ? Lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, ie = (n, e, t) => Ut(n, typeof e != "symbol" ? e + "" : e, t);
2513
- class Rt {
2514
- constructor() {
2515
- ie(this, "pending", /* @__PURE__ */ new Set()), ie(this, "isFlushScheduled", !1);
2516
- }
2517
- schedule(e) {
2518
- this.pending.add(e), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
2519
- }
2520
- flush() {
2521
- if (this.pending.size === 0) {
2522
- this.isFlushScheduled = !1;
2523
- return;
2524
- }
2525
- const e = Array.from(this.pending);
2526
- this.pending.clear(), this.isFlushScheduled = !1;
2527
- for (const t of e)
2528
- try {
2529
- t();
2530
- } catch (i) {
2531
- console.error("Error in scheduled task:", i);
2532
- }
2533
- this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
2534
- }
2535
- }
2536
- new Rt();
2537
- function ve(n, e = {}) {
2538
- const t = J();
2323
+ function pe(n, e = {}) {
2324
+ const t = we();
2539
2325
  let i;
2540
2326
  const s = () => {
2541
2327
  const r = n(i);
2542
2328
  return i = r, r;
2543
- }, a = new ye(s, t);
2329
+ }, a = new pt(s, t);
2544
2330
  return e.name && Object.defineProperty(a, "name", {
2545
2331
  value: e.name,
2546
2332
  enumerable: !1
2547
2333
  }), a.execute(), a;
2548
2334
  }
2549
- const M = /* @__PURE__ */ new WeakMap();
2550
- function se(n, e, t) {
2335
+ function St(n) {
2336
+ const e = we();
2337
+ e && !e.disposed ? e.cleanups.push(n) : __DEV__ && console.warn("onCleanup called outside of reactive context");
2338
+ }
2339
+ typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
2340
+ const E = /* @__PURE__ */ new WeakMap();
2341
+ function Z(n, e, t) {
2551
2342
  try {
2552
2343
  n(e);
2553
2344
  } catch (i) {
2554
2345
  console.error(`Reactive style updater failed (${t}):`, i);
2555
2346
  }
2556
2347
  }
2557
- const q = 200, m = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new Set();
2558
- let oe = !1, R = !1;
2559
- function $t(n) {
2560
- m.get(n)?.forEach((e) => e()), m.delete(n), G.delete(n);
2348
+ const R = 200, f = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Set();
2349
+ let Y = !1, _ = !1;
2350
+ function Et(n) {
2351
+ f.get(n)?.forEach((e) => e()), f.delete(n), F.delete(n);
2561
2352
  }
2562
- function We() {
2353
+ function fe() {
2563
2354
  const n = Date.now();
2564
- for (const e of Array.from(W)) {
2355
+ for (const e of Array.from(v)) {
2565
2356
  const t = e.deref();
2566
2357
  if (!t) {
2567
- W.delete(e);
2358
+ v.delete(e);
2568
2359
  continue;
2569
2360
  }
2570
- const i = G.get(t), s = m.get(t);
2361
+ const i = F.get(t), s = f.get(t);
2571
2362
  if (!i || !s || s.size === 0) {
2572
- W.delete(e);
2363
+ v.delete(e);
2573
2364
  continue;
2574
2365
  }
2575
2366
  if (t.isConnected) {
2576
2367
  i.wasConnected = !0;
2577
2368
  continue;
2578
2369
  }
2579
- (i.wasConnected || n - i.trackedAt >= q) && ($t(t), W.delete(e));
2370
+ (i.wasConnected || n - i.trackedAt >= R) && (Et(t), v.delete(e));
2580
2371
  }
2581
2372
  }
2582
- function jt() {
2583
- if (R || typeof setTimeout != "function") return;
2584
- R = !0;
2373
+ function Ct() {
2374
+ if (_ || typeof setTimeout != "function") return;
2375
+ _ = !0;
2585
2376
  const n = () => {
2586
- if (We(), W.size === 0) {
2587
- R = !1;
2377
+ if (fe(), v.size === 0) {
2378
+ _ = !1;
2588
2379
  return;
2589
2380
  }
2590
- setTimeout(n, q);
2381
+ setTimeout(n, R);
2591
2382
  };
2592
- setTimeout(n, q);
2593
- }
2594
- function Bt() {
2595
- oe || typeof document > "u" || !document.documentElement || typeof MutationObserver > "u" || (new MutationObserver(() => {
2596
- We();
2597
- }).observe(document.documentElement, { childList: !0, subtree: !0 }), oe = !0);
2383
+ setTimeout(n, R);
2598
2384
  }
2599
- function qt(n, e) {
2600
- Bt(), jt();
2601
- const t = m.get(n) ?? /* @__PURE__ */ new Set(), i = t.size > 0;
2602
- return t.add(e), m.set(n, t), i || (G.set(n, {
2385
+ function Mt() {
2386
+ Y || typeof document > "u" || !document.documentElement || typeof MutationObserver > "u" || (new MutationObserver(() => {
2387
+ fe();
2388
+ }).observe(document.documentElement, { childList: !0, subtree: !0 }), Y = !0);
2389
+ }
2390
+ function kt(n, e) {
2391
+ Mt(), Ct();
2392
+ const t = f.get(n) ?? /* @__PURE__ */ new Set(), i = t.size > 0;
2393
+ return t.add(e), f.set(n, t), i || (F.set(n, {
2603
2394
  trackedAt: Date.now(),
2604
2395
  wasConnected: n.isConnected
2605
- }), W.add(new WeakRef(n))), () => {
2606
- const s = m.get(n);
2607
- s && (s.delete(e), s.size === 0 && (m.delete(n), G.delete(n)));
2396
+ }), v.add(new WeakRef(n))), () => {
2397
+ const s = f.get(n);
2398
+ s && (s.delete(e), s.size === 0 && (f.delete(n), F.delete(n)));
2608
2399
  };
2609
2400
  }
2610
- function Qt({
2401
+ function Pt({
2611
2402
  element: n,
2612
2403
  accessor: e,
2613
2404
  updater: t,
2614
2405
  updaterId: i
2615
2406
  }) {
2616
- const s = M.get(n) ?? /* @__PURE__ */ new Map();
2617
- M.has(n) || M.set(n, s);
2407
+ const s = E.get(n) ?? /* @__PURE__ */ new Map();
2408
+ E.has(n) || E.set(n, s);
2618
2409
  let a = s.get(e);
2619
2410
  if (!a) {
2620
2411
  const d = /* @__PURE__ */ new Map();
2621
- a = { effect: ve(() => {
2412
+ a = { effect: pe(() => {
2622
2413
  const l = e();
2623
2414
  d.forEach(
2624
- (h, b) => se(h, l, b)
2415
+ (h, g) => Z(h, l, g)
2625
2416
  );
2626
2417
  }), updaters: d }, s.set(e, a);
2627
2418
  }
2628
- a.updaters.set(i, t), se(t, e(), i);
2419
+ a.updaters.set(i, t), Z(t, e(), i);
2629
2420
  let r = null;
2630
2421
  const c = () => {
2631
2422
  r && (r(), r = null);
2632
- const d = M.get(n), l = d?.get(e);
2633
- l && (l.updaters.delete(i), l.updaters.size === 0 && (l.effect.dispose(), d?.delete(e), B(e) && Ft(e)), d && d.size === 0 && M.delete(n));
2423
+ const d = E.get(n), l = d?.get(e);
2424
+ l && (l.updaters.delete(i), l.updaters.size === 0 && (l.effect.dispose(), d?.delete(e), U(e) && Wt(e)), d && d.size === 0 && E.delete(n));
2634
2425
  };
2635
- yt() ? Gt(c) : r = qt(n, c);
2426
+ ft() ? St(c) : r = kt(n, c);
2427
+ }
2428
+ const ee = Symbol.for("tachui.modifier.instanceId"), Tt = "core";
2429
+ let te = 0;
2430
+ function ne(n) {
2431
+ return typeof HTMLElement < "u" && n instanceof HTMLElement;
2636
2432
  }
2637
- const re = Symbol.for("tachui.modifier.instanceId"), Kt = "core";
2638
- let ae = 0;
2639
- function Xt(n) {
2640
- const e = n[re];
2433
+ function xt(n) {
2434
+ const e = n[ee];
2641
2435
  if (typeof e == "number") return e;
2642
- ae += 1;
2643
- const t = ae;
2644
- return Object.defineProperty(n, re, {
2436
+ te += 1;
2437
+ const t = te;
2438
+ return Object.defineProperty(n, ee, {
2645
2439
  value: t,
2646
2440
  enumerable: !1,
2647
2441
  configurable: !1,
2648
2442
  writable: !1
2649
2443
  }), t;
2650
2444
  }
2651
- class Jt {
2445
+ class It {
2652
2446
  constructor(e) {
2653
2447
  this.properties = e;
2654
2448
  }
@@ -2665,26 +2459,24 @@ class Jt {
2665
2459
  * Apply a single style change to an element with reactive support
2666
2460
  */
2667
2461
  applyStyleChange(e, t, i) {
2668
- if (e instanceof HTMLElement) {
2669
- const s = this.toCSSProperty(t);
2670
- if (ne(i) || B(i))
2671
- ve(() => {
2672
- const a = i(), r = String(a);
2673
- if (r.includes("!important")) {
2674
- const c = r.replace(/\s*!important\s*$/, "").trim();
2675
- e.style.setProperty(s, c, "important");
2676
- } else
2677
- e.style.setProperty(s, r);
2678
- });
2679
- else {
2680
- const a = String(i);
2681
- if (a.includes("!important")) {
2682
- const r = a.replace(/\s*!important\s*$/, "").trim();
2683
- e.style.setProperty(s, r, "important");
2684
- } else
2685
- e.style.setProperty(s, a);
2462
+ if (!(typeof HTMLElement < "u" && e instanceof HTMLElement) && !e.style)
2463
+ return;
2464
+ const a = this.toCSSProperty(t), r = e.style, c = (d) => {
2465
+ if (d.includes("!important")) {
2466
+ const l = d.replace(/\s*!important\s*$/, "").trim();
2467
+ r.setProperty(a, l, "important");
2468
+ return;
2686
2469
  }
2470
+ r.setProperty(a, d);
2471
+ };
2472
+ if (J(i) || U(i)) {
2473
+ pe(() => {
2474
+ const d = i();
2475
+ c(String(d));
2476
+ });
2477
+ return;
2687
2478
  }
2479
+ c(String(i));
2688
2480
  }
2689
2481
  /**
2690
2482
  * Convert camelCase property to CSS kebab-case
@@ -2723,34 +2515,34 @@ class Jt {
2723
2515
  * Apply multiple CSS properties to an element with reactive support
2724
2516
  */
2725
2517
  applyStyles(e, t) {
2726
- if (e instanceof HTMLElement || e.style) {
2727
- const i = e.style, s = (a, r) => {
2728
- if (i.setProperty)
2729
- if (typeof r == "string" && r.includes("!important")) {
2730
- const c = r.replace(/\s*!important\s*$/, "").trim();
2731
- i.setProperty(a, c, "important");
2518
+ if (typeof HTMLElement < "u" && e instanceof HTMLElement || e.style) {
2519
+ const s = e.style, a = (r, c) => {
2520
+ if (s.setProperty)
2521
+ if (typeof c == "string" && c.includes("!important")) {
2522
+ const d = c.replace(/\s*!important\s*$/, "").trim();
2523
+ s.setProperty(r, d, "important");
2732
2524
  } else
2733
- i.setProperty(a, r);
2525
+ s.setProperty(r, c);
2734
2526
  else
2735
- i[a] = r;
2527
+ s[r] = c;
2736
2528
  };
2737
- for (const [a, r] of Object.entries(t))
2738
- if (r !== void 0) {
2739
- const c = this.toCSSProperty(a);
2740
- if (ne(r) || B(r)) {
2741
- const d = r, l = Xt(this);
2742
- Qt({
2529
+ for (const [r, c] of Object.entries(t))
2530
+ if (c !== void 0) {
2531
+ const d = this.toCSSProperty(r);
2532
+ if (J(c) || U(c)) {
2533
+ const l = c, h = xt(this);
2534
+ Pt({
2743
2535
  element: e,
2744
- accessor: d,
2745
- updaterId: `${Kt}:${l}:${c}`,
2746
- updater: (h) => {
2747
- const b = this.toCSSValueForProperty(c, h);
2748
- s(c, b);
2536
+ accessor: l,
2537
+ updaterId: `${Tt}:${h}:${d}`,
2538
+ updater: (g) => {
2539
+ const ve = this.toCSSValueForProperty(d, g);
2540
+ a(d, ve);
2749
2541
  }
2750
2542
  });
2751
2543
  } else {
2752
- const d = this.toCSSValueForProperty(c, r);
2753
- s(c, d);
2544
+ const l = this.toCSSValueForProperty(d, c);
2545
+ a(d, l);
2754
2546
  }
2755
2547
  }
2756
2548
  }
@@ -2759,13 +2551,13 @@ class Jt {
2759
2551
  * Add CSS classes to an element
2760
2552
  */
2761
2553
  addClasses(e, t) {
2762
- e instanceof HTMLElement && e.classList.add(...t);
2554
+ ne(e) && e.classList.add(...t);
2763
2555
  }
2764
2556
  /**
2765
2557
  * Remove CSS classes from an element
2766
2558
  */
2767
2559
  removeClasses(e, t) {
2768
- e instanceof HTMLElement && e.classList.remove(...t);
2560
+ ne(e) && e.classList.remove(...t);
2769
2561
  }
2770
2562
  /**
2771
2563
  * Create a style computation context
@@ -2780,8 +2572,8 @@ class Jt {
2780
2572
  };
2781
2573
  }
2782
2574
  }
2783
- const P = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap();
2784
- class Se extends Jt {
2575
+ const k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
2576
+ class me extends It {
2785
2577
  constructor() {
2786
2578
  super(...arguments);
2787
2579
  o(this, "type", "viewportLifecycle");
@@ -2792,8 +2584,8 @@ class Se extends Jt {
2792
2584
  i.element && (this.properties.onAppear || this.properties.onDisappear) && this.setupLifecycleObserver(i.element, this.properties);
2793
2585
  }
2794
2586
  setupLifecycleObserver(t, i) {
2795
- const s = T.get(t);
2796
- s && (s.unobserve(t), s.disconnect(), T.delete(t)), P.set(t, {
2587
+ const s = P.get(t);
2588
+ s && (s.unobserve(t), s.disconnect(), P.delete(t)), k.set(t, {
2797
2589
  isVisible: !1
2798
2590
  });
2799
2591
  const a = new IntersectionObserver(
@@ -2802,11 +2594,11 @@ class Se extends Jt {
2802
2594
  const d = c.target;
2803
2595
  if (!(d instanceof Element)) return;
2804
2596
  if (!d.isConnected) {
2805
- a.unobserve(d), T.delete(d), P.delete(d);
2597
+ a.unobserve(d), P.delete(d), k.delete(d);
2806
2598
  return;
2807
2599
  }
2808
- const l = P.get(d) ?? { isVisible: !1 }, h = c.isIntersecting;
2809
- h !== l.isVisible && (l.isVisible = h, P.set(d, l), h && i.onAppear ? i.onAppear() : !h && i.onDisappear && i.onDisappear());
2600
+ const l = k.get(d) ?? { isVisible: !1 }, h = c.isIntersecting;
2601
+ h !== l.isVisible && (l.isVisible = h, k.set(d, l), h && i.onAppear ? i.onAppear() : !h && i.onDisappear && i.onDisappear());
2810
2602
  });
2811
2603
  },
2812
2604
  {
@@ -2816,98 +2608,98 @@ class Se extends Jt {
2816
2608
  // Add some margin for better UX
2817
2609
  }
2818
2610
  );
2819
- a.observe(t), T.set(t, a);
2611
+ a.observe(t), P.set(t, a);
2820
2612
  }
2821
2613
  }
2822
- function Ee(n) {
2823
- return new Se({ onAppear: n });
2614
+ function ge(n) {
2615
+ return new me({ onAppear: n });
2824
2616
  }
2825
- function Ce(n) {
2826
- return new Se({ onDisappear: n });
2617
+ function be(n) {
2618
+ return new me({ onDisappear: n });
2827
2619
  }
2828
- const Zt = {
2620
+ const Ht = {
2829
2621
  name: "@tachui/viewport",
2830
- version: pt,
2622
+ version: dt,
2831
2623
  author: "TachUI Team",
2832
2624
  verified: !0
2833
- }, le = {
2625
+ }, ie = {
2834
2626
  category: "interaction",
2835
2627
  priority: 110,
2836
2628
  signature: "(handler: () => void) => Modifier",
2837
2629
  description: "Triggers handlers when an element appears in or disappears from the viewport."
2838
2630
  };
2839
- let de = !1;
2840
- function Me(n) {
2841
- const e = n?.registry, t = n?.plugin ?? Zt, i = n?.force === !0, s = !!(e || n?.plugin);
2842
- !s && de && !i || (Z(
2631
+ let se = !1;
2632
+ function ye(n) {
2633
+ const e = n?.registry, t = n?.plugin ?? Ht, i = n?.force === !0, s = !!(e || n?.plugin);
2634
+ !s && se && !i || (Q(
2843
2635
  "onAppear",
2844
- Ee,
2636
+ ge,
2845
2637
  {
2846
- ...le,
2638
+ ...ie,
2847
2639
  description: "Executes a callback when the component enters the viewport."
2848
2640
  },
2849
2641
  e,
2850
2642
  t
2851
- ), Z(
2643
+ ), Q(
2852
2644
  "onDisappear",
2853
- Ce,
2645
+ be,
2854
2646
  {
2855
- ...le,
2647
+ ...ie,
2856
2648
  description: "Executes a callback when the component leaves the viewport."
2857
2649
  },
2858
2650
  e,
2859
2651
  t
2860
- ), s || (de = !0));
2652
+ ), s || (se = !0));
2861
2653
  }
2862
- Me();
2863
- const Yt = {
2654
+ ye();
2655
+ const zt = {
2864
2656
  // Manager
2865
- getManager: p,
2657
+ getManager: u,
2866
2658
  // Environment
2867
- useOpenWindow: A,
2868
- useDismissWindow: _,
2869
- useViewportInfo: X,
2870
- useViewport: ge,
2659
+ useOpenWindow: H,
2660
+ useDismissWindow: z,
2661
+ useViewportInfo: j,
2662
+ useViewport: ue,
2871
2663
  // Components
2872
- Window: S,
2873
- WindowGroup: L,
2874
- App: H,
2664
+ Window: W,
2665
+ WindowGroup: G,
2666
+ App: x,
2875
2667
  // Utilities
2876
- Utils: D,
2877
- Examples: ue
2668
+ Utils: I,
2669
+ Examples: re
2878
2670
  };
2879
- function en(n) {
2880
- const e = new K(n?.customAdapter);
2881
- return ce(e), e;
2671
+ function Ot(n) {
2672
+ const e = new B(n?.customAdapter);
2673
+ return oe(e), e;
2882
2674
  }
2883
- const tn = {
2675
+ const At = {
2884
2676
  isWindow: (n) => n.type === "window",
2885
2677
  isModal: (n) => n.type === "modal",
2886
2678
  isPortal: (n) => n.type === "portal",
2887
2679
  isSheet: (n) => n.type === "sheet",
2888
2680
  isPopover: (n) => n.type === "popover"
2889
- }, nn = {
2681
+ }, Dt = {
2890
2682
  /**
2891
2683
  * Check if running in Electron
2892
2684
  */
2893
- isElectron: () => p().environment.platform === "electron",
2685
+ isElectron: () => u().environment.platform === "electron",
2894
2686
  /**
2895
2687
  * Check if on mobile
2896
2688
  */
2897
- isMobile: () => p().environment.platform === "mobile",
2689
+ isMobile: () => u().environment.platform === "mobile",
2898
2690
  /**
2899
2691
  * Check if multi-window is supported
2900
2692
  */
2901
- supportsMultiWindow: () => p().environment.capabilities.multiWindow,
2693
+ supportsMultiWindow: () => u().environment.capabilities.multiWindow,
2902
2694
  /**
2903
2695
  * Check if native windows are supported
2904
2696
  */
2905
- supportsNativeWindows: () => p().environment.capabilities.nativeWindows,
2697
+ supportsNativeWindows: () => u().environment.capabilities.nativeWindows,
2906
2698
  /**
2907
2699
  * Get optimal window type for current platform
2908
2700
  */
2909
- getOptimalWindowType: (n = !1) => p().getOptimalWindowType({ preferNativeWindow: n })
2910
- }, sn = {
2701
+ getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2702
+ }, Ft = {
2911
2703
  /**
2912
2704
  * Standard document window
2913
2705
  */
@@ -2974,7 +2766,7 @@ const tn = {
2974
2766
  minimizable: !1,
2975
2767
  maximizable: !1
2976
2768
  })
2977
- }, on = {
2769
+ }, Gt = {
2978
2770
  DEFAULT_WINDOW_WIDTH: 800,
2979
2771
  DEFAULT_WINDOW_HEIGHT: 600,
2980
2772
  MIN_WINDOW_WIDTH: 300,
@@ -2982,84 +2774,84 @@ const tn = {
2982
2774
  MODAL_Z_INDEX: 1e3,
2983
2775
  PORTAL_Z_INDEX: 999,
2984
2776
  ANIMATION_DURATION: 200
2985
- }, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2777
+ }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2986
2778
  __proto__: null,
2987
- App: H,
2988
- EnvironmentKeys: ot,
2989
- ExampleScenes: ue,
2990
- PlatformUtils: nn,
2991
- TachUIViewportManager: K,
2992
- Viewport: Yt,
2993
- ViewportConstants: on,
2994
- ViewportEnvironmentProvider: pe,
2995
- ViewportTypeGuards: tn,
2996
- WebViewportAdapter: j,
2997
- Window: S,
2998
- WindowConfigs: sn,
2999
- WindowGroup: L,
3000
- WindowUtils: D,
3001
- checkFeatureSupport: Qe,
3002
- createCapabilityChecker: $,
3003
- createWindowAwareComponent: st,
3004
- detectViewportEnvironment: Q,
3005
- disposeViewportManager: et,
3006
- getBrowserInfo: Be,
3007
- getEnvironmentValue: rt,
3008
- getOSInfo: qe,
3009
- getViewportManager: p,
3010
- initializeViewportSystem: en,
3011
- onAppear: Ee,
3012
- onDisappear: Ce,
3013
- registerViewportModifiers: Me,
3014
- setViewportManager: ce,
3015
- useCurrentWindow: tt,
3016
- useDismissWindow: _,
3017
- useEnvironmentDismissWindow: _,
3018
- useEnvironmentOpenWindow: A,
3019
- useOpenWindow: A,
3020
- useViewport: ge,
3021
- useViewportEnvironment: C,
3022
- useViewportInfo: X,
3023
- useViewportManager: nt,
3024
- withViewportEnvironment: it
2779
+ App: x,
2780
+ EnvironmentKeys: et,
2781
+ ExampleScenes: re,
2782
+ PlatformUtils: Dt,
2783
+ TachUIViewportManager: B,
2784
+ Viewport: zt,
2785
+ ViewportConstants: Gt,
2786
+ ViewportEnvironmentProvider: de,
2787
+ ViewportTypeGuards: At,
2788
+ WebViewportAdapter: V,
2789
+ Window: W,
2790
+ WindowConfigs: Ft,
2791
+ WindowGroup: G,
2792
+ WindowUtils: I,
2793
+ checkFeatureSupport: Re,
2794
+ createCapabilityChecker: L,
2795
+ createWindowAwareComponent: Ye,
2796
+ detectViewportEnvironment: $,
2797
+ disposeViewportManager: qe,
2798
+ getBrowserInfo: Ne,
2799
+ getEnvironmentValue: tt,
2800
+ getOSInfo: Ue,
2801
+ getViewportManager: u,
2802
+ initializeViewportSystem: Ot,
2803
+ onAppear: ge,
2804
+ onDisappear: be,
2805
+ registerViewportModifiers: ye,
2806
+ setViewportManager: oe,
2807
+ useCurrentWindow: Xe,
2808
+ useDismissWindow: z,
2809
+ useEnvironmentDismissWindow: z,
2810
+ useEnvironmentOpenWindow: H,
2811
+ useOpenWindow: H,
2812
+ useViewport: ue,
2813
+ useViewportEnvironment: S,
2814
+ useViewportInfo: j,
2815
+ useViewportManager: Je,
2816
+ withViewportEnvironment: Ze
3025
2817
  }, Symbol.toStringTag, { value: "Module" }));
3026
2818
  export {
3027
- H as App,
3028
- ot as EnvironmentKeys,
3029
- ue as ExampleScenes,
3030
- nn as PlatformUtils,
3031
- K as TachUIViewportManager,
3032
- Yt as Viewport,
3033
- on as ViewportConstants,
3034
- pe as ViewportEnvironmentProvider,
3035
- tn as ViewportTypeGuards,
3036
- j as WebViewportAdapter,
3037
- S as Window,
3038
- sn as WindowConfigs,
3039
- L as WindowGroup,
3040
- D as WindowUtils,
3041
- Qe as checkFeatureSupport,
3042
- $ as createCapabilityChecker,
3043
- st as createWindowAwareComponent,
3044
- Q as detectViewportEnvironment,
3045
- et as disposeViewportManager,
3046
- Be as getBrowserInfo,
3047
- rt as getEnvironmentValue,
3048
- qe as getOSInfo,
3049
- p as getViewportManager,
3050
- en as initializeViewportSystem,
3051
- Ee as onAppear,
3052
- Ce as onDisappear,
3053
- Me as registerViewportModifiers,
3054
- ce as setViewportManager,
3055
- tt as useCurrentWindow,
3056
- _ as useDismissWindow,
3057
- _ as useEnvironmentDismissWindow,
3058
- A as useEnvironmentOpenWindow,
3059
- A as useOpenWindow,
3060
- ge as useViewport,
3061
- C as useViewportEnvironment,
3062
- X as useViewportInfo,
3063
- nt as useViewportManager,
3064
- it as withViewportEnvironment
2819
+ x as App,
2820
+ et as EnvironmentKeys,
2821
+ re as ExampleScenes,
2822
+ Dt as PlatformUtils,
2823
+ B as TachUIViewportManager,
2824
+ zt as Viewport,
2825
+ Gt as ViewportConstants,
2826
+ de as ViewportEnvironmentProvider,
2827
+ At as ViewportTypeGuards,
2828
+ V as WebViewportAdapter,
2829
+ W as Window,
2830
+ Ft as WindowConfigs,
2831
+ G as WindowGroup,
2832
+ I as WindowUtils,
2833
+ Re as checkFeatureSupport,
2834
+ L as createCapabilityChecker,
2835
+ Ye as createWindowAwareComponent,
2836
+ $ as detectViewportEnvironment,
2837
+ qe as disposeViewportManager,
2838
+ Ne as getBrowserInfo,
2839
+ tt as getEnvironmentValue,
2840
+ Ue as getOSInfo,
2841
+ u as getViewportManager,
2842
+ Ot as initializeViewportSystem,
2843
+ ge as onAppear,
2844
+ be as onDisappear,
2845
+ ye as registerViewportModifiers,
2846
+ oe as setViewportManager,
2847
+ Xe as useCurrentWindow,
2848
+ z as useDismissWindow,
2849
+ z as useEnvironmentDismissWindow,
2850
+ H as useEnvironmentOpenWindow,
2851
+ H as useOpenWindow,
2852
+ ue as useViewport,
2853
+ S as useViewportEnvironment,
2854
+ j as useViewportInfo,
2855
+ Je as useViewportManager,
2856
+ Ze as withViewportEnvironment
3065
2857
  };