@tachui/viewport 0.8.23 → 0.8.24

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 ve = Object.defineProperty;
2
+ var We = (n, e, t) => e in n ? ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var o = (n, e, t) => We(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { createSignal as M, mountComponentTree as Se, createRoot as Ee, withComponentContext as Ce, useContext as Me, createContext as ke } from "@tachui/core";
5
+ import { getOwner as Pe, onCleanup as Te } from "@tachui/core/reactive";
6
+ import { registerModifierWithMetadata as Q } from "@tachui/modifiers";
7
+ function $(n = {}) {
8
+ const e = xe(), t = Oe(e, n), i = _e(), s = Ge(), a = Le();
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 xe() {
18
+ return Ie() ? "electron" : He() ? "mobile" : ze() ? "embedded" : "web";
19
19
  }
20
- function _e() {
20
+ function Ie() {
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 He() {
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 ze() {
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 Oe(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 ? Ae() : !1,
65
+ crossWindowCommunication: De() || Fe(),
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 Ae() {
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 De() {
97
97
  return typeof window < "u" && "BroadcastChannel" in window;
98
98
  }
99
- function Ue() {
99
+ function Fe() {
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 Ge() {
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 Le() {
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 Ve() {
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 Ue() {
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 Re {
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 N extends Re {
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 $e(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 Be(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 je(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 $e {
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 Be {
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 je {
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 = Se(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 Qe(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 N(this.platformConfig);
1206
1206
  default:
1207
- return new j(this.platformConfig);
1207
+ return new N(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 Qe {
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 se(n) {
1624
+ m?.dispose(), m = n;
1625
1625
  }
1626
- function et() {
1627
- g?.dispose(), g = null;
1626
+ function Ke() {
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 = Ee(() => Ce((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 _(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 _({
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
+ }, oe = {
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
+ _({
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
+ }, re = ke(null);
1924
+ function ae({
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: re,
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 = Me(re);
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 qe() {
1963
+ const { currentWindow: n } = S();
1964
1964
  return n;
1965
1965
  }
1966
- function nt() {
1967
- return p();
1966
+ function Xe() {
1967
+ return u();
1968
1968
  }
1969
- function it(n, e) {
1970
- return (t) => pe({
1969
+ function Je(n, e) {
1970
+ return (t) => ae({
1971
1971
  children: n(t),
1972
1972
  manager: e
1973
1973
  });
1974
1974
  }
1975
- function st(n) {
1975
+ function Ze(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 Ye = {
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 et(n) {
1993
+ return S()[n];
1994
1994
  }
1995
- function at() {
1995
+ function tt() {
1996
1996
  return typeof window > "u" ? 0 : window.innerWidth;
1997
1997
  }
1998
- function lt() {
1998
+ function nt() {
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, de, le, T = 0, D = !1;
2002
+ function ce() {
2003
+ typeof window > "u" || (de?.(window.innerWidth), le?.(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 it() {
2006
+ if (O && A) return;
2007
+ const [n, e] = M(tt()), [t, i] = M(nt());
2008
+ O = n, A = t, de = e, le = i;
2009
2009
  }
2010
- function ct() {
2011
- typeof window > "u" || N || (window.addEventListener("resize", me), N = !0);
2010
+ function st() {
2011
+ typeof window > "u" || D || (window.addEventListener("resize", ce), D = !0);
2012
2012
  }
2013
- function ut() {
2014
- typeof window > "u" || !N || I > 0 || (window.removeEventListener("resize", me), N = !1);
2013
+ function ot() {
2014
+ typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", ce), D = !1);
2015
2015
  }
2016
- function ge() {
2017
- if (dt(), I += 1, typeof window > "u")
2016
+ function he() {
2017
+ if (it(), 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
+ st();
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), ot());
2028
2028
  };
2029
- return He() && De(e), {
2030
- width: F,
2031
- height: V,
2029
+ return Pe() && Te(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 rt = "0.8.24", at = rt, 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 dt = Object.defineProperty, lt = (n, e, t) => e in n ? dt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => lt(n, typeof e != "symbol" ? e + "" : e, t);
2042
+ let ct = 0;
2043
+ const ht = Math.random().toString(36).substr(2, 6);
2044
+ let q = null, X = null;
2045
+ const ut = /* @__PURE__ */ new Set();
2046
+ ut.add(ht);
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;
2063
- }
2064
- function J() {
2065
- return E.currentOwner;
2061
+ function ue() {
2062
+ return C.currentOwner;
2066
2063
  }
2067
- let ye = class {
2064
+ class wt {
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 = ++ct, 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 pt() {
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 ft = Object.defineProperty, mt = (n, e, t) => e in n ? ft(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e, t) => mt(n, typeof e != "symbol" ? e + "" : e, t), V = /* @__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))(V || {});
2103
+ let gt = 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 bt = 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(V))
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 gt(`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[V[t]] = i.size;
2386
2303
  return {
2387
2304
  isFlushPending: this.isFlushPending,
2388
2305
  isDestroyed: this.isDestroyed,
@@ -2392,263 +2309,137 @@ 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(bt, "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 yt(n) {
2493
2317
  return n[Symbol.for("tachui.computed")] || null;
2494
2318
  }
2495
- function Ft(n) {
2496
- const e = _t(n);
2319
+ function vt(n) {
2320
+ const e = yt(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 we(n, e = {}) {
2324
+ const t = ue();
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 wt(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 Wt(n) {
2336
+ const e = ue();
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, G = !1;
2350
+ function St(n) {
2351
+ f.get(n)?.forEach((e) => e()), f.delete(n), F.delete(n);
2561
2352
  }
2562
- function We() {
2353
+ function pe() {
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) && (St(t), v.delete(e));
2580
2371
  }
2581
2372
  }
2582
- function jt() {
2583
- if (R || typeof setTimeout != "function") return;
2584
- R = !0;
2373
+ function Et() {
2374
+ if (G || typeof setTimeout != "function") return;
2375
+ G = !0;
2585
2376
  const n = () => {
2586
- if (We(), W.size === 0) {
2587
- R = !1;
2377
+ if (pe(), v.size === 0) {
2378
+ G = !1;
2588
2379
  return;
2589
2380
  }
2590
- setTimeout(n, q);
2381
+ setTimeout(n, R);
2591
2382
  };
2592
- setTimeout(n, q);
2383
+ setTimeout(n, R);
2593
2384
  }
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);
2385
+ function Ct() {
2386
+ Y || typeof document > "u" || !document.documentElement || typeof MutationObserver > "u" || (new MutationObserver(() => {
2387
+ pe();
2388
+ }).observe(document.documentElement, { childList: !0, subtree: !0 }), Y = !0);
2598
2389
  }
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, {
2390
+ function Mt(n, e) {
2391
+ Ct(), Et();
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 kt({
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: we(() => {
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) && vt(e)), d && d.size === 0 && E.delete(n));
2634
2425
  };
2635
- yt() ? Gt(c) : r = qt(n, c);
2426
+ pt() ? Wt(c) : r = Mt(n, c);
2636
2427
  }
2637
- const re = Symbol.for("tachui.modifier.instanceId"), Kt = "core";
2638
- let ae = 0;
2639
- function Xt(n) {
2640
- const e = n[re];
2428
+ const ee = Symbol.for("tachui.modifier.instanceId"), Pt = "core";
2429
+ let te = 0;
2430
+ function Tt(n) {
2431
+ const e = n[ee];
2641
2432
  if (typeof e == "number") return e;
2642
- ae += 1;
2643
- const t = ae;
2644
- return Object.defineProperty(n, re, {
2433
+ te += 1;
2434
+ const t = te;
2435
+ return Object.defineProperty(n, ee, {
2645
2436
  value: t,
2646
2437
  enumerable: !1,
2647
2438
  configurable: !1,
2648
2439
  writable: !1
2649
2440
  }), t;
2650
2441
  }
2651
- class Jt {
2442
+ class xt {
2652
2443
  constructor(e) {
2653
2444
  this.properties = e;
2654
2445
  }
@@ -2665,26 +2456,24 @@ class Jt {
2665
2456
  * Apply a single style change to an element with reactive support
2666
2457
  */
2667
2458
  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);
2459
+ if (!(typeof HTMLElement < "u" && e instanceof HTMLElement) && !e.style)
2460
+ return;
2461
+ const a = this.toCSSProperty(t), r = e.style, c = (d) => {
2462
+ if (d.includes("!important")) {
2463
+ const l = d.replace(/\s*!important\s*$/, "").trim();
2464
+ r.setProperty(a, l, "important");
2465
+ return;
2686
2466
  }
2467
+ r.setProperty(a, d);
2468
+ };
2469
+ if (J(i) || U(i)) {
2470
+ we(() => {
2471
+ const d = i();
2472
+ c(String(d));
2473
+ });
2474
+ return;
2687
2475
  }
2476
+ c(String(i));
2688
2477
  }
2689
2478
  /**
2690
2479
  * Convert camelCase property to CSS kebab-case
@@ -2723,34 +2512,34 @@ class Jt {
2723
2512
  * Apply multiple CSS properties to an element with reactive support
2724
2513
  */
2725
2514
  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");
2515
+ if (typeof HTMLElement < "u" && e instanceof HTMLElement || e.style) {
2516
+ const s = e.style, a = (r, c) => {
2517
+ if (s.setProperty)
2518
+ if (typeof c == "string" && c.includes("!important")) {
2519
+ const d = c.replace(/\s*!important\s*$/, "").trim();
2520
+ s.setProperty(r, d, "important");
2732
2521
  } else
2733
- i.setProperty(a, r);
2522
+ s.setProperty(r, c);
2734
2523
  else
2735
- i[a] = r;
2524
+ s[r] = c;
2736
2525
  };
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({
2526
+ for (const [r, c] of Object.entries(t))
2527
+ if (c !== void 0) {
2528
+ const d = this.toCSSProperty(r);
2529
+ if (J(c) || U(c)) {
2530
+ const l = c, h = Tt(this);
2531
+ kt({
2743
2532
  element: e,
2744
- accessor: d,
2745
- updaterId: `${Kt}:${l}:${c}`,
2746
- updater: (h) => {
2747
- const b = this.toCSSValueForProperty(c, h);
2748
- s(c, b);
2533
+ accessor: l,
2534
+ updaterId: `${Pt}:${h}:${d}`,
2535
+ updater: (g) => {
2536
+ const ye = this.toCSSValueForProperty(d, g);
2537
+ a(d, ye);
2749
2538
  }
2750
2539
  });
2751
2540
  } else {
2752
- const d = this.toCSSValueForProperty(c, r);
2753
- s(c, d);
2541
+ const l = this.toCSSValueForProperty(d, c);
2542
+ a(d, l);
2754
2543
  }
2755
2544
  }
2756
2545
  }
@@ -2780,8 +2569,8 @@ class Jt {
2780
2569
  };
2781
2570
  }
2782
2571
  }
2783
- const P = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap();
2784
- class Se extends Jt {
2572
+ const k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
2573
+ class fe extends xt {
2785
2574
  constructor() {
2786
2575
  super(...arguments);
2787
2576
  o(this, "type", "viewportLifecycle");
@@ -2792,8 +2581,8 @@ class Se extends Jt {
2792
2581
  i.element && (this.properties.onAppear || this.properties.onDisappear) && this.setupLifecycleObserver(i.element, this.properties);
2793
2582
  }
2794
2583
  setupLifecycleObserver(t, i) {
2795
- const s = T.get(t);
2796
- s && (s.unobserve(t), s.disconnect(), T.delete(t)), P.set(t, {
2584
+ const s = P.get(t);
2585
+ s && (s.unobserve(t), s.disconnect(), P.delete(t)), k.set(t, {
2797
2586
  isVisible: !1
2798
2587
  });
2799
2588
  const a = new IntersectionObserver(
@@ -2802,11 +2591,11 @@ class Se extends Jt {
2802
2591
  const d = c.target;
2803
2592
  if (!(d instanceof Element)) return;
2804
2593
  if (!d.isConnected) {
2805
- a.unobserve(d), T.delete(d), P.delete(d);
2594
+ a.unobserve(d), P.delete(d), k.delete(d);
2806
2595
  return;
2807
2596
  }
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());
2597
+ const l = k.get(d) ?? { isVisible: !1 }, h = c.isIntersecting;
2598
+ h !== l.isVisible && (l.isVisible = h, k.set(d, l), h && i.onAppear ? i.onAppear() : !h && i.onDisappear && i.onDisappear());
2810
2599
  });
2811
2600
  },
2812
2601
  {
@@ -2816,98 +2605,98 @@ class Se extends Jt {
2816
2605
  // Add some margin for better UX
2817
2606
  }
2818
2607
  );
2819
- a.observe(t), T.set(t, a);
2608
+ a.observe(t), P.set(t, a);
2820
2609
  }
2821
2610
  }
2822
- function Ee(n) {
2823
- return new Se({ onAppear: n });
2611
+ function me(n) {
2612
+ return new fe({ onAppear: n });
2824
2613
  }
2825
- function Ce(n) {
2826
- return new Se({ onDisappear: n });
2614
+ function ge(n) {
2615
+ return new fe({ onDisappear: n });
2827
2616
  }
2828
- const Zt = {
2617
+ const It = {
2829
2618
  name: "@tachui/viewport",
2830
- version: pt,
2619
+ version: at,
2831
2620
  author: "TachUI Team",
2832
2621
  verified: !0
2833
- }, le = {
2622
+ }, ne = {
2834
2623
  category: "interaction",
2835
2624
  priority: 110,
2836
2625
  signature: "(handler: () => void) => Modifier",
2837
2626
  description: "Triggers handlers when an element appears in or disappears from the viewport."
2838
2627
  };
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(
2628
+ let ie = !1;
2629
+ function be(n) {
2630
+ const e = n?.registry, t = n?.plugin ?? It, i = n?.force === !0, s = !!(e || n?.plugin);
2631
+ !s && ie && !i || (Q(
2843
2632
  "onAppear",
2844
- Ee,
2633
+ me,
2845
2634
  {
2846
- ...le,
2635
+ ...ne,
2847
2636
  description: "Executes a callback when the component enters the viewport."
2848
2637
  },
2849
2638
  e,
2850
2639
  t
2851
- ), Z(
2640
+ ), Q(
2852
2641
  "onDisappear",
2853
- Ce,
2642
+ ge,
2854
2643
  {
2855
- ...le,
2644
+ ...ne,
2856
2645
  description: "Executes a callback when the component leaves the viewport."
2857
2646
  },
2858
2647
  e,
2859
2648
  t
2860
- ), s || (de = !0));
2649
+ ), s || (ie = !0));
2861
2650
  }
2862
- Me();
2863
- const Yt = {
2651
+ be();
2652
+ const Ht = {
2864
2653
  // Manager
2865
- getManager: p,
2654
+ getManager: u,
2866
2655
  // Environment
2867
- useOpenWindow: A,
2868
- useDismissWindow: _,
2869
- useViewportInfo: X,
2870
- useViewport: ge,
2656
+ useOpenWindow: H,
2657
+ useDismissWindow: z,
2658
+ useViewportInfo: j,
2659
+ useViewport: he,
2871
2660
  // Components
2872
- Window: S,
2873
- WindowGroup: L,
2874
- App: H,
2661
+ Window: W,
2662
+ WindowGroup: _,
2663
+ App: x,
2875
2664
  // Utilities
2876
- Utils: D,
2877
- Examples: ue
2665
+ Utils: I,
2666
+ Examples: oe
2878
2667
  };
2879
- function en(n) {
2880
- const e = new K(n?.customAdapter);
2881
- return ce(e), e;
2668
+ function zt(n) {
2669
+ const e = new B(n?.customAdapter);
2670
+ return se(e), e;
2882
2671
  }
2883
- const tn = {
2672
+ const Ot = {
2884
2673
  isWindow: (n) => n.type === "window",
2885
2674
  isModal: (n) => n.type === "modal",
2886
2675
  isPortal: (n) => n.type === "portal",
2887
2676
  isSheet: (n) => n.type === "sheet",
2888
2677
  isPopover: (n) => n.type === "popover"
2889
- }, nn = {
2678
+ }, At = {
2890
2679
  /**
2891
2680
  * Check if running in Electron
2892
2681
  */
2893
- isElectron: () => p().environment.platform === "electron",
2682
+ isElectron: () => u().environment.platform === "electron",
2894
2683
  /**
2895
2684
  * Check if on mobile
2896
2685
  */
2897
- isMobile: () => p().environment.platform === "mobile",
2686
+ isMobile: () => u().environment.platform === "mobile",
2898
2687
  /**
2899
2688
  * Check if multi-window is supported
2900
2689
  */
2901
- supportsMultiWindow: () => p().environment.capabilities.multiWindow,
2690
+ supportsMultiWindow: () => u().environment.capabilities.multiWindow,
2902
2691
  /**
2903
2692
  * Check if native windows are supported
2904
2693
  */
2905
- supportsNativeWindows: () => p().environment.capabilities.nativeWindows,
2694
+ supportsNativeWindows: () => u().environment.capabilities.nativeWindows,
2906
2695
  /**
2907
2696
  * Get optimal window type for current platform
2908
2697
  */
2909
- getOptimalWindowType: (n = !1) => p().getOptimalWindowType({ preferNativeWindow: n })
2910
- }, sn = {
2698
+ getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2699
+ }, Dt = {
2911
2700
  /**
2912
2701
  * Standard document window
2913
2702
  */
@@ -2974,7 +2763,7 @@ const tn = {
2974
2763
  minimizable: !1,
2975
2764
  maximizable: !1
2976
2765
  })
2977
- }, on = {
2766
+ }, Ft = {
2978
2767
  DEFAULT_WINDOW_WIDTH: 800,
2979
2768
  DEFAULT_WINDOW_HEIGHT: 600,
2980
2769
  MIN_WINDOW_WIDTH: 300,
@@ -2982,84 +2771,84 @@ const tn = {
2982
2771
  MODAL_Z_INDEX: 1e3,
2983
2772
  PORTAL_Z_INDEX: 999,
2984
2773
  ANIMATION_DURATION: 200
2985
- }, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2774
+ }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2986
2775
  __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
2776
+ App: x,
2777
+ EnvironmentKeys: Ye,
2778
+ ExampleScenes: oe,
2779
+ PlatformUtils: At,
2780
+ TachUIViewportManager: B,
2781
+ Viewport: Ht,
2782
+ ViewportConstants: Ft,
2783
+ ViewportEnvironmentProvider: ae,
2784
+ ViewportTypeGuards: Ot,
2785
+ WebViewportAdapter: N,
2786
+ Window: W,
2787
+ WindowConfigs: Dt,
2788
+ WindowGroup: _,
2789
+ WindowUtils: I,
2790
+ checkFeatureSupport: Ue,
2791
+ createCapabilityChecker: L,
2792
+ createWindowAwareComponent: Ze,
2793
+ detectViewportEnvironment: $,
2794
+ disposeViewportManager: Ke,
2795
+ getBrowserInfo: Ne,
2796
+ getEnvironmentValue: et,
2797
+ getOSInfo: Ve,
2798
+ getViewportManager: u,
2799
+ initializeViewportSystem: zt,
2800
+ onAppear: me,
2801
+ onDisappear: ge,
2802
+ registerViewportModifiers: be,
2803
+ setViewportManager: se,
2804
+ useCurrentWindow: qe,
2805
+ useDismissWindow: z,
2806
+ useEnvironmentDismissWindow: z,
2807
+ useEnvironmentOpenWindow: H,
2808
+ useOpenWindow: H,
2809
+ useViewport: he,
2810
+ useViewportEnvironment: S,
2811
+ useViewportInfo: j,
2812
+ useViewportManager: Xe,
2813
+ withViewportEnvironment: Je
3025
2814
  }, Symbol.toStringTag, { value: "Module" }));
3026
2815
  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
2816
+ x as App,
2817
+ Ye as EnvironmentKeys,
2818
+ oe as ExampleScenes,
2819
+ At as PlatformUtils,
2820
+ B as TachUIViewportManager,
2821
+ Ht as Viewport,
2822
+ Ft as ViewportConstants,
2823
+ ae as ViewportEnvironmentProvider,
2824
+ Ot as ViewportTypeGuards,
2825
+ N as WebViewportAdapter,
2826
+ W as Window,
2827
+ Dt as WindowConfigs,
2828
+ _ as WindowGroup,
2829
+ I as WindowUtils,
2830
+ Ue as checkFeatureSupport,
2831
+ L as createCapabilityChecker,
2832
+ Ze as createWindowAwareComponent,
2833
+ $ as detectViewportEnvironment,
2834
+ Ke as disposeViewportManager,
2835
+ Ne as getBrowserInfo,
2836
+ et as getEnvironmentValue,
2837
+ Ve as getOSInfo,
2838
+ u as getViewportManager,
2839
+ zt as initializeViewportSystem,
2840
+ me as onAppear,
2841
+ ge as onDisappear,
2842
+ be as registerViewportModifiers,
2843
+ se as setViewportManager,
2844
+ qe as useCurrentWindow,
2845
+ z as useDismissWindow,
2846
+ z as useEnvironmentDismissWindow,
2847
+ H as useEnvironmentOpenWindow,
2848
+ H as useOpenWindow,
2849
+ he as useViewport,
2850
+ S as useViewportEnvironment,
2851
+ j as useViewportInfo,
2852
+ Xe as useViewportManager,
2853
+ Je as withViewportEnvironment
3065
2854
  };