@tachui/viewport 0.8.24 → 0.8.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- var ve = Object.defineProperty;
2
- var We = (n, e, t) => e in n ? ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => We(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { createSignal as M, mountComponentTree as Se, createRoot as Ee, withComponentContext as Ce, useContext as Me, createContext as ke } from "@tachui/core";
5
- import { getOwner as Pe, onCleanup as Te } from "@tachui/core/reactive";
1
+ var We = Object.defineProperty;
2
+ var Se = (n, e, t) => e in n ? We(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var o = (n, e, t) => Se(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { createSignal as M, mountComponentTree as Ee, createRoot as Ce, withComponentContext as Me, useContext as ke, createContext as Pe } from "@tachui/core";
5
+ import { getOwner as Te, onCleanup as xe } from "@tachui/core/reactive";
6
6
  import { registerModifierWithMetadata as Q } from "@tachui/modifiers";
7
7
  function $(n = {}) {
8
- const e = xe(), t = Oe(e, n), i = _e(), s = Ge(), a = Le();
8
+ const e = Ie(), t = Ae(e, n), i = _e(), s = Le(), a = Ve();
9
9
  return {
10
10
  platform: e,
11
11
  capabilities: t,
@@ -14,20 +14,20 @@ function $(n = {}) {
14
14
  isTouch: a
15
15
  };
16
16
  }
17
- function xe() {
18
- return Ie() ? "electron" : He() ? "mobile" : ze() ? "embedded" : "web";
19
- }
20
17
  function Ie() {
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;
18
+ return He() ? "electron" : ze() ? "mobile" : Oe() ? "embedded" : "web";
22
19
  }
23
20
  function He() {
21
+ return typeof window < "u" ? !!window.electronAPI || !!window.electron || !!window.require || navigator.userAgent.toLowerCase().includes("electron") : typeof process < "u" ? !!process.electron || !!process.versions?.electron || process.env.ELECTRON === "true" : !1;
22
+ }
23
+ function ze() {
24
24
  if (typeof window > "u") return !1;
25
25
  const n = "ontouchstart" in window && !("onmousedown" in window), e = window.innerWidth <= 768 || window.innerHeight <= 768, t = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
26
26
  navigator.userAgent
27
27
  ), i = window.matchMedia?.("(pointer: coarse)")?.matches, s = window.matchMedia?.("(max-width: 768px)")?.matches;
28
28
  return n || e && t || i || s;
29
29
  }
30
- function ze() {
30
+ function Oe() {
31
31
  if (typeof window > "u") return !1;
32
32
  try {
33
33
  return window.self !== window.top;
@@ -35,7 +35,7 @@ function ze() {
35
35
  return !0;
36
36
  }
37
37
  }
38
- function Oe(n, e) {
38
+ function Ae(n, e) {
39
39
  const t = {
40
40
  multiWindow: !1,
41
41
  nativeWindows: !1,
@@ -61,8 +61,8 @@ function Oe(n, e) {
61
61
  case "web":
62
62
  return {
63
63
  ...t,
64
- multiWindow: e.enablePopupTest ? Ae() : !1,
65
- crossWindowCommunication: De() || Fe(),
64
+ multiWindow: e.enablePopupTest ? De() : !1,
65
+ crossWindowCommunication: Fe() || Ge(),
66
66
  fullscreenSupport: K(),
67
67
  windowResizing: !1,
68
68
  // Browser windows can't be resized programmatically
@@ -83,7 +83,7 @@ function Oe(n, e) {
83
83
  return t;
84
84
  }
85
85
  }
86
- function Ae() {
86
+ function De() {
87
87
  if (typeof window > "u" || typeof window.navigator < "u" && window.navigator.userAgent.includes("jsdom"))
88
88
  return !1;
89
89
  try {
@@ -93,10 +93,10 @@ function Ae() {
93
93
  return !1;
94
94
  }
95
95
  }
96
- function De() {
96
+ function Fe() {
97
97
  return typeof window < "u" && "BroadcastChannel" in window;
98
98
  }
99
- function Fe() {
99
+ function Ge() {
100
100
  return typeof window < "u" && "MessageChannel" in window;
101
101
  }
102
102
  function K() {
@@ -105,13 +105,13 @@ function K() {
105
105
  function _e() {
106
106
  return typeof navigator > "u" ? "unknown" : navigator.userAgent;
107
107
  }
108
- function Ge() {
108
+ function Le() {
109
109
  return typeof window > "u" ? { width: 1920, height: 1080 } : {
110
110
  width: window.screen?.width || window.innerWidth || 1920,
111
111
  height: window.screen?.height || window.innerHeight || 1080
112
112
  };
113
113
  }
114
- function Le() {
114
+ function Ve() {
115
115
  return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
116
116
  }
117
117
  function Ne() {
@@ -142,7 +142,7 @@ function Ne() {
142
142
  }
143
143
  return { name: e, version: t, engine: i };
144
144
  }
145
- function Ve() {
145
+ function Ue() {
146
146
  if (typeof navigator > "u")
147
147
  return {
148
148
  name: "unknown",
@@ -169,7 +169,7 @@ function Ve() {
169
169
  }
170
170
  return { name: e, version: t };
171
171
  }
172
- function Ue() {
172
+ function Re() {
173
173
  return typeof window > "u" ? {
174
174
  webgl: !1,
175
175
  webgl2: !1,
@@ -201,7 +201,7 @@ function L(n) {
201
201
  getOptimalViewportType: (e = !1) => e && n.capabilities.nativeWindows ? "window" : n.capabilities.modalOverlays ? "modal" : n.platform === "mobile" ? "sheet" : "portal"
202
202
  };
203
203
  }
204
- class Re {
204
+ class $e {
205
205
  // Fallback strategies
206
206
  createModal(e) {
207
207
  throw new Error("Modal fallback not implemented");
@@ -210,7 +210,7 @@ class Re {
210
210
  throw new Error("Portal fallback not implemented");
211
211
  }
212
212
  }
213
- class N extends Re {
213
+ class V extends $e {
214
214
  constructor(t = {}) {
215
215
  super();
216
216
  o(this, "environment");
@@ -323,21 +323,21 @@ class N extends Re {
323
323
  * Create popup window (native browser window)
324
324
  */
325
325
  createPopupWindow(t) {
326
- const i = new $e(t);
326
+ const i = new Be(t);
327
327
  return this.popups.set(t.id, i), i;
328
328
  }
329
329
  /**
330
330
  * Create modal overlay
331
331
  */
332
332
  createModal(t) {
333
- const i = new Be(t);
333
+ const i = new je(t);
334
334
  return this.modals.set(t.id, i), i;
335
335
  }
336
336
  /**
337
337
  * Create portal
338
338
  */
339
339
  createPortal(t) {
340
- const i = new je(t, this.portalContainer);
340
+ const i = new Qe(t, this.portalContainer);
341
341
  return this.portals.set(t.id, i), i;
342
342
  }
343
343
  /**
@@ -430,7 +430,7 @@ class N extends Re {
430
430
  `, document.head.appendChild(i);
431
431
  }
432
432
  }
433
- class $e {
433
+ class Be {
434
434
  constructor(e) {
435
435
  o(this, "id");
436
436
  o(this, "type", "window");
@@ -639,7 +639,7 @@ class $e {
639
639
  removeChildWindow(e) {
640
640
  }
641
641
  }
642
- class Be {
642
+ class je {
643
643
  constructor(e) {
644
644
  o(this, "id");
645
645
  o(this, "type", "modal");
@@ -861,7 +861,7 @@ class Be {
861
861
  e && e.remove();
862
862
  }
863
863
  }
864
- class je {
864
+ class Qe {
865
865
  constructor(e, t) {
866
866
  o(this, "id");
867
867
  o(this, "type", "portal");
@@ -906,7 +906,7 @@ class je {
906
906
  if (this.portalElement) {
907
907
  this.portalElement.innerHTML = "";
908
908
  try {
909
- const t = Se(e, this.portalElement);
909
+ const t = Ee(e, this.portalElement);
910
910
  this.cleanupFunction = t;
911
911
  } catch (t) {
912
912
  console.error("Error during mountComponentTree:", t);
@@ -1144,7 +1144,7 @@ class B {
1144
1144
  createWindowGroup(e) {
1145
1145
  if (this.windowGroups.has(e))
1146
1146
  return this.windowGroups.get(e);
1147
- const t = new Qe(e, this);
1147
+ const t = new Ke(e, this);
1148
1148
  return this.windowGroups.set(e, t), t;
1149
1149
  }
1150
1150
  /**
@@ -1202,9 +1202,9 @@ class B {
1202
1202
  createDefaultAdapter() {
1203
1203
  switch (this.environment.platform) {
1204
1204
  case "electron":
1205
- return new N(this.platformConfig);
1205
+ return new V(this.platformConfig);
1206
1206
  default:
1207
- return new N(this.platformConfig);
1207
+ return new V(this.platformConfig);
1208
1208
  }
1209
1209
  }
1210
1210
  // ==================== Phase 2: Global State Management ====================
@@ -1268,7 +1268,7 @@ class B {
1268
1268
  });
1269
1269
  }
1270
1270
  }
1271
- class Qe {
1271
+ class Ke {
1272
1272
  constructor(e, t, i = "any") {
1273
1273
  o(this, "windows", /* @__PURE__ */ new Map());
1274
1274
  o(this, "defaultOptions", {});
@@ -1620,10 +1620,10 @@ let m = null;
1620
1620
  function u(n = {}) {
1621
1621
  return m || (m = new B(void 0, n)), m;
1622
1622
  }
1623
- function se(n) {
1623
+ function oe(n) {
1624
1624
  m?.dispose(), m = n;
1625
1625
  }
1626
- function Ke() {
1626
+ function qe() {
1627
1627
  m?.dispose(), m = null;
1628
1628
  }
1629
1629
  function W(n) {
@@ -1651,7 +1651,7 @@ function W(n) {
1651
1651
  },
1652
1652
  // Open this window
1653
1653
  async open() {
1654
- const e = u(), t = Ee(() => Ce((i) => n.children(), `Window-${n.id}`)({}));
1654
+ const e = u(), t = Ce(() => Me((i) => n.children(), `Window-${n.id}`)({}));
1655
1655
  await e.openWindow(n.id, t, n);
1656
1656
  },
1657
1657
  // Close this window
@@ -1660,7 +1660,7 @@ function W(n) {
1660
1660
  }
1661
1661
  };
1662
1662
  }
1663
- function _(n) {
1663
+ function G(n) {
1664
1664
  const e = u(), t = e.createWindowGroup(n.id);
1665
1665
  n.groupingStrategy && t.setGroupingStrategy(n.groupingStrategy), n.tabConfig && t.configureTabbing(n.tabConfig), n.poolConfig && t.configurePool(n.poolConfig), n.stateSyncScope && t.enableStateSync(n.stateSyncScope), n.maxInstances && t.setMaxInstances(n.maxInstances);
1666
1666
  const {
@@ -1792,7 +1792,7 @@ const I = {
1792
1792
  * Create a document window group
1793
1793
  */
1794
1794
  documentGroup(n, e, t, i) {
1795
- return _({
1795
+ return G({
1796
1796
  id: n,
1797
1797
  title: e,
1798
1798
  for: t,
@@ -1843,7 +1843,7 @@ const I = {
1843
1843
  children: t
1844
1844
  });
1845
1845
  }
1846
- }, oe = {
1846
+ }, re = {
1847
1847
  /**
1848
1848
  * Basic app with main window and settings
1849
1849
  */
@@ -1884,7 +1884,7 @@ const I = {
1884
1884
  */
1885
1885
  documentApp: () => x({
1886
1886
  children: [
1887
- _({
1887
+ G({
1888
1888
  id: "document",
1889
1889
  title: "Document",
1890
1890
  for: class {
@@ -1920,8 +1920,8 @@ const I = {
1920
1920
  }))
1921
1921
  ]
1922
1922
  })
1923
- }, re = ke(null);
1924
- function ae({
1923
+ }, ae = Pe(null);
1924
+ function de({
1925
1925
  children: n,
1926
1926
  manager: e
1927
1927
  }) {
@@ -1934,13 +1934,13 @@ function ae({
1934
1934
  };
1935
1935
  return {
1936
1936
  type: "context-provider",
1937
- context: re,
1937
+ context: ae,
1938
1938
  value: i,
1939
1939
  children: Array.isArray(n) ? n : [n]
1940
1940
  };
1941
1941
  }
1942
1942
  function S() {
1943
- const n = Me(re);
1943
+ const n = ke(ae);
1944
1944
  if (!n)
1945
1945
  throw new Error(
1946
1946
  "useViewportEnvironment must be used within a ViewportEnvironmentProvider"
@@ -1959,20 +1959,20 @@ function j() {
1959
1959
  const { viewportEnvironment: n } = S();
1960
1960
  return n;
1961
1961
  }
1962
- function qe() {
1962
+ function Xe() {
1963
1963
  const { currentWindow: n } = S();
1964
1964
  return n;
1965
1965
  }
1966
- function Xe() {
1966
+ function Je() {
1967
1967
  return u();
1968
1968
  }
1969
- function Je(n, e) {
1970
- return (t) => ae({
1969
+ function Ze(n, e) {
1970
+ return (t) => de({
1971
1971
  children: n(t),
1972
1972
  manager: e
1973
1973
  });
1974
1974
  }
1975
- function Ze(n) {
1975
+ function Ye(n) {
1976
1976
  return (e) => {
1977
1977
  const t = H(), i = z(), s = j();
1978
1978
  return n({
@@ -1983,67 +1983,67 @@ function Ze(n) {
1983
1983
  });
1984
1984
  };
1985
1985
  }
1986
- const Ye = {
1986
+ const et = {
1987
1987
  openWindow: "openWindow",
1988
1988
  dismissWindow: "dismissWindow",
1989
1989
  viewportEnvironment: "viewportEnvironment",
1990
1990
  currentWindow: "currentWindow"
1991
1991
  };
1992
- function et(n) {
1992
+ function tt(n) {
1993
1993
  return S()[n];
1994
1994
  }
1995
- function tt() {
1995
+ function nt() {
1996
1996
  return typeof window > "u" ? 0 : window.innerWidth;
1997
1997
  }
1998
- function nt() {
1998
+ function it() {
1999
1999
  return typeof window > "u" ? 0 : window.innerHeight;
2000
2000
  }
2001
- let O, A, de, le, T = 0, D = !1;
2002
- function ce() {
2003
- typeof window > "u" || (de?.(window.innerWidth), le?.(window.innerHeight));
2004
- }
2005
- function it() {
2006
- if (O && A) return;
2007
- const [n, e] = M(tt()), [t, i] = M(nt());
2008
- O = n, A = t, de = e, le = i;
2001
+ let O, A, le, ce, T = 0, D = !1;
2002
+ function he() {
2003
+ typeof window > "u" || (le?.(window.innerWidth), ce?.(window.innerHeight));
2009
2004
  }
2010
2005
  function st() {
2011
- typeof window > "u" || D || (window.addEventListener("resize", ce), D = !0);
2006
+ if (O && A) return;
2007
+ const [n, e] = M(nt()), [t, i] = M(it());
2008
+ O = n, A = t, le = e, ce = i;
2012
2009
  }
2013
2010
  function ot() {
2014
- typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", ce), D = !1);
2011
+ typeof window > "u" || D || (window.addEventListener("resize", he), D = !0);
2015
2012
  }
2016
- function he() {
2017
- if (it(), T += 1, typeof window > "u")
2013
+ function rt() {
2014
+ typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", he), D = !1);
2015
+ }
2016
+ function ue() {
2017
+ if (st(), T += 1, typeof window > "u")
2018
2018
  return {
2019
2019
  width: O,
2020
2020
  height: A,
2021
2021
  dispose: () => {
2022
2022
  }
2023
2023
  };
2024
- st();
2024
+ ot();
2025
2025
  let n = !1;
2026
2026
  const e = () => {
2027
- n || (n = !0, T = Math.max(0, T - 1), ot());
2027
+ n || (n = !0, T = Math.max(0, T - 1), rt());
2028
2028
  };
2029
- return Pe() && Te(e), {
2029
+ return Te() && xe(e), {
2030
2030
  width: O,
2031
2031
  height: A,
2032
2032
  dispose: e
2033
2033
  };
2034
2034
  }
2035
- const rt = "0.8.24", at = rt, b = {
2035
+ const at = "0.8.25", dt = at, b = {
2036
2036
  Clean: 0,
2037
2037
  Check: 1,
2038
2038
  Dirty: 2,
2039
2039
  Disposed: 3
2040
2040
  };
2041
- var dt = Object.defineProperty, lt = (n, e, t) => e in n ? dt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => lt(n, typeof e != "symbol" ? e + "" : e, t);
2042
- let ct = 0;
2043
- const ht = Math.random().toString(36).substr(2, 6);
2041
+ var lt = Object.defineProperty, ct = (n, e, t) => e in n ? lt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, p = (n, e, t) => ct(n, typeof e != "symbol" ? e + "" : e, t);
2042
+ let ht = 0;
2043
+ const ut = Math.random().toString(36).substr(2, 6);
2044
2044
  let q = null, X = null;
2045
- const ut = /* @__PURE__ */ new Set();
2046
- ut.add(ht);
2045
+ const wt = /* @__PURE__ */ new Set();
2046
+ wt.add(ut);
2047
2047
  const C = {
2048
2048
  get currentComputation() {
2049
2049
  return q;
@@ -2058,12 +2058,12 @@ const C = {
2058
2058
  X = n;
2059
2059
  }
2060
2060
  };
2061
- function ue() {
2061
+ function we() {
2062
2062
  return C.currentOwner;
2063
2063
  }
2064
- class wt {
2064
+ class pt {
2065
2065
  constructor(e, t = null) {
2066
- p(this, "id"), p(this, "owner"), p(this, "fn"), p(this, "sources", /* @__PURE__ */ new Set()), p(this, "observers", /* @__PURE__ */ new Set()), p(this, "state", b.Dirty), p(this, "value"), this.id = ++ct, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2066
+ p(this, "id"), p(this, "owner"), p(this, "fn"), p(this, "sources", /* @__PURE__ */ new Set()), p(this, "observers", /* @__PURE__ */ new Set()), p(this, "state", b.Dirty), p(this, "value"), this.id = ++ht, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2067
2067
  }
2068
2068
  execute() {
2069
2069
  if (this.state === b.Disposed)
@@ -2093,22 +2093,22 @@ class wt {
2093
2093
  }
2094
2094
  }
2095
2095
  }
2096
- function pt() {
2096
+ function ft() {
2097
2097
  return C.currentOwner;
2098
2098
  }
2099
2099
  function J(n) {
2100
2100
  return typeof n == "function" && Symbol.for("tachui.signal") in n;
2101
2101
  }
2102
- var ft = Object.defineProperty, mt = (n, e, t) => e in n ? ft(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e, t) => mt(n, typeof e != "symbol" ? e + "" : e, t), V = /* @__PURE__ */ ((n) => (n[n.Immediate = 0] = "Immediate", n[n.High = 1] = "High", n[n.Normal = 2] = "Normal", n[n.Low = 3] = "Low", n[n.Idle = 4] = "Idle", n))(V || {});
2103
- let gt = class extends Error {
2102
+ var mt = Object.defineProperty, gt = (n, e, t) => e in n ? mt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, w = (n, e, t) => gt(n, typeof e != "symbol" ? e + "" : e, t), N = /* @__PURE__ */ ((n) => (n[n.Immediate = 0] = "Immediate", n[n.High = 1] = "High", n[n.Normal = 2] = "Normal", n[n.Low = 3] = "Low", n[n.Idle = 4] = "Idle", n))(N || {});
2103
+ let bt = class extends Error {
2104
2104
  constructor(e, t, i) {
2105
2105
  super(e), this.cause = t, this.node = i, this.name = "ReactiveError";
2106
2106
  }
2107
2107
  };
2108
- const bt = class y {
2108
+ const yt = class y {
2109
2109
  constructor() {
2110
2110
  w(this, "updateQueues", /* @__PURE__ */ new Map()), w(this, "isFlushPending", !1), w(this, "isDestroyed", !1), w(this, "errorHandlers", /* @__PURE__ */ new Set()), w(this, "maxRetries", 3), w(this, "totalUpdateCycles", 0), w(this, "totalUpdateTime", 0), w(this, "errorCount", 0), w(this, "nodeRegistry", /* @__PURE__ */ new WeakSet());
2111
- for (const e of Object.values(V))
2111
+ for (const e of Object.values(N))
2112
2112
  typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
2113
2113
  }
2114
2114
  static getInstance() {
@@ -2145,7 +2145,7 @@ const bt = class y {
2145
2145
  await this.updateNodeWithRetry(a);
2146
2146
  } catch (r) {
2147
2147
  this.handleReactiveError(
2148
- new gt(`Failed to update ${a.type} node ${a.id}`, r, a)
2148
+ new bt(`Failed to update ${a.type} node ${a.id}`, r, a)
2149
2149
  );
2150
2150
  }
2151
2151
  if (this.hasHigherPriorityWork(t))
@@ -2299,7 +2299,7 @@ const bt = class y {
2299
2299
  getDebugInfo() {
2300
2300
  const e = {};
2301
2301
  for (const [t, i] of this.updateQueues)
2302
- e[V[t]] = i.size;
2302
+ e[N[t]] = i.size;
2303
2303
  return {
2304
2304
  isFlushPending: this.isFlushPending,
2305
2305
  isDestroyed: this.isDestroyed,
@@ -2309,31 +2309,31 @@ const bt = class y {
2309
2309
  };
2310
2310
  }
2311
2311
  };
2312
- w(bt, "instance", null);
2312
+ w(yt, "instance", null);
2313
2313
  function U(n) {
2314
2314
  return typeof n == "function" && Symbol.for("tachui.computed") in n;
2315
2315
  }
2316
- function yt(n) {
2316
+ function vt(n) {
2317
2317
  return n[Symbol.for("tachui.computed")] || null;
2318
2318
  }
2319
- function vt(n) {
2320
- const e = yt(n);
2319
+ function Wt(n) {
2320
+ const e = vt(n);
2321
2321
  !e || e.observers.size !== 0 || e.releaseSources();
2322
2322
  }
2323
- function we(n, e = {}) {
2324
- const t = ue();
2323
+ function pe(n, e = {}) {
2324
+ const t = we();
2325
2325
  let i;
2326
2326
  const s = () => {
2327
2327
  const r = n(i);
2328
2328
  return i = r, r;
2329
- }, a = new wt(s, t);
2329
+ }, a = new pt(s, t);
2330
2330
  return e.name && Object.defineProperty(a, "name", {
2331
2331
  value: e.name,
2332
2332
  enumerable: !1
2333
2333
  }), a.execute(), a;
2334
2334
  }
2335
- function Wt(n) {
2336
- const e = ue();
2335
+ function St(n) {
2336
+ const e = we();
2337
2337
  e && !e.disposed ? e.cleanups.push(n) : __DEV__ && console.warn("onCleanup called outside of reactive context");
2338
2338
  }
2339
2339
  typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
@@ -2346,11 +2346,11 @@ function Z(n, e, t) {
2346
2346
  }
2347
2347
  }
2348
2348
  const R = 200, f = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Set();
2349
- let Y = !1, G = !1;
2350
- function St(n) {
2349
+ let Y = !1, _ = !1;
2350
+ function Et(n) {
2351
2351
  f.get(n)?.forEach((e) => e()), f.delete(n), F.delete(n);
2352
2352
  }
2353
- function pe() {
2353
+ function fe() {
2354
2354
  const n = Date.now();
2355
2355
  for (const e of Array.from(v)) {
2356
2356
  const t = e.deref();
@@ -2367,28 +2367,28 @@ function pe() {
2367
2367
  i.wasConnected = !0;
2368
2368
  continue;
2369
2369
  }
2370
- (i.wasConnected || n - i.trackedAt >= R) && (St(t), v.delete(e));
2370
+ (i.wasConnected || n - i.trackedAt >= R) && (Et(t), v.delete(e));
2371
2371
  }
2372
2372
  }
2373
- function Et() {
2374
- if (G || typeof setTimeout != "function") return;
2375
- G = !0;
2373
+ function Ct() {
2374
+ if (_ || typeof setTimeout != "function") return;
2375
+ _ = !0;
2376
2376
  const n = () => {
2377
- if (pe(), v.size === 0) {
2378
- G = !1;
2377
+ if (fe(), v.size === 0) {
2378
+ _ = !1;
2379
2379
  return;
2380
2380
  }
2381
2381
  setTimeout(n, R);
2382
2382
  };
2383
2383
  setTimeout(n, R);
2384
2384
  }
2385
- function Ct() {
2385
+ function Mt() {
2386
2386
  Y || typeof document > "u" || !document.documentElement || typeof MutationObserver > "u" || (new MutationObserver(() => {
2387
- pe();
2387
+ fe();
2388
2388
  }).observe(document.documentElement, { childList: !0, subtree: !0 }), Y = !0);
2389
2389
  }
2390
- function Mt(n, e) {
2391
- Ct(), Et();
2390
+ function kt(n, e) {
2391
+ Mt(), Ct();
2392
2392
  const t = f.get(n) ?? /* @__PURE__ */ new Set(), i = t.size > 0;
2393
2393
  return t.add(e), f.set(n, t), i || (F.set(n, {
2394
2394
  trackedAt: Date.now(),
@@ -2398,7 +2398,7 @@ function Mt(n, e) {
2398
2398
  s && (s.delete(e), s.size === 0 && (f.delete(n), F.delete(n)));
2399
2399
  };
2400
2400
  }
2401
- function kt({
2401
+ function Pt({
2402
2402
  element: n,
2403
2403
  accessor: e,
2404
2404
  updater: t,
@@ -2409,7 +2409,7 @@ function kt({
2409
2409
  let a = s.get(e);
2410
2410
  if (!a) {
2411
2411
  const d = /* @__PURE__ */ new Map();
2412
- a = { effect: we(() => {
2412
+ a = { effect: pe(() => {
2413
2413
  const l = e();
2414
2414
  d.forEach(
2415
2415
  (h, g) => Z(h, l, g)
@@ -2421,13 +2421,16 @@ function kt({
2421
2421
  const c = () => {
2422
2422
  r && (r(), r = null);
2423
2423
  const d = E.get(n), l = d?.get(e);
2424
- l && (l.updaters.delete(i), l.updaters.size === 0 && (l.effect.dispose(), d?.delete(e), U(e) && vt(e)), d && d.size === 0 && E.delete(n));
2424
+ l && (l.updaters.delete(i), l.updaters.size === 0 && (l.effect.dispose(), d?.delete(e), U(e) && Wt(e)), d && d.size === 0 && E.delete(n));
2425
2425
  };
2426
- pt() ? Wt(c) : r = Mt(n, c);
2426
+ ft() ? St(c) : r = kt(n, c);
2427
2427
  }
2428
- const ee = Symbol.for("tachui.modifier.instanceId"), Pt = "core";
2428
+ const ee = Symbol.for("tachui.modifier.instanceId"), Tt = "core";
2429
2429
  let te = 0;
2430
- function Tt(n) {
2430
+ function ne(n) {
2431
+ return typeof HTMLElement < "u" && n instanceof HTMLElement;
2432
+ }
2433
+ function xt(n) {
2431
2434
  const e = n[ee];
2432
2435
  if (typeof e == "number") return e;
2433
2436
  te += 1;
@@ -2439,7 +2442,7 @@ function Tt(n) {
2439
2442
  writable: !1
2440
2443
  }), t;
2441
2444
  }
2442
- class xt {
2445
+ class It {
2443
2446
  constructor(e) {
2444
2447
  this.properties = e;
2445
2448
  }
@@ -2467,7 +2470,7 @@ class xt {
2467
2470
  r.setProperty(a, d);
2468
2471
  };
2469
2472
  if (J(i) || U(i)) {
2470
- we(() => {
2473
+ pe(() => {
2471
2474
  const d = i();
2472
2475
  c(String(d));
2473
2476
  });
@@ -2527,14 +2530,14 @@ class xt {
2527
2530
  if (c !== void 0) {
2528
2531
  const d = this.toCSSProperty(r);
2529
2532
  if (J(c) || U(c)) {
2530
- const l = c, h = Tt(this);
2531
- kt({
2533
+ const l = c, h = xt(this);
2534
+ Pt({
2532
2535
  element: e,
2533
2536
  accessor: l,
2534
- updaterId: `${Pt}:${h}:${d}`,
2537
+ updaterId: `${Tt}:${h}:${d}`,
2535
2538
  updater: (g) => {
2536
- const ye = this.toCSSValueForProperty(d, g);
2537
- a(d, ye);
2539
+ const ve = this.toCSSValueForProperty(d, g);
2540
+ a(d, ve);
2538
2541
  }
2539
2542
  });
2540
2543
  } else {
@@ -2548,13 +2551,13 @@ class xt {
2548
2551
  * Add CSS classes to an element
2549
2552
  */
2550
2553
  addClasses(e, t) {
2551
- e instanceof HTMLElement && e.classList.add(...t);
2554
+ ne(e) && e.classList.add(...t);
2552
2555
  }
2553
2556
  /**
2554
2557
  * Remove CSS classes from an element
2555
2558
  */
2556
2559
  removeClasses(e, t) {
2557
- e instanceof HTMLElement && e.classList.remove(...t);
2560
+ ne(e) && e.classList.remove(...t);
2558
2561
  }
2559
2562
  /**
2560
2563
  * Create a style computation context
@@ -2570,7 +2573,7 @@ class xt {
2570
2573
  }
2571
2574
  }
2572
2575
  const k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
2573
- class fe extends xt {
2576
+ class me extends It {
2574
2577
  constructor() {
2575
2578
  super(...arguments);
2576
2579
  o(this, "type", "viewportLifecycle");
@@ -2608,74 +2611,74 @@ class fe extends xt {
2608
2611
  a.observe(t), P.set(t, a);
2609
2612
  }
2610
2613
  }
2611
- function me(n) {
2612
- return new fe({ onAppear: n });
2613
- }
2614
2614
  function ge(n) {
2615
- return new fe({ onDisappear: n });
2615
+ return new me({ onAppear: n });
2616
+ }
2617
+ function be(n) {
2618
+ return new me({ onDisappear: n });
2616
2619
  }
2617
- const It = {
2620
+ const Ht = {
2618
2621
  name: "@tachui/viewport",
2619
- version: at,
2622
+ version: dt,
2620
2623
  author: "TachUI Team",
2621
2624
  verified: !0
2622
- }, ne = {
2625
+ }, ie = {
2623
2626
  category: "interaction",
2624
2627
  priority: 110,
2625
2628
  signature: "(handler: () => void) => Modifier",
2626
2629
  description: "Triggers handlers when an element appears in or disappears from the viewport."
2627
2630
  };
2628
- let ie = !1;
2629
- function be(n) {
2630
- const e = n?.registry, t = n?.plugin ?? It, i = n?.force === !0, s = !!(e || n?.plugin);
2631
- !s && ie && !i || (Q(
2631
+ let se = !1;
2632
+ function ye(n) {
2633
+ const e = n?.registry, t = n?.plugin ?? Ht, i = n?.force === !0, s = !!(e || n?.plugin);
2634
+ !s && se && !i || (Q(
2632
2635
  "onAppear",
2633
- me,
2636
+ ge,
2634
2637
  {
2635
- ...ne,
2638
+ ...ie,
2636
2639
  description: "Executes a callback when the component enters the viewport."
2637
2640
  },
2638
2641
  e,
2639
2642
  t
2640
2643
  ), Q(
2641
2644
  "onDisappear",
2642
- ge,
2645
+ be,
2643
2646
  {
2644
- ...ne,
2647
+ ...ie,
2645
2648
  description: "Executes a callback when the component leaves the viewport."
2646
2649
  },
2647
2650
  e,
2648
2651
  t
2649
- ), s || (ie = !0));
2652
+ ), s || (se = !0));
2650
2653
  }
2651
- be();
2652
- const Ht = {
2654
+ ye();
2655
+ const zt = {
2653
2656
  // Manager
2654
2657
  getManager: u,
2655
2658
  // Environment
2656
2659
  useOpenWindow: H,
2657
2660
  useDismissWindow: z,
2658
2661
  useViewportInfo: j,
2659
- useViewport: he,
2662
+ useViewport: ue,
2660
2663
  // Components
2661
2664
  Window: W,
2662
- WindowGroup: _,
2665
+ WindowGroup: G,
2663
2666
  App: x,
2664
2667
  // Utilities
2665
2668
  Utils: I,
2666
- Examples: oe
2669
+ Examples: re
2667
2670
  };
2668
- function zt(n) {
2671
+ function Ot(n) {
2669
2672
  const e = new B(n?.customAdapter);
2670
- return se(e), e;
2673
+ return oe(e), e;
2671
2674
  }
2672
- const Ot = {
2675
+ const At = {
2673
2676
  isWindow: (n) => n.type === "window",
2674
2677
  isModal: (n) => n.type === "modal",
2675
2678
  isPortal: (n) => n.type === "portal",
2676
2679
  isSheet: (n) => n.type === "sheet",
2677
2680
  isPopover: (n) => n.type === "popover"
2678
- }, At = {
2681
+ }, Dt = {
2679
2682
  /**
2680
2683
  * Check if running in Electron
2681
2684
  */
@@ -2696,7 +2699,7 @@ const Ot = {
2696
2699
  * Get optimal window type for current platform
2697
2700
  */
2698
2701
  getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2699
- }, Dt = {
2702
+ }, Ft = {
2700
2703
  /**
2701
2704
  * Standard document window
2702
2705
  */
@@ -2763,7 +2766,7 @@ const Ot = {
2763
2766
  minimizable: !1,
2764
2767
  maximizable: !1
2765
2768
  })
2766
- }, Ft = {
2769
+ }, Gt = {
2767
2770
  DEFAULT_WINDOW_WIDTH: 800,
2768
2771
  DEFAULT_WINDOW_HEIGHT: 600,
2769
2772
  MIN_WINDOW_WIDTH: 300,
@@ -2774,81 +2777,81 @@ const Ot = {
2774
2777
  }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2775
2778
  __proto__: null,
2776
2779
  App: x,
2777
- EnvironmentKeys: Ye,
2778
- ExampleScenes: oe,
2779
- PlatformUtils: At,
2780
+ EnvironmentKeys: et,
2781
+ ExampleScenes: re,
2782
+ PlatformUtils: Dt,
2780
2783
  TachUIViewportManager: B,
2781
- Viewport: Ht,
2782
- ViewportConstants: Ft,
2783
- ViewportEnvironmentProvider: ae,
2784
- ViewportTypeGuards: Ot,
2785
- WebViewportAdapter: N,
2784
+ Viewport: zt,
2785
+ ViewportConstants: Gt,
2786
+ ViewportEnvironmentProvider: de,
2787
+ ViewportTypeGuards: At,
2788
+ WebViewportAdapter: V,
2786
2789
  Window: W,
2787
- WindowConfigs: Dt,
2788
- WindowGroup: _,
2790
+ WindowConfigs: Ft,
2791
+ WindowGroup: G,
2789
2792
  WindowUtils: I,
2790
- checkFeatureSupport: Ue,
2793
+ checkFeatureSupport: Re,
2791
2794
  createCapabilityChecker: L,
2792
- createWindowAwareComponent: Ze,
2795
+ createWindowAwareComponent: Ye,
2793
2796
  detectViewportEnvironment: $,
2794
- disposeViewportManager: Ke,
2797
+ disposeViewportManager: qe,
2795
2798
  getBrowserInfo: Ne,
2796
- getEnvironmentValue: et,
2797
- getOSInfo: Ve,
2799
+ getEnvironmentValue: tt,
2800
+ getOSInfo: Ue,
2798
2801
  getViewportManager: u,
2799
- initializeViewportSystem: zt,
2800
- onAppear: me,
2801
- onDisappear: ge,
2802
- registerViewportModifiers: be,
2803
- setViewportManager: se,
2804
- useCurrentWindow: qe,
2802
+ initializeViewportSystem: Ot,
2803
+ onAppear: ge,
2804
+ onDisappear: be,
2805
+ registerViewportModifiers: ye,
2806
+ setViewportManager: oe,
2807
+ useCurrentWindow: Xe,
2805
2808
  useDismissWindow: z,
2806
2809
  useEnvironmentDismissWindow: z,
2807
2810
  useEnvironmentOpenWindow: H,
2808
2811
  useOpenWindow: H,
2809
- useViewport: he,
2812
+ useViewport: ue,
2810
2813
  useViewportEnvironment: S,
2811
2814
  useViewportInfo: j,
2812
- useViewportManager: Xe,
2813
- withViewportEnvironment: Je
2815
+ useViewportManager: Je,
2816
+ withViewportEnvironment: Ze
2814
2817
  }, Symbol.toStringTag, { value: "Module" }));
2815
2818
  export {
2816
2819
  x as App,
2817
- Ye as EnvironmentKeys,
2818
- oe as ExampleScenes,
2819
- At as PlatformUtils,
2820
+ et as EnvironmentKeys,
2821
+ re as ExampleScenes,
2822
+ Dt as PlatformUtils,
2820
2823
  B as TachUIViewportManager,
2821
- Ht as Viewport,
2822
- Ft as ViewportConstants,
2823
- ae as ViewportEnvironmentProvider,
2824
- Ot as ViewportTypeGuards,
2825
- N as WebViewportAdapter,
2824
+ zt as Viewport,
2825
+ Gt as ViewportConstants,
2826
+ de as ViewportEnvironmentProvider,
2827
+ At as ViewportTypeGuards,
2828
+ V as WebViewportAdapter,
2826
2829
  W as Window,
2827
- Dt as WindowConfigs,
2828
- _ as WindowGroup,
2830
+ Ft as WindowConfigs,
2831
+ G as WindowGroup,
2829
2832
  I as WindowUtils,
2830
- Ue as checkFeatureSupport,
2833
+ Re as checkFeatureSupport,
2831
2834
  L as createCapabilityChecker,
2832
- Ze as createWindowAwareComponent,
2835
+ Ye as createWindowAwareComponent,
2833
2836
  $ as detectViewportEnvironment,
2834
- Ke as disposeViewportManager,
2837
+ qe as disposeViewportManager,
2835
2838
  Ne as getBrowserInfo,
2836
- et as getEnvironmentValue,
2837
- Ve as getOSInfo,
2839
+ tt as getEnvironmentValue,
2840
+ Ue as getOSInfo,
2838
2841
  u as getViewportManager,
2839
- zt as initializeViewportSystem,
2840
- me as onAppear,
2841
- ge as onDisappear,
2842
- be as registerViewportModifiers,
2843
- se as setViewportManager,
2844
- qe as useCurrentWindow,
2842
+ Ot as initializeViewportSystem,
2843
+ ge as onAppear,
2844
+ be as onDisappear,
2845
+ ye as registerViewportModifiers,
2846
+ oe as setViewportManager,
2847
+ Xe as useCurrentWindow,
2845
2848
  z as useDismissWindow,
2846
2849
  z as useEnvironmentDismissWindow,
2847
2850
  H as useEnvironmentOpenWindow,
2848
2851
  H as useOpenWindow,
2849
- he as useViewport,
2852
+ ue as useViewport,
2850
2853
  S as useViewportEnvironment,
2851
2854
  j as useViewportInfo,
2852
- Xe as useViewportManager,
2853
- Je as withViewportEnvironment
2855
+ Je as useViewportManager,
2856
+ Ze as withViewportEnvironment
2854
2857
  };