@tachui/viewport 0.8.5-alpha → 0.8.8

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,10 @@
1
- var oe = Object.defineProperty;
2
- var re = (n, e, t) => e in n ? oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => re(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { createSignal as D, mountComponentTree as ae, createRoot as le, withComponentContext as de, createContext as ce, useContext as he } from "@tachui/core";
5
- import { registerModifierWithMetadata as V } from "@tachui/modifiers";
6
- function z(n = {}) {
7
- const e = ue(), t = me(e, n), i = ve(), s = We(), a = Se();
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();
8
8
  return {
9
9
  platform: e,
10
10
  capabilities: t,
@@ -13,20 +13,20 @@ function z(n = {}) {
13
13
  isTouch: a
14
14
  };
15
15
  }
16
- function ue() {
17
- return pe() ? "electron" : we() ? "mobile" : fe() ? "embedded" : "web";
16
+ function Ee() {
17
+ return Ce() ? "electron" : Me() ? "mobile" : ke() ? "embedded" : "web";
18
18
  }
19
- function pe() {
19
+ function Ce() {
20
20
  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
21
  }
22
- function we() {
22
+ function Me() {
23
23
  if (typeof window > "u") return !1;
24
24
  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
25
  navigator.userAgent
26
26
  ), i = window.matchMedia?.("(pointer: coarse)")?.matches, s = window.matchMedia?.("(max-width: 768px)")?.matches;
27
27
  return n || e && t || i || s;
28
28
  }
29
- function fe() {
29
+ function ke() {
30
30
  if (typeof window > "u") return !1;
31
31
  try {
32
32
  return window.self !== window.top;
@@ -34,7 +34,7 @@ function fe() {
34
34
  return !0;
35
35
  }
36
36
  }
37
- function me(n, e) {
37
+ function Pe(n, e) {
38
38
  const t = {
39
39
  multiWindow: !1,
40
40
  nativeWindows: !1,
@@ -60,9 +60,9 @@ function me(n, e) {
60
60
  case "web":
61
61
  return {
62
62
  ...t,
63
- multiWindow: e.enablePopupTest ? ge() : !1,
64
- crossWindowCommunication: be() || ye(),
65
- fullscreenSupport: G(),
63
+ multiWindow: e.enablePopupTest ? xe() : !1,
64
+ crossWindowCommunication: Te() || Ie(),
65
+ fullscreenSupport: q(),
66
66
  windowResizing: !1,
67
67
  // Browser windows can't be resized programmatically
68
68
  windowMinimizing: !1
@@ -70,7 +70,7 @@ function me(n, e) {
70
70
  case "mobile":
71
71
  return {
72
72
  ...t,
73
- fullscreenSupport: G(),
73
+ fullscreenSupport: q(),
74
74
  modalOverlays: !0
75
75
  };
76
76
  case "embedded":
@@ -82,7 +82,7 @@ function me(n, e) {
82
82
  return t;
83
83
  }
84
84
  }
85
- function ge() {
85
+ function xe() {
86
86
  if (typeof window > "u" || typeof window.navigator < "u" && window.navigator.userAgent.includes("jsdom"))
87
87
  return !1;
88
88
  try {
@@ -92,28 +92,28 @@ function ge() {
92
92
  return !1;
93
93
  }
94
94
  }
95
- function be() {
95
+ function Te() {
96
96
  return typeof window < "u" && "BroadcastChannel" in window;
97
97
  }
98
- function ye() {
98
+ function Ie() {
99
99
  return typeof window < "u" && "MessageChannel" in window;
100
100
  }
101
- function G() {
101
+ function q() {
102
102
  return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
103
103
  }
104
- function ve() {
104
+ function Oe() {
105
105
  return typeof navigator > "u" ? "unknown" : navigator.userAgent;
106
106
  }
107
- function We() {
107
+ function ze() {
108
108
  return typeof window > "u" ? { width: 1920, height: 1080 } : {
109
109
  width: window.screen?.width || window.innerWidth || 1920,
110
110
  height: window.screen?.height || window.innerHeight || 1080
111
111
  };
112
112
  }
113
- function Se() {
113
+ function De() {
114
114
  return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
115
115
  }
116
- function Ee() {
116
+ function He() {
117
117
  if (typeof navigator > "u")
118
118
  return {
119
119
  name: "unknown",
@@ -141,7 +141,7 @@ function Ee() {
141
141
  }
142
142
  return { name: e, version: t, engine: i };
143
143
  }
144
- function Ce() {
144
+ function Ae() {
145
145
  if (typeof navigator > "u")
146
146
  return {
147
147
  name: "unknown",
@@ -168,7 +168,7 @@ function Ce() {
168
168
  }
169
169
  return { name: e, version: t };
170
170
  }
171
- function Me() {
171
+ function _e() {
172
172
  return typeof window > "u" ? {
173
173
  webgl: !1,
174
174
  webgl2: !1,
@@ -189,7 +189,7 @@ function Me() {
189
189
  resizeObserver: "ResizeObserver" in window
190
190
  };
191
191
  }
192
- function O(n) {
192
+ function F(n) {
193
193
  return {
194
194
  canOpenWindow: (e = !1) => e ? n.capabilities.nativeWindows : n.capabilities.multiWindow || n.capabilities.modalOverlays,
195
195
  canCommunicateBetweenWindows: () => n.capabilities.crossWindowCommunication,
@@ -200,7 +200,7 @@ function O(n) {
200
200
  getOptimalViewportType: (e = !1) => e && n.capabilities.nativeWindows ? "window" : n.capabilities.modalOverlays ? "modal" : n.platform === "mobile" ? "sheet" : "portal"
201
201
  };
202
202
  }
203
- class Pe {
203
+ class Fe {
204
204
  // Fallback strategies
205
205
  createModal(e) {
206
206
  throw new Error("Modal fallback not implemented");
@@ -209,7 +209,7 @@ class Pe {
209
209
  throw new Error("Portal fallback not implemented");
210
210
  }
211
211
  }
212
- class H extends Pe {
212
+ class V extends Fe {
213
213
  constructor(t = {}) {
214
214
  super();
215
215
  o(this, "environment");
@@ -218,7 +218,7 @@ class H extends Pe {
218
218
  o(this, "popups", /* @__PURE__ */ new Map());
219
219
  o(this, "portalContainer", null);
220
220
  o(this, "broadcastChannel", null);
221
- this.environment = z(t), this.initializePortalContainer();
221
+ this.environment = U(t), this.initializePortalContainer();
222
222
  }
223
223
  /**
224
224
  * Check if we can create a window with given config
@@ -322,21 +322,21 @@ class H extends Pe {
322
322
  * Create popup window (native browser window)
323
323
  */
324
324
  createPopupWindow(t) {
325
- const i = new ke(t);
325
+ const i = new Ve(t);
326
326
  return this.popups.set(t.id, i), i;
327
327
  }
328
328
  /**
329
329
  * Create modal overlay
330
330
  */
331
331
  createModal(t) {
332
- const i = new xe(t);
332
+ const i = new Ne(t);
333
333
  return this.modals.set(t.id, i), i;
334
334
  }
335
335
  /**
336
336
  * Create portal
337
337
  */
338
338
  createPortal(t) {
339
- const i = new Te(t, this.portalContainer);
339
+ const i = new Ge(t, this.portalContainer);
340
340
  return this.portals.set(t.id, i), i;
341
341
  }
342
342
  /**
@@ -429,7 +429,7 @@ class H extends Pe {
429
429
  `, document.head.appendChild(i);
430
430
  }
431
431
  }
432
- class ke {
432
+ class Ve {
433
433
  constructor(e) {
434
434
  o(this, "id");
435
435
  o(this, "type", "window");
@@ -440,7 +440,7 @@ class ke {
440
440
  o(this, "eventHandlers", /* @__PURE__ */ new Map());
441
441
  o(this, "setState");
442
442
  this.id = e.id, this.config = e;
443
- const [t, i] = D({
443
+ const [t, i] = L({
444
444
  id: e.id,
445
445
  title: e.title || e.id,
446
446
  isVisible: !1,
@@ -638,7 +638,7 @@ class ke {
638
638
  removeChildWindow(e) {
639
639
  }
640
640
  }
641
- class xe {
641
+ class Ne {
642
642
  constructor(e) {
643
643
  o(this, "id");
644
644
  o(this, "type", "modal");
@@ -656,7 +656,7 @@ class xe {
656
656
  o(this, "parentWindow", null);
657
657
  o(this, "tabContainer", null);
658
658
  this.id = e.id, this.config = e;
659
- const [t, i] = D({
659
+ const [t, i] = L({
660
660
  id: e.id,
661
661
  title: e.title || e.id,
662
662
  isVisible: !1,
@@ -860,7 +860,7 @@ class xe {
860
860
  e && e.remove();
861
861
  }
862
862
  }
863
- class Te {
863
+ class Ge {
864
864
  constructor(e, t) {
865
865
  o(this, "id");
866
866
  o(this, "type", "portal");
@@ -878,7 +878,7 @@ class Te {
878
878
  o(this, "parentWindow", null);
879
879
  o(this, "tabContainer", null);
880
880
  this.container = t, this.id = e.id, this.config = e;
881
- const [i, s] = D({
881
+ const [i, s] = L({
882
882
  id: e.id,
883
883
  title: e.title || e.id,
884
884
  isVisible: !1,
@@ -905,7 +905,7 @@ class Te {
905
905
  if (this.portalElement) {
906
906
  this.portalElement.innerHTML = "";
907
907
  try {
908
- const t = ae(e, this.portalElement);
908
+ const t = be(e, this.portalElement);
909
909
  this.cleanupFunction = t;
910
910
  } catch (t) {
911
911
  console.error("Error during mountComponentTree:", t);
@@ -1085,7 +1085,7 @@ class Te {
1085
1085
  e && e.remove();
1086
1086
  }
1087
1087
  }
1088
- class A {
1088
+ class R {
1089
1089
  constructor(e, t = {}) {
1090
1090
  o(this, "adapter");
1091
1091
  o(this, "windows", /* @__PURE__ */ new Map());
@@ -1096,7 +1096,7 @@ class A {
1096
1096
  o(this, "globalStateCallbacks", /* @__PURE__ */ new Map());
1097
1097
  o(this, "environment");
1098
1098
  o(this, "platformConfig");
1099
- this.platformConfig = t, this.environment = z(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
1099
+ this.platformConfig = t, this.environment = U(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
1100
1100
  }
1101
1101
  /**
1102
1102
  * Open a new window/viewport
@@ -1143,20 +1143,20 @@ class A {
1143
1143
  createWindowGroup(e) {
1144
1144
  if (this.windowGroups.has(e))
1145
1145
  return this.windowGroups.get(e);
1146
- const t = new Ie(e, this);
1146
+ const t = new Le(e, this);
1147
1147
  return this.windowGroups.set(e, t), t;
1148
1148
  }
1149
1149
  /**
1150
1150
  * Check if we can open a window with given options
1151
1151
  */
1152
1152
  canOpenWindow(e = {}) {
1153
- return O(this.environment).canOpenWindow(e.preferNativeWindow);
1153
+ return F(this.environment).canOpenWindow(e.preferNativeWindow);
1154
1154
  }
1155
1155
  /**
1156
1156
  * Get optimal window type for given options
1157
1157
  */
1158
1158
  getOptimalWindowType(e = {}) {
1159
- const t = O(this.environment);
1159
+ const t = F(this.environment);
1160
1160
  return e.preferNativeWindow && this.environment.capabilities.nativeWindows ? "window" : e.modal !== !1 && this.environment.capabilities.modalOverlays ? "modal" : t.getOptimalViewportType(e.preferNativeWindow);
1161
1161
  }
1162
1162
  /**
@@ -1201,9 +1201,9 @@ class A {
1201
1201
  createDefaultAdapter() {
1202
1202
  switch (this.environment.platform) {
1203
1203
  case "electron":
1204
- return new H(this.platformConfig);
1204
+ return new V(this.platformConfig);
1205
1205
  default:
1206
- return new H(this.platformConfig);
1206
+ return new V(this.platformConfig);
1207
1207
  }
1208
1208
  }
1209
1209
  // ==================== Phase 2: Global State Management ====================
@@ -1267,7 +1267,7 @@ class A {
1267
1267
  });
1268
1268
  }
1269
1269
  }
1270
- class Ie {
1270
+ class Le {
1271
1271
  constructor(e, t, i = "any") {
1272
1272
  o(this, "windows", /* @__PURE__ */ new Map());
1273
1273
  o(this, "defaultOptions", {});
@@ -1317,10 +1317,10 @@ class Ie {
1317
1317
  const d = this.windows.values().next().value;
1318
1318
  d && (this.poolConfig.enabled ? await this.returnToPool(d) : await d.close());
1319
1319
  }
1320
- const h = t(e);
1320
+ const u = t(e);
1321
1321
  return r = await this.manager.openWindow(
1322
1322
  s,
1323
- h,
1323
+ u,
1324
1324
  this.defaultOptions
1325
1325
  ), this.setWindowGroupMetadata(r, {
1326
1326
  groupId: this.id,
@@ -1554,17 +1554,17 @@ class Ie {
1554
1554
  });
1555
1555
  }
1556
1556
  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, h = i / a;
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
1558
  e.forEach((d, l) => {
1559
- const w = l % s, F = Math.floor(l / s);
1559
+ const p = l % s, b = Math.floor(l / s);
1560
1560
  this.setWindowGroupMetadata(d, {
1561
1561
  tilePosition: {
1562
- col: w,
1563
- row: F,
1564
- x: w * r,
1565
- y: F * h,
1562
+ col: p,
1563
+ row: b,
1564
+ x: p * r,
1565
+ y: b * u,
1566
1566
  width: r,
1567
- height: h
1567
+ height: u
1568
1568
  },
1569
1569
  arrangementStyle: "tile"
1570
1570
  });
@@ -1615,17 +1615,17 @@ class Ie {
1615
1615
  }
1616
1616
  }
1617
1617
  }
1618
- let m = null;
1619
- function u(n = {}) {
1620
- return m || (m = new A(void 0, n)), m;
1618
+ let g = null;
1619
+ function h(n = {}) {
1620
+ return g || (g = new R(void 0, n)), g;
1621
1621
  }
1622
- function Q(n) {
1623
- m?.dispose(), m = n;
1622
+ function se(n) {
1623
+ g?.dispose(), g = n;
1624
1624
  }
1625
- function Oe() {
1626
- m?.dispose(), m = null;
1625
+ function Ue() {
1626
+ g?.dispose(), g = null;
1627
1627
  }
1628
- function y(n) {
1628
+ function S(n) {
1629
1629
  return {
1630
1630
  type: "window-scene",
1631
1631
  sceneType: "window",
@@ -1650,24 +1650,24 @@ function y(n) {
1650
1650
  },
1651
1651
  // Open this window
1652
1652
  async open() {
1653
- const e = u(), t = le(() => de((i) => n.children(), `Window-${n.id}`)({}));
1653
+ const e = h(), t = ye(() => ve((i) => n.children(), `Window-${n.id}`)({}));
1654
1654
  await e.openWindow(n.id, t, n);
1655
1655
  },
1656
1656
  // Close this window
1657
1657
  async close() {
1658
- await u().dismissWindow(n.id);
1658
+ await h().dismissWindow(n.id);
1659
1659
  }
1660
1660
  };
1661
1661
  }
1662
- function T(n) {
1663
- const e = u(), t = e.createWindowGroup(n.id);
1662
+ function H(n) {
1663
+ const e = h(), t = e.createWindowGroup(n.id);
1664
1664
  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
1665
  const {
1666
1666
  groupingStrategy: i,
1667
1667
  tabConfig: s,
1668
1668
  poolConfig: a,
1669
1669
  stateSyncScope: r,
1670
- maxInstances: h,
1670
+ maxInstances: u,
1671
1671
  ...d
1672
1672
  } = n;
1673
1673
  return t.setDefaultOptions(d), {
@@ -1701,8 +1701,8 @@ function T(n) {
1701
1701
  n.children
1702
1702
  );
1703
1703
  else {
1704
- const w = n.children();
1705
- await e.openWindow(n.id, w, n);
1704
+ const p = n.children();
1705
+ await e.openWindow(n.id, p, n);
1706
1706
  }
1707
1707
  },
1708
1708
  // Open window for specific data
@@ -1737,18 +1737,18 @@ function T(n) {
1737
1737
  enableStateSync(l) {
1738
1738
  t.enableStateSync(l);
1739
1739
  },
1740
- syncGroupState(l, w) {
1741
- t.syncState(l, w);
1740
+ syncGroupState(l, p) {
1741
+ t.syncState(l, p);
1742
1742
  },
1743
1743
  getGroupState(l) {
1744
1744
  return t.getSharedState(l);
1745
1745
  },
1746
- onGroupStateChange(l, w) {
1747
- return t.onStateChange(l, w);
1746
+ onGroupStateChange(l, p) {
1747
+ return t.onStateChange(l, p);
1748
1748
  }
1749
1749
  };
1750
1750
  }
1751
- function M(n) {
1751
+ function T(n) {
1752
1752
  return {
1753
1753
  type: "app",
1754
1754
  scenes: n.children,
@@ -1768,8 +1768,8 @@ function M(n) {
1768
1768
  },
1769
1769
  // Initialize all scenes
1770
1770
  async initialize() {
1771
- if (!u(n.platformConfig)) {
1772
- const { initializeViewportSystem: t } = await Promise.resolve().then(() => vt);
1771
+ if (!h(n.platformConfig)) {
1772
+ const { initializeViewportSystem: t } = await Promise.resolve().then(() => Ut);
1773
1773
  t();
1774
1774
  }
1775
1775
  },
@@ -1786,12 +1786,12 @@ function M(n) {
1786
1786
  }
1787
1787
  };
1788
1788
  }
1789
- const P = {
1789
+ const I = {
1790
1790
  /**
1791
1791
  * Create a document window group
1792
1792
  */
1793
1793
  documentGroup(n, e, t, i) {
1794
- return T({
1794
+ return H({
1795
1795
  id: n,
1796
1796
  title: e,
1797
1797
  for: t,
@@ -1805,7 +1805,7 @@ const P = {
1805
1805
  * Create a settings window
1806
1806
  */
1807
1807
  settingsWindow(n) {
1808
- return y({
1808
+ return S({
1809
1809
  id: "settings",
1810
1810
  title: "Settings",
1811
1811
  width: 600,
@@ -1818,7 +1818,7 @@ const P = {
1818
1818
  * Create an inspector window
1819
1819
  */
1820
1820
  inspectorWindow(n) {
1821
- return y({
1821
+ return S({
1822
1822
  id: "inspector",
1823
1823
  title: "Inspector",
1824
1824
  width: 300,
@@ -1832,7 +1832,7 @@ const P = {
1832
1832
  * Create a palette window
1833
1833
  */
1834
1834
  paletteWindow(n, e, t) {
1835
- return y({
1835
+ return S({
1836
1836
  id: n,
1837
1837
  title: e,
1838
1838
  width: 250,
@@ -1842,13 +1842,13 @@ const P = {
1842
1842
  children: t
1843
1843
  });
1844
1844
  }
1845
- }, K = {
1845
+ }, oe = {
1846
1846
  /**
1847
1847
  * Basic app with main window and settings
1848
1848
  */
1849
- basicApp: () => M({
1849
+ basicApp: () => T({
1850
1850
  children: [
1851
- y({
1851
+ S({
1852
1852
  id: "main",
1853
1853
  title: "My App",
1854
1854
  children: () => ({
@@ -1864,7 +1864,7 @@ const P = {
1864
1864
  })
1865
1865
  })
1866
1866
  }),
1867
- P.settingsWindow(() => ({
1867
+ I.settingsWindow(() => ({
1868
1868
  type: "component",
1869
1869
  id: "settings-content",
1870
1870
  props: {},
@@ -1881,9 +1881,9 @@ const P = {
1881
1881
  /**
1882
1882
  * Document-based app
1883
1883
  */
1884
- documentApp: () => M({
1884
+ documentApp: () => T({
1885
1885
  children: [
1886
- T({
1886
+ H({
1887
1887
  id: "document",
1888
1888
  title: "Document",
1889
1889
  for: class {
@@ -1905,7 +1905,7 @@ const P = {
1905
1905
  })
1906
1906
  })
1907
1907
  }),
1908
- P.settingsWindow(() => ({
1908
+ I.settingsWindow(() => ({
1909
1909
  type: "component",
1910
1910
  id: "settings",
1911
1911
  props: {},
@@ -1919,12 +1919,12 @@ const P = {
1919
1919
  }))
1920
1920
  ]
1921
1921
  })
1922
- }, X = ce(null);
1923
- function J({
1922
+ }, re = We(null);
1923
+ function ae({
1924
1924
  children: n,
1925
1925
  manager: e
1926
1926
  }) {
1927
- const t = e || u(), i = {
1927
+ const t = e || h(), i = {
1928
1928
  openWindow: async (s, a, r) => await t.openWindow(s, a, r),
1929
1929
  dismissWindow: async (s) => await t.dismissWindow(s),
1930
1930
  viewportEnvironment: t.environment,
@@ -1933,47 +1933,47 @@ function J({
1933
1933
  };
1934
1934
  return {
1935
1935
  type: "context-provider",
1936
- context: X,
1936
+ context: re,
1937
1937
  value: i,
1938
1938
  children: Array.isArray(n) ? n : [n]
1939
1939
  };
1940
1940
  }
1941
- function v() {
1942
- const n = he(X);
1941
+ function C() {
1942
+ const n = Se(re);
1943
1943
  if (!n)
1944
1944
  throw new Error(
1945
1945
  "useViewportEnvironment must be used within a ViewportEnvironmentProvider"
1946
1946
  );
1947
1947
  return n();
1948
1948
  }
1949
- function k() {
1950
- const { openWindow: n } = v();
1949
+ function O() {
1950
+ const { openWindow: n } = C();
1951
1951
  return n;
1952
1952
  }
1953
- function x() {
1954
- const { dismissWindow: n } = v();
1953
+ function z() {
1954
+ const { dismissWindow: n } = C();
1955
1955
  return n;
1956
1956
  }
1957
- function _() {
1958
- const { viewportEnvironment: n } = v();
1957
+ function $() {
1958
+ const { viewportEnvironment: n } = C();
1959
1959
  return n;
1960
1960
  }
1961
- function He() {
1962
- const { currentWindow: n } = v();
1961
+ function Re() {
1962
+ const { currentWindow: n } = C();
1963
1963
  return n;
1964
1964
  }
1965
- function De() {
1966
- return u();
1965
+ function $e() {
1966
+ return h();
1967
1967
  }
1968
- function ze(n, e) {
1969
- return (t) => J({
1968
+ function Be(n, e) {
1969
+ return (t) => ae({
1970
1970
  children: n(t),
1971
1971
  manager: e
1972
1972
  });
1973
1973
  }
1974
- function Ae(n) {
1974
+ function je(n) {
1975
1975
  return (e) => {
1976
- const t = k(), i = x(), s = _();
1976
+ const t = O(), i = z(), s = $();
1977
1977
  return n({
1978
1978
  ...e,
1979
1979
  openWindow: t,
@@ -1982,50 +1982,50 @@ function Ae(n) {
1982
1982
  });
1983
1983
  };
1984
1984
  }
1985
- const _e = {
1985
+ const qe = {
1986
1986
  openWindow: "openWindow",
1987
1987
  dismissWindow: "dismissWindow",
1988
1988
  viewportEnvironment: "viewportEnvironment",
1989
1989
  currentWindow: "currentWindow"
1990
1990
  };
1991
- function Fe(n) {
1992
- return v()[n];
1991
+ function Qe(n) {
1992
+ return C()[n];
1993
1993
  }
1994
- const Ve = "0.8.0-alpha", Ge = Ve, c = {
1994
+ const Ke = "0.8.8", Xe = Ke, c = {
1995
1995
  Clean: 0,
1996
1996
  Check: 1,
1997
1997
  Dirty: 2,
1998
1998
  Disposed: 3
1999
1999
  };
2000
- var Ne = Object.defineProperty, Le = (n, e, t) => e in n ? Ne(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, f = (n, e, t) => Le(n, typeof e != "symbol" ? e + "" : e, t);
2001
- let Ue = 0;
2002
- const Re = Math.random().toString(36).substr(2, 6);
2003
- let N = null, L = null;
2004
- const $e = /* @__PURE__ */ new Set();
2005
- $e.add(Re);
2006
- const W = {
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);
2006
+ const E = {
2007
2007
  get currentComputation() {
2008
- return N;
2008
+ return Q;
2009
2009
  },
2010
2010
  set currentComputation(n) {
2011
- N = n;
2011
+ Q = n;
2012
2012
  },
2013
2013
  get currentOwner() {
2014
- return L;
2014
+ return K;
2015
2015
  },
2016
2016
  set currentOwner(n) {
2017
- L = n;
2017
+ K = n;
2018
2018
  }
2019
2019
  };
2020
- function Z() {
2021
- return W.currentComputation;
2020
+ function le() {
2021
+ return E.currentComputation;
2022
2022
  }
2023
- function Y() {
2024
- return W.currentOwner;
2023
+ function B() {
2024
+ return E.currentOwner;
2025
2025
  }
2026
- class ee {
2026
+ let de = class {
2027
2027
  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 = ++Ue, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
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);
2029
2029
  }
2030
2030
  execute() {
2031
2031
  if (this.state === c.Disposed)
@@ -2033,14 +2033,14 @@ class ee {
2033
2033
  for (const t of this.sources)
2034
2034
  t && typeof t == "object" && "removeObserver" in t && t.removeObserver(this);
2035
2035
  this.sources.clear();
2036
- const e = W.currentComputation;
2037
- W.currentComputation = this;
2036
+ const e = E.currentComputation;
2037
+ E.currentComputation = this;
2038
2038
  try {
2039
2039
  return this.state = c.Clean, this.value = this.fn(), this.value;
2040
2040
  } catch (t) {
2041
2041
  throw this.state = c.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
2042
2042
  } finally {
2043
- W.currentComputation = e;
2043
+ E.currentComputation = e;
2044
2044
  }
2045
2045
  }
2046
2046
  dispose() {
@@ -2054,18 +2054,20 @@ class ee {
2054
2054
  this.observers.clear(), this.owner && !this.owner.disposed && this.owner.sources.delete(this);
2055
2055
  }
2056
2056
  }
2057
+ };
2058
+ function nt() {
2059
+ return E.currentOwner;
2057
2060
  }
2058
- var Be = Object.defineProperty, je = (n, e, t) => e in n ? Be(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => je(n, typeof e != "symbol" ? e + "" : e, t);
2059
- let qe = 0;
2060
- class Qe {
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 {
2061
2063
  constructor(e) {
2062
- I(this, "id"), I(this, "observers", /* @__PURE__ */ new Set()), I(this, "_value"), this.id = ++qe, this._value = e;
2064
+ A(this, "id"), A(this, "observers", /* @__PURE__ */ new Set()), A(this, "_value"), this.id = ++ot, this._value = e;
2063
2065
  }
2064
2066
  /**
2065
2067
  * Get the current value and track dependency
2066
2068
  */
2067
2069
  getValue() {
2068
- const e = Z();
2070
+ const e = le();
2069
2071
  return e && e.state !== c.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
2070
2072
  }
2071
2073
  /**
@@ -2086,7 +2088,7 @@ class Qe {
2086
2088
  */
2087
2089
  notify() {
2088
2090
  for (const e of this.observers)
2089
- e.state !== c.Disposed && (e.state = c.Dirty, Ke(e));
2091
+ e.state !== c.Disposed && (e.state = c.Dirty, at(e));
2090
2092
  }
2091
2093
  /**
2092
2094
  * Remove an observer (cleanup)
@@ -2105,29 +2107,29 @@ class Qe {
2105
2107
  type: "Signal"
2106
2108
  };
2107
2109
  }
2110
+ };
2111
+ const P = /* @__PURE__ */ new Set();
2112
+ let x = !1;
2113
+ function at(n) {
2114
+ P.add(n), !x && queueMicrotask(lt);
2108
2115
  }
2109
- const E = /* @__PURE__ */ new Set();
2110
- let C = !1;
2111
- function Ke(n) {
2112
- E.add(n), !C && queueMicrotask(Xe);
2113
- }
2114
- function Xe() {
2115
- if (!C) {
2116
- C = !0;
2116
+ function lt() {
2117
+ if (!x) {
2118
+ x = !0;
2117
2119
  try {
2118
- for (; E.size > 0; ) {
2119
- const n = Array.from(E).sort((e, t) => e.id - t.id);
2120
- E.clear();
2120
+ for (; P.size > 0; ) {
2121
+ const n = Array.from(P).sort((e, t) => e.id - t.id);
2122
+ P.clear();
2121
2123
  for (const e of n)
2122
2124
  e.state === c.Dirty && e.execute();
2123
2125
  }
2124
2126
  } finally {
2125
- C = !1;
2127
+ x = !1;
2126
2128
  }
2127
2129
  }
2128
2130
  }
2129
- function Je(n) {
2130
- const e = new Qe(n), t = e.getValue.bind(e);
2131
+ function dt(n) {
2132
+ const e = new rt(n), t = e.getValue.bind(e);
2131
2133
  t.peek = e.peek.bind(e);
2132
2134
  const i = e.set.bind(e);
2133
2135
  return Object.defineProperty(t, Symbol.for("tachui.signal"), {
@@ -2135,24 +2137,24 @@ function Je(n) {
2135
2137
  enumerable: !1
2136
2138
  }), [t, i];
2137
2139
  }
2138
- function U(n) {
2140
+ function X(n) {
2139
2141
  return typeof n == "function" && Symbol.for("tachui.signal") in n;
2140
2142
  }
2141
- const Ze = (n, e) => n === e;
2142
- var Ye = Object.defineProperty, et = (n, e, t) => e in n ? Ye(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => et(n, typeof e != "symbol" ? e + "" : e, t), S = /* @__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))(S || {});
2143
- class tt extends Error {
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 {
2144
2146
  constructor(e, t, i) {
2145
2147
  super(e), this.cause = t, this.node = i, this.name = "ReactiveError";
2146
2148
  }
2147
2149
  }
2148
- const nt = class b {
2150
+ const wt = class v {
2149
2151
  constructor() {
2150
- p(this, "updateQueues", /* @__PURE__ */ new Map()), p(this, "isFlushPending", !1), p(this, "isDestroyed", !1), p(this, "errorHandlers", /* @__PURE__ */ new Set()), p(this, "maxRetries", 3), p(this, "totalUpdateCycles", 0), p(this, "totalUpdateTime", 0), p(this, "errorCount", 0), p(this, "nodeRegistry", /* @__PURE__ */ new WeakSet());
2151
- for (const e of Object.values(S))
2152
+ 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))
2152
2154
  typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
2153
2155
  }
2154
2156
  static getInstance() {
2155
- return b.instance || (b.instance = new b()), b.instance;
2157
+ return v.instance || (v.instance = new v()), v.instance;
2156
2158
  }
2157
2159
  /**
2158
2160
  * Schedule reactive node for update
@@ -2185,7 +2187,7 @@ const nt = class b {
2185
2187
  await this.updateNodeWithRetry(a);
2186
2188
  } catch (r) {
2187
2189
  this.handleReactiveError(
2188
- new tt(`Failed to update ${a.type} node ${a.id}`, r, a)
2190
+ new pt(`Failed to update ${a.type} node ${a.id}`, r, a)
2189
2191
  );
2190
2192
  }
2191
2193
  if (this.hasHigherPriorityWork(t))
@@ -2331,7 +2333,7 @@ const nt = class b {
2331
2333
  }
2332
2334
  e.clear();
2333
2335
  }
2334
- this.updateQueues.clear(), this.errorHandlers.clear(), b.instance = null;
2336
+ this.updateQueues.clear(), this.errorHandlers.clear(), v.instance = null;
2335
2337
  }
2336
2338
  /**
2337
2339
  * Get debug information
@@ -2339,7 +2341,7 @@ const nt = class b {
2339
2341
  getDebugInfo() {
2340
2342
  const e = {};
2341
2343
  for (const [t, i] of this.updateQueues)
2342
- e[S[t]] = i.size;
2344
+ e[k[t]] = i.size;
2343
2345
  return {
2344
2346
  isFlushPending: this.isFlushPending,
2345
2347
  isDestroyed: this.isDestroyed,
@@ -2349,17 +2351,17 @@ const nt = class b {
2349
2351
  };
2350
2352
  }
2351
2353
  };
2352
- p(nt, "instance", null);
2353
- 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, g = (n, e, t) => st(n, typeof e != "symbol" ? e + "" : e, t);
2354
- class ot extends ee {
2355
- constructor(e, t = {}, i = Y()) {
2356
- super(e, i), g(this, "type", "computed"), g(this, "priority"), g(this, "_hasValue", !1), g(this, "_error", null), g(this, "equalsFn"), g(this, "options"), this.priority = t.priority ?? S.Normal, this.equalsFn = t.equals ?? Ze, this.options = t;
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;
2357
2359
  }
2358
2360
  /**
2359
2361
  * Get the computed value, tracking dependency and lazily computing
2360
2362
  */
2361
2363
  getValue() {
2362
- const e = Z();
2364
+ const e = le();
2363
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;
2364
2366
  }
2365
2367
  /**
@@ -2372,7 +2374,12 @@ class ot extends ee {
2372
2374
  * Remove an observer (cleanup)
2373
2375
  */
2374
2376
  removeObserver(e) {
2375
- this.observers.delete(e);
2377
+ this.observers.delete(e), this.options.releaseOnNoObservers === !0 && this.observers.size === 0 && e.state === c.Disposed && this.releaseSources();
2378
+ }
2379
+ releaseSources() {
2380
+ for (const e of this.sources)
2381
+ "removeObserver" in e && e.removeObserver(this);
2382
+ this.sources.clear(), this._hasValue = !1, this.state = c.Dirty;
2376
2383
  }
2377
2384
  /**
2378
2385
  * Execute the computation and notify observers
@@ -2422,7 +2429,7 @@ class ot extends ee {
2422
2429
  state: this.state,
2423
2430
  sourceCount: this.sources.size,
2424
2431
  observerCount: this.observers.size,
2425
- priority: S[this.priority],
2432
+ priority: k[this.priority],
2426
2433
  debugName: this.options.debugName,
2427
2434
  equalsFn: this.equalsFn.name || "anonymous"
2428
2435
  };
@@ -2431,29 +2438,40 @@ class ot extends ee {
2431
2438
  return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
2432
2439
  }
2433
2440
  }
2434
- function rt(n, e) {
2435
- const t = new ot(n, e), i = t.getValue.bind(t);
2441
+ function bt(n, e) {
2442
+ const t = new gt(n, e), i = t.getValue.bind(t);
2436
2443
  return i.peek = t.peek.bind(t), Object.defineProperty(i, Symbol.for("tachui.computed"), {
2437
2444
  value: t,
2438
2445
  enumerable: !1
2439
2446
  }), i;
2440
2447
  }
2441
- function R(n) {
2448
+ function N(n) {
2442
2449
  return typeof n == "function" && Symbol.for("tachui.computed") in n;
2443
2450
  }
2444
- const [at, Mt] = Je("light");
2445
- rt(() => {
2446
- const n = at();
2447
- return n === "system" ? lt() : n;
2451
+ function yt(n) {
2452
+ return n[Symbol.for("tachui.computed")] || null;
2453
+ }
2454
+ function vt(n) {
2455
+ const e = yt(n);
2456
+ !e || e.observers.size !== 0 || e.releaseSources();
2457
+ }
2458
+ const [Wt, Kt] = dt("light");
2459
+ bt(() => {
2460
+ const n = Wt();
2461
+ return n === "system" ? St() : n;
2448
2462
  });
2449
- function lt() {
2463
+ function St() {
2450
2464
  return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
2451
2465
  }
2466
+ function Et(n) {
2467
+ const e = B();
2468
+ e && !e.disposed ? e.cleanups.push(n) : __DEV__ && console.warn("onCleanup called outside of reactive context");
2469
+ }
2452
2470
  typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
2453
- var dt = Object.defineProperty, ct = (n, e, t) => e in n ? dt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, $ = (n, e, t) => ct(n, typeof e != "symbol" ? e + "" : e, t);
2454
- class ht {
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 {
2455
2473
  constructor() {
2456
- $(this, "pending", /* @__PURE__ */ new Set()), $(this, "isFlushScheduled", !1);
2474
+ J(this, "pending", /* @__PURE__ */ new Set()), J(this, "isFlushScheduled", !1);
2457
2475
  }
2458
2476
  schedule(e) {
2459
2477
  this.pending.add(e), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
@@ -2474,20 +2492,122 @@ class ht {
2474
2492
  this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
2475
2493
  }
2476
2494
  }
2477
- new ht();
2478
- function B(n, e = {}) {
2479
- const t = Y();
2495
+ new kt();
2496
+ function ce(n, e = {}) {
2497
+ const t = B();
2480
2498
  let i;
2481
2499
  const s = () => {
2482
2500
  const r = n(i);
2483
2501
  return i = r, r;
2484
- }, a = new ee(s, t);
2502
+ }, a = new de(s, t);
2485
2503
  return e.name && Object.defineProperty(a, "name", {
2486
2504
  value: e.name,
2487
2505
  enumerable: !1
2488
2506
  }), a.execute(), a;
2489
2507
  }
2490
- class ut {
2508
+ const M = /* @__PURE__ */ new WeakMap();
2509
+ function Z(n, e, t) {
2510
+ try {
2511
+ n(e);
2512
+ } catch (i) {
2513
+ console.error(`Reactive style updater failed (${t}):`, i);
2514
+ }
2515
+ }
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);
2520
+ }
2521
+ function ue() {
2522
+ const n = Date.now();
2523
+ for (const e of Array.from(W)) {
2524
+ const t = e.deref();
2525
+ if (!t) {
2526
+ W.delete(e);
2527
+ continue;
2528
+ }
2529
+ const i = D.get(t), s = m.get(t);
2530
+ if (!i || !s || s.size === 0) {
2531
+ W.delete(e);
2532
+ continue;
2533
+ }
2534
+ if (t.isConnected) {
2535
+ i.wasConnected = !0;
2536
+ continue;
2537
+ }
2538
+ (i.wasConnected || n - i.trackedAt >= G) && (Pt(t), W.delete(e));
2539
+ }
2540
+ }
2541
+ function xt() {
2542
+ if (_ || typeof setTimeout != "function") return;
2543
+ _ = !0;
2544
+ const n = () => {
2545
+ if (ue(), W.size === 0) {
2546
+ _ = !1;
2547
+ return;
2548
+ }
2549
+ setTimeout(n, G);
2550
+ };
2551
+ setTimeout(n, G);
2552
+ }
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);
2557
+ }
2558
+ function It(n, e) {
2559
+ Tt(), xt();
2560
+ 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, {
2562
+ trackedAt: Date.now(),
2563
+ wasConnected: n.isConnected
2564
+ }), W.add(new WeakRef(n))), () => {
2565
+ const s = m.get(n);
2566
+ s && (s.delete(e), s.size === 0 && (m.delete(n), D.delete(n)));
2567
+ };
2568
+ }
2569
+ function Ot({
2570
+ element: n,
2571
+ accessor: e,
2572
+ updater: t,
2573
+ updaterId: i
2574
+ }) {
2575
+ const s = M.get(n) ?? /* @__PURE__ */ new Map();
2576
+ M.has(n) || M.set(n, s);
2577
+ let a = s.get(e);
2578
+ if (!a) {
2579
+ const d = /* @__PURE__ */ new Map();
2580
+ a = { effect: ce(() => {
2581
+ const l = e();
2582
+ d.forEach(
2583
+ (p, b) => Z(p, l, b)
2584
+ );
2585
+ }), updaters: d }, s.set(e, a);
2586
+ }
2587
+ a.updaters.set(i, t), Z(t, e(), i);
2588
+ let r = null;
2589
+ const u = () => {
2590
+ r && (r(), r = null);
2591
+ 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));
2593
+ };
2594
+ nt() ? Et(u) : r = It(n, u);
2595
+ }
2596
+ const ee = Symbol.for("tachui.modifier.instanceId"), zt = "core";
2597
+ let te = 0;
2598
+ function Dt(n) {
2599
+ const e = n[ee];
2600
+ if (typeof e == "number") return e;
2601
+ te += 1;
2602
+ const t = te;
2603
+ return Object.defineProperty(n, ee, {
2604
+ value: t,
2605
+ enumerable: !1,
2606
+ configurable: !1,
2607
+ writable: !1
2608
+ }), t;
2609
+ }
2610
+ class Ht {
2491
2611
  constructor(e) {
2492
2612
  this.properties = e;
2493
2613
  }
@@ -2506,12 +2626,12 @@ class ut {
2506
2626
  applyStyleChange(e, t, i) {
2507
2627
  if (e instanceof HTMLElement) {
2508
2628
  const s = this.toCSSProperty(t);
2509
- if (U(i) || R(i))
2510
- B(() => {
2629
+ if (X(i) || N(i))
2630
+ ce(() => {
2511
2631
  const a = i(), r = String(a);
2512
2632
  if (r.includes("!important")) {
2513
- const h = r.replace(/\s*!important\s*$/, "").trim();
2514
- e.style.setProperty(s, h, "important");
2633
+ const u = r.replace(/\s*!important\s*$/, "").trim();
2634
+ e.style.setProperty(s, u, "important");
2515
2635
  } else
2516
2636
  e.style.setProperty(s, r);
2517
2637
  });
@@ -2557,35 +2677,33 @@ class ut {
2557
2677
  */
2558
2678
  applyStyles(e, t) {
2559
2679
  if (e instanceof HTMLElement || e.style) {
2560
- const i = e.style;
2561
- for (const [s, a] of Object.entries(t))
2562
- if (a !== void 0) {
2563
- const r = this.toCSSProperty(s);
2564
- if (U(a) || R(a))
2565
- B(() => {
2566
- const h = a(), d = this.toCSSValueForProperty(
2567
- r,
2568
- h
2569
- );
2570
- if (i.setProperty)
2571
- if (typeof d == "string" && d.includes("!important")) {
2572
- const l = d.replace(/\s*!important\s*$/, "").trim();
2573
- i.setProperty(r, l, "important");
2574
- } else
2575
- i.setProperty(r, d);
2576
- else
2577
- i[r] = d;
2680
+ const i = e.style, s = (a, r) => {
2681
+ if (i.setProperty)
2682
+ if (typeof r == "string" && r.includes("!important")) {
2683
+ const u = r.replace(/\s*!important\s*$/, "").trim();
2684
+ i.setProperty(a, u, "important");
2685
+ } else
2686
+ i.setProperty(a, r);
2687
+ else
2688
+ i[a] = r;
2689
+ };
2690
+ for (const [a, r] of Object.entries(t))
2691
+ 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({
2696
+ element: e,
2697
+ accessor: d,
2698
+ updaterId: `${zt}:${l}:${u}`,
2699
+ updater: (p) => {
2700
+ const b = this.toCSSValueForProperty(u, p);
2701
+ s(u, b);
2702
+ }
2578
2703
  });
2579
- else {
2580
- const h = this.toCSSValueForProperty(r, a);
2581
- if (i.setProperty)
2582
- if (typeof h == "string" && h.includes("!important")) {
2583
- const d = h.replace(/\s*!important\s*$/, "").trim();
2584
- i.setProperty(r, d, "important");
2585
- } else
2586
- i.setProperty(r, h);
2587
- else
2588
- i[r] = h;
2704
+ } else {
2705
+ const d = this.toCSSValueForProperty(u, r);
2706
+ s(u, d);
2589
2707
  }
2590
2708
  }
2591
2709
  }
@@ -2615,7 +2733,7 @@ class ut {
2615
2733
  };
2616
2734
  }
2617
2735
  }
2618
- class te extends ut {
2736
+ class he extends Ht {
2619
2737
  constructor() {
2620
2738
  super(...arguments);
2621
2739
  o(this, "type", "viewportLifecycle");
@@ -2641,94 +2759,94 @@ class te extends ut {
2641
2759
  ).observe(t);
2642
2760
  }
2643
2761
  }
2644
- function ne(n) {
2645
- return new te({ onAppear: n });
2762
+ function pe(n) {
2763
+ return new he({ onAppear: n });
2646
2764
  }
2647
- function ie(n) {
2648
- return new te({ onDisappear: n });
2765
+ function we(n) {
2766
+ return new he({ onDisappear: n });
2649
2767
  }
2650
- const pt = {
2768
+ const At = {
2651
2769
  name: "@tachui/viewport",
2652
- version: Ge,
2770
+ version: Xe,
2653
2771
  author: "TachUI Team",
2654
2772
  verified: !0
2655
- }, j = {
2773
+ }, ne = {
2656
2774
  category: "interaction",
2657
2775
  priority: 110,
2658
2776
  signature: "(handler: () => void) => Modifier",
2659
2777
  description: "Triggers handlers when an element appears in or disappears from the viewport."
2660
2778
  };
2661
- let q = !1;
2662
- function se(n) {
2663
- const e = n?.registry, t = n?.plugin ?? pt, i = n?.force === !0, s = !!(e || n?.plugin);
2664
- !s && q && !i || (V(
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(
2665
2783
  "onAppear",
2666
- ne,
2784
+ pe,
2667
2785
  {
2668
- ...j,
2786
+ ...ne,
2669
2787
  description: "Executes a callback when the component enters the viewport."
2670
2788
  },
2671
2789
  e,
2672
2790
  t
2673
- ), V(
2791
+ ), j(
2674
2792
  "onDisappear",
2675
- ie,
2793
+ we,
2676
2794
  {
2677
- ...j,
2795
+ ...ne,
2678
2796
  description: "Executes a callback when the component leaves the viewport."
2679
2797
  },
2680
2798
  e,
2681
2799
  t
2682
- ), s || (q = !0));
2800
+ ), s || (ie = !0));
2683
2801
  }
2684
- se();
2685
- const wt = {
2802
+ fe();
2803
+ const _t = {
2686
2804
  // Manager
2687
- getManager: u,
2805
+ getManager: h,
2688
2806
  // Environment
2689
- useOpenWindow: k,
2690
- useDismissWindow: x,
2691
- useViewportInfo: _,
2807
+ useOpenWindow: O,
2808
+ useDismissWindow: z,
2809
+ useViewportInfo: $,
2692
2810
  // Components
2693
- Window: y,
2694
- WindowGroup: T,
2695
- App: M,
2811
+ Window: S,
2812
+ WindowGroup: H,
2813
+ App: T,
2696
2814
  // Utilities
2697
- Utils: P,
2698
- Examples: K
2815
+ Utils: I,
2816
+ Examples: oe
2699
2817
  };
2700
- function ft(n) {
2701
- const e = new A(n?.customAdapter);
2702
- return Q(e), e;
2818
+ function Ft(n) {
2819
+ const e = new R(n?.customAdapter);
2820
+ return se(e), e;
2703
2821
  }
2704
- const mt = {
2822
+ const Vt = {
2705
2823
  isWindow: (n) => n.type === "window",
2706
2824
  isModal: (n) => n.type === "modal",
2707
2825
  isPortal: (n) => n.type === "portal",
2708
2826
  isSheet: (n) => n.type === "sheet",
2709
2827
  isPopover: (n) => n.type === "popover"
2710
- }, gt = {
2828
+ }, Nt = {
2711
2829
  /**
2712
2830
  * Check if running in Electron
2713
2831
  */
2714
- isElectron: () => u().environment.platform === "electron",
2832
+ isElectron: () => h().environment.platform === "electron",
2715
2833
  /**
2716
2834
  * Check if on mobile
2717
2835
  */
2718
- isMobile: () => u().environment.platform === "mobile",
2836
+ isMobile: () => h().environment.platform === "mobile",
2719
2837
  /**
2720
2838
  * Check if multi-window is supported
2721
2839
  */
2722
- supportsMultiWindow: () => u().environment.capabilities.multiWindow,
2840
+ supportsMultiWindow: () => h().environment.capabilities.multiWindow,
2723
2841
  /**
2724
2842
  * Check if native windows are supported
2725
2843
  */
2726
- supportsNativeWindows: () => u().environment.capabilities.nativeWindows,
2844
+ supportsNativeWindows: () => h().environment.capabilities.nativeWindows,
2727
2845
  /**
2728
2846
  * Get optimal window type for current platform
2729
2847
  */
2730
- getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2731
- }, bt = {
2848
+ getOptimalWindowType: (n = !1) => h().getOptimalWindowType({ preferNativeWindow: n })
2849
+ }, Gt = {
2732
2850
  /**
2733
2851
  * Standard document window
2734
2852
  */
@@ -2795,7 +2913,7 @@ const mt = {
2795
2913
  minimizable: !1,
2796
2914
  maximizable: !1
2797
2915
  })
2798
- }, yt = {
2916
+ }, Lt = {
2799
2917
  DEFAULT_WINDOW_WIDTH: 800,
2800
2918
  DEFAULT_WINDOW_HEIGHT: 600,
2801
2919
  MIN_WINDOW_WIDTH: 300,
@@ -2803,82 +2921,82 @@ const mt = {
2803
2921
  MODAL_Z_INDEX: 1e3,
2804
2922
  PORTAL_Z_INDEX: 999,
2805
2923
  ANIMATION_DURATION: 200
2806
- }, vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2924
+ }, Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2807
2925
  __proto__: null,
2808
- App: M,
2809
- EnvironmentKeys: _e,
2810
- ExampleScenes: K,
2811
- PlatformUtils: gt,
2812
- TachUIViewportManager: A,
2813
- Viewport: wt,
2814
- ViewportConstants: yt,
2815
- ViewportEnvironmentProvider: J,
2816
- ViewportTypeGuards: mt,
2817
- WebViewportAdapter: H,
2818
- Window: y,
2819
- WindowConfigs: bt,
2820
- WindowGroup: T,
2821
- WindowUtils: P,
2822
- checkFeatureSupport: Me,
2823
- createCapabilityChecker: O,
2824
- createWindowAwareComponent: Ae,
2825
- detectViewportEnvironment: z,
2826
- disposeViewportManager: Oe,
2827
- getBrowserInfo: Ee,
2828
- getEnvironmentValue: Fe,
2829
- getOSInfo: Ce,
2830
- getViewportManager: u,
2831
- initializeViewportSystem: ft,
2832
- onAppear: ne,
2833
- onDisappear: ie,
2834
- registerViewportModifiers: se,
2835
- setViewportManager: Q,
2836
- useCurrentWindow: He,
2837
- useDismissWindow: x,
2838
- useEnvironmentDismissWindow: x,
2839
- useEnvironmentOpenWindow: k,
2840
- useOpenWindow: k,
2841
- useViewportEnvironment: v,
2842
- useViewportInfo: _,
2843
- useViewportManager: De,
2844
- withViewportEnvironment: ze
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,
2936
+ 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,
2959
+ useViewportEnvironment: C,
2960
+ useViewportInfo: $,
2961
+ useViewportManager: $e,
2962
+ withViewportEnvironment: Be
2845
2963
  }, Symbol.toStringTag, { value: "Module" }));
2846
2964
  export {
2847
- M as App,
2848
- _e as EnvironmentKeys,
2849
- K as ExampleScenes,
2850
- gt as PlatformUtils,
2851
- A as TachUIViewportManager,
2852
- wt as Viewport,
2853
- yt as ViewportConstants,
2854
- J as ViewportEnvironmentProvider,
2855
- mt as ViewportTypeGuards,
2856
- H as WebViewportAdapter,
2857
- y as Window,
2858
- bt as WindowConfigs,
2859
- T as WindowGroup,
2860
- P as WindowUtils,
2861
- Me as checkFeatureSupport,
2862
- O as createCapabilityChecker,
2863
- Ae as createWindowAwareComponent,
2864
- z as detectViewportEnvironment,
2865
- Oe as disposeViewportManager,
2866
- Ee as getBrowserInfo,
2867
- Fe as getEnvironmentValue,
2868
- Ce as getOSInfo,
2869
- u as getViewportManager,
2870
- ft as initializeViewportSystem,
2871
- ne as onAppear,
2872
- ie as onDisappear,
2873
- se as registerViewportModifiers,
2874
- Q as setViewportManager,
2875
- He as useCurrentWindow,
2876
- x as useDismissWindow,
2877
- x as useEnvironmentDismissWindow,
2878
- k as useEnvironmentOpenWindow,
2879
- k as useOpenWindow,
2880
- v as useViewportEnvironment,
2881
- _ as useViewportInfo,
2882
- De as useViewportManager,
2883
- ze as withViewportEnvironment
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,
2975
+ 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,
2998
+ C as useViewportEnvironment,
2999
+ $ as useViewportInfo,
3000
+ $e as useViewportManager,
3001
+ Be as withViewportEnvironment
2884
3002
  };