@tachui/viewport 0.8.14 → 0.8.16

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