@tachui/viewport 0.8.26 → 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.26", 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,12 @@ 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
+ }
2449
+ getStaticCSS(e) {
2450
+ return [];
2448
2451
  }
2449
2452
  /**
2450
2453
  * Helper to resolve reactive properties
@@ -2530,11 +2533,11 @@ class It {
2530
2533
  if (c !== void 0) {
2531
2534
  const d = this.toCSSProperty(r);
2532
2535
  if (J(c) || U(c)) {
2533
- const l = c, h = xt(this);
2536
+ const l = c, u = zt(this);
2534
2537
  Pt({
2535
2538
  element: e,
2536
2539
  accessor: l,
2537
- updaterId: `${Tt}:${h}:${d}`,
2540
+ updaterId: `${Ht}:${u}:${d}`,
2538
2541
  updater: (g) => {
2539
2542
  const ve = this.toCSSValueForProperty(d, g);
2540
2543
  a(d, ve);
@@ -2573,7 +2576,7 @@ class It {
2573
2576
  }
2574
2577
  }
2575
2578
  const k = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
2576
- class me extends It {
2579
+ class me extends Ot {
2577
2580
  constructor() {
2578
2581
  super(...arguments);
2579
2582
  o(this, "type", "viewportLifecycle");
@@ -2597,8 +2600,8 @@ class me extends It {
2597
2600
  a.unobserve(d), P.delete(d), k.delete(d);
2598
2601
  return;
2599
2602
  }
2600
- const l = k.get(d) ?? { isVisible: !1 }, h = c.isIntersecting;
2601
- 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());
2602
2605
  });
2603
2606
  },
2604
2607
  {
@@ -2617,7 +2620,7 @@ function ge(n) {
2617
2620
  function be(n) {
2618
2621
  return new me({ onDisappear: n });
2619
2622
  }
2620
- const Ht = {
2623
+ const At = {
2621
2624
  name: "@tachui/viewport",
2622
2625
  version: dt,
2623
2626
  author: "TachUI Team",
@@ -2630,7 +2633,7 @@ const Ht = {
2630
2633
  };
2631
2634
  let se = !1;
2632
2635
  function ye(n) {
2633
- 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);
2634
2637
  !s && se && !i || (Q(
2635
2638
  "onAppear",
2636
2639
  ge,
@@ -2652,14 +2655,14 @@ function ye(n) {
2652
2655
  ), s || (se = !0));
2653
2656
  }
2654
2657
  ye();
2655
- const zt = {
2658
+ const Dt = {
2656
2659
  // Manager
2657
- getManager: u,
2660
+ getManager: h,
2658
2661
  // Environment
2659
2662
  useOpenWindow: H,
2660
2663
  useDismissWindow: z,
2661
2664
  useViewportInfo: j,
2662
- useViewport: ue,
2665
+ useViewport: he,
2663
2666
  // Components
2664
2667
  Window: W,
2665
2668
  WindowGroup: G,
@@ -2668,38 +2671,38 @@ const zt = {
2668
2671
  Utils: I,
2669
2672
  Examples: re
2670
2673
  };
2671
- function Ot(n) {
2674
+ function Ft(n) {
2672
2675
  const e = new B(n?.customAdapter);
2673
2676
  return oe(e), e;
2674
2677
  }
2675
- const At = {
2678
+ const Gt = {
2676
2679
  isWindow: (n) => n.type === "window",
2677
2680
  isModal: (n) => n.type === "modal",
2678
2681
  isPortal: (n) => n.type === "portal",
2679
2682
  isSheet: (n) => n.type === "sheet",
2680
2683
  isPopover: (n) => n.type === "popover"
2681
- }, Dt = {
2684
+ }, _t = {
2682
2685
  /**
2683
2686
  * Check if running in Electron
2684
2687
  */
2685
- isElectron: () => u().environment.platform === "electron",
2688
+ isElectron: () => h().environment.platform === "electron",
2686
2689
  /**
2687
2690
  * Check if on mobile
2688
2691
  */
2689
- isMobile: () => u().environment.platform === "mobile",
2692
+ isMobile: () => h().environment.platform === "mobile",
2690
2693
  /**
2691
2694
  * Check if multi-window is supported
2692
2695
  */
2693
- supportsMultiWindow: () => u().environment.capabilities.multiWindow,
2696
+ supportsMultiWindow: () => h().environment.capabilities.multiWindow,
2694
2697
  /**
2695
2698
  * Check if native windows are supported
2696
2699
  */
2697
- supportsNativeWindows: () => u().environment.capabilities.nativeWindows,
2700
+ supportsNativeWindows: () => h().environment.capabilities.nativeWindows,
2698
2701
  /**
2699
2702
  * Get optimal window type for current platform
2700
2703
  */
