@tachui/viewport 0.8.27 → 0.8.28

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
@@ -863,6 +863,7 @@ class je {
863
863
  }
864
864
  class Qe {
865
865
  constructor(e, t) {
866
+ o(this, "container");
866
867
  o(this, "id");
867
868
  o(this, "type", "portal");
868
869
  o(this, "config");
@@ -1200,12 +1201,7 @@ class B {
1200
1201
  * Create default adapter based on platform
1201
1202
  */
1202
1203
  createDefaultAdapter() {
1203
- switch (this.environment.platform) {
1204
- case "electron":
1205
- return new V(this.platformConfig);
1206
- default:
1207
- return new V(this.platformConfig);
1208
- }
1204
+ return this.environment.platform === "electron" ? new V(this.platformConfig) : new V(this.platformConfig);
1209
1205
  }
1210
1206
  // ==================== Phase 2: Global State Management ====================
1211
1207
  /**
@@ -1270,6 +1266,9 @@ class B {
1270
1266
  }
1271
1267
  class Ke {
1272
1268
  constructor(e, t, i = "any") {
1269
+ o(this, "id");
1270
+ o(this, "manager");
1271
+ o(this, "dataType");
1273
1272
  o(this, "windows", /* @__PURE__ */ new Map());
1274
1273
  o(this, "defaultOptions", {});
1275
1274
  o(this, "maxInstances", 1 / 0);
@@ -1557,12 +1556,12 @@ class Ke {
1557
1556
  arrangeWindowsAsTiles(e) {
1558
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, c = i / a;
1559
1558
  e.forEach((d, l) => {
1560
- const h = l % s, g = Math.floor(l / s);
1559
+ const u = l % s, g = Math.floor(l / s);
1561
1560
  this.setWindowGroupMetadata(d, {
1562
1561
  tilePosition: {
1563
- col: h,
1562
+ col: u,
1564
1563
  row: g,
1565
- x: h * r,
1564
+ x: u * r,
1566
1565
  y: g * c,
1567
1566
  width: r,
1568
1567
  height: c
@@ -1617,7 +1616,7 @@ class Ke {
1617
1616
  }
1618
1617
  }
1619
1618
  let m = null;
1620
- function u(n = {}) {
1619
+ function h(n = {}) {
1621
1620
  return m || (m = new B(void 0, n)), m;
1622
1621
  }
1623
1622
  function oe(n) {
@@ -1651,17 +1650,17 @@ function W(n) {
1651
1650
  },
1652
1651
  // Open this window
1653
1652
  async open() {
1654
- const e = u(), t = Ce(() => Me((i) => n.children(), `Window-${n.id}`)({}));
1653
+ const e = h(), t = Ce(() => Me((i) => n.children(), `Window-${n.id}`)({}));
1655
1654
  await e.openWindow(n.id, t, n);
1656
1655
  },
1657
1656
  // Close this window
1658
1657
  async close() {
1659
- await u().dismissWindow(n.id);
1658
+ await h().dismissWindow(n.id);
1660
1659
  }
1661
1660
  };
1662
1661
  }
1663
1662
  function G(n) {
1664
- const e = u(), t = e.createWindowGroup(n.id);
1663
+ const e = h(), t = e.createWindowGroup(n.id);
1665
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);
1666
1665
  const {
1667
1666
  groupingStrategy: i,
@@ -1702,8 +1701,8 @@ function G(n) {
1702
1701
  n.children
1703
1702
  );
1704
1703
  else {
1705
- const h = n.children();
1706
- await e.openWindow(n.id, h, n);
1704
+ const u = n.children();
1705
+ await e.openWindow(n.id, u, n);
1707
1706
  }
1708
1707
  },
1709
1708
  // Open window for specific data
@@ -1738,14 +1737,14 @@ function G(n) {
1738
1737
  enableStateSync(l) {
1739
1738
  t.enableStateSync(l);
1740
1739
  },
1741
- syncGroupState(l, h) {
1742
- t.syncState(l, h);
1740
+ syncGroupState(l, u) {
1741
+ t.syncState(l, u);
1743
1742
  },
1744
1743
  getGroupState(l) {
1745
1744
  return t.getSharedState(l);
1746
1745
  },
1747
- onGroupStateChange(l, h) {
1748
- return t.onStateChange(l, h);
1746
+ onGroupStateChange(l, u) {
1747
+ return t.onStateChange(l, u);
1749
1748
  }
1750
1749
  };
1751
1750
  }
@@ -1769,8 +1768,8 @@ function x(n) {
1769
1768
  },
1770
1769
  // Initialize all scenes
1771
1770
  async initialize() {
1772
- if (!u(n.platformConfig)) {
1773
- const { initializeViewportSystem: t } = await Promise.resolve().then(() => _t);
1771
+ if (!h(n.platformConfig)) {
1772
+ const { initializeViewportSystem: t } = await Promise.resolve().then(() => Nt);
1774
1773
  t();
1775
1774
  }
1776
1775
  },
@@ -1925,7 +1924,7 @@ function de({
1925
1924
  children: n,
1926
1925
  manager: e
1927
1926
  }) {
1928
- const t = e || u(), i = {
1927
+ const t = e || h(), i = {
1929
1928
  openWindow: async (s, a, r) => await t.openWindow(s, a, r),
1930
1929
  dismissWindow: async (s) => await t.dismissWindow(s),
1931
1930
  viewportEnvironment: t.environment,
@@ -1964,7 +1963,7 @@ function Xe() {
1964
1963
  return n;
1965
1964
  }
1966
1965
  function Je() {
1967
- return u();
1966
+ return h();
1968
1967
  }
1969
1968
  function Ze(n, e) {
1970
1969
  return (t) => de({
@@ -1999,7 +1998,7 @@ function it() {
1999
1998
  return typeof window > "u" ? 0 : window.innerHeight;
2000
1999
  }
2001
2000
  let O, A, le, ce, T = 0, D = !1;
2002
- function he() {
2001
+ function ue() {
2003
2002
  typeof window > "u" || (le?.(window.innerWidth), ce?.(window.innerHeight));
2004
2003
  }
2005
2004
  function st() {
@@ -2008,12 +2007,12 @@ function st() {
2008
2007
  O = n, A = t, le = e, ce = i;
2009
2008
  }
2010
2009
  function ot() {
2011
- typeof window > "u" || D || (window.addEventListener("resize", he), D = !0);
2010
+ typeof window > "u" || D || (window.addEventListener("resize", ue), D = !0);
2012
2011
  }
2013
2012
  function rt() {
2014
- typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", he), D = !1);
2013
+ typeof window > "u" || !D || T > 0 || (window.removeEventListener("resize", ue), D = !1);
2015
2014
  }
2016
- function ue() {
2015
+ function he() {
2017
2016
  if (st(), T += 1, typeof window > "u")
2018
2017
  return {
2019
2018
  width: O,
@@ -2032,18 +2031,18 @@ function ue() {
2032
2031
  dispose: e
2033
2032
  };
2034
2033
  }
2035
- const at = "0.8.27", dt = at, b = {
2034
+ const at = "0.8.28", dt = at, b = {
2036
2035
  Clean: 0,
2037
2036
  Check: 1,
2038
2037
  Dirty: 2,
2039
2038
  Disposed: 3
2040
2039
  };
2041
2040
  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);
2041
+ let ut = 0;
2042
+ const ht = Math.random().toString(36).substr(2, 6);
2044
2043
  let q = null, X = null;
2045
2044
  const wt = /* @__PURE__ */ new Set();
2046
- wt.add(ut);
2045
+ wt.add(ht);
2047
2046
  const C = {
2048
2047
  get currentComputation() {
2049
2048
  return q;
@@ -2063,7 +2062,7 @@ function we() {
2063
2062
  }
2064
2063
  class pt {
2065
2064
  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 = ++ht, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2065
+ 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 = ++ut, this.fn = e, this.owner = t, t && !t.disposed && t.sources.add(this);
2067
2066
  }
2068
2067
  execute() {
2069
2068
  if (this.state === b.Disposed)
@@ -2097,12 +2096,12 @@ function ft() {
2097
2096
  return C.currentOwner;
2098
2097
  }
2099
2098
  function J(n) {
2100
- return typeof n == "function" && Symbol.for("tachui.signal") in n;
2099
+ return typeof n == "function" && /* @__PURE__ */ Symbol.for("tachui.signal") in n;
2101
2100
  }
2102
2101
  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
2102
  let bt = class extends Error {
2104
2103
  constructor(e, t, i) {
2105
- super(e), this.cause = t, this.node = i, this.name = "ReactiveError";
2104
+ super(e), w(this, "cause", t), w(this, "node", i), this.name = "ReactiveError";
2106
2105
  }
2107
2106
  };
2108
2107
  const yt = class y {
@@ -2311,10 +2310,10 @@ const yt = class y {
2311
2310
  };
2312
2311
  w(yt, "instance", null);
2313
2312
  function U(n) {
2314
- return typeof n == "function" && Symbol.for("tachui.computed") in n;
2313
+ return typeof n == "function" && /* @__PURE__ */ Symbol.for("tachui.computed") in n;
2315
2314
  }
2316
2315
  function vt(n) {
2317
- return n[Symbol.for("tachui.computed")] || null;
2316
+ return n[/* @__PURE__ */ Symbol.for("tachui.computed")] || null;
2318
2317
  }
2319
2318
  function Wt(n) {
2320
2319
  const e = vt(n);
@@ -2412,7 +2411,7 @@ function Pt({
2412
2411
  a = { effect: pe(() => {
2413
2412
  const l = e();
2414
2413
  d.forEach(
2415
- (h, g) => Z(h, l, g)
2414
+ (u, g) => Z(u, l, g)
2416
2415
  );
2417
2416
  }), updaters: d }, s.set(e, a);
2418
2417
  }
@@ -2425,12 +2424,13 @@ function Pt({
2425
2424
  };
2426
2425
  ft() ? St(c) : r = kt(n, c);
2427
2426
  }
2428
- const ee = Symbol.for("tachui.modifier.instanceId"), Tt = "core";
2427
+ var Tt = Object.defineProperty, xt = (n, e, t) => e in n ? Tt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, It = (n, e, t) => xt(n, e + "", t);
2428
+ const ee = /* @__PURE__ */ Symbol.for("tachui.modifier.instanceId"), Ht = "core";
2429
2429
  let te = 0;
2430
2430
  function ne(n) {
2431
2431
  return typeof HTMLElement < "u" && n instanceof HTMLElement;
2432
2432
  }
2433
- function xt(n) {
2433
+ function zt(n) {
2434
2434
  const e = n[ee];
2435
2435
  if (typeof e == "number") return e;
2436
2436
  te += 1;
@@ -2442,9 +2442,9 @@ function xt(n) {
2442
2442
  writable: !1
2443
2443
  }), t;
2444
2444
  }
2445
- class It {
2445
+ class Ot {
2446
2446
  constructor(e) {
2447
- this.properties = e;
2447
+ It(this, "properties", e);
2448
2448
  }
2449
2449
  getStaticCSS(e) {
2450
2450
  return [];
@@ -2533,11 +2533,11 @@ class It {
2533
2533
  if (c !== void 0) {
2534
2534
  const d = this.toCSSProperty(r);
2535
2535
  if (J(c) || U(c)) {
2536
- const l = c, h = xt(this);
2536
+ const l = c, u = zt(this);
2537
2537
  Pt({
2538
2538
  element: e,
2539
2539
  accessor: l,
2540
- updaterId: `${Tt}:${h}:${d}`,
2540
+ updaterId: `${Ht}:${u}:${d}`,
2541
2541
  updater: (g) => {
2542
2542
  const ve = this.toCSSValueForProperty(d, g);
2543
2543
  a(d, ve);
@@ -2576,7 +2576,7 @@ class It {
2576
2576
  }
2577
2577
  }
2578
2578
  const k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
2579
- class me extends It {
2579
+ class me extends Ot {
2580
2580
  constructor() {
2581
2581
  super(...arguments);
2582
2582
  o(this, "type", "viewportLifecycle");
@@ -2600,8 +2600,8 @@ class me extends It {
2600
2600
  a.unobserve(d), P.delete(d), k.delete(d);
2601
2601
  return;
2602
2602
  }
2603
- const l = k.get(d) ?? { isVisible: !1 }, h = c.isIntersecting;
2604
- h !== l.isVisible && (l.isVisible = h, k.set(d, l), h && i.onAppear ? i.onAppear() : !h && i.onDisappear && i.onDisappear());
2603
+ const l = k.get(d) ?? { isVisible: !1 }, u = c.isIntersecting;
2604
+ u !== l.isVisible && (l.isVisible = u, k.set(d, l), u && i.onAppear ? i.onAppear() : !u && i.onDisappear && i.onDisappear());
2605
2605
  });
2606
2606
  },
2607
2607
  {
@@ -2620,7 +2620,7 @@ function ge(n) {
2620
2620
  function be(n) {
2621
2621
  return new me({ onDisappear: n });
2622
2622
  }
2623
- const Ht = {
2623
+ const At = {
2624
2624
  name: "@tachui/viewport",
2625
2625
  version: dt,
2626
2626
  author: "TachUI Team",
@@ -2633,7 +2633,7 @@ const Ht = {
2633
2633
  };
2634
2634
  let se = !1;
2635
2635
  function ye(n) {
2636
- const e = n?.registry, t = n?.plugin ?? Ht, i = n?.force === !0, s = !!(e || n?.plugin);
2636
+ const e = n?.registry, t = n?.plugin ?? At, i = n?.force === !0, s = !!(e || n?.plugin);
2637
2637
  !s && se && !i || (Q(
2638
2638
  "onAppear",
2639
2639
  ge,
@@ -2655,14 +2655,14 @@ function ye(n) {
2655
2655
  ), s || (se = !0));
2656
2656
  }
2657
2657
  ye();
2658
- const zt = {
2658
+ const Dt = {
2659
2659
  // Manager
2660
- getManager: u,
2660
+ getManager: h,
2661
2661
  // Environment
2662
2662
  useOpenWindow: H,
2663
2663
  useDismissWindow: z,
2664
2664
  useViewportInfo: j,
2665
- useViewport: ue,
2665
+ useViewport: he,
2666
2666
  // Components
2667
2667
  Window: W,
2668
2668
  WindowGroup: G,
@@ -2671,38 +2671,38 @@ const zt = {
2671
2671
  Utils: I,
2672
2672
  Examples: re
2673
2673
  };
2674
- function Ot(n) {
2674
+ function Ft(n) {
2675
2675
  const e = new B(n?.customAdapter);
2676
2676
  return oe(e), e;
2677
2677
  }
2678
- const At = {
2678
+ const Gt = {
2679
2679
  isWindow: (n) => n.type === "window",
2680
2680
  isModal: (n) => n.type === "modal",
2681
2681
  isPortal: (n) => n.type === "portal",
2682
2682
  isSheet: (n) => n.type === "sheet",
2683
2683
  isPopover: (n) => n.type === "popover"
2684
- }, Dt = {
2684
+ }, _t = {
2685
2685
  /**
2686
2686
  * Check if running in Electron
2687
2687
  */
2688
- isElectron: () => u().environment.platform === "electron",
2688
+ isElectron: () => h().environment.platform === "electron",
2689
2689
  /**
2690
2690
  * Check if on mobile
2691
2691
  */
2692
- isMobile: () => u().environment.platform === "mobile",
2692
+ isMobile: () => h().environment.platform === "mobile",
2693
2693
  /**
2694
2694
  * Check if multi-window is supported
2695
2695
  */
2696
- supportsMultiWindow: () => u().environment.capabilities.multiWindow,
2696
+ supportsMultiWindow: () => h().environment.capabilities.multiWindow,
2697
2697
  /**
2698
2698
  * Check if native windows are supported
2699
2699
  */
2700
- supportsNativeWindows: () => u().environment.capabilities.nativeWindows,
2700
+ supportsNativeWindows: () => h().environment.capabilities.nativeWindows,
2701
2701
  /**
2702
2702
  * Get optimal window type for current platform
2703
2703
  */
2704
- getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2705
- }, Ft = {
2704
+ getOptimalWindowType: (n = !1) => h().getOptimalWindowType({ preferNativeWindow: n })
2705
+ }, Lt = {
2706
2706
  /**
2707
2707
  * Standard document window
2708
2708
  */
@@ -2769,7 +2769,7 @@ const At = {
2769
2769
  minimizable: !1,
2770
2770
  maximizable: !1
2771
2771
  })
2772
- }, Gt = {
2772
+ }, Vt = {
2773
2773
  DEFAULT_WINDOW_WIDTH: 800,
2774
2774
  DEFAULT_WINDOW_HEIGHT: 600,
2775
2775
  MIN_WINDOW_WIDTH: 300,
@@ -2777,20 +2777,20 @@ const At = {
2777
2777
  MODAL_Z_INDEX: 1e3,
2778
2778
  PORTAL_Z_INDEX: 999,
2779
2779
  ANIMATION_DURATION: 200
2780
- }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2780
+ }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2781
2781
  __proto__: null,
2782
2782
  App: x,
2783
2783
  EnvironmentKeys: et,
2784
2784
  ExampleScenes: re,
2785
- PlatformUtils: Dt,
2785
+ PlatformUtils: _t,
2786
2786
  TachUIViewportManager: B,
2787
- Viewport: zt,
2788
- ViewportConstants: Gt,
2787
+ Viewport: Dt,
2788
+ ViewportConstants: Vt,
2789
2789
  ViewportEnvironmentProvider: de,
2790
- ViewportTypeGuards: At,
2790
+ ViewportTypeGuards: Gt,
2791
2791
  WebViewportAdapter: V,
2792
2792
  Window: W,
2793
- WindowConfigs: Ft,
2793
+ WindowConfigs: Lt,
2794
2794
  WindowGroup: G,
2795
2795
  WindowUtils: I,
2796
2796
  checkFeatureSupport: Re,
@@ -2801,8 +2801,8 @@ const At = {
2801
2801
  getBrowserInfo: Ne,
2802
2802
  getEnvironmentValue: tt,
2803
2803
  getOSInfo: Ue,
2804
- getViewportManager: u,
2805
- initializeViewportSystem: Ot,
2804
+ getViewportManager: h,
2805
+ initializeViewportSystem: Ft,
2806
2806
  onAppear: ge,
2807
2807
  onDisappear: be,
2808
2808
  registerViewportModifiers: ye,
@@ -2812,7 +2812,7 @@ const At = {
2812
2812
  useEnvironmentDismissWindow: z,
2813
2813
  useEnvironmentOpenWindow: H,
2814
2814
  useOpenWindow: H,
2815
- useViewport: ue,
2815
+ useViewport: he,
2816
2816
  useViewportEnvironment: S,
2817
2817
  useViewportInfo: j,
2818
2818
  useViewportManager: Je,
@@ -2822,15 +2822,15 @@ export {
2822
2822
  x as App,
2823
2823
  et as EnvironmentKeys,
2824
2824
  re as ExampleScenes,
2825
- Dt as PlatformUtils,
2825
+ _t as PlatformUtils,
2826
2826
  B as TachUIViewportManager,
2827
- zt as Viewport,
2828
- Gt as ViewportConstants,
2827
+ Dt as Viewport,
2828
+ Vt as ViewportConstants,
2829
2829
  de as ViewportEnvironmentProvider,
2830
- At as ViewportTypeGuards,
2830
+ Gt as ViewportTypeGuards,
2831
2831
  V as WebViewportAdapter,
2832
2832
  W as Window,
2833
- Ft as WindowConfigs,
2833
+ Lt as WindowConfigs,
2834
2834
  G as WindowGroup,
2835
2835
  I as WindowUtils,
2836
2836
  Re as checkFeatureSupport,
@@ -2841,8 +2841,8 @@ export {
2841
2841
  Ne as getBrowserInfo,
2842
2842
  tt as getEnvironmentValue,
2843
2843
  Ue as getOSInfo,
2844
- u as getViewportManager,
2845
- Ot as initializeViewportSystem,
2844
+ h as getViewportManager,
2845
+ Ft as initializeViewportSystem,
2846
2846
  ge as onAppear,
2847
2847
  be as onDisappear,
2848
2848
  ye as registerViewportModifiers,
@@ -2852,7 +2852,7 @@ export {
2852
2852
  z as useEnvironmentDismissWindow,
2853
2853
  H as useEnvironmentOpenWindow,
2854
2854
  H as useOpenWindow,
2855
- ue as useViewport,
2855
+ he as useViewport,
2856
2856
  S as useViewportEnvironment,
2857
2857
  j as useViewportInfo,
2858
2858
  Je as useViewportManager,