@tachui/viewport 0.8.0-alpha → 0.8.5-alpha
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 +284 -223
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (n, e, t) =>
|
|
4
|
-
import { createSignal as
|
|
5
|
-
|
|
6
|
-
|
|
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();
|
|
7
8
|
return {
|
|
8
9
|
platform: e,
|
|
9
10
|
capabilities: t,
|
|
@@ -12,20 +13,20 @@ function O(n = {}) {
|
|
|
12
13
|
isTouch: a
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
16
|
+
function ue() {
|
|
17
|
+
return pe() ? "electron" : we() ? "mobile" : fe() ? "embedded" : "web";
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function pe() {
|
|
19
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;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
+
function we() {
|
|
22
23
|
if (typeof window > "u") return !1;
|
|
23
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(
|
|
24
25
|
navigator.userAgent
|
|
25
26
|
), i = window.matchMedia?.("(pointer: coarse)")?.matches, s = window.matchMedia?.("(max-width: 768px)")?.matches;
|
|
26
27
|
return n || e && t || i || s;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function fe() {
|
|
29
30
|
if (typeof window > "u") return !1;
|
|
30
31
|
try {
|
|
31
32
|
return window.self !== window.top;
|
|
@@ -33,7 +34,7 @@ function ae() {
|
|
|
33
34
|
return !0;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function me(n, e) {
|
|
37
38
|
const t = {
|
|
38
39
|
multiWindow: !1,
|
|
39
40
|
nativeWindows: !1,
|
|
@@ -59,9 +60,9 @@ function le(n, e) {
|
|
|
59
60
|
case "web":
|
|
60
61
|
return {
|
|
61
62
|
...t,
|
|
62
|
-
multiWindow: e.enablePopupTest ?
|
|
63
|
-
crossWindowCommunication:
|
|
64
|
-
fullscreenSupport:
|
|
63
|
+
multiWindow: e.enablePopupTest ? ge() : !1,
|
|
64
|
+
crossWindowCommunication: be() || ye(),
|
|
65
|
+
fullscreenSupport: G(),
|
|
65
66
|
windowResizing: !1,
|
|
66
67
|
// Browser windows can't be resized programmatically
|
|
67
68
|
windowMinimizing: !1
|
|
@@ -69,7 +70,7 @@ function le(n, e) {
|
|
|
69
70
|
case "mobile":
|
|
70
71
|
return {
|
|
71
72
|
...t,
|
|
72
|
-
fullscreenSupport:
|
|
73
|
+
fullscreenSupport: G(),
|
|
73
74
|
modalOverlays: !0
|
|
74
75
|
};
|
|
75
76
|
case "embedded":
|
|
@@ -81,7 +82,7 @@ function le(n, e) {
|
|
|
81
82
|
return t;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function ge() {
|
|
85
86
|
if (typeof window > "u" || typeof window.navigator < "u" && window.navigator.userAgent.includes("jsdom"))
|
|
86
87
|
return !1;
|
|
87
88
|
try {
|
|
@@ -91,28 +92,28 @@ function de() {
|
|
|
91
92
|
return !1;
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function be() {
|
|
95
96
|
return typeof window < "u" && "BroadcastChannel" in window;
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function ye() {
|
|
98
99
|
return typeof window < "u" && "MessageChannel" in window;
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function G() {
|
|
101
102
|
return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function ve() {
|
|
104
105
|
return typeof navigator > "u" ? "unknown" : navigator.userAgent;
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function We() {
|
|
107
108
|
return typeof window > "u" ? { width: 1920, height: 1080 } : {
|
|
108
109
|
width: window.screen?.width || window.innerWidth || 1920,
|
|
109
110
|
height: window.screen?.height || window.innerHeight || 1080
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function Se() {
|
|
113
114
|
return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function Ee() {
|
|
116
117
|
if (typeof navigator > "u")
|
|
117
118
|
return {
|
|
118
119
|
name: "unknown",
|
|
@@ -140,7 +141,7 @@ function fe() {
|
|
|
140
141
|
}
|
|
141
142
|
return { name: e, version: t, engine: i };
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function Ce() {
|
|
144
145
|
if (typeof navigator > "u")
|
|
145
146
|
return {
|
|
146
147
|
name: "unknown",
|
|
@@ -167,7 +168,7 @@ function me() {
|
|
|
167
168
|
}
|
|
168
169
|
return { name: e, version: t };
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function Me() {
|
|
171
172
|
return typeof window > "u" ? {
|
|
172
173
|
webgl: !1,
|
|
173
174
|
webgl2: !1,
|
|
@@ -188,7 +189,7 @@ function ge() {
|
|
|
188
189
|
resizeObserver: "ResizeObserver" in window
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function O(n) {
|
|
192
193
|
return {
|
|
193
194
|
canOpenWindow: (e = !1) => e ? n.capabilities.nativeWindows : n.capabilities.multiWindow || n.capabilities.modalOverlays,
|
|
194
195
|
canCommunicateBetweenWindows: () => n.capabilities.crossWindowCommunication,
|
|
@@ -199,7 +200,7 @@ function H(n) {
|
|
|
199
200
|
getOptimalViewportType: (e = !1) => e && n.capabilities.nativeWindows ? "window" : n.capabilities.modalOverlays ? "modal" : n.platform === "mobile" ? "sheet" : "portal"
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
|
-
class
|
|
203
|
+
class Pe {
|
|
203
204
|
// Fallback strategies
|
|
204
205
|
createModal(e) {
|
|
205
206
|
throw new Error("Modal fallback not implemented");
|
|
@@ -208,7 +209,7 @@ class be {
|
|
|
208
209
|
throw new Error("Portal fallback not implemented");
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
class
|
|
212
|
+
class H extends Pe {
|
|
212
213
|
constructor(t = {}) {
|
|
213
214
|
super();
|
|
214
215
|
o(this, "environment");
|
|
@@ -217,7 +218,7 @@ class D extends be {
|
|
|
217
218
|
o(this, "popups", /* @__PURE__ */ new Map());
|
|
218
219
|
o(this, "portalContainer", null);
|
|
219
220
|
o(this, "broadcastChannel", null);
|
|
220
|
-
this.environment =
|
|
221
|
+
this.environment = z(t), this.initializePortalContainer();
|
|
221
222
|
}
|
|
222
223
|
/**
|
|
223
224
|
* Check if we can create a window with given config
|
|
@@ -321,21 +322,21 @@ class D extends be {
|
|
|
321
322
|
* Create popup window (native browser window)
|
|
322
323
|
*/
|
|
323
324
|
createPopupWindow(t) {
|
|
324
|
-
const i = new
|
|
325
|
+
const i = new ke(t);
|
|
325
326
|
return this.popups.set(t.id, i), i;
|
|
326
327
|
}
|
|
327
328
|
/**
|
|
328
329
|
* Create modal overlay
|
|
329
330
|
*/
|
|
330
331
|
createModal(t) {
|
|
331
|
-
const i = new
|
|
332
|
+
const i = new xe(t);
|
|
332
333
|
return this.modals.set(t.id, i), i;
|
|
333
334
|
}
|
|
334
335
|
/**
|
|
335
336
|
* Create portal
|
|
336
337
|
*/
|
|
337
338
|
createPortal(t) {
|
|
338
|
-
const i = new
|
|
339
|
+
const i = new Te(t, this.portalContainer);
|
|
339
340
|
return this.portals.set(t.id, i), i;
|
|
340
341
|
}
|
|
341
342
|
/**
|
|
@@ -428,7 +429,7 @@ class D extends be {
|
|
|
428
429
|
`, document.head.appendChild(i);
|
|
429
430
|
}
|
|
430
431
|
}
|
|
431
|
-
class
|
|
432
|
+
class ke {
|
|
432
433
|
constructor(e) {
|
|
433
434
|
o(this, "id");
|
|
434
435
|
o(this, "type", "window");
|
|
@@ -439,7 +440,7 @@ class ye {
|
|
|
439
440
|
o(this, "eventHandlers", /* @__PURE__ */ new Map());
|
|
440
441
|
o(this, "setState");
|
|
441
442
|
this.id = e.id, this.config = e;
|
|
442
|
-
const [t, i] =
|
|
443
|
+
const [t, i] = D({
|
|
443
444
|
id: e.id,
|
|
444
445
|
title: e.title || e.id,
|
|
445
446
|
isVisible: !1,
|
|
@@ -637,7 +638,7 @@ class ye {
|
|
|
637
638
|
removeChildWindow(e) {
|
|
638
639
|
}
|
|
639
640
|
}
|
|
640
|
-
class
|
|
641
|
+
class xe {
|
|
641
642
|
constructor(e) {
|
|
642
643
|
o(this, "id");
|
|
643
644
|
o(this, "type", "modal");
|
|
@@ -655,7 +656,7 @@ class ve {
|
|
|
655
656
|
o(this, "parentWindow", null);
|
|
656
657
|
o(this, "tabContainer", null);
|
|
657
658
|
this.id = e.id, this.config = e;
|
|
658
|
-
const [t, i] =
|
|
659
|
+
const [t, i] = D({
|
|
659
660
|
id: e.id,
|
|
660
661
|
title: e.title || e.id,
|
|
661
662
|
isVisible: !1,
|
|
@@ -859,7 +860,7 @@ class ve {
|
|
|
859
860
|
e && e.remove();
|
|
860
861
|
}
|
|
861
862
|
}
|
|
862
|
-
class
|
|
863
|
+
class Te {
|
|
863
864
|
constructor(e, t) {
|
|
864
865
|
o(this, "id");
|
|
865
866
|
o(this, "type", "portal");
|
|
@@ -877,7 +878,7 @@ class We {
|
|
|
877
878
|
o(this, "parentWindow", null);
|
|
878
879
|
o(this, "tabContainer", null);
|
|
879
880
|
this.container = t, this.id = e.id, this.config = e;
|
|
880
|
-
const [i, s] =
|
|
881
|
+
const [i, s] = D({
|
|
881
882
|
id: e.id,
|
|
882
883
|
title: e.title || e.id,
|
|
883
884
|
isVisible: !1,
|
|
@@ -904,7 +905,7 @@ class We {
|
|
|
904
905
|
if (this.portalElement) {
|
|
905
906
|
this.portalElement.innerHTML = "";
|
|
906
907
|
try {
|
|
907
|
-
const t =
|
|
908
|
+
const t = ae(e, this.portalElement);
|
|
908
909
|
this.cleanupFunction = t;
|
|
909
910
|
} catch (t) {
|
|
910
911
|
console.error("Error during mountComponentTree:", t);
|
|
@@ -1095,7 +1096,7 @@ class A {
|
|
|
1095
1096
|
o(this, "globalStateCallbacks", /* @__PURE__ */ new Map());
|
|
1096
1097
|
o(this, "environment");
|
|
1097
1098
|
o(this, "platformConfig");
|
|
1098
|
-
this.platformConfig = t, this.environment =
|
|
1099
|
+
this.platformConfig = t, this.environment = z(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
|
|
1099
1100
|
}
|
|
1100
1101
|
/**
|
|
1101
1102
|
* Open a new window/viewport
|
|
@@ -1142,20 +1143,20 @@ class A {
|
|
|
1142
1143
|
createWindowGroup(e) {
|
|
1143
1144
|
if (this.windowGroups.has(e))
|
|
1144
1145
|
return this.windowGroups.get(e);
|
|
1145
|
-
const t = new
|
|
1146
|
+
const t = new Ie(e, this);
|
|
1146
1147
|
return this.windowGroups.set(e, t), t;
|
|
1147
1148
|
}
|
|
1148
1149
|
/**
|
|
1149
1150
|
* Check if we can open a window with given options
|
|
1150
1151
|
*/
|
|
1151
1152
|
canOpenWindow(e = {}) {
|
|
1152
|
-
return
|
|
1153
|
+
return O(this.environment).canOpenWindow(e.preferNativeWindow);
|
|
1153
1154
|
}
|
|
1154
1155
|
/**
|
|
1155
1156
|
* Get optimal window type for given options
|
|
1156
1157
|
*/
|
|
1157
1158
|
getOptimalWindowType(e = {}) {
|
|
1158
|
-
const t =
|
|
1159
|
+
const t = O(this.environment);
|
|
1159
1160
|
return e.preferNativeWindow && this.environment.capabilities.nativeWindows ? "window" : e.modal !== !1 && this.environment.capabilities.modalOverlays ? "modal" : t.getOptimalViewportType(e.preferNativeWindow);
|
|
1160
1161
|
}
|
|
1161
1162
|
/**
|
|
@@ -1200,9 +1201,9 @@ class A {
|
|
|
1200
1201
|
createDefaultAdapter() {
|
|
1201
1202
|
switch (this.environment.platform) {
|
|
1202
1203
|
case "electron":
|
|
1203
|
-
return new
|
|
1204
|
+
return new H(this.platformConfig);
|
|
1204
1205
|
default:
|
|
1205
|
-
return new
|
|
1206
|
+
return new H(this.platformConfig);
|
|
1206
1207
|
}
|
|
1207
1208
|
}
|
|
1208
1209
|
// ==================== Phase 2: Global State Management ====================
|
|
@@ -1266,7 +1267,7 @@ class A {
|
|
|
1266
1267
|
});
|
|
1267
1268
|
}
|
|
1268
1269
|
}
|
|
1269
|
-
class
|
|
1270
|
+
class Ie {
|
|
1270
1271
|
constructor(e, t, i = "any") {
|
|
1271
1272
|
o(this, "windows", /* @__PURE__ */ new Map());
|
|
1272
1273
|
o(this, "defaultOptions", {});
|
|
@@ -1304,8 +1305,8 @@ class Se {
|
|
|
1304
1305
|
return await a.show(), await a.focus(), a.markAsUsed(), a;
|
|
1305
1306
|
let r = await this.getPooledWindow();
|
|
1306
1307
|
if (r) {
|
|
1307
|
-
const
|
|
1308
|
-
return r.render(
|
|
1308
|
+
const d = t(e);
|
|
1309
|
+
return r.render(d), this.setWindowGroupMetadata(r, {
|
|
1309
1310
|
id: s,
|
|
1310
1311
|
groupId: this.id,
|
|
1311
1312
|
isPooled: !1,
|
|
@@ -1313,8 +1314,8 @@ class Se {
|
|
|
1313
1314
|
}), await r.show(), await r.focus(), this.windows.set(i, r), this.emitEvent("window:reused", r, e), r;
|
|
1314
1315
|
}
|
|
1315
1316
|
if (this.windows.size >= this.maxInstances) {
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1317
|
+
const d = this.windows.values().next().value;
|
|
1318
|
+
d && (this.poolConfig.enabled ? await this.returnToPool(d) : await d.close());
|
|
1318
1319
|
}
|
|
1319
1320
|
const h = t(e);
|
|
1320
1321
|
return r = await this.manager.openWindow(
|
|
@@ -1554,9 +1555,9 @@ class Se {
|
|
|
1554
1555
|
}
|
|
1555
1556
|
arrangeWindowsAsTiles(e) {
|
|
1556
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
|
-
e.forEach((
|
|
1558
|
+
e.forEach((d, l) => {
|
|
1558
1559
|
const w = l % s, F = Math.floor(l / s);
|
|
1559
|
-
this.setWindowGroupMetadata(
|
|
1560
|
+
this.setWindowGroupMetadata(d, {
|
|
1560
1561
|
tilePosition: {
|
|
1561
1562
|
col: w,
|
|
1562
1563
|
row: F,
|
|
@@ -1618,10 +1619,10 @@ let m = null;
|
|
|
1618
1619
|
function u(n = {}) {
|
|
1619
1620
|
return m || (m = new A(void 0, n)), m;
|
|
1620
1621
|
}
|
|
1621
|
-
function
|
|
1622
|
+
function Q(n) {
|
|
1622
1623
|
m?.dispose(), m = n;
|
|
1623
1624
|
}
|
|
1624
|
-
function
|
|
1625
|
+
function Oe() {
|
|
1625
1626
|
m?.dispose(), m = null;
|
|
1626
1627
|
}
|
|
1627
1628
|
function y(n) {
|
|
@@ -1649,7 +1650,7 @@ function y(n) {
|
|
|
1649
1650
|
},
|
|
1650
1651
|
// Open this window
|
|
1651
1652
|
async open() {
|
|
1652
|
-
const e = u(), t =
|
|
1653
|
+
const e = u(), t = le(() => de((i) => n.children(), `Window-${n.id}`)({}));
|
|
1653
1654
|
await e.openWindow(n.id, t, n);
|
|
1654
1655
|
},
|
|
1655
1656
|
// Close this window
|
|
@@ -1667,9 +1668,9 @@ function T(n) {
|
|
|
1667
1668
|
poolConfig: a,
|
|
1668
1669
|
stateSyncScope: r,
|
|
1669
1670
|
maxInstances: h,
|
|
1670
|
-
...
|
|
1671
|
+
...d
|
|
1671
1672
|
} = n;
|
|
1672
|
-
return t.setDefaultOptions(
|
|
1673
|
+
return t.setDefaultOptions(d), {
|
|
1673
1674
|
type: "window-group",
|
|
1674
1675
|
sceneType: "window-group",
|
|
1675
1676
|
id: n.id,
|
|
@@ -1768,7 +1769,7 @@ function M(n) {
|
|
|
1768
1769
|
// Initialize all scenes
|
|
1769
1770
|
async initialize() {
|
|
1770
1771
|
if (!u(n.platformConfig)) {
|
|
1771
|
-
const { initializeViewportSystem: t } = await Promise.resolve().then(() =>
|
|
1772
|
+
const { initializeViewportSystem: t } = await Promise.resolve().then(() => vt);
|
|
1772
1773
|
t();
|
|
1773
1774
|
}
|
|
1774
1775
|
},
|
|
@@ -1785,7 +1786,7 @@ function M(n) {
|
|
|
1785
1786
|
}
|
|
1786
1787
|
};
|
|
1787
1788
|
}
|
|
1788
|
-
const
|
|
1789
|
+
const P = {
|
|
1789
1790
|
/**
|
|
1790
1791
|
* Create a document window group
|
|
1791
1792
|
*/
|
|
@@ -1841,7 +1842,7 @@ const k = {
|
|
|
1841
1842
|
children: t
|
|
1842
1843
|
});
|
|
1843
1844
|
}
|
|
1844
|
-
},
|
|
1845
|
+
}, K = {
|
|
1845
1846
|
/**
|
|
1846
1847
|
* Basic app with main window and settings
|
|
1847
1848
|
*/
|
|
@@ -1863,7 +1864,7 @@ const k = {
|
|
|
1863
1864
|
})
|
|
1864
1865
|
})
|
|
1865
1866
|
}),
|
|
1866
|
-
|
|
1867
|
+
P.settingsWindow(() => ({
|
|
1867
1868
|
type: "component",
|
|
1868
1869
|
id: "settings-content",
|
|
1869
1870
|
props: {},
|
|
@@ -1904,7 +1905,7 @@ const k = {
|
|
|
1904
1905
|
})
|
|
1905
1906
|
})
|
|
1906
1907
|
}),
|
|
1907
|
-
|
|
1908
|
+
P.settingsWindow(() => ({
|
|
1908
1909
|
type: "component",
|
|
1909
1910
|
id: "settings",
|
|
1910
1911
|
props: {},
|
|
@@ -1918,8 +1919,8 @@ const k = {
|
|
|
1918
1919
|
}))
|
|
1919
1920
|
]
|
|
1920
1921
|
})
|
|
1921
|
-
},
|
|
1922
|
-
function
|
|
1922
|
+
}, X = ce(null);
|
|
1923
|
+
function J({
|
|
1923
1924
|
children: n,
|
|
1924
1925
|
manager: e
|
|
1925
1926
|
}) {
|
|
@@ -1932,20 +1933,20 @@ function B({
|
|
|
1932
1933
|
};
|
|
1933
1934
|
return {
|
|
1934
1935
|
type: "context-provider",
|
|
1935
|
-
context:
|
|
1936
|
+
context: X,
|
|
1936
1937
|
value: i,
|
|
1937
1938
|
children: Array.isArray(n) ? n : [n]
|
|
1938
1939
|
};
|
|
1939
1940
|
}
|
|
1940
1941
|
function v() {
|
|
1941
|
-
const n =
|
|
1942
|
+
const n = he(X);
|
|
1942
1943
|
if (!n)
|
|
1943
1944
|
throw new Error(
|
|
1944
1945
|
"useViewportEnvironment must be used within a ViewportEnvironmentProvider"
|
|
1945
1946
|
);
|
|
1946
1947
|
return n();
|
|
1947
1948
|
}
|
|
1948
|
-
function
|
|
1949
|
+
function k() {
|
|
1949
1950
|
const { openWindow: n } = v();
|
|
1950
1951
|
return n;
|
|
1951
1952
|
}
|
|
@@ -1957,22 +1958,22 @@ function _() {
|
|
|
1957
1958
|
const { viewportEnvironment: n } = v();
|
|
1958
1959
|
return n;
|
|
1959
1960
|
}
|
|
1960
|
-
function
|
|
1961
|
+
function He() {
|
|
1961
1962
|
const { currentWindow: n } = v();
|
|
1962
1963
|
return n;
|
|
1963
1964
|
}
|
|
1964
|
-
function
|
|
1965
|
+
function De() {
|
|
1965
1966
|
return u();
|
|
1966
1967
|
}
|
|
1967
|
-
function
|
|
1968
|
-
return (t) =>
|
|
1968
|
+
function ze(n, e) {
|
|
1969
|
+
return (t) => J({
|
|
1969
1970
|
children: n(t),
|
|
1970
1971
|
manager: e
|
|
1971
1972
|
});
|
|
1972
1973
|
}
|
|
1973
|
-
function
|
|
1974
|
+
function Ae(n) {
|
|
1974
1975
|
return (e) => {
|
|
1975
|
-
const t =
|
|
1976
|
+
const t = k(), i = x(), s = _();
|
|
1976
1977
|
return n({
|
|
1977
1978
|
...e,
|
|
1978
1979
|
openWindow: t,
|
|
@@ -1981,46 +1982,70 @@ function Pe(n) {
|
|
|
1981
1982
|
});
|
|
1982
1983
|
};
|
|
1983
1984
|
}
|
|
1984
|
-
const
|
|
1985
|
+
const _e = {
|
|
1985
1986
|
openWindow: "openWindow",
|
|
1986
1987
|
dismissWindow: "dismissWindow",
|
|
1987
1988
|
viewportEnvironment: "viewportEnvironment",
|
|
1988
1989
|
currentWindow: "currentWindow"
|
|
1989
1990
|
};
|
|
1990
|
-
function
|
|
1991
|
+
function Fe(n) {
|
|
1991
1992
|
return v()[n];
|
|
1992
1993
|
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1994
|
+
const Ve = "0.8.0-alpha", Ge = Ve, c = {
|
|
1995
|
+
Clean: 0,
|
|
1996
|
+
Check: 1,
|
|
1997
|
+
Dirty: 2,
|
|
1998
|
+
Disposed: 3
|
|
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 = {
|
|
2007
|
+
get currentComputation() {
|
|
2008
|
+
return N;
|
|
2009
|
+
},
|
|
2010
|
+
set currentComputation(n) {
|
|
2011
|
+
N = n;
|
|
2012
|
+
},
|
|
2013
|
+
get currentOwner() {
|
|
2014
|
+
return L;
|
|
2015
|
+
},
|
|
2016
|
+
set currentOwner(n) {
|
|
2017
|
+
L = n;
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
function Z() {
|
|
2021
|
+
return W.currentComputation;
|
|
1997
2022
|
}
|
|
1998
|
-
function
|
|
1999
|
-
return
|
|
2023
|
+
function Y() {
|
|
2024
|
+
return W.currentOwner;
|
|
2000
2025
|
}
|
|
2001
|
-
class
|
|
2026
|
+
class ee {
|
|
2002
2027
|
constructor(e, t = null) {
|
|
2003
|
-
f(this, "id"), f(this, "owner"), f(this, "fn"), f(this, "sources", /* @__PURE__ */ new Set()), f(this, "observers", /* @__PURE__ */ new Set()), f(this, "state",
|
|
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);
|
|
2004
2029
|
}
|
|
2005
2030
|
execute() {
|
|
2006
|
-
if (this.state ===
|
|
2031
|
+
if (this.state === c.Disposed)
|
|
2007
2032
|
return this.value;
|
|
2008
2033
|
for (const t of this.sources)
|
|
2009
2034
|
t && typeof t == "object" && "removeObserver" in t && t.removeObserver(this);
|
|
2010
2035
|
this.sources.clear();
|
|
2011
|
-
const e =
|
|
2012
|
-
|
|
2036
|
+
const e = W.currentComputation;
|
|
2037
|
+
W.currentComputation = this;
|
|
2013
2038
|
try {
|
|
2014
|
-
return this.state =
|
|
2039
|
+
return this.state = c.Clean, this.value = this.fn(), this.value;
|
|
2015
2040
|
} catch (t) {
|
|
2016
|
-
throw this.state =
|
|
2041
|
+
throw this.state = c.Disposed, (typeof process > "u" || process.env.NODE_ENV !== "test") && console.error("Error in computation:", t), t;
|
|
2017
2042
|
} finally {
|
|
2018
|
-
|
|
2043
|
+
W.currentComputation = e;
|
|
2019
2044
|
}
|
|
2020
2045
|
}
|
|
2021
2046
|
dispose() {
|
|
2022
|
-
if (this.state !==
|
|
2023
|
-
this.state =
|
|
2047
|
+
if (this.state !== c.Disposed) {
|
|
2048
|
+
this.state = c.Disposed;
|
|
2024
2049
|
for (const e of this.sources)
|
|
2025
2050
|
e && typeof e == "object" && "removeObserver" in e && e.removeObserver(this);
|
|
2026
2051
|
this.sources.clear();
|
|
@@ -2030,18 +2055,18 @@ class K {
|
|
|
2030
2055
|
}
|
|
2031
2056
|
}
|
|
2032
2057
|
}
|
|
2033
|
-
var
|
|
2034
|
-
let
|
|
2035
|
-
class
|
|
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 {
|
|
2036
2061
|
constructor(e) {
|
|
2037
|
-
I(this, "id"), I(this, "observers", /* @__PURE__ */ new Set()), I(this, "_value"), this.id = ++
|
|
2062
|
+
I(this, "id"), I(this, "observers", /* @__PURE__ */ new Set()), I(this, "_value"), this.id = ++qe, this._value = e;
|
|
2038
2063
|
}
|
|
2039
2064
|
/**
|
|
2040
2065
|
* Get the current value and track dependency
|
|
2041
2066
|
*/
|
|
2042
2067
|
getValue() {
|
|
2043
|
-
const e =
|
|
2044
|
-
return e && e.state !==
|
|
2068
|
+
const e = Z();
|
|
2069
|
+
return e && e.state !== c.Disposed && (this.observers.add(e), e.sources.add(this)), this._value;
|
|
2045
2070
|
}
|
|
2046
2071
|
/**
|
|
2047
2072
|
* Get the current value without tracking dependency
|
|
@@ -2061,7 +2086,7 @@ class Fe {
|
|
|
2061
2086
|
*/
|
|
2062
2087
|
notify() {
|
|
2063
2088
|
for (const e of this.observers)
|
|
2064
|
-
e.state !==
|
|
2089
|
+
e.state !== c.Disposed && (e.state = c.Dirty, Ke(e));
|
|
2065
2090
|
}
|
|
2066
2091
|
/**
|
|
2067
2092
|
* Remove an observer (cleanup)
|
|
@@ -2083,10 +2108,10 @@ class Fe {
|
|
|
2083
2108
|
}
|
|
2084
2109
|
const E = /* @__PURE__ */ new Set();
|
|
2085
2110
|
let C = !1;
|
|
2086
|
-
function
|
|
2087
|
-
E.add(n), !C && queueMicrotask(
|
|
2111
|
+
function Ke(n) {
|
|
2112
|
+
E.add(n), !C && queueMicrotask(Xe);
|
|
2088
2113
|
}
|
|
2089
|
-
function
|
|
2114
|
+
function Xe() {
|
|
2090
2115
|
if (!C) {
|
|
2091
2116
|
C = !0;
|
|
2092
2117
|
try {
|
|
@@ -2094,15 +2119,15 @@ function Ge() {
|
|
|
2094
2119
|
const n = Array.from(E).sort((e, t) => e.id - t.id);
|
|
2095
2120
|
E.clear();
|
|
2096
2121
|
for (const e of n)
|
|
2097
|
-
e.state ===
|
|
2122
|
+
e.state === c.Dirty && e.execute();
|
|
2098
2123
|
}
|
|
2099
2124
|
} finally {
|
|
2100
2125
|
C = !1;
|
|
2101
2126
|
}
|
|
2102
2127
|
}
|
|
2103
2128
|
}
|
|
2104
|
-
function
|
|
2105
|
-
const e = new
|
|
2129
|
+
function Je(n) {
|
|
2130
|
+
const e = new Qe(n), t = e.getValue.bind(e);
|
|
2106
2131
|
t.peek = e.peek.bind(e);
|
|
2107
2132
|
const i = e.set.bind(e);
|
|
2108
2133
|
return Object.defineProperty(t, Symbol.for("tachui.signal"), {
|
|
@@ -2110,20 +2135,20 @@ function Ne(n) {
|
|
|
2110
2135
|
enumerable: !1
|
|
2111
2136
|
}), [t, i];
|
|
2112
2137
|
}
|
|
2113
|
-
function
|
|
2138
|
+
function U(n) {
|
|
2114
2139
|
return typeof n == "function" && Symbol.for("tachui.signal") in n;
|
|
2115
2140
|
}
|
|
2116
|
-
const
|
|
2117
|
-
var
|
|
2118
|
-
class
|
|
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 {
|
|
2119
2144
|
constructor(e, t, i) {
|
|
2120
2145
|
super(e), this.cause = t, this.node = i, this.name = "ReactiveError";
|
|
2121
2146
|
}
|
|
2122
2147
|
}
|
|
2123
|
-
const
|
|
2148
|
+
const nt = class b {
|
|
2124
2149
|
constructor() {
|
|
2125
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());
|
|
2126
|
-
for (const e of Object.values(
|
|
2151
|
+
for (const e of Object.values(S))
|
|
2127
2152
|
typeof e == "number" && this.updateQueues.set(e, /* @__PURE__ */ new Set());
|
|
2128
2153
|
}
|
|
2129
2154
|
static getInstance() {
|
|
@@ -2160,7 +2185,7 @@ const qe = class b {
|
|
|
2160
2185
|
await this.updateNodeWithRetry(a);
|
|
2161
2186
|
} catch (r) {
|
|
2162
2187
|
this.handleReactiveError(
|
|
2163
|
-
new
|
|
2188
|
+
new tt(`Failed to update ${a.type} node ${a.id}`, r, a)
|
|
2164
2189
|
);
|
|
2165
2190
|
}
|
|
2166
2191
|
if (this.hasHigherPriorityWork(t))
|
|
@@ -2314,7 +2339,7 @@ const qe = class b {
|
|
|
2314
2339
|
getDebugInfo() {
|
|
2315
2340
|
const e = {};
|
|
2316
2341
|
for (const [t, i] of this.updateQueues)
|
|
2317
|
-
e[
|
|
2342
|
+
e[S[t]] = i.size;
|
|
2318
2343
|
return {
|
|
2319
2344
|
isFlushPending: this.isFlushPending,
|
|
2320
2345
|
isDestroyed: this.isDestroyed,
|
|
@@ -2324,24 +2349,24 @@ const qe = class b {
|
|
|
2324
2349
|
};
|
|
2325
2350
|
}
|
|
2326
2351
|
};
|
|
2327
|
-
p(
|
|
2328
|
-
var
|
|
2329
|
-
class
|
|
2330
|
-
constructor(e, t = {}, i =
|
|
2331
|
-
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 ??
|
|
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;
|
|
2332
2357
|
}
|
|
2333
2358
|
/**
|
|
2334
2359
|
* Get the computed value, tracking dependency and lazily computing
|
|
2335
2360
|
*/
|
|
2336
2361
|
getValue() {
|
|
2337
|
-
const e =
|
|
2338
|
-
return e && e.state !==
|
|
2362
|
+
const e = Z();
|
|
2363
|
+
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;
|
|
2339
2364
|
}
|
|
2340
2365
|
/**
|
|
2341
2366
|
* Get the current value without tracking dependency
|
|
2342
2367
|
*/
|
|
2343
2368
|
peek() {
|
|
2344
|
-
return (this.state ===
|
|
2369
|
+
return (this.state === c.Dirty || !this._hasValue) && (this.execute(), this._hasValue = !0), this.value;
|
|
2345
2370
|
}
|
|
2346
2371
|
/**
|
|
2347
2372
|
* Remove an observer (cleanup)
|
|
@@ -2356,8 +2381,8 @@ class Qe extends K {
|
|
|
2356
2381
|
const e = this._hasValue ? this.value : void 0, t = super.execute();
|
|
2357
2382
|
if (!this._hasValue || !this.equalsFn(e, t))
|
|
2358
2383
|
for (const i of this.observers)
|
|
2359
|
-
i.state !==
|
|
2360
|
-
i.state ===
|
|
2384
|
+
i.state !== c.Disposed && (i.state = c.Dirty, "execute" in i && typeof i.execute == "function" && queueMicrotask(() => {
|
|
2385
|
+
i.state === c.Dirty && i.execute();
|
|
2361
2386
|
}));
|
|
2362
2387
|
return t;
|
|
2363
2388
|
}
|
|
@@ -2376,7 +2401,7 @@ class Qe extends K {
|
|
|
2376
2401
|
this.sources.clear();
|
|
2377
2402
|
for (const e of this.observers)
|
|
2378
2403
|
e.sources.delete(this);
|
|
2379
|
-
this.observers.clear(), this._hasValue = !1, this._error = null, this.state =
|
|
2404
|
+
this.observers.clear(), this._hasValue = !1, this._error = null, this.state = c.Disposed;
|
|
2380
2405
|
}
|
|
2381
2406
|
/**
|
|
2382
2407
|
* Dispose the computed value
|
|
@@ -2397,7 +2422,7 @@ class Qe extends K {
|
|
|
2397
2422
|
state: this.state,
|
|
2398
2423
|
sourceCount: this.sources.size,
|
|
2399
2424
|
observerCount: this.observers.size,
|
|
2400
|
-
priority:
|
|
2425
|
+
priority: S[this.priority],
|
|
2401
2426
|
debugName: this.options.debugName,
|
|
2402
2427
|
equalsFn: this.equalsFn.name || "anonymous"
|
|
2403
2428
|
};
|
|
@@ -2406,29 +2431,29 @@ class Qe extends K {
|
|
|
2406
2431
|
return `Computed(${this.options.debugName || this.id}): ${this._hasValue ? this.value : "no value"}`;
|
|
2407
2432
|
}
|
|
2408
2433
|
}
|
|
2409
|
-
function
|
|
2410
|
-
const t = new
|
|
2434
|
+
function rt(n, e) {
|
|
2435
|
+
const t = new ot(n, e), i = t.getValue.bind(t);
|
|
2411
2436
|
return i.peek = t.peek.bind(t), Object.defineProperty(i, Symbol.for("tachui.computed"), {
|
|
2412
2437
|
value: t,
|
|
2413
2438
|
enumerable: !1
|
|
2414
2439
|
}), i;
|
|
2415
2440
|
}
|
|
2416
|
-
function
|
|
2441
|
+
function R(n) {
|
|
2417
2442
|
return typeof n == "function" && Symbol.for("tachui.computed") in n;
|
|
2418
2443
|
}
|
|
2419
|
-
const [
|
|
2420
|
-
|
|
2421
|
-
const n =
|
|
2422
|
-
return n === "system" ?
|
|
2444
|
+
const [at, Mt] = Je("light");
|
|
2445
|
+
rt(() => {
|
|
2446
|
+
const n = at();
|
|
2447
|
+
return n === "system" ? lt() : n;
|
|
2423
2448
|
});
|
|
2424
|
-
function
|
|
2449
|
+
function lt() {
|
|
2425
2450
|
return typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
2426
2451
|
}
|
|
2427
2452
|
typeof globalThis.__DEV__ > "u" && (globalThis.__DEV__ = process.env.NODE_ENV !== "production");
|
|
2428
|
-
var
|
|
2429
|
-
class
|
|
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 {
|
|
2430
2455
|
constructor() {
|
|
2431
|
-
|
|
2456
|
+
$(this, "pending", /* @__PURE__ */ new Set()), $(this, "isFlushScheduled", !1);
|
|
2432
2457
|
}
|
|
2433
2458
|
schedule(e) {
|
|
2434
2459
|
this.pending.add(e), this.isFlushScheduled || (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
@@ -2449,20 +2474,20 @@ class et {
|
|
|
2449
2474
|
this.pending.size > 0 && (this.isFlushScheduled = !0, queueMicrotask(() => this.flush()));
|
|
2450
2475
|
}
|
|
2451
2476
|
}
|
|
2452
|
-
new
|
|
2453
|
-
function
|
|
2454
|
-
const t =
|
|
2477
|
+
new ht();
|
|
2478
|
+
function B(n, e = {}) {
|
|
2479
|
+
const t = Y();
|
|
2455
2480
|
let i;
|
|
2456
2481
|
const s = () => {
|
|
2457
2482
|
const r = n(i);
|
|
2458
2483
|
return i = r, r;
|
|
2459
|
-
}, a = new
|
|
2484
|
+
}, a = new ee(s, t);
|
|
2460
2485
|
return e.name && Object.defineProperty(a, "name", {
|
|
2461
2486
|
value: e.name,
|
|
2462
2487
|
enumerable: !1
|
|
2463
2488
|
}), a.execute(), a;
|
|
2464
2489
|
}
|
|
2465
|
-
class
|
|
2490
|
+
class ut {
|
|
2466
2491
|
constructor(e) {
|
|
2467
2492
|
this.properties = e;
|
|
2468
2493
|
}
|
|
@@ -2481,8 +2506,8 @@ class tt {
|
|
|
2481
2506
|
applyStyleChange(e, t, i) {
|
|
2482
2507
|
if (e instanceof HTMLElement) {
|
|
2483
2508
|
const s = this.toCSSProperty(t);
|
|
2484
|
-
if (
|
|
2485
|
-
|
|
2509
|
+
if (U(i) || R(i))
|
|
2510
|
+
B(() => {
|
|
2486
2511
|
const a = i(), r = String(a);
|
|
2487
2512
|
if (r.includes("!important")) {
|
|
2488
2513
|
const h = r.replace(/\s*!important\s*$/, "").trim();
|
|
@@ -2536,27 +2561,27 @@ class tt {
|
|
|
2536
2561
|
for (const [s, a] of Object.entries(t))
|
|
2537
2562
|
if (a !== void 0) {
|
|
2538
2563
|
const r = this.toCSSProperty(s);
|
|
2539
|
-
if (
|
|
2540
|
-
|
|
2541
|
-
const h = a(),
|
|
2564
|
+
if (U(a) || R(a))
|
|
2565
|
+
B(() => {
|
|
2566
|
+
const h = a(), d = this.toCSSValueForProperty(
|
|
2542
2567
|
r,
|
|
2543
2568
|
h
|
|
2544
2569
|
);
|
|
2545
2570
|
if (i.setProperty)
|
|
2546
|
-
if (typeof
|
|
2547
|
-
const l =
|
|
2571
|
+
if (typeof d == "string" && d.includes("!important")) {
|
|
2572
|
+
const l = d.replace(/\s*!important\s*$/, "").trim();
|
|
2548
2573
|
i.setProperty(r, l, "important");
|
|
2549
2574
|
} else
|
|
2550
|
-
i.setProperty(r,
|
|
2575
|
+
i.setProperty(r, d);
|
|
2551
2576
|
else
|
|
2552
|
-
i[r] =
|
|
2577
|
+
i[r] = d;
|
|
2553
2578
|
});
|
|
2554
2579
|
else {
|
|
2555
2580
|
const h = this.toCSSValueForProperty(r, a);
|
|
2556
2581
|
if (i.setProperty)
|
|
2557
2582
|
if (typeof h == "string" && h.includes("!important")) {
|
|
2558
|
-
const
|
|
2559
|
-
i.setProperty(r,
|
|
2583
|
+
const d = h.replace(/\s*!important\s*$/, "").trim();
|
|
2584
|
+
i.setProperty(r, d, "important");
|
|
2560
2585
|
} else
|
|
2561
2586
|
i.setProperty(r, h);
|
|
2562
2587
|
else
|
|
@@ -2590,7 +2615,7 @@ class tt {
|
|
|
2590
2615
|
};
|
|
2591
2616
|
}
|
|
2592
2617
|
}
|
|
2593
|
-
class
|
|
2618
|
+
class te extends ut {
|
|
2594
2619
|
constructor() {
|
|
2595
2620
|
super(...arguments);
|
|
2596
2621
|
o(this, "type", "viewportLifecycle");
|
|
@@ -2616,17 +2641,52 @@ class X extends tt {
|
|
|
2616
2641
|
).observe(t);
|
|
2617
2642
|
}
|
|
2618
2643
|
}
|
|
2619
|
-
function
|
|
2620
|
-
return new
|
|
2644
|
+
function ne(n) {
|
|
2645
|
+
return new te({ onAppear: n });
|
|
2646
|
+
}
|
|
2647
|
+
function ie(n) {
|
|
2648
|
+
return new te({ onDisappear: n });
|
|
2621
2649
|
}
|
|
2622
|
-
|
|
2623
|
-
|
|
2650
|
+
const pt = {
|
|
2651
|
+
name: "@tachui/viewport",
|
|
2652
|
+
version: Ge,
|
|
2653
|
+
author: "TachUI Team",
|
|
2654
|
+
verified: !0
|
|
2655
|
+
}, j = {
|
|
2656
|
+
category: "interaction",
|
|
2657
|
+
priority: 110,
|
|
2658
|
+
signature: "(handler: () => void) => Modifier",
|
|
2659
|
+
description: "Triggers handlers when an element appears in or disappears from the viewport."
|
|
2660
|
+
};
|
|
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(
|
|
2665
|
+
"onAppear",
|
|
2666
|
+
ne,
|
|
2667
|
+
{
|
|
2668
|
+
...j,
|
|
2669
|
+
description: "Executes a callback when the component enters the viewport."
|
|
2670
|
+
},
|
|
2671
|
+
e,
|
|
2672
|
+
t
|
|
2673
|
+
), V(
|
|
2674
|
+
"onDisappear",
|
|
2675
|
+
ie,
|
|
2676
|
+
{
|
|
2677
|
+
...j,
|
|
2678
|
+
description: "Executes a callback when the component leaves the viewport."
|
|
2679
|
+
},
|
|
2680
|
+
e,
|
|
2681
|
+
t
|
|
2682
|
+
), s || (q = !0));
|
|
2624
2683
|
}
|
|
2625
|
-
|
|
2684
|
+
se();
|
|
2685
|
+
const wt = {
|
|
2626
2686
|
// Manager
|
|
2627
2687
|
getManager: u,
|
|
2628
2688
|
// Environment
|
|
2629
|
-
useOpenWindow:
|
|
2689
|
+
useOpenWindow: k,
|
|
2630
2690
|
useDismissWindow: x,
|
|
2631
2691
|
useViewportInfo: _,
|
|
2632
2692
|
// Components
|
|
@@ -2634,20 +2694,20 @@ const st = {
|
|
|
2634
2694
|
WindowGroup: T,
|
|
2635
2695
|
App: M,
|
|
2636
2696
|
// Utilities
|
|
2637
|
-
Utils:
|
|
2638
|
-
Examples:
|
|
2697
|
+
Utils: P,
|
|
2698
|
+
Examples: K
|
|
2639
2699
|
};
|
|
2640
|
-
function
|
|
2700
|
+
function ft(n) {
|
|
2641
2701
|
const e = new A(n?.customAdapter);
|
|
2642
|
-
return
|
|
2702
|
+
return Q(e), e;
|
|
2643
2703
|
}
|
|
2644
|
-
const
|
|
2704
|
+
const mt = {
|
|
2645
2705
|
isWindow: (n) => n.type === "window",
|
|
2646
2706
|
isModal: (n) => n.type === "modal",
|
|
2647
2707
|
isPortal: (n) => n.type === "portal",
|
|
2648
2708
|
isSheet: (n) => n.type === "sheet",
|
|
2649
2709
|
isPopover: (n) => n.type === "popover"
|
|
2650
|
-
},
|
|
2710
|
+
}, gt = {
|
|
2651
2711
|
/**
|
|
2652
2712
|
* Check if running in Electron
|
|
2653
2713
|
*/
|
|
@@ -2668,7 +2728,7 @@ const rt = {
|
|
|
2668
2728
|
* Get optimal window type for current platform
|
|
2669
2729
|
*/
|
|
2670
2730
|
getOptimalWindowType: (n = !1) => u().getOptimalWindowType({ preferNativeWindow: n })
|
|
2671
|
-
},
|
|
2731
|
+
}, bt = {
|
|
2672
2732
|
/**
|
|
2673
2733
|
* Standard document window
|
|
2674
2734
|
*/
|
|
@@ -2735,7 +2795,7 @@ const rt = {
|
|
|
2735
2795
|
minimizable: !1,
|
|
2736
2796
|
maximizable: !1
|
|
2737
2797
|
})
|
|
2738
|
-
},
|
|
2798
|
+
}, yt = {
|
|
2739
2799
|
DEFAULT_WINDOW_WIDTH: 800,
|
|
2740
2800
|
DEFAULT_WINDOW_HEIGHT: 600,
|
|
2741
2801
|
MIN_WINDOW_WIDTH: 300,
|
|
@@ -2743,81 +2803,82 @@ const rt = {
|
|
|
2743
2803
|
MODAL_Z_INDEX: 1e3,
|
|
2744
2804
|
PORTAL_Z_INDEX: 999,
|
|
2745
2805
|
ANIMATION_DURATION: 200
|
|
2746
|
-
},
|
|
2806
|
+
}, vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2747
2807
|
__proto__: null,
|
|
2748
2808
|
App: M,
|
|
2749
|
-
EnvironmentKeys:
|
|
2750
|
-
ExampleScenes:
|
|
2751
|
-
PlatformUtils:
|
|
2809
|
+
EnvironmentKeys: _e,
|
|
2810
|
+
ExampleScenes: K,
|
|
2811
|
+
PlatformUtils: gt,
|
|
2752
2812
|
TachUIViewportManager: A,
|
|
2753
|
-
Viewport:
|
|
2754
|
-
ViewportConstants:
|
|
2755
|
-
ViewportEnvironmentProvider:
|
|
2756
|
-
ViewportTypeGuards:
|
|
2757
|
-
WebViewportAdapter:
|
|
2813
|
+
Viewport: wt,
|
|
2814
|
+
ViewportConstants: yt,
|
|
2815
|
+
ViewportEnvironmentProvider: J,
|
|
2816
|
+
ViewportTypeGuards: mt,
|
|
2817
|
+
WebViewportAdapter: H,
|
|
2758
2818
|
Window: y,
|
|
2759
|
-
WindowConfigs:
|
|
2819
|
+
WindowConfigs: bt,
|
|
2760
2820
|
WindowGroup: T,
|
|
2761
|
-
WindowUtils:
|
|
2762
|
-
checkFeatureSupport:
|
|
2763
|
-
createCapabilityChecker:
|
|
2764
|
-
createWindowAwareComponent:
|
|
2765
|
-
detectViewportEnvironment:
|
|
2766
|
-
disposeViewportManager:
|
|
2767
|
-
getBrowserInfo:
|
|
2768
|
-
getEnvironmentValue:
|
|
2769
|
-
getOSInfo:
|
|
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,
|
|
2770
2830
|
getViewportManager: u,
|
|
2771
|
-
initializeViewportSystem:
|
|
2772
|
-
onAppear:
|
|
2773
|
-
onDisappear:
|
|
2774
|
-
|
|
2775
|
-
|
|
2831
|
+
initializeViewportSystem: ft,
|
|
2832
|
+
onAppear: ne,
|
|
2833
|
+
onDisappear: ie,
|
|
2834
|
+
registerViewportModifiers: se,
|
|
2835
|
+
setViewportManager: Q,
|
|
2836
|
+
useCurrentWindow: He,
|
|
2776
2837
|
useDismissWindow: x,
|
|
2777
2838
|
useEnvironmentDismissWindow: x,
|
|
2778
|
-
useEnvironmentOpenWindow:
|
|
2779
|
-
useOpenWindow:
|
|
2839
|
+
useEnvironmentOpenWindow: k,
|
|
2840
|
+
useOpenWindow: k,
|
|
2780
2841
|
useViewportEnvironment: v,
|
|
2781
2842
|
useViewportInfo: _,
|
|
2782
|
-
useViewportManager:
|
|
2783
|
-
withViewportEnvironment:
|
|
2843
|
+
useViewportManager: De,
|
|
2844
|
+
withViewportEnvironment: ze
|
|
2784
2845
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2785
2846
|
export {
|
|
2786
2847
|
M as App,
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2848
|
+
_e as EnvironmentKeys,
|
|
2849
|
+
K as ExampleScenes,
|
|
2850
|
+
gt as PlatformUtils,
|
|
2790
2851
|
A as TachUIViewportManager,
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2852
|
+
wt as Viewport,
|
|
2853
|
+
yt as ViewportConstants,
|
|
2854
|
+
J as ViewportEnvironmentProvider,
|
|
2855
|
+
mt as ViewportTypeGuards,
|
|
2856
|
+
H as WebViewportAdapter,
|
|
2796
2857
|
y as Window,
|
|
2797
|
-
|
|
2858
|
+
bt as WindowConfigs,
|
|
2798
2859
|
T as WindowGroup,
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
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,
|
|
2808
2869
|
u as getViewportManager,
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2870
|
+
ft as initializeViewportSystem,
|
|
2871
|
+
ne as onAppear,
|
|
2872
|
+
ie as onDisappear,
|
|
2873
|
+
se as registerViewportModifiers,
|
|
2874
|
+
Q as setViewportManager,
|
|
2875
|
+
He as useCurrentWindow,
|
|
2814
2876
|
x as useDismissWindow,
|
|
2815
2877
|
x as useEnvironmentDismissWindow,
|
|
2816
|
-
|
|
2817
|
-
|
|
2878
|
+
k as useEnvironmentOpenWindow,
|
|
2879
|
+
k as useOpenWindow,
|
|
2818
2880
|
v as useViewportEnvironment,
|
|
2819
2881
|
_ as useViewportInfo,
|
|
2820
|
-
|
|
2821
|
-
|
|
2882
|
+
De as useViewportManager,
|
|
2883
|
+
ze as withViewportEnvironment
|
|
2822
2884
|
};
|
|
2823
|
-
//# sourceMappingURL=index.js.map
|