2701
- getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
2702
- }, Ft = {
2704
+ getOptimalWindowType: (n = !1) => h().getOptimalWindowType({ preferNativeWindow: n })
2705
+ }, Lt = {
2703
2706
  /**
2704
2707
  * Standard document window
2705
2708
  */
@@ -2766,7 +2769,7 @@ const At = {
2766
2769
  minimizable: !1,
2767
2770
  maximizable: !1
2768
2771
  })
2769
- }, Gt = {
2772
+ }, Vt = {
2770
2773
  DEFAULT_WINDOW_WIDTH: 800,
2771
2774
  DEFAULT_WINDOW_HEIGHT: 600,
2772
2775
  MIN_WINDOW_WIDTH: 300,
@@ -2774,20 +2777,20 @@ const At = {
2774
2777
  MODAL_Z_INDEX: 1e3,
2775
2778
  PORTAL_Z_INDEX: 999,
2776
2779
  ANIMATION_DURATION: 200
2777
- }, _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2780
+ }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2778
2781
  __proto__: null,
2779
2782
  App: x,
2780
2783
  EnvironmentKeys: et,
2781
2784
  ExampleScenes: re,
2782
- PlatformUtils: Dt,
2785
+ PlatformUtils: _t,
2783
2786
  TachUIViewportManager: B,
2784
- Viewport: zt,
2785
- ViewportConstants: Gt,
2787
+ Viewport: Dt,
2788
+ ViewportConstants: Vt,
2786
2789
  ViewportEnvironmentProvider: de,
2787
- ViewportTypeGuards: At,
2790
+ ViewportTypeGuards: Gt,
2788
2791
  WebViewportAdapter: V,
2789
2792
  Window: W,
2790
- WindowConfigs: Ft,
2793
+ WindowConfigs: Lt,
2791
2794
  WindowGroup: G,
2792
2795
  WindowUtils: I,
2793
2796
  checkFeatureSupport: Re,
@@ -2798,8 +2801,8 @@ const At = {
2798
2801
  getBrowserInfo: Ne,
2799
2802
  getEnvironmentValue: tt,
2800
2803
  getOSInfo: Ue,
2801
- getViewportManager: u,
2802
- initializeViewportSystem: Ot,
2804
+ getViewportManager: h,
2805
+ initializeViewportSystem: Ft,
2803
2806
  onAppear: ge,
2804
2807
  onDisappear: be,
2805
2808
  registerViewportModifiers: ye,
@@ -2809,7 +2812,7 @@ const At = {
2809
2812
  useEnvironmentDismissWindow: z,
2810
2813
  useEnvironmentOpenWindow: H,
2811
2814
  useOpenWindow: H,
2812
- useViewport: ue,
2815
+ useViewport: he,
2813
2816
  useViewportEnvironment: S,
2814
2817
  useViewportInfo: j,
2815
2818
  useViewportManager: Je,
@@ -2819,15 +2822,15 @@ export {
2819
2822
  x as App,
2820
2823
  et as EnvironmentKeys,
2821
2824
  re as ExampleScenes,
2822
- Dt as PlatformUtils,
2825
+ _t as PlatformUtils,
2823
2826
  B as TachUIViewportManager,
2824
- zt as Viewport,
2825
- Gt as ViewportConstants,
2827
+ Dt as Viewport,
2828
+ Vt as ViewportConstants,
2826
2829
  de as ViewportEnvironmentProvider,
2827
- At as ViewportTypeGuards,
2830
+ Gt as ViewportTypeGuards,
2828
2831
  V as WebViewportAdapter,
2829
2832
  W as Window,
2830
- Ft as WindowConfigs,
2833
+ Lt as WindowConfigs,
2831
2834
  G as WindowGroup,
2832
2835
  I as WindowUtils,
2833
2836
  Re as checkFeatureSupport,
@@ -2838,8 +2841,8 @@ export {
2838
2841
  Ne as getBrowserInfo,
2839
2842
  tt as getEnvironmentValue,
2840
2843
  Ue as getOSInfo,
2841
- u as getViewportManager,
2842
- Ot as initializeViewportSystem,
2844
+ h as getViewportManager,
2845
+ Ft as initializeViewportSystem,
2843
2846
  ge as onAppear,
2844
2847
  be as onDisappear,
2845
2848
  ye as registerViewportModifiers,
@@ -2849,7 +2852,7 @@ export {
2849
2852
  z as useEnvironmentDismissWindow,
2850
2853
  H as useEnvironmentOpenWindow,
2851
2854
  H as useOpenWindow,
2852
- ue as useViewport,
2855
+ he as useViewport,
2853
2856
  S as useViewportEnvironment,
2854
2857
  j as useViewportInfo,
2855
2858
  Je as useViewportManager,