@caperjs/core 0.2.4 → 0.4.0
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/build/assetpack.mjs +90 -0
- package/build/index.mjs +3 -1
- package/build/internal/discovery.mjs +1 -1
- package/build/internal/manifest.mjs +8 -3
- package/build/internal/validate.mjs +3 -1
- package/build/plugins/assetTypes.mjs +4 -4
- package/build/plugins/caperConfig.mjs +12 -5
- package/build/plugins/lists.mjs +29 -9
- package/build/plugins/pruneFallbacks.mjs +25 -2
- package/cli/create.mjs +57 -6
- package/cli/create.test.mjs +36 -0
- package/cli/update.mjs +1 -1
- package/lib/{CaptionsPlugin-WPAcfAkx.js → CaptionsPlugin-cSJj-R9M.js} +5 -5
- package/lib/{CaptionsPlugin-WPAcfAkx.js.map → CaptionsPlugin-cSJj-R9M.js.map} +1 -1
- package/lib/{DataAdapter-DS-twowe.js → DataAdapter-D2tc6hx9.js} +15 -10
- package/lib/DataAdapter-D2tc6hx9.js.map +1 -0
- package/lib/{DebugRenderer-D1ryrRYx.js → DebugRenderer-CGUKy6Fy.js} +2 -2
- package/lib/{DebugRenderer-D1ryrRYx.js.map → DebugRenderer-CGUKy6Fy.js.map} +1 -1
- package/lib/{DevToolsPlugin-DH7zX7HU.js → DevToolsPlugin-B8GX3H9b.js} +2 -2
- package/lib/{DevToolsPlugin-DH7zX7HU.js.map → DevToolsPlugin-B8GX3H9b.js.map} +1 -1
- package/lib/{GSAPPlugin-BBtRjUqe.js → GSAPPlugin-Br9AjuTD.js} +6 -6
- package/lib/{GSAPPlugin-BBtRjUqe.js.map → GSAPPlugin-Br9AjuTD.js.map} +1 -1
- package/lib/{LayoutPlugin-Co6vcoV4.js → LayoutPlugin-BX3OP7pw.js} +4 -4
- package/lib/{LayoutPlugin-Co6vcoV4.js.map → LayoutPlugin-BX3OP7pw.js.map} +1 -1
- package/lib/{SpinePlugin-uN641Hmk.js → SpinePlugin-C-JDdXpf.js} +690 -793
- package/lib/SpinePlugin-C-JDdXpf.js.map +1 -0
- package/lib/{StatsPlugin-vZQRm6wh.js → StatsPlugin-yJlJtoQ2.js} +7 -7
- package/lib/StatsPlugin-yJlJtoQ2.js.map +1 -0
- package/lib/{VoiceOverPlugin-KlZdGj1G.js → VoiceOverPlugin-DjSZp4Ko.js} +7 -6
- package/lib/VoiceOverPlugin-DjSZp4Ko.js.map +1 -0
- package/lib/caper.mjs +159 -1917
- package/lib/caper.mjs.map +1 -1
- package/lib/const-C3sxeYhl.js +1746 -0
- package/lib/const-C3sxeYhl.js.map +1 -0
- package/lib/core/Application.d.ts +8 -3
- package/lib/core/Application.d.ts.map +1 -1
- package/lib/core/Application.test.d.ts +2 -0
- package/lib/core/Application.test.d.ts.map +1 -0
- package/lib/core/config.d.ts +6 -1
- package/lib/core/config.d.ts.map +1 -1
- package/lib/core/config.test.d.ts +2 -0
- package/lib/core/config.test.d.ts.map +1 -0
- package/lib/core/create.d.ts.map +1 -1
- package/lib/core/interfaces/IApplication.d.ts +6 -6
- package/lib/core/interfaces/IApplication.d.ts.map +1 -1
- package/lib/core/interfaces/ICoreSignals.d.ts +2 -1
- package/lib/core/interfaces/ICoreSignals.d.ts.map +1 -1
- package/lib/display/Camera.test.d.ts +2 -0
- package/lib/display/Camera.test.d.ts.map +1 -0
- package/lib/display/Entity.d.ts +2 -2
- package/lib/display/SceneTransition.test.d.ts +1 -0
- package/lib/display/SceneTransition.test.d.ts.map +1 -0
- package/lib/display/SpineAnimation.d.ts +3 -3
- package/lib/mixins/factory/methods.d.ts.map +1 -1
- package/lib/padding-1kHDpGlQ.js +41 -0
- package/lib/padding-1kHDpGlQ.js.map +1 -0
- package/lib/plugins/AssetsPlugin.d.ts.map +1 -1
- package/lib/plugins/AssetsPlugin.test.d.ts +2 -0
- package/lib/plugins/AssetsPlugin.test.d.ts.map +1 -0
- package/lib/plugins/DataAdapter.d.ts.map +1 -1
- package/lib/plugins/DataAdapter.test.d.ts +2 -0
- package/lib/plugins/DataAdapter.test.d.ts.map +1 -0
- package/lib/plugins/FullScreenPlugin.d.ts +0 -5
- package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
- package/lib/plugins/FullScreenPlugin.test.d.ts +2 -0
- package/lib/plugins/FullScreenPlugin.test.d.ts.map +1 -0
- package/lib/plugins/GSAPPlugin.d.ts +0 -2
- package/lib/plugins/GSAPPlugin.d.ts.map +1 -1
- package/lib/plugins/GSAPPlugin.test.d.ts +2 -0
- package/lib/plugins/GSAPPlugin.test.d.ts.map +1 -0
- package/lib/plugins/KeyboardPlugin.d.ts +0 -1
- package/lib/plugins/KeyboardPlugin.d.ts.map +1 -1
- package/lib/plugins/LookupPlugin.d.ts +6 -1
- package/lib/plugins/LookupPlugin.d.ts.map +1 -1
- package/lib/plugins/LookupPlugin.test.d.ts +2 -0
- package/lib/plugins/LookupPlugin.test.d.ts.map +1 -0
- package/lib/plugins/Plugin.d.ts +101 -2
- package/lib/plugins/Plugin.d.ts.map +1 -1
- package/lib/plugins/PopupManagerPlugin.d.ts.map +1 -1
- package/lib/plugins/PopupManagerPlugin.test.d.ts +1 -0
- package/lib/plugins/PopupManagerPlugin.test.d.ts.map +1 -0
- package/lib/plugins/SceneManagerPlugin.d.ts +1 -1
- package/lib/plugins/SceneManagerPlugin.d.ts.map +1 -1
- package/lib/plugins/SceneManagerPlugin.test.d.ts +2 -0
- package/lib/plugins/SceneManagerPlugin.test.d.ts.map +1 -0
- package/lib/plugins/StatsPlugin.d.ts.map +1 -1
- package/lib/plugins/TimerPlugin.d.ts.map +1 -1
- package/lib/plugins/WebEventsPlugin.d.ts +0 -1
- package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
- package/lib/plugins/actions/ActionsPlugin.test.d.ts +2 -0
- package/lib/plugins/actions/ActionsPlugin.test.d.ts.map +1 -0
- package/lib/plugins/audio/AudioChannel.d.ts.map +1 -1
- package/lib/plugins/audio/AudioManagerPlugin.d.ts.map +1 -1
- package/lib/plugins/audio/AudioManagerPlugin.test.d.ts +2 -0
- package/lib/plugins/audio/AudioManagerPlugin.test.d.ts.map +1 -0
- package/lib/plugins/audio/VoiceOverPlugin.d.ts.map +1 -1
- package/lib/plugins/breakpoints/BreakpointPlugin.d.ts.map +1 -1
- package/lib/plugins/captions/CaptionsPlugin.test.d.ts +2 -0
- package/lib/plugins/captions/CaptionsPlugin.test.d.ts.map +1 -0
- package/lib/plugins/focus/FocusManagerPlugin.d.ts.map +1 -1
- package/lib/plugins/focus/FocusManagerPlugin.test.d.ts +2 -0
- package/lib/plugins/focus/FocusManagerPlugin.test.d.ts.map +1 -0
- package/lib/plugins/gesture/GesturePlugin.d.ts.map +1 -1
- package/lib/plugins/input/AbstractControls.d.ts +47 -3
- package/lib/plugins/input/AbstractControls.d.ts.map +1 -1
- package/lib/plugins/input/Controls.test.d.ts +2 -0
- package/lib/plugins/input/Controls.test.d.ts.map +1 -0
- package/lib/plugins/input/InputPlugin.d.ts.map +1 -1
- package/lib/plugins/input/controlsCore.d.ts +58 -0
- package/lib/plugins/input/controlsCore.d.ts.map +1 -0
- package/lib/plugins/input/controlsCore.test.d.ts +2 -0
- package/lib/plugins/input/controlsCore.test.d.ts.map +1 -0
- package/lib/plugins/input/keyboard/KeyboardControls.d.ts +15 -0
- package/lib/plugins/input/keyboard/KeyboardControls.d.ts.map +1 -0
- package/lib/plugins/input/keyboard/index.d.ts +1 -1
- package/lib/plugins/input/keyboard/index.d.ts.map +1 -1
- package/lib/plugins/input/touch/VirtualControls.d.ts +8 -14
- package/lib/plugins/input/touch/VirtualControls.d.ts.map +1 -1
- package/lib/plugins/input/touch/VirtualControls.test.d.ts +2 -0
- package/lib/plugins/input/touch/VirtualControls.test.d.ts.map +1 -0
- package/lib/{registries-BLrxALZ0.js → registries-BfV-VF7a.js} +665 -597
- package/lib/registries-BfV-VF7a.js.map +1 -0
- package/lib/store/Store.d.ts.map +1 -1
- package/lib/ui/Button.d.ts.map +1 -1
- package/lib/ui/UICanvas.d.ts +10 -1
- package/lib/ui/UICanvas.d.ts.map +1 -1
- package/lib/ui/UICanvas.test.d.ts +0 -1
- package/lib/ui/UICanvas.test.d.ts.map +1 -1
- package/lib/utils/color.d.ts.map +1 -1
- package/lib/utils/color.test.d.ts +2 -0
- package/lib/utils/color.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/core/Application.test.ts +168 -0
- package/src/core/Application.ts +37 -27
- package/src/core/config.test.ts +79 -0
- package/src/core/config.ts +28 -6
- package/src/core/create.ts +11 -0
- package/src/core/interfaces/IApplication.ts +6 -6
- package/src/core/interfaces/ICoreSignals.ts +2 -0
- package/src/display/Camera.test.ts +40 -0
- package/src/display/Camera.ts +3 -3
- package/src/display/Entity.ts +2 -2
- package/src/display/SceneTransition.test.ts +58 -0
- package/src/display/SceneTransition.ts +1 -1
- package/src/display/SpineAnimation.ts +4 -4
- package/src/mixins/factory/methods.ts +0 -1
- package/src/plugins/AssetsPlugin.test.ts +48 -0
- package/src/plugins/AssetsPlugin.ts +3 -1
- package/src/plugins/DataAdapter.test.ts +32 -0
- package/src/plugins/DataAdapter.ts +5 -1
- package/src/plugins/FullScreenPlugin.test.ts +48 -0
- package/src/plugins/FullScreenPlugin.ts +9 -18
- package/src/plugins/GSAPPlugin.test.ts +31 -0
- package/src/plugins/GSAPPlugin.ts +1 -4
- package/src/plugins/KeyboardPlugin.ts +3 -10
- package/src/plugins/LookupPlugin.test.ts +42 -0
- package/src/plugins/LookupPlugin.ts +15 -3
- package/src/plugins/Plugin.test.ts +130 -2
- package/src/plugins/Plugin.ts +159 -3
- package/src/plugins/PopupManagerPlugin.test.ts +53 -0
- package/src/plugins/PopupManagerPlugin.ts +5 -3
- package/src/plugins/SceneManagerPlugin.test.ts +76 -0
- package/src/plugins/SceneManagerPlugin.ts +18 -13
- package/src/plugins/StatsPlugin.ts +3 -2
- package/src/plugins/TimerPlugin.ts +1 -2
- package/src/plugins/WebEventsPlugin.test.ts +32 -0
- package/src/plugins/WebEventsPlugin.ts +9 -16
- package/src/plugins/actions/ActionsPlugin.test.ts +68 -0
- package/src/plugins/actions/ActionsPlugin.ts +5 -5
- package/src/plugins/audio/AudioChannel.test.ts +19 -0
- package/src/plugins/audio/AudioChannel.ts +8 -1
- package/src/plugins/audio/AudioManagerPlugin.test.ts +41 -0
- package/src/plugins/audio/AudioManagerPlugin.ts +3 -2
- package/src/plugins/audio/VoiceOverPlugin.ts +1 -0
- package/src/plugins/breakpoints/BreakpointPlugin.ts +1 -2
- package/src/plugins/captions/CaptionsPlugin.test.ts +40 -0
- package/src/plugins/captions/CaptionsPlugin.ts +2 -2
- package/src/plugins/focus/FocusManagerPlugin.test.ts +71 -0
- package/src/plugins/focus/FocusManagerPlugin.ts +7 -0
- package/src/plugins/gesture/GesturePlugin.ts +4 -8
- package/src/plugins/input/AbstractControls.ts +104 -3
- package/src/plugins/input/Controls.test.ts +205 -0
- package/src/plugins/input/InputPlugin.ts +6 -14
- package/src/plugins/input/controlsCore.test.ts +151 -0
- package/src/plugins/input/controlsCore.ts +162 -0
- package/src/plugins/input/keyboard/KeyboardControls.ts +84 -0
- package/src/plugins/input/keyboard/index.ts +1 -1
- package/src/plugins/input/touch/VirtualControls.test.ts +38 -0
- package/src/plugins/input/touch/VirtualControls.ts +53 -120
- package/src/plugins/spine/SpinePlugin.ts +2 -2
- package/src/store/Store.test.ts +15 -0
- package/src/store/Store.ts +4 -1
- package/src/ui/Button.test.ts +12 -0
- package/src/ui/Button.ts +1 -0
- package/src/ui/UICanvas.test.ts +109 -6
- package/src/ui/UICanvas.ts +41 -3
- package/src/utils/color.test.ts +16 -0
- package/src/utils/color.ts +2 -1
- package/src/utils/platform.ts +1 -1
- package/src/version.ts +1 -1
- package/lib/DataAdapter-DS-twowe.js.map +0 -1
- package/lib/SpinePlugin-uN641Hmk.js.map +0 -1
- package/lib/StatsPlugin-vZQRm6wh.js.map +0 -1
- package/lib/VoiceOverPlugin-KlZdGj1G.js.map +0 -1
- package/lib/plugins/input/keyboard/KeyboardContols.d.ts +0 -28
- package/lib/plugins/input/keyboard/KeyboardContols.d.ts.map +0 -1
- package/lib/registries-BLrxALZ0.js.map +0 -1
- package/src/plugins/input/keyboard/KeyboardContols.ts +0 -182
|
@@ -26,30 +26,30 @@ function ue() {
|
|
|
26
26
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function g(e, t, n = !1) {
|
|
30
30
|
return e + Math.random() * (t - e + +!!n);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function de(e, t = !1) {
|
|
33
|
+
return g(e.x, e.y, t);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return Math.floor(
|
|
35
|
+
function fe(e, t, n = !1) {
|
|
36
|
+
return Math.floor(g(e, t, n));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
38
|
+
function pe(e, t = !1) {
|
|
39
|
+
return fe(e.x, e.y, t);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function me() {
|
|
42
42
|
return Math.random() < .5;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
//#region src/utils/bind.ts
|
|
46
|
-
function
|
|
46
|
+
function he(e, ...t) {
|
|
47
47
|
t.forEach((t) => {
|
|
48
48
|
let n = e[t];
|
|
49
49
|
typeof n == "function" && (e[t] = n.bind(e));
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ge(e, t = [], n = []) {
|
|
53
53
|
let r = Object.getPrototypeOf(e), i = [];
|
|
54
54
|
for (; r;) {
|
|
55
55
|
let e = Object.getOwnPropertyNames(r).filter((e) => typeof Object.getOwnPropertyDescriptor(r, e)?.value == "function" && e !== "constructor" && !t.some((t) => e.startsWith(t)) && !n.includes(e));
|
|
@@ -58,17 +58,17 @@ function _e(e, t = [], n = []) {
|
|
|
58
58
|
}
|
|
59
59
|
return i;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
61
|
+
function _(e, t = [], n = []) {
|
|
62
|
+
ge(e, t, n).forEach((t) => {
|
|
63
63
|
e[t] = e[t].bind(e);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function _e(e, t, ...n) {
|
|
67
67
|
typeof e[t] == "function" && e[t](...n);
|
|
68
68
|
}
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/utils/env.ts
|
|
71
|
-
var
|
|
71
|
+
var ve = process.env.NODE_ENV, v = ve === "development", ye = ve === "production";
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/utils/string.ts
|
|
74
74
|
function y(e) {
|
|
@@ -83,7 +83,7 @@ var b = {
|
|
|
83
83
|
log: "background: #74b64c; color: black;",
|
|
84
84
|
warn: "background: yellow; color: black;",
|
|
85
85
|
error: "background: red; color: white;"
|
|
86
|
-
},
|
|
86
|
+
}, xe = "background: #1f2937; color: #74b64c;", x = class e {
|
|
87
87
|
static {
|
|
88
88
|
this._instance = null;
|
|
89
89
|
}
|
|
@@ -119,8 +119,8 @@ var b = {
|
|
|
119
119
|
static lifecycle(t, n = "init", ...r) {
|
|
120
120
|
if (e.mode === "disabled") return;
|
|
121
121
|
let i = `${t} ${n}`;
|
|
122
|
-
if (e.mode === "default") return console.log(`%c ${y(n)} `,
|
|
123
|
-
console.groupCollapsed(`%c ${y(n)} `,
|
|
122
|
+
if (e.mode === "default") return console.log(`%c ${y(n)} `, xe, i, ...r);
|
|
123
|
+
console.groupCollapsed(`%c ${y(n)} `, xe, i, ...r), console.trace("%c Stack ", xe), console.groupEnd();
|
|
124
124
|
}
|
|
125
125
|
static trace(t = "log", ...n) {
|
|
126
126
|
if (e.mode !== "disabled") {
|
|
@@ -129,20 +129,20 @@ var b = {
|
|
|
129
129
|
console.groupCollapsed(`%c ${y(t)} `, b[t], ...n), console.trace("%c Stack ", b[t]), console.groupEnd();
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
},
|
|
132
|
+
}, S = /* @__PURE__ */ function(e) {
|
|
133
133
|
return e.REQUIRED_ASSETS_START = "caper-required-assets-start", e.REQUIRED_ASSETS_PROGRESS = "caper-required-assets-progress", e.REQUIRED_ASSETS_COMPLETE = "caper-required-assets-complete", e.ASSETS_START = "caper-assets-start", e.ASSETS_PROGRESS = "caper-assets-progress", e.ASSETS_COMPLETE = "caper-assets-complete", e;
|
|
134
|
-
}({}),
|
|
134
|
+
}({}), Se = (e = 0) => new Promise((t) => setTimeout(t, e * 1e3)), Ce = (e = 0) => Se(e), C = (e) => e && typeof e.then == "function";
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/utils/vite.ts
|
|
137
|
-
function
|
|
138
|
-
|
|
137
|
+
function w(e) {
|
|
138
|
+
x.error(e);
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/utils/promise/Queue.ts
|
|
142
|
-
function
|
|
143
|
-
return new
|
|
142
|
+
function we(...e) {
|
|
143
|
+
return new Te(e);
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var Te = class {
|
|
146
146
|
constructor(e = []) {
|
|
147
147
|
this._currentIndex = 0, this._isPaused = !1, this._isCanceled = !1, this._promises = e;
|
|
148
148
|
}
|
|
@@ -175,7 +175,7 @@ var we = class {
|
|
|
175
175
|
this._results.push(t), this._currentIndex++, this._next();
|
|
176
176
|
} catch (e) {
|
|
177
177
|
let t = e instanceof Error ? e : Error(String(e));
|
|
178
|
-
console.error("Queue didn't complete due to an error:", e),
|
|
178
|
+
console.error("Queue didn't complete due to an error:", e), w({
|
|
179
179
|
message: `Queue didn't complete due to an error: ${t.message}`,
|
|
180
180
|
stack: t.stack,
|
|
181
181
|
id: e?.id
|
|
@@ -185,23 +185,23 @@ var we = class {
|
|
|
185
185
|
};
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/utils/framework.ts
|
|
188
|
-
function
|
|
188
|
+
function Ee(e) {
|
|
189
189
|
return typeof e == "function" && /^class\s/.test(Function.prototype.toString.call(e));
|
|
190
190
|
}
|
|
191
|
-
async function
|
|
191
|
+
async function T(e) {
|
|
192
192
|
let t, n;
|
|
193
|
-
return
|
|
193
|
+
return C(e.module) ? (t = await e.module, n = e?.namedExport ? t[e.namedExport] : t.default) : typeof e.module == "function" ? Ee(e.module) ? (t = e.module, n = t) : (t = await e.module(), n = e?.namedExport ? t[e.namedExport] : t.default) : (t = e.module, n = t), n;
|
|
194
194
|
}
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/utils/map.ts
|
|
197
|
-
function
|
|
197
|
+
function De(e, t) {
|
|
198
198
|
let n;
|
|
199
199
|
for (let r of e) {
|
|
200
200
|
if (r[0] === t) return n;
|
|
201
201
|
n = r;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Oe(e, t) {
|
|
205
205
|
let n, r = Array.from(e.entries());
|
|
206
206
|
for (let e = r.length - 1; e >= 0; e--) {
|
|
207
207
|
let i = r[e];
|
|
@@ -209,23 +209,23 @@ function De(e, t) {
|
|
|
209
209
|
n = i;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function ke(e) {
|
|
213
213
|
return Array.from(e.entries()).pop();
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ae(e) {
|
|
216
216
|
return Array.from(e.entries()).shift();
|
|
217
217
|
}
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region src/utils/math.ts
|
|
220
|
-
function
|
|
220
|
+
function je(e, t, n) {
|
|
221
221
|
return Math.max(t, Math.min(n, e));
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Me(e, t, n) {
|
|
224
224
|
return e + (t - e) * n;
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
227
|
//#region src/utils/misc.ts
|
|
228
|
-
function
|
|
228
|
+
function Ne(e) {
|
|
229
229
|
if (e === void 0) return {
|
|
230
230
|
width: 0,
|
|
231
231
|
height: 0
|
|
@@ -249,7 +249,7 @@ function Me(e) {
|
|
|
249
249
|
height: e ?? 0
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function Pe(e, t) {
|
|
253
253
|
let n = null;
|
|
254
254
|
return function(...r) {
|
|
255
255
|
n && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -259,20 +259,20 @@ function Ne(e, t) {
|
|
|
259
259
|
}
|
|
260
260
|
//#endregion
|
|
261
261
|
//#region src/utils/object.ts
|
|
262
|
-
function
|
|
262
|
+
function Fe(e, t) {
|
|
263
263
|
return t.reduce((t, n) => n in e ? {
|
|
264
264
|
...t,
|
|
265
265
|
[n]: e[n]
|
|
266
266
|
} : t, {});
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function Ie(e, t) {
|
|
269
269
|
return Object.entries(t).filter(([t]) => !e.includes(t)).reduce((e, [t, n]) => ({
|
|
270
270
|
...e,
|
|
271
271
|
[t]: n
|
|
272
272
|
}), {});
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] =
|
|
274
|
+
function E(e, t) {
|
|
275
|
+
for (let n in t) t[n] !== void 0 && Object.prototype.toString.call(t[n]) === "[object Object]" && n in e && typeof e[n] == "object" ? e[n] = E(e[n], t[n]) : t[n] !== void 0 && (e[n] = t[n]);
|
|
276
276
|
return e;
|
|
277
277
|
}
|
|
278
278
|
//#endregion
|
|
@@ -294,7 +294,7 @@ function Ve(e, t) {
|
|
|
294
294
|
return n.x *= t, n.y *= t, n;
|
|
295
295
|
}
|
|
296
296
|
function He(e, t) {
|
|
297
|
-
return
|
|
297
|
+
return Me(e.x, e.y, t);
|
|
298
298
|
}
|
|
299
299
|
function Ue(e, t) {
|
|
300
300
|
return Math.sqrt(We(e, t));
|
|
@@ -325,62 +325,63 @@ function qe() {
|
|
|
325
325
|
//#endregion
|
|
326
326
|
//#region src/core/config.ts
|
|
327
327
|
async function Je(e) {
|
|
328
|
-
let t = Caper
|
|
328
|
+
let t = globalThis.Caper?.get?.("pluginsList") ?? [];
|
|
329
329
|
return e.map((e) => {
|
|
330
|
-
let n =
|
|
331
|
-
if (!
|
|
332
|
-
let
|
|
330
|
+
let n = Array.isArray(e) ? e[0] : e, r = t.find((e) => e.id === n);
|
|
331
|
+
if (!r) return x.warn(`Plugin ${e} not found`), null;
|
|
332
|
+
let i = e;
|
|
333
333
|
return {
|
|
334
|
-
id:
|
|
335
|
-
path:
|
|
336
|
-
module:
|
|
337
|
-
requires:
|
|
338
|
-
options:
|
|
339
|
-
autoLoad:
|
|
334
|
+
id: r.id,
|
|
335
|
+
path: r.path,
|
|
336
|
+
module: r.module,
|
|
337
|
+
requires: r.requires ?? [],
|
|
338
|
+
options: i[1]?.options,
|
|
339
|
+
autoLoad: i[1]?.autoLoad !== !1
|
|
340
340
|
};
|
|
341
341
|
}).filter(Boolean);
|
|
342
342
|
}
|
|
343
343
|
function Ye(e) {
|
|
344
344
|
return e;
|
|
345
345
|
}
|
|
346
|
-
function Xe(e) {
|
|
346
|
+
function Xe(e, t) {
|
|
347
347
|
if (e.length < 2) return e.slice();
|
|
348
|
-
let
|
|
349
|
-
for (let
|
|
350
|
-
let n = [];
|
|
351
|
-
for (let
|
|
352
|
-
from:
|
|
348
|
+
let n = /* @__PURE__ */ new Map();
|
|
349
|
+
for (let t of e) n.set(t.id, t);
|
|
350
|
+
let r = (e) => (e.requires ?? []).filter((e) => n.has(e) || !t?.has(e)), i = [];
|
|
351
|
+
for (let t of e) for (let e of r(t)) n.has(e) || i.push({
|
|
352
|
+
from: t.id,
|
|
353
353
|
required: e
|
|
354
354
|
});
|
|
355
|
-
if (
|
|
356
|
-
let e =
|
|
355
|
+
if (i.length > 0) {
|
|
356
|
+
let e = i.map((e) => ` - Plugin '${e.from}' requires '${e.required}' which is not registered.`), t = "\nAdd the missing plugin id(s) to plugins[] in caper.config.ts:\n " + [...new Set(i.map((e) => `'${e.required}'`))].join(", ");
|
|
357
357
|
throw Error(`Caper bootstrap failed:\n${e.join("\n")}${t}`);
|
|
358
358
|
}
|
|
359
|
-
let
|
|
360
|
-
e.forEach((e, t) =>
|
|
361
|
-
let
|
|
359
|
+
let a = /* @__PURE__ */ new Map();
|
|
360
|
+
e.forEach((e, t) => a.set(e.id, t));
|
|
361
|
+
let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
362
362
|
for (let t of e) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
363
|
+
let e = r(t);
|
|
364
|
+
o.set(t.id, e.length);
|
|
365
|
+
for (let n of e) s.has(n) || s.set(n, []), s.get(n).push(t.id);
|
|
366
|
+
}
|
|
367
|
+
let c = [];
|
|
368
|
+
for (let t of e) o.get(t.id) === 0 && c.push(t.id);
|
|
369
|
+
c.sort((e, t) => a.get(e) - a.get(t));
|
|
370
|
+
let l = [];
|
|
371
|
+
for (; c.length > 0;) {
|
|
372
|
+
let e = c.shift();
|
|
373
|
+
l.push(n.get(e));
|
|
374
|
+
for (let t of s.get(e) ?? []) if (o.set(t, o.get(t) - 1), o.get(t) === 0) {
|
|
375
|
+
let e = a.get(t), n = 0;
|
|
376
|
+
for (; n < c.length && a.get(c[n]) < e;) n++;
|
|
377
|
+
c.splice(n, 0, t);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (l.length !== e.length) {
|
|
381
|
+
let t = e.filter((e) => !l.includes(e)).map((e) => e.id), r = Ze(t, n);
|
|
382
|
+
throw Error(`Caper bootstrap failed: plugin dependency cycle detected: ${r.join(" → ")}\nPlugins involved: ${t.join(", ")}`);
|
|
383
|
+
}
|
|
384
|
+
return l;
|
|
384
385
|
}
|
|
385
386
|
function Ze(e, t) {
|
|
386
387
|
let n = /* @__PURE__ */ new Set(), r = [], i = new Set(e);
|
|
@@ -404,13 +405,23 @@ function Ze(e, t) {
|
|
|
404
405
|
return e;
|
|
405
406
|
}
|
|
406
407
|
//#endregion
|
|
408
|
+
//#region src/mixins/factory/defaults.ts
|
|
409
|
+
var D = null;
|
|
410
|
+
function Qe(e) {
|
|
411
|
+
D = e;
|
|
412
|
+
}
|
|
413
|
+
function $e() {
|
|
414
|
+
if (!D) throw Error("[caper] The factory method table hasn't been initialized. Import '@caperjs/core' (or its factory module) before deep-importing display/ui classes so the table is registered first.");
|
|
415
|
+
return D;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
407
418
|
//#region src/core/interfaces/IStorageCapability.ts
|
|
408
|
-
function
|
|
419
|
+
function O(e) {
|
|
409
420
|
return !!e && typeof e.save == "function" && typeof e.load == "function";
|
|
410
421
|
}
|
|
411
422
|
//#endregion
|
|
412
423
|
//#region ../../node_modules/.pnpm/typed-signals@2.5.0/node_modules/typed-signals/dist/Collector.js
|
|
413
|
-
var
|
|
424
|
+
var k = /* @__PURE__ */ h(((e) => {
|
|
414
425
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.Collector = void 0, e.Collector = class {
|
|
415
426
|
constructor(e) {
|
|
416
427
|
this.emit = (...t) => {
|
|
@@ -418,9 +429,9 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
418
429
|
};
|
|
419
430
|
}
|
|
420
431
|
};
|
|
421
|
-
})),
|
|
432
|
+
})), et = /* @__PURE__ */ h(((e) => {
|
|
422
433
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorArray = void 0;
|
|
423
|
-
var t =
|
|
434
|
+
var t = k();
|
|
424
435
|
e.CollectorArray = class extends t.Collector {
|
|
425
436
|
constructor() {
|
|
426
437
|
super(...arguments), this.result = [];
|
|
@@ -435,9 +446,9 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
435
446
|
this.result.length = 0;
|
|
436
447
|
}
|
|
437
448
|
};
|
|
438
|
-
})),
|
|
449
|
+
})), tt = /* @__PURE__ */ h(((e) => {
|
|
439
450
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorLast = void 0;
|
|
440
|
-
var t =
|
|
451
|
+
var t = k();
|
|
441
452
|
e.CollectorLast = class extends t.Collector {
|
|
442
453
|
handleResult(e) {
|
|
443
454
|
return this.result = e, !0;
|
|
@@ -449,9 +460,9 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
449
460
|
delete this.result;
|
|
450
461
|
}
|
|
451
462
|
};
|
|
452
|
-
})),
|
|
463
|
+
})), nt = /* @__PURE__ */ h(((e) => {
|
|
453
464
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorUntil0 = void 0;
|
|
454
|
-
var t =
|
|
465
|
+
var t = k();
|
|
455
466
|
e.CollectorUntil0 = class extends t.Collector {
|
|
456
467
|
constructor() {
|
|
457
468
|
super(...arguments), this.result = !1;
|
|
@@ -466,9 +477,9 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
466
477
|
this.result = !1;
|
|
467
478
|
}
|
|
468
479
|
};
|
|
469
|
-
})),
|
|
480
|
+
})), rt = /* @__PURE__ */ h(((e) => {
|
|
470
481
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.CollectorWhile0 = void 0;
|
|
471
|
-
var t =
|
|
482
|
+
var t = k();
|
|
472
483
|
e.CollectorWhile0 = class extends t.Collector {
|
|
473
484
|
constructor() {
|
|
474
485
|
super(...arguments), this.result = !1;
|
|
@@ -483,7 +494,7 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
483
494
|
this.result = !1;
|
|
484
495
|
}
|
|
485
496
|
};
|
|
486
|
-
})),
|
|
497
|
+
})), it = /* @__PURE__ */ h(((e) => {
|
|
487
498
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnectionImpl = void 0, e.SignalConnectionImpl = class {
|
|
488
499
|
constructor(e, t) {
|
|
489
500
|
this.link = e, this.parentCleanup = t;
|
|
@@ -498,7 +509,7 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
498
509
|
return this.link !== null && this.link.isEnabled();
|
|
499
510
|
}
|
|
500
511
|
};
|
|
501
|
-
})),
|
|
512
|
+
})), at = /* @__PURE__ */ h(((e) => {
|
|
502
513
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalLink = void 0, e.SignalLink = class e {
|
|
503
514
|
constructor(e = null, t = null, n = 0) {
|
|
504
515
|
this.enabled = !0, this.newLink = !1, this.callback = null, this.prev = e ?? this, this.next = t ?? this, this.order = n;
|
|
@@ -519,9 +530,9 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
519
530
|
return i.callback = t, r.next = i, i.next.prev = i, i;
|
|
520
531
|
}
|
|
521
532
|
};
|
|
522
|
-
})),
|
|
533
|
+
})), ot = /* @__PURE__ */ h(((e) => {
|
|
523
534
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.Signal = void 0;
|
|
524
|
-
var t =
|
|
535
|
+
var t = it(), n = at();
|
|
525
536
|
e.Signal = class {
|
|
526
537
|
constructor() {
|
|
527
538
|
this.head = new n.SignalLink(), this.hasNewLinks = !1, this.emitDepth = 0, this.connectionsCount = 0;
|
|
@@ -568,7 +579,7 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
568
579
|
}
|
|
569
580
|
}
|
|
570
581
|
};
|
|
571
|
-
})),
|
|
582
|
+
})), st = /* @__PURE__ */ h(((e) => {
|
|
572
583
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnections = void 0, e.SignalConnections = class {
|
|
573
584
|
constructor() {
|
|
574
585
|
this.list = [];
|
|
@@ -587,58 +598,58 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
587
598
|
return this.list.length === 0;
|
|
588
599
|
}
|
|
589
600
|
};
|
|
590
|
-
})),
|
|
601
|
+
})), A = (/* @__PURE__ */ h(((e) => {
|
|
591
602
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.SignalConnections = e.Signal = e.CollectorWhile0 = e.CollectorUntil0 = e.CollectorLast = e.CollectorArray = e.Collector = void 0;
|
|
592
|
-
var t =
|
|
603
|
+
var t = k();
|
|
593
604
|
Object.defineProperty(e, "Collector", {
|
|
594
605
|
enumerable: !0,
|
|
595
606
|
get: function() {
|
|
596
607
|
return t.Collector;
|
|
597
608
|
}
|
|
598
609
|
});
|
|
599
|
-
var n =
|
|
610
|
+
var n = et();
|
|
600
611
|
Object.defineProperty(e, "CollectorArray", {
|
|
601
612
|
enumerable: !0,
|
|
602
613
|
get: function() {
|
|
603
614
|
return n.CollectorArray;
|
|
604
615
|
}
|
|
605
616
|
});
|
|
606
|
-
var r =
|
|
617
|
+
var r = tt();
|
|
607
618
|
Object.defineProperty(e, "CollectorLast", {
|
|
608
619
|
enumerable: !0,
|
|
609
620
|
get: function() {
|
|
610
621
|
return r.CollectorLast;
|
|
611
622
|
}
|
|
612
623
|
});
|
|
613
|
-
var i =
|
|
624
|
+
var i = nt();
|
|
614
625
|
Object.defineProperty(e, "CollectorUntil0", {
|
|
615
626
|
enumerable: !0,
|
|
616
627
|
get: function() {
|
|
617
628
|
return i.CollectorUntil0;
|
|
618
629
|
}
|
|
619
630
|
});
|
|
620
|
-
var a =
|
|
631
|
+
var a = rt();
|
|
621
632
|
Object.defineProperty(e, "CollectorWhile0", {
|
|
622
633
|
enumerable: !0,
|
|
623
634
|
get: function() {
|
|
624
635
|
return a.CollectorWhile0;
|
|
625
636
|
}
|
|
626
637
|
});
|
|
627
|
-
var o =
|
|
638
|
+
var o = ot();
|
|
628
639
|
Object.defineProperty(e, "Signal", {
|
|
629
640
|
enumerable: !0,
|
|
630
641
|
get: function() {
|
|
631
642
|
return o.Signal;
|
|
632
643
|
}
|
|
633
644
|
});
|
|
634
|
-
var s =
|
|
645
|
+
var s = st();
|
|
635
646
|
Object.defineProperty(e, "SignalConnections", {
|
|
636
647
|
enumerable: !0,
|
|
637
648
|
get: function() {
|
|
638
649
|
return s.SignalConnections;
|
|
639
650
|
}
|
|
640
651
|
});
|
|
641
|
-
})))(),
|
|
652
|
+
})))(), ct = {
|
|
642
653
|
highest: -(2 ** 53 - 1),
|
|
643
654
|
higher: -1e3,
|
|
644
655
|
high: -100,
|
|
@@ -646,7 +657,7 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
646
657
|
low: 100,
|
|
647
658
|
lower: 1e3,
|
|
648
659
|
lowest: 2 ** 53 - 1
|
|
649
|
-
},
|
|
660
|
+
}, j = class extends A.Signal {
|
|
650
661
|
connectOnce(e, t) {
|
|
651
662
|
let n = this.connect(((...t) => {
|
|
652
663
|
e(...t), n.disconnect();
|
|
@@ -660,12 +671,12 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
660
671
|
return i;
|
|
661
672
|
}
|
|
662
673
|
connect(e, t = "normal") {
|
|
663
|
-
let n =
|
|
674
|
+
let n = ct[t] ?? t;
|
|
664
675
|
return super.connect(e, n);
|
|
665
676
|
}
|
|
666
|
-
},
|
|
677
|
+
}, lt = class {
|
|
667
678
|
constructor() {
|
|
668
|
-
this.onError = new
|
|
679
|
+
this.onError = new j();
|
|
669
680
|
}
|
|
670
681
|
initialize(e) {
|
|
671
682
|
return this._app = e, this;
|
|
@@ -674,26 +685,26 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
674
685
|
this.onError.disconnectAll();
|
|
675
686
|
}
|
|
676
687
|
_emitError(e) {
|
|
677
|
-
|
|
688
|
+
x.error(`[Store.${e.operation}] adapter='${e.adapterId}' key='${e.key}': ${e.error.message}`), this.onError.emit(e);
|
|
678
689
|
}
|
|
679
690
|
getAdapter(e) {
|
|
680
691
|
let t = this._app.getPlugin(e);
|
|
681
692
|
if (!t) throw Error(`Adapter ${String(e)} not found`);
|
|
682
|
-
if (!
|
|
693
|
+
if (!O(t)) throw Error(`Plugin '${String(e)}' is not storage-capable (missing save/load)`);
|
|
683
694
|
return t;
|
|
684
695
|
}
|
|
685
696
|
hasAdapter(e) {
|
|
686
697
|
let t = this._app.getPlugin(e);
|
|
687
|
-
return !!t &&
|
|
698
|
+
return !!t && O(t);
|
|
688
699
|
}
|
|
689
700
|
allAdapterIds() {
|
|
690
701
|
let e = this._app._plugins, t = [];
|
|
691
|
-
if (e) for (let [n, r] of e)
|
|
702
|
+
if (e) for (let [n, r] of e) O(r) && t.push(n);
|
|
692
703
|
return t;
|
|
693
704
|
}
|
|
694
705
|
async save(e, t, n, r = !0) {
|
|
695
706
|
let i = [], a = [];
|
|
696
|
-
i = Array.isArray(e) ? e : [e], (
|
|
707
|
+
i = Array.isArray(e) ? e : [e], i.some((e) => e === "*" || e?.adapterId === "*") && (i = this.allAdapterIds());
|
|
697
708
|
for (let e = 0; e < i.length; e++) {
|
|
698
709
|
let o, s = !1;
|
|
699
710
|
if (typeof i[e] == "object") {
|
|
@@ -747,17 +758,10 @@ var O = /* @__PURE__ */ h(((e) => {
|
|
|
747
758
|
}), n;
|
|
748
759
|
}
|
|
749
760
|
}
|
|
750
|
-
}
|
|
751
|
-
function lt(e) {
|
|
752
|
-
ct = e;
|
|
753
|
-
}
|
|
754
|
-
function ut() {
|
|
755
|
-
if (!ct) throw Error("[caper] The factory method table hasn't been initialized. Import '@caperjs/core' (or its factory module) before deep-importing display/ui classes so the table is registered first.");
|
|
756
|
-
return ct;
|
|
757
|
-
}
|
|
761
|
+
};
|
|
758
762
|
//#endregion
|
|
759
763
|
//#region src/mixins/factory/methods.ts
|
|
760
|
-
function
|
|
764
|
+
function M(e, t, n) {
|
|
761
765
|
let r = {};
|
|
762
766
|
for (let i in e) r[i] = (...r) => {
|
|
763
767
|
let a = e[i](...r);
|
|
@@ -767,7 +771,7 @@ function j(e, t, n) {
|
|
|
767
771
|
}
|
|
768
772
|
//#endregion
|
|
769
773
|
//#region src/plugins/Plugin.ts
|
|
770
|
-
var
|
|
774
|
+
var N = class {
|
|
771
775
|
static {
|
|
772
776
|
this.__caper_method_binding_root = !0;
|
|
773
777
|
}
|
|
@@ -775,12 +779,19 @@ var M = class {
|
|
|
775
779
|
return this._options;
|
|
776
780
|
}
|
|
777
781
|
constructor(e = "Plugin") {
|
|
778
|
-
this.id = e, this._signalConnections = new
|
|
782
|
+
this.id = e, this._signalConnections = new A.SignalConnections(), this._disposers = [], _(this);
|
|
779
783
|
}
|
|
780
784
|
get app() {
|
|
781
785
|
return $.getInstance();
|
|
782
786
|
}
|
|
783
787
|
destroy() {
|
|
788
|
+
let e = this._disposers;
|
|
789
|
+
this._disposers = [];
|
|
790
|
+
for (let t = e.length - 1; t >= 0; t--) try {
|
|
791
|
+
e[t]();
|
|
792
|
+
} catch (e) {
|
|
793
|
+
x.error(`Plugin "${this.id}" threw while running a disposer:`, e);
|
|
794
|
+
}
|
|
784
795
|
this._signalConnections.disconnectAll();
|
|
785
796
|
}
|
|
786
797
|
async initialize(e, t) {
|
|
@@ -795,16 +806,34 @@ var M = class {
|
|
|
795
806
|
clearSignalConnections() {
|
|
796
807
|
this._signalConnections.disconnectAll();
|
|
797
808
|
}
|
|
809
|
+
addDisposer(...e) {
|
|
810
|
+
for (let t of e) this._disposers.push(t);
|
|
811
|
+
}
|
|
812
|
+
listen(e, t, n, r) {
|
|
813
|
+
e.addEventListener(t, n, r);
|
|
814
|
+
let i = !1, a = () => {
|
|
815
|
+
i || (i = !0, e.removeEventListener(t, n, r));
|
|
816
|
+
};
|
|
817
|
+
return this.addDisposer(a), a;
|
|
818
|
+
}
|
|
819
|
+
addTickerCallback(e, t, n) {
|
|
820
|
+
let r = this.app.ticker;
|
|
821
|
+
r.add(e, t, n);
|
|
822
|
+
let i = !1, a = () => {
|
|
823
|
+
i || (i = !0, r.remove(e, t));
|
|
824
|
+
};
|
|
825
|
+
return this.addDisposer(a), a;
|
|
826
|
+
}
|
|
798
827
|
registerCoreFunctions() {
|
|
799
828
|
this.getCoreFunctions().forEach((e) => {
|
|
800
829
|
let t = e;
|
|
801
|
-
|
|
830
|
+
Jn[t] = this[e];
|
|
802
831
|
});
|
|
803
832
|
}
|
|
804
833
|
registerCoreSignals() {
|
|
805
834
|
this.getCoreSignals().forEach((e) => {
|
|
806
835
|
let t = e;
|
|
807
|
-
|
|
836
|
+
qn[t] = this[e];
|
|
808
837
|
});
|
|
809
838
|
}
|
|
810
839
|
getCoreFunctions() {
|
|
@@ -813,65 +842,65 @@ var M = class {
|
|
|
813
842
|
getCoreSignals() {
|
|
814
843
|
return [];
|
|
815
844
|
}
|
|
816
|
-
},
|
|
845
|
+
}, ut = {
|
|
817
846
|
preferWorkers: !v,
|
|
818
847
|
crossOrigin: "anonymous"
|
|
819
848
|
};
|
|
820
|
-
function
|
|
849
|
+
function dt(e) {
|
|
821
850
|
if (typeof e == "string") {
|
|
822
851
|
if (!e?.includes(".svg")) return e;
|
|
823
852
|
e = { src: e };
|
|
824
853
|
} else if (Array.isArray(e.src) || !e.src?.includes(".svg")) return e;
|
|
825
854
|
return e.data ||= {}, e.data.parseAsGraphicsContext = !0, e;
|
|
826
855
|
}
|
|
827
|
-
function
|
|
856
|
+
function P(e) {
|
|
828
857
|
return Array.isArray(e) || (e = [e]), e.map((e) => {
|
|
829
|
-
if (typeof e == "string") return
|
|
858
|
+
if (typeof e == "string") return dt(e);
|
|
830
859
|
if (typeof e == "object") {
|
|
831
860
|
let t = e?.src || [];
|
|
832
|
-
return Array.isArray(t) || (t = [t]), e.ext ? (e.src && !Array.isArray(e.src) && (t.push(e.src), e.src = [e.src]), e.src = e.src.map((t) => `${t}.${e.ext}`), e.alias = [...t, ...e.src].filter(Boolean)) :
|
|
861
|
+
return Array.isArray(t) || (t = [t]), e.ext ? (e.src && !Array.isArray(e.src) && (t.push(e.src), e.src = [e.src]), e.src = e.src.map((t) => `${t}.${e.ext}`), e.alias = [...t, ...e.src].filter(Boolean)) : dt(e), e;
|
|
833
862
|
}
|
|
834
863
|
});
|
|
835
864
|
}
|
|
836
|
-
var
|
|
865
|
+
var ft = class extends N {
|
|
837
866
|
constructor(...e) {
|
|
838
|
-
super(...e), this.id = "assets", this.onLoadStart = new
|
|
867
|
+
super(...e), this.id = "assets", this.onLoadStart = new j(), this.onLoadProgress = new j(), this.onLoadComplete = new j(), this.onLoadRequiredStart = new j(), this.onLoadRequiredProgress = new j(), this.onLoadRequiredComplete = new j(), this.onBackgroundLoadStart = new j(), this.onBackgroundAssetLoaded = new j(), this.onBackgroundBundlesLoaded = new j(), this._loadedBundles = /* @__PURE__ */ new Set(), this._loadedAssets = /* @__PURE__ */ new Set(), this._required = {}, this._background = {}, this._isLoadingRequired = !1, this.webRequiredStartEvent = new Event(S.REQUIRED_ASSETS_START, {
|
|
839
868
|
bubbles: !0,
|
|
840
869
|
cancelable: !1
|
|
841
|
-
}), this.webRequiredProgressEvent = new CustomEvent(
|
|
870
|
+
}), this.webRequiredProgressEvent = new CustomEvent(S.REQUIRED_ASSETS_PROGRESS, {
|
|
842
871
|
bubbles: !0,
|
|
843
872
|
cancelable: !1,
|
|
844
873
|
detail: { progress: 0 }
|
|
845
|
-
}), this.webRequiredCompleteEvent = new Event(
|
|
874
|
+
}), this.webRequiredCompleteEvent = new Event(S.REQUIRED_ASSETS_COMPLETE, {
|
|
846
875
|
bubbles: !0,
|
|
847
876
|
cancelable: !1
|
|
848
|
-
}), this.webStartEvent = new Event(
|
|
877
|
+
}), this.webStartEvent = new Event(S.ASSETS_START, {
|
|
849
878
|
bubbles: !0,
|
|
850
879
|
cancelable: !1
|
|
851
|
-
}), this.webProgressEvent = new CustomEvent(
|
|
880
|
+
}), this.webProgressEvent = new CustomEvent(S.ASSETS_PROGRESS, {
|
|
852
881
|
bubbles: !0,
|
|
853
882
|
cancelable: !1,
|
|
854
883
|
detail: { progress: 0 }
|
|
855
|
-
}), this.webCompleteEvent = new Event(
|
|
884
|
+
}), this.webCompleteEvent = new Event(S.ASSETS_COMPLETE, {
|
|
856
885
|
bubbles: !0,
|
|
857
886
|
cancelable: !1
|
|
858
887
|
});
|
|
859
888
|
}
|
|
860
889
|
initialize(e) {
|
|
861
890
|
e?.preload && (this._required = e.preload), e?.background && (this._background = e.background), t.setPreferences({
|
|
862
|
-
...
|
|
891
|
+
...ut,
|
|
863
892
|
...e?.assetPreferences
|
|
864
893
|
});
|
|
865
894
|
}
|
|
866
895
|
async loadRequired() {
|
|
867
|
-
if (this._isLoadingRequired = !0, this._handleLoadStart(), this._handleLoadProgress(0), this._required && (this._required.assets && await t.load(
|
|
896
|
+
if (this._isLoadingRequired = !0, this._handleLoadStart(), this._handleLoadProgress(0), this._required && (this._required.assets && await t.load(P(this._required.assets), this._handleLoadProgress), this._required.bundles)) {
|
|
868
897
|
let e = this._required.bundles;
|
|
869
|
-
Array.isArray(e) || (e = [e]), e = e.filter((e) => !this._isBundleLoaded(e)), await t.loadBundle(
|
|
898
|
+
Array.isArray(e) || (e = [e]), e = e.filter((e) => !this._isBundleLoaded(e)), e.length && await t.loadBundle(e, this._handleLoadProgress);
|
|
870
899
|
}
|
|
871
900
|
return this._handleLoadComplete(), this._isLoadingRequired = !1, Promise.resolve();
|
|
872
901
|
}
|
|
873
902
|
loadBackground() {
|
|
874
|
-
this.onBackgroundLoadStart.emit(), this._background && (this._background.assets &&
|
|
903
|
+
this.onBackgroundLoadStart.emit(), this._background && (this._background.assets && P(this._background.assets).forEach((e) => {
|
|
875
904
|
if (e?.src) {
|
|
876
905
|
let n = e.src;
|
|
877
906
|
if (n) return t.backgroundLoad(n);
|
|
@@ -884,14 +913,14 @@ var pt = class extends M {
|
|
|
884
913
|
}));
|
|
885
914
|
}
|
|
886
915
|
async loadAssets(e, n = !0) {
|
|
887
|
-
return e =
|
|
916
|
+
return e = P(e), await t.load(e, n ? this._handleLoadProgress : void 0), this._markAssetsLoaded(e), Promise.resolve();
|
|
888
917
|
}
|
|
889
918
|
async loadBundles(e, n = !0) {
|
|
890
919
|
return await t.loadBundle(e, n ? this._handleLoadProgress : void 0), this._markBundlesLoaded(e), Promise.resolve();
|
|
891
920
|
}
|
|
892
921
|
async unloadSceneAssets(e) {
|
|
893
922
|
if (e.assets?.preload?.assets) {
|
|
894
|
-
let n =
|
|
923
|
+
let n = P(e.assets.preload.assets);
|
|
895
924
|
t.unload(n).then(() => {
|
|
896
925
|
this._markAssetsUnloaded(n);
|
|
897
926
|
});
|
|
@@ -908,7 +937,7 @@ var pt = class extends M {
|
|
|
908
937
|
if (n) {
|
|
909
938
|
if (e.assets?.background) {
|
|
910
939
|
if (e.assets.background.assets) {
|
|
911
|
-
let n =
|
|
940
|
+
let n = P(e.assets.background.assets).filter((e) => !this._isAssetLoaded(e));
|
|
912
941
|
n.length && n.forEach((e) => {
|
|
913
942
|
if (e?.src) {
|
|
914
943
|
let n = e.src;
|
|
@@ -924,7 +953,7 @@ var pt = class extends M {
|
|
|
924
953
|
}
|
|
925
954
|
} else {
|
|
926
955
|
if (this._handleLoadStart(), this._handleLoadProgress(0), e.assets?.preload?.assets) {
|
|
927
|
-
let n =
|
|
956
|
+
let n = P(e.assets.preload.assets), r = n.filter((e) => !this._isAssetLoaded(e));
|
|
928
957
|
r.length && (await t.load(r, this._handleLoadProgress), this._markAssetsLoaded(n));
|
|
929
958
|
}
|
|
930
959
|
if (e.assets?.preload?.bundles) {
|
|
@@ -1002,7 +1031,7 @@ var pt = class extends M {
|
|
|
1002
1031
|
throw Error("Error dispatching web event", { cause: e });
|
|
1003
1032
|
}
|
|
1004
1033
|
}
|
|
1005
|
-
},
|
|
1034
|
+
}, pt = class extends N {
|
|
1006
1035
|
set isFullScreen(e) {
|
|
1007
1036
|
this._isFullScreen = e, this.setFullScreen(e);
|
|
1008
1037
|
}
|
|
@@ -1016,16 +1045,13 @@ var pt = class extends M {
|
|
|
1016
1045
|
return this._fullScreenElement;
|
|
1017
1046
|
}
|
|
1018
1047
|
constructor() {
|
|
1019
|
-
super(), this.id = "fullscreen", this.onFullScreenChange = new
|
|
1048
|
+
super(), this.id = "fullscreen", this.onFullScreenChange = new j(), this._isFullScreen = !1, this._fullScreenElement = null, _(this);
|
|
1020
1049
|
}
|
|
1021
1050
|
get app() {
|
|
1022
1051
|
return $.getInstance();
|
|
1023
1052
|
}
|
|
1024
1053
|
initialize() {
|
|
1025
|
-
|
|
1026
|
-
}
|
|
1027
|
-
destroy() {
|
|
1028
|
-
document.removeEventListener("fullscreenchange", this._onFullScreenChange), document.removeEventListener("webkitfullscreenchange", this._onFullScreenChange), document.removeEventListener("mozfullscreenchange", this._onFullScreenChange), document.removeEventListener("msfullscreenchange", this._onFullScreenChange), document.removeEventListener("fullscreenchange", this._onFullScreenChange);
|
|
1054
|
+
this.listen(document, "fullscreenchange", this._onFullScreenChange), this.listen(document, "webkitfullscreenchange", this._onFullScreenChange), this.listen(document, "mozfullscreenchange", this._onFullScreenChange), this.listen(document, "msfullscreenchange", this._onFullScreenChange), this.listen(document, "fullscreenchange", this._onFullScreenChange);
|
|
1029
1055
|
}
|
|
1030
1056
|
toggleFullScreen() {
|
|
1031
1057
|
this.setFullScreen(!this._isFullScreen);
|
|
@@ -1034,7 +1060,7 @@ var pt = class extends M {
|
|
|
1034
1060
|
this._isFullScreen = e, e ? this._requestFullscreen() : this._exitFullscreen();
|
|
1035
1061
|
}
|
|
1036
1062
|
setFullScreenElement(e) {
|
|
1037
|
-
e ||
|
|
1063
|
+
e || x.warn("No element passed to setFullScreenElement for fullscreen mode"), this._fullScreenElement = e;
|
|
1038
1064
|
}
|
|
1039
1065
|
get canFullscreen() {
|
|
1040
1066
|
let e = this._fullScreenElement || $.containerElement;
|
|
@@ -1062,24 +1088,24 @@ var pt = class extends M {
|
|
|
1062
1088
|
try {
|
|
1063
1089
|
t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.msRequestFullscreen ? t.msRequestFullscreen() : t.mozRequestFullScreen && t.mozRequestFullScreen();
|
|
1064
1090
|
} catch (e) {
|
|
1065
|
-
|
|
1091
|
+
x.error("Failed to request fullscreen:", e), this._isFullScreen = !1;
|
|
1066
1092
|
}
|
|
1067
1093
|
}
|
|
1068
1094
|
_exitFullscreen() {
|
|
1069
1095
|
document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen && document.mozCancelFullScreen();
|
|
1070
1096
|
}
|
|
1071
1097
|
_onFullScreenChange() {
|
|
1072
|
-
this.onFullScreenChange.emit(
|
|
1098
|
+
this._isFullScreen = this.isFullscreen, this.onFullScreenChange.emit(this._isFullScreen);
|
|
1073
1099
|
}
|
|
1074
1100
|
};
|
|
1075
1101
|
//#endregion
|
|
1076
1102
|
//#region src/plugins/KeyboardPlugin.ts
|
|
1077
|
-
function
|
|
1103
|
+
function F(e) {
|
|
1078
1104
|
return e === void 0 ? e = "*undefined*" : e === " " ? e = "Space" : e.length === 1 && (e = e.toUpperCase()), e;
|
|
1079
1105
|
}
|
|
1080
|
-
var
|
|
1106
|
+
var mt = class extends N {
|
|
1081
1107
|
constructor(...e) {
|
|
1082
|
-
super(...e), this.id = "keyboard", this.onGlobalKeyDown = new
|
|
1108
|
+
super(...e), this.id = "keyboard", this.onGlobalKeyDown = new j(), this.onGlobalKeyUp = new j(), this._keyDownSignals = /* @__PURE__ */ new Map(), this._keyUpSignals = /* @__PURE__ */ new Map(), this._keysDown = /* @__PURE__ */ new Set(), this._warnedNoConsumers = !1, this._enabled = !0;
|
|
1083
1109
|
}
|
|
1084
1110
|
get keysDown() {
|
|
1085
1111
|
return this._keysDown;
|
|
@@ -1091,10 +1117,7 @@ var ht = class extends M {
|
|
|
1091
1117
|
this._enabled = e;
|
|
1092
1118
|
}
|
|
1093
1119
|
initialize(e, t) {
|
|
1094
|
-
|
|
1095
|
-
}
|
|
1096
|
-
destroy() {
|
|
1097
|
-
document.removeEventListener("keydown", this._handleKeyDown), document.removeEventListener("keyup", this._handleKeyUp), document.removeEventListener("keydown", this._handleEvent), document.removeEventListener("keyup", this._handleEvent);
|
|
1120
|
+
this.listen(document, "keydown", this._handleKeyDown), this.listen(document, "keyup", this._handleKeyUp);
|
|
1098
1121
|
}
|
|
1099
1122
|
onKeyDown(e) {
|
|
1100
1123
|
return this._checkAndAddSignal(e || void 0, "keydown");
|
|
@@ -1117,29 +1140,29 @@ var ht = class extends M {
|
|
|
1117
1140
|
];
|
|
1118
1141
|
}
|
|
1119
1142
|
_handleKeyDown(e) {
|
|
1120
|
-
let t =
|
|
1143
|
+
let t = F(e.key);
|
|
1121
1144
|
this._keysDown.add(t), this.onGlobalKeyDown.emit({
|
|
1122
1145
|
event: e,
|
|
1123
1146
|
key: e.key
|
|
1124
1147
|
});
|
|
1125
1148
|
}
|
|
1126
1149
|
_handleKeyUp(e) {
|
|
1127
|
-
let t =
|
|
1128
|
-
this._keysDown.delete(t), v && !this._warnedNoConsumers && this._keyUpSignals.size === 0 && this._keyDownSignals.size === 0 && (this._warnedNoConsumers = !0,
|
|
1150
|
+
let t = F(e.key);
|
|
1151
|
+
this._keysDown.delete(t), v && !this._warnedNoConsumers && this._keyUpSignals.size === 0 && this._keyDownSignals.size === 0 && (this._warnedNoConsumers = !0, x.warn("KeyboardPlugin received a key event but no consumers are connected, so keyboard actions will not fire. Ensure the InputPlugin controls are connected — e.g. an Application subclass overriding postInitialize() must not skip framework wiring, or call app.controls.connect().")), this.onGlobalKeyUp.emit({
|
|
1129
1152
|
event: e,
|
|
1130
1153
|
key: e.key
|
|
1131
1154
|
});
|
|
1132
1155
|
}
|
|
1133
1156
|
_checkAndAddSignal(e, t) {
|
|
1134
1157
|
let n = t === "keydown" ? this._keyDownSignals : this._keyUpSignals;
|
|
1135
|
-
return n.size || this._listen(t), e =
|
|
1158
|
+
return n.size || this._listen(t), e = F(e), n.has(e) || n.set(e, new j()), n.get(e);
|
|
1136
1159
|
}
|
|
1137
1160
|
_listen(e) {
|
|
1138
|
-
|
|
1161
|
+
this.listen(document, e, this._handleEvent);
|
|
1139
1162
|
}
|
|
1140
1163
|
_handleEvent(e) {
|
|
1141
1164
|
if (!this._enabled) return;
|
|
1142
|
-
let t = e.type === "keydown" ? this._keyDownSignals : this._keyUpSignals, n =
|
|
1165
|
+
let t = e.type === "keydown" ? this._keyDownSignals : this._keyUpSignals, n = F(e.key);
|
|
1143
1166
|
t.get("*undefined*")?.emit({
|
|
1144
1167
|
event: e,
|
|
1145
1168
|
key: n
|
|
@@ -1148,9 +1171,9 @@ var ht = class extends M {
|
|
|
1148
1171
|
key: n
|
|
1149
1172
|
});
|
|
1150
1173
|
}
|
|
1151
|
-
},
|
|
1174
|
+
}, ht = class extends N {
|
|
1152
1175
|
constructor(...e) {
|
|
1153
|
-
super(...e), this.id = "actions", this.onActionContextChanged = new
|
|
1176
|
+
super(...e), this.id = "actions", this.onActionContextChanged = new j(), this.onActionDispatched = new j(), this._context = "default", this._signals = /* @__PURE__ */ new Map(), this._actions = {}, this._debug = !1;
|
|
1154
1177
|
}
|
|
1155
1178
|
set debug(e) {
|
|
1156
1179
|
this._debug = e;
|
|
@@ -1168,17 +1191,18 @@ var ht = class extends M {
|
|
|
1168
1191
|
this._actions = t?.config?.actions && t.config.actions || {};
|
|
1169
1192
|
}
|
|
1170
1193
|
getAction(e) {
|
|
1171
|
-
return this._signals.has(e) || this._signals.set(e, new
|
|
1194
|
+
return this._signals.has(e) || this._signals.set(e, new j()), this._signals.get(e);
|
|
1172
1195
|
}
|
|
1173
1196
|
getActions() {
|
|
1174
1197
|
return this._actions;
|
|
1175
1198
|
}
|
|
1176
1199
|
sendAction(e, t) {
|
|
1177
1200
|
if (!this._actions[e]) {
|
|
1178
|
-
this._debug &&
|
|
1201
|
+
this._debug && x.warn(`Action ${e} is not defined`);
|
|
1179
1202
|
return;
|
|
1180
1203
|
}
|
|
1181
|
-
|
|
1204
|
+
let n = this._actions[e].context;
|
|
1205
|
+
if (Array.isArray(n) ? n.includes(this.context) : n === this.context || n === "*") {
|
|
1182
1206
|
let n = {
|
|
1183
1207
|
id: e,
|
|
1184
1208
|
context: this.context,
|
|
@@ -1187,7 +1211,7 @@ var ht = class extends M {
|
|
|
1187
1211
|
this.getAction(e).emit(n), this.onActionDispatched.emit(n);
|
|
1188
1212
|
return;
|
|
1189
1213
|
}
|
|
1190
|
-
this._debug &&
|
|
1214
|
+
this._debug && x.warn(`Action ${e} is not allowed for context ${this.context}`);
|
|
1191
1215
|
}
|
|
1192
1216
|
setActionContext(e) {
|
|
1193
1217
|
return this.context = e, this.context;
|
|
@@ -1203,19 +1227,19 @@ var ht = class extends M {
|
|
|
1203
1227
|
getCoreSignals() {
|
|
1204
1228
|
return ["onActionContextChanged", "onActionDispatched"];
|
|
1205
1229
|
}
|
|
1206
|
-
},
|
|
1230
|
+
}, gt = {
|
|
1207
1231
|
default: "default",
|
|
1208
1232
|
menu: "menu",
|
|
1209
1233
|
pause: "pause",
|
|
1210
1234
|
popup: "popup",
|
|
1211
1235
|
game: "game"
|
|
1212
|
-
},
|
|
1236
|
+
}, _t = [
|
|
1213
1237
|
"default",
|
|
1214
1238
|
"menu",
|
|
1215
1239
|
"pause",
|
|
1216
1240
|
"popup",
|
|
1217
1241
|
"game"
|
|
1218
|
-
],
|
|
1242
|
+
], vt = [
|
|
1219
1243
|
"up",
|
|
1220
1244
|
"down",
|
|
1221
1245
|
"left",
|
|
@@ -1228,7 +1252,7 @@ var ht = class extends M {
|
|
|
1228
1252
|
"menu",
|
|
1229
1253
|
"back",
|
|
1230
1254
|
"next"
|
|
1231
|
-
],
|
|
1255
|
+
], yt = {
|
|
1232
1256
|
action: { context: "*" },
|
|
1233
1257
|
back: { context: [
|
|
1234
1258
|
"menu",
|
|
@@ -1265,10 +1289,10 @@ var ht = class extends M {
|
|
|
1265
1289
|
pause: { context: "*" },
|
|
1266
1290
|
unpause: { context: "*" },
|
|
1267
1291
|
start: { context: "*" }
|
|
1268
|
-
},
|
|
1292
|
+
}, bt = { __default_do_not_use__: "__default_do_not_use__" };
|
|
1269
1293
|
//#endregion
|
|
1270
1294
|
//#region src/plugins/breakpoints/evaluate.ts
|
|
1271
|
-
function
|
|
1295
|
+
function xt(e) {
|
|
1272
1296
|
let t = Object.entries(e);
|
|
1273
1297
|
if (t.length === 0) throw Error("[breakpoints] `tiers` is empty — declare at least one tier in caper.config.ts.");
|
|
1274
1298
|
for (let [e, n] of t) if (!Number.isFinite(n) || n < 0) throw Error(`[breakpoints] tier '${e}' has an invalid stop (${n}) — stops must be finite numbers >= 0.`);
|
|
@@ -1281,58 +1305,58 @@ function St(e) {
|
|
|
1281
1305
|
byName: Object.fromEntries(n)
|
|
1282
1306
|
};
|
|
1283
1307
|
}
|
|
1284
|
-
function
|
|
1308
|
+
function St(e, t) {
|
|
1285
1309
|
let n = e.names[0];
|
|
1286
1310
|
for (let r = 0; r < e.stops.length && !(t < e.stops[r]); r++) n = e.names[r];
|
|
1287
1311
|
return n;
|
|
1288
1312
|
}
|
|
1289
|
-
var
|
|
1290
|
-
function
|
|
1291
|
-
|
|
1313
|
+
var Ct = /* @__PURE__ */ new Set();
|
|
1314
|
+
function wt(e, t) {
|
|
1315
|
+
Ct.has(e) || (Ct.add(e), x.warn(t));
|
|
1292
1316
|
}
|
|
1293
|
-
function
|
|
1317
|
+
function I(e, t) {
|
|
1294
1318
|
if (typeof t == "number") return t;
|
|
1295
1319
|
let n = e.byName[t];
|
|
1296
|
-
return n === void 0 &&
|
|
1320
|
+
return n === void 0 && wt(`stop:${t}`, `[breakpoints] unknown tier '${t}' — known tiers: ${e.names.join(", ")}.`), n;
|
|
1297
1321
|
}
|
|
1298
|
-
function
|
|
1322
|
+
function Tt(e, t, n, r = "mode") {
|
|
1299
1323
|
if (typeof t == "function") try {
|
|
1300
1324
|
return t(e) === !0;
|
|
1301
1325
|
} catch (e) {
|
|
1302
|
-
return
|
|
1326
|
+
return wt(`predicate:${r}`, `[breakpoints] mode '${r}' threw; treating as false. ${String(e)}`), !1;
|
|
1303
1327
|
}
|
|
1304
1328
|
if (t.tier !== void 0 && !(Array.isArray(t.tier) ? t.tier : [t.tier]).includes(e.tier)) return !1;
|
|
1305
1329
|
if (t.atLeast !== void 0) {
|
|
1306
|
-
let r =
|
|
1330
|
+
let r = I(n, t.atLeast);
|
|
1307
1331
|
if (r === void 0 || e.width < r) return !1;
|
|
1308
1332
|
}
|
|
1309
1333
|
if (t.below !== void 0) {
|
|
1310
|
-
let r =
|
|
1334
|
+
let r = I(n, t.below);
|
|
1311
1335
|
if (r === void 0 || e.width >= r) return !1;
|
|
1312
1336
|
}
|
|
1313
1337
|
return !(t.orientation !== void 0 && e.orientation !== t.orientation || t.pointer !== void 0 && e.pointer !== t.pointer || t.minHeight !== void 0 && e.height < t.minHeight || t.maxHeight !== void 0 && e.height > t.maxHeight);
|
|
1314
1338
|
}
|
|
1315
|
-
function
|
|
1339
|
+
function L(e, t, n) {
|
|
1316
1340
|
let { width: r, height: i } = e;
|
|
1317
1341
|
return {
|
|
1318
1342
|
width: r,
|
|
1319
1343
|
height: i,
|
|
1320
1344
|
aspect: i === 0 ? 0 : r / i,
|
|
1321
|
-
tier:
|
|
1345
|
+
tier: St(t, r),
|
|
1322
1346
|
orientation: r > i ? "landscape" : "portrait",
|
|
1323
1347
|
pointer: n
|
|
1324
1348
|
};
|
|
1325
1349
|
}
|
|
1326
|
-
function
|
|
1350
|
+
function Et(e, t, n) {
|
|
1327
1351
|
let r = new Set([
|
|
1328
1352
|
e.tier,
|
|
1329
1353
|
e.orientation,
|
|
1330
1354
|
e.pointer
|
|
1331
1355
|
]);
|
|
1332
|
-
for (let [i, a] of t)
|
|
1356
|
+
for (let [i, a] of t) Tt(e, a, n, i) && r.add(i);
|
|
1333
1357
|
return r;
|
|
1334
1358
|
}
|
|
1335
|
-
function
|
|
1359
|
+
function Dt(e, t) {
|
|
1336
1360
|
let n = [], r = [];
|
|
1337
1361
|
for (let r of t) e.has(r) || n.push(r);
|
|
1338
1362
|
for (let n of e) t.has(n) || r.push(n);
|
|
@@ -1341,7 +1365,7 @@ function Ot(e, t) {
|
|
|
1341
1365
|
left: r
|
|
1342
1366
|
};
|
|
1343
1367
|
}
|
|
1344
|
-
function
|
|
1368
|
+
function Ot(e, t, n) {
|
|
1345
1369
|
let r = e.names.indexOf(t);
|
|
1346
1370
|
for (let t = r; t >= 0; t--) {
|
|
1347
1371
|
let r = n[e.names[t]];
|
|
@@ -1354,23 +1378,23 @@ function kt(e, t, n) {
|
|
|
1354
1378
|
}
|
|
1355
1379
|
//#endregion
|
|
1356
1380
|
//#region src/plugins/breakpoints/types.ts
|
|
1357
|
-
var
|
|
1381
|
+
var R = {
|
|
1358
1382
|
mobile: 0,
|
|
1359
1383
|
tablet: 768,
|
|
1360
1384
|
desktop: 1024,
|
|
1361
1385
|
wide: 1440
|
|
1362
|
-
},
|
|
1386
|
+
}, kt = new Set([
|
|
1363
1387
|
"portrait",
|
|
1364
1388
|
"landscape",
|
|
1365
1389
|
"coarse",
|
|
1366
1390
|
"fine"
|
|
1367
|
-
]),
|
|
1391
|
+
]), z = {
|
|
1368
1392
|
width: 0,
|
|
1369
1393
|
height: 0
|
|
1370
|
-
},
|
|
1394
|
+
}, At = class extends N {
|
|
1371
1395
|
constructor(...e) {
|
|
1372
|
-
super(...e), this.id = "breakpoints", this.onBreakpointChanged = new
|
|
1373
|
-
let t =
|
|
1396
|
+
super(...e), this.id = "breakpoints", this.onBreakpointChanged = new j(), this._modes = /* @__PURE__ */ new Map(), this._active = /* @__PURE__ */ new Set(), this._enter = /* @__PURE__ */ new Map(), this._leave = /* @__PURE__ */ new Map(), this._pointer = "fine", this._pointerQuery = null, this._warnedListenerNames = /* @__PURE__ */ new Set(), this._evaluate = (e) => {
|
|
1397
|
+
let t = L(e ?? z, this._ladder, this._pointer), n = Et(t, this._modes, this._ladder), { entered: r, left: i } = Dt(this._active, n), a = this._ctx.tier;
|
|
1374
1398
|
if (this._ctx = t, this._active = n, !(r.length === 0 && i.length === 0)) {
|
|
1375
1399
|
for (let e of i) this._leave.get(e)?.emit();
|
|
1376
1400
|
for (let e of r) this._enter.get(e)?.emit();
|
|
@@ -1414,41 +1438,41 @@ var L = {
|
|
|
1414
1438
|
return this._ctx.pointer;
|
|
1415
1439
|
}
|
|
1416
1440
|
async initialize(e = {}) {
|
|
1417
|
-
this._ladder =
|
|
1418
|
-
tiers: e.tiers ?? { ...
|
|
1441
|
+
this._ladder = xt({ ...R }), this._ctx = L(z, this._ladder, this._pointer), this._options = {
|
|
1442
|
+
tiers: e.tiers ?? { ...R },
|
|
1419
1443
|
modes: e.modes ?? {}
|
|
1420
|
-
}, this._ladder =
|
|
1444
|
+
}, this._ladder = xt(this._options.tiers);
|
|
1421
1445
|
for (let [e, t] of Object.entries(this._options.modes)) this._modes.set(e, t);
|
|
1422
|
-
this._initPointer(), this._ctx =
|
|
1446
|
+
this._initPointer(), this._ctx = L(z, this._ladder, this._pointer), this._active = Et(this._ctx, this._modes, this._ladder);
|
|
1423
1447
|
}
|
|
1424
1448
|
async postInitialize(e) {
|
|
1425
|
-
this._evaluate(this.app.size ??
|
|
1449
|
+
this._evaluate(this.app.size ?? z), this.addSignalConnection(this.app.onResize.connect(this._evaluate, "highest"));
|
|
1426
1450
|
}
|
|
1427
1451
|
destroy() {
|
|
1428
|
-
this._pointerQuery
|
|
1452
|
+
this._pointerQuery = null;
|
|
1429
1453
|
for (let e of this._enter.values()) e.disconnectAll();
|
|
1430
1454
|
for (let e of this._leave.values()) e.disconnectAll();
|
|
1431
1455
|
this._enter.clear(), this._leave.clear(), this.onBreakpointChanged.disconnectAll(), super.destroy();
|
|
1432
1456
|
}
|
|
1433
1457
|
is(e) {
|
|
1434
|
-
return this._isKnown(e) ? this._active.has(e) : (
|
|
1458
|
+
return this._isKnown(e) ? this._active.has(e) : (x.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`), !1);
|
|
1435
1459
|
}
|
|
1436
1460
|
atLeast(e) {
|
|
1437
|
-
let t =
|
|
1461
|
+
let t = I(this._ladder, e);
|
|
1438
1462
|
return t !== void 0 && this._ctx.width >= t;
|
|
1439
1463
|
}
|
|
1440
1464
|
below(e) {
|
|
1441
|
-
let t =
|
|
1465
|
+
let t = I(this._ladder, e);
|
|
1442
1466
|
return t !== void 0 && this._ctx.width < t;
|
|
1443
1467
|
}
|
|
1444
1468
|
between(e, t) {
|
|
1445
1469
|
return this.atLeast(e) && this.below(t);
|
|
1446
1470
|
}
|
|
1447
1471
|
matches(e) {
|
|
1448
|
-
return
|
|
1472
|
+
return Tt(this._ctx, e, this._ladder);
|
|
1449
1473
|
}
|
|
1450
1474
|
value(e) {
|
|
1451
|
-
return
|
|
1475
|
+
return Ot(this._ladder, this._ctx.tier, e);
|
|
1452
1476
|
}
|
|
1453
1477
|
define(e, t) {
|
|
1454
1478
|
this._modes.set(e, t), this._evaluate(this.size);
|
|
@@ -1473,26 +1497,26 @@ var L = {
|
|
|
1473
1497
|
this._pointer = "fine";
|
|
1474
1498
|
return;
|
|
1475
1499
|
}
|
|
1476
|
-
this._pointerQuery = window.matchMedia("(pointer: coarse)"), this._pointer = this._pointerQuery.matches ? "coarse" : "fine", this._pointerQuery
|
|
1500
|
+
this._pointerQuery = window.matchMedia("(pointer: coarse)"), this._pointer = this._pointerQuery.matches ? "coarse" : "fine", this.listen(this._pointerQuery, "change", this._onPointerChange);
|
|
1477
1501
|
}
|
|
1478
1502
|
_signal(e, t) {
|
|
1479
1503
|
let n = e.get(t);
|
|
1480
|
-
return n || (n = new
|
|
1504
|
+
return n || (n = new j(), e.set(t, n)), n;
|
|
1481
1505
|
}
|
|
1482
1506
|
_isKnown(e) {
|
|
1483
|
-
return e in this._ladder.byName || this._modes.has(e) ||
|
|
1507
|
+
return e in this._ladder.byName || this._modes.has(e) || kt.has(e);
|
|
1484
1508
|
}
|
|
1485
1509
|
_warnIfUnknown(e) {
|
|
1486
|
-
this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e),
|
|
1510
|
+
this._isKnown(e) || this._warnedListenerNames.has(e) || (this._warnedListenerNames.add(e), x.warn(`[breakpoints] unknown name '${e}'. Known: ${this._knownNames().join(", ")}.`));
|
|
1487
1511
|
}
|
|
1488
1512
|
_knownNames() {
|
|
1489
1513
|
return [
|
|
1490
1514
|
...this._ladder.names,
|
|
1491
1515
|
...this._modes.keys(),
|
|
1492
|
-
...
|
|
1516
|
+
...kt
|
|
1493
1517
|
];
|
|
1494
1518
|
}
|
|
1495
|
-
},
|
|
1519
|
+
}, jt = class {
|
|
1496
1520
|
constructor(e, t) {
|
|
1497
1521
|
this.name = e, this.manager = t, this._sounds = /* @__PURE__ */ new Map(), this._muted = !1, this._volume = 1, this.muted = this.manager.muted;
|
|
1498
1522
|
}
|
|
@@ -1540,7 +1564,7 @@ var L = {
|
|
|
1540
1564
|
try {
|
|
1541
1565
|
e.pause();
|
|
1542
1566
|
} catch (t) {
|
|
1543
|
-
|
|
1567
|
+
x.error("Error pausing sound", e.id, t);
|
|
1544
1568
|
}
|
|
1545
1569
|
});
|
|
1546
1570
|
});
|
|
@@ -1551,7 +1575,7 @@ var L = {
|
|
|
1551
1575
|
try {
|
|
1552
1576
|
e.resume();
|
|
1553
1577
|
} catch (t) {
|
|
1554
|
-
|
|
1578
|
+
x.error("Error resuming sound", e.id, t);
|
|
1555
1579
|
}
|
|
1556
1580
|
});
|
|
1557
1581
|
});
|
|
@@ -1578,10 +1602,14 @@ var L = {
|
|
|
1578
1602
|
restore() {
|
|
1579
1603
|
this.muted = this._muted, this.volume = this._volume;
|
|
1580
1604
|
}
|
|
1581
|
-
destroy() {
|
|
1582
|
-
|
|
1605
|
+
destroy() {
|
|
1606
|
+
this._sounds.forEach((e) => {
|
|
1607
|
+
[...e].forEach((e) => e.destroy());
|
|
1608
|
+
}), this._sounds.clear();
|
|
1609
|
+
}
|
|
1610
|
+
}, Mt = class {
|
|
1583
1611
|
constructor(e, t, n) {
|
|
1584
|
-
this.id = e, this.channel = t, this.manager = n, this.onStart = new
|
|
1612
|
+
this.id = e, this.channel = t, this.manager = n, this.onStart = new j(), this.onStop = new j(), this.onEnd = new j(), this.onPaused = new j(), this.onResumed = new j(), this.onProgress = new j(), this._volume = 1, this._muted = !1, this._isPlaying = !1, _(this), this.muted = this.channel.muted;
|
|
1585
1613
|
}
|
|
1586
1614
|
get media() {
|
|
1587
1615
|
return this._media;
|
|
@@ -1868,7 +1896,7 @@ var It = class extends i {
|
|
|
1868
1896
|
destroy() {
|
|
1869
1897
|
this.removeAllListeners();
|
|
1870
1898
|
}
|
|
1871
|
-
}, Lt = 0,
|
|
1899
|
+
}, Lt = 0, W = class extends i {
|
|
1872
1900
|
constructor(e) {
|
|
1873
1901
|
super(), this.id = Lt++, this.init(e);
|
|
1874
1902
|
}
|
|
@@ -1968,7 +1996,7 @@ var It = class extends i {
|
|
|
1968
1996
|
}
|
|
1969
1997
|
play(e) {
|
|
1970
1998
|
let { start: t, end: n, speed: r, loop: i, volume: a, muted: o } = e;
|
|
1971
|
-
n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start -
|
|
1999
|
+
n && console.assert(n > t, "End time is before start time"), this._speed = r, this._volume = a, this._loop = !!i, this._muted = o, this.refresh(), this.loop && n !== null && (console.warn("Looping not support when specifying an \"end\" time"), this.loop = !1), this._start = t, this._end = n || this._duration, this._start = Math.max(0, this._start - W.PADDING), this._end = Math.min(this._end + W.PADDING, this._duration), this._source.onloadedmetadata = () => {
|
|
1972
2000
|
this._source && (this._source.currentTime = t, this._source.onloadedmetadata = null, this.emit("progress", t / this._duration, this._duration), d.shared.add(this._onUpdate, this));
|
|
1973
2001
|
}, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
|
|
1974
2002
|
}
|
|
@@ -1986,16 +2014,16 @@ var It = class extends i {
|
|
|
1986
2014
|
toString() {
|
|
1987
2015
|
return `[HTMLAudioInstance id=${this.id}]`;
|
|
1988
2016
|
}
|
|
1989
|
-
},
|
|
1990
|
-
|
|
2017
|
+
}, Rt = W;
|
|
2018
|
+
Rt.PADDING = .1;
|
|
1991
2019
|
//#endregion
|
|
1992
2020
|
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/htmlaudio/HTMLAudioMedia.mjs
|
|
1993
|
-
var
|
|
2021
|
+
var zt = class extends i {
|
|
1994
2022
|
init(e) {
|
|
1995
2023
|
this.parent = e, this._source = e.options.source || new Audio(), e.url && (this._source.src = e.url);
|
|
1996
2024
|
}
|
|
1997
2025
|
create() {
|
|
1998
|
-
return new
|
|
2026
|
+
return new Rt(this);
|
|
1999
2027
|
}
|
|
2000
2028
|
get isPlayable() {
|
|
2001
2029
|
return !!this._source && this._source.readyState === 4;
|
|
@@ -2048,7 +2076,7 @@ var Bt = class extends i {
|
|
|
2048
2076
|
};
|
|
2049
2077
|
t.addEventListener("canplaythrough", r, !1), t.addEventListener("load", r, !1), t.addEventListener("abort", i, !1), t.addEventListener("error", a, !1), t.load();
|
|
2050
2078
|
}
|
|
2051
|
-
},
|
|
2079
|
+
}, Bt = class {
|
|
2052
2080
|
constructor(e, t) {
|
|
2053
2081
|
this.parent = e, Object.assign(this, t), this.duration = this.end - this.start, console.assert(this.duration > 0, "End time must be after start time");
|
|
2054
2082
|
}
|
|
@@ -2064,7 +2092,7 @@ var Bt = class extends i {
|
|
|
2064
2092
|
destroy() {
|
|
2065
2093
|
this.parent = null;
|
|
2066
2094
|
}
|
|
2067
|
-
},
|
|
2095
|
+
}, G = [
|
|
2068
2096
|
"ogg",
|
|
2069
2097
|
"oga",
|
|
2070
2098
|
"opus",
|
|
@@ -2076,8 +2104,8 @@ var Bt = class extends i {
|
|
|
2076
2104
|
"wma",
|
|
2077
2105
|
"mid",
|
|
2078
2106
|
"caf"
|
|
2079
|
-
],
|
|
2080
|
-
function
|
|
2107
|
+
], Vt = ["audio/mpeg", "audio/ogg"], K = {};
|
|
2108
|
+
function Ht(e) {
|
|
2081
2109
|
let t = {
|
|
2082
2110
|
m4a: "audio/mp4",
|
|
2083
2111
|
oga: "audio/ogg",
|
|
@@ -2085,17 +2113,17 @@ function Ut(e) {
|
|
|
2085
2113
|
caf: "audio/x-caf; codecs=\"opus\"",
|
|
2086
2114
|
...e || {}
|
|
2087
2115
|
}, n = document.createElement("audio"), r = {}, i = /^no$/;
|
|
2088
|
-
|
|
2116
|
+
G.forEach((e) => {
|
|
2089
2117
|
let a = n.canPlayType(`audio/${e}`).replace(i, ""), o = t[e] ? n.canPlayType(t[e]).replace(i, "") : "";
|
|
2090
2118
|
r[e] = !!a || !!o;
|
|
2091
|
-
}), Object.assign(
|
|
2119
|
+
}), Object.assign(K, r);
|
|
2092
2120
|
}
|
|
2093
|
-
|
|
2121
|
+
Ht();
|
|
2094
2122
|
//#endregion
|
|
2095
2123
|
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioInstance.mjs
|
|
2096
|
-
var
|
|
2124
|
+
var Ut = 0, Wt = class extends i {
|
|
2097
2125
|
constructor(e) {
|
|
2098
|
-
super(), this.id =
|
|
2126
|
+
super(), this.id = Ut++, this._media = null, this._paused = !1, this._muted = !1, this._elapsed = 0, this.init(e);
|
|
2099
2127
|
}
|
|
2100
2128
|
set(e, t) {
|
|
2101
2129
|
if (this[e] === void 0) throw Error(`Property with name ${e} does not exist.`);
|
|
@@ -2247,7 +2275,7 @@ var Wt = 0, Gt = class extends i {
|
|
|
2247
2275
|
}
|
|
2248
2276
|
this._source = null, this._progress = 1, this.emit("progress", 1, this._duration), this.emit("end", this);
|
|
2249
2277
|
}
|
|
2250
|
-
},
|
|
2278
|
+
}, Gt = class {
|
|
2251
2279
|
constructor(e, t) {
|
|
2252
2280
|
this._output = t, this._input = e;
|
|
2253
2281
|
}
|
|
@@ -2271,13 +2299,13 @@ var Wt = 0, Gt = class extends i {
|
|
|
2271
2299
|
destroy() {
|
|
2272
2300
|
this.filters = null, this._input = null, this._output = null;
|
|
2273
2301
|
}
|
|
2274
|
-
},
|
|
2302
|
+
}, Kt = class extends Gt {
|
|
2275
2303
|
constructor(e) {
|
|
2276
2304
|
let t = e.audioContext, n = t.createBufferSource(), r = t.createGain(), i = t.createAnalyser();
|
|
2277
2305
|
n.connect(i), i.connect(r), r.connect(e.destination), super(i, r), this.context = e, this.bufferSource = n, this.gain = r, this.analyser = i;
|
|
2278
2306
|
}
|
|
2279
2307
|
get script() {
|
|
2280
|
-
return this._script || (this._script = this.context.audioContext.createScriptProcessor(
|
|
2308
|
+
return this._script || (this._script = this.context.audioContext.createScriptProcessor(Kt.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
|
|
2281
2309
|
}
|
|
2282
2310
|
destroy() {
|
|
2283
2311
|
super.destroy(), this.bufferSource.disconnect(), this._script && this._script.disconnect(), this.gain.disconnect(), this.analyser.disconnect(), this.bufferSource = null, this._script = null, this.gain = null, this.analyser = null, this.context = null;
|
|
@@ -2294,13 +2322,13 @@ var Wt = 0, Gt = class extends i {
|
|
|
2294
2322
|
get bufferSize() {
|
|
2295
2323
|
return this.script.bufferSize;
|
|
2296
2324
|
}
|
|
2297
|
-
},
|
|
2298
|
-
|
|
2325
|
+
}, qt = Kt;
|
|
2326
|
+
qt.BUFFER_SIZE = 0;
|
|
2299
2327
|
//#endregion
|
|
2300
2328
|
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioMedia.mjs
|
|
2301
|
-
var
|
|
2329
|
+
var Jt = class {
|
|
2302
2330
|
init(e) {
|
|
2303
|
-
this.parent = e, this._nodes = new
|
|
2331
|
+
this.parent = e, this._nodes = new qt(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
|
|
2304
2332
|
}
|
|
2305
2333
|
destroy() {
|
|
2306
2334
|
this.parent = null, this._nodes.destroy(), this._nodes = null;
|
|
@@ -2312,7 +2340,7 @@ var Yt = class {
|
|
|
2312
2340
|
this._source = null, this.source = null;
|
|
2313
2341
|
}
|
|
2314
2342
|
create() {
|
|
2315
|
-
return new
|
|
2343
|
+
return new Wt(this);
|
|
2316
2344
|
}
|
|
2317
2345
|
get context() {
|
|
2318
2346
|
return this.parent.context;
|
|
@@ -2356,7 +2384,7 @@ var Yt = class {
|
|
|
2356
2384
|
};
|
|
2357
2385
|
e instanceof AudioBuffer ? n(null, e) : this.parent.context.decode(e, n);
|
|
2358
2386
|
}
|
|
2359
|
-
},
|
|
2387
|
+
}, q = class {
|
|
2360
2388
|
static from(e) {
|
|
2361
2389
|
let t = {};
|
|
2362
2390
|
return typeof e == "string" ? t.url = e : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? t.source = e : Array.isArray(e) ? t.url = e : t = e, t = {
|
|
@@ -2371,7 +2399,7 @@ var Yt = class {
|
|
|
2371
2399
|
loaded: null,
|
|
2372
2400
|
loop: !1,
|
|
2373
2401
|
...t
|
|
2374
|
-
}, Object.freeze(t), new
|
|
2402
|
+
}, Object.freeze(t), new q(B().useLegacy ? new zt() : new Jt(), t);
|
|
2375
2403
|
}
|
|
2376
2404
|
constructor(e, t) {
|
|
2377
2405
|
this.media = e, this.options = t, this._instances = [], this._sprites = {}, this.media.init(this);
|
|
@@ -2382,7 +2410,7 @@ var Yt = class {
|
|
|
2382
2410
|
let [t] = e.map((e) => ({
|
|
2383
2411
|
url: e,
|
|
2384
2412
|
ext: f.extname(e).slice(1)
|
|
2385
|
-
})).filter(({ ext: e }) =>
|
|
2413
|
+
})).filter(({ ext: e }) => K[e]).sort((e, t) => G.indexOf(e.ext) - G.indexOf(t.ext));
|
|
2386
2414
|
if (!t) throw Error("No supported file type found");
|
|
2387
2415
|
return t.url;
|
|
2388
2416
|
}
|
|
@@ -2420,7 +2448,7 @@ var Yt = class {
|
|
|
2420
2448
|
return t;
|
|
2421
2449
|
}
|
|
2422
2450
|
console.assert(!this._sprites[e], `Alias ${e} is already taken`);
|
|
2423
|
-
let n = new
|
|
2451
|
+
let n = new Bt(this, t);
|
|
2424
2452
|
return this._sprites[e] = n, n;
|
|
2425
2453
|
}
|
|
2426
2454
|
destroy() {
|
|
@@ -2536,20 +2564,20 @@ var Yt = class {
|
|
|
2536
2564
|
this._poolInstance(e);
|
|
2537
2565
|
}
|
|
2538
2566
|
_createInstance() {
|
|
2539
|
-
if (
|
|
2540
|
-
let e =
|
|
2567
|
+
if (q._pool.length > 0) {
|
|
2568
|
+
let e = q._pool.pop();
|
|
2541
2569
|
return e.init(this.media), e;
|
|
2542
2570
|
}
|
|
2543
2571
|
return this.media.create();
|
|
2544
2572
|
}
|
|
2545
2573
|
_poolInstance(e) {
|
|
2546
|
-
e.destroy(),
|
|
2574
|
+
e.destroy(), q._pool.indexOf(e) < 0 && q._pool.push(e);
|
|
2547
2575
|
}
|
|
2548
|
-
},
|
|
2549
|
-
|
|
2576
|
+
}, J = q;
|
|
2577
|
+
J._pool = [];
|
|
2550
2578
|
//#endregion
|
|
2551
2579
|
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/webaudio/WebAudioContext.mjs
|
|
2552
|
-
var
|
|
2580
|
+
var Yt = class e extends Gt {
|
|
2553
2581
|
constructor() {
|
|
2554
2582
|
let t = window, n = new e.AudioContext(), r = n.createDynamicsCompressor(), a = n.createAnalyser();
|
|
2555
2583
|
a.connect(r), r.connect(n.destination), super(a, r), this.autoPause = !0, this._ctx = n, this._offlineCtx = new e.OfflineAudioContext(1, 2, t.OfflineAudioContext ? Math.max(8e3, Math.min(96e3, n.sampleRate)) : 44100), this.compressor = r, this.analyser = a, this.events = new i(), this.volume = 1, this.speed = 1, this.muted = !1, this.paused = !1, this._locked = n.state === "suspended" && ("ontouchstart" in globalThis || "onclick" in globalThis), this._locked && (this._unlock(), this._unlock = this._unlock.bind(this), document.addEventListener("mousedown", this._unlock, !0), document.addEventListener("touchstart", this._unlock, !0), document.addEventListener("touchend", this._unlock, !0)), this.onFocus = this.onFocus.bind(this), this.onBlur = this.onBlur.bind(this), globalThis.addEventListener("focus", this.onFocus), globalThis.addEventListener("blur", this.onBlur);
|
|
@@ -2614,12 +2642,12 @@ var Xt = class e extends Kt {
|
|
|
2614
2642
|
}, n);
|
|
2615
2643
|
r && r.catch(n);
|
|
2616
2644
|
}
|
|
2617
|
-
},
|
|
2645
|
+
}, Xt = class {
|
|
2618
2646
|
constructor() {
|
|
2619
2647
|
this.init();
|
|
2620
2648
|
}
|
|
2621
2649
|
init() {
|
|
2622
|
-
return this.supported && (this._webAudioContext = new
|
|
2650
|
+
return this.supported && (this._webAudioContext = new Yt()), this._htmlAudioContext = new It(), this._sounds = {}, this.useLegacy = !this.supported, this;
|
|
2623
2651
|
}
|
|
2624
2652
|
get context() {
|
|
2625
2653
|
return this._context;
|
|
@@ -2631,7 +2659,7 @@ var Xt = class e extends Kt {
|
|
|
2631
2659
|
this.useLegacy || (this._context.filters = e);
|
|
2632
2660
|
}
|
|
2633
2661
|
get supported() {
|
|
2634
|
-
return
|
|
2662
|
+
return Yt.AudioContext !== null;
|
|
2635
2663
|
}
|
|
2636
2664
|
add(e, t) {
|
|
2637
2665
|
if (typeof e == "object") {
|
|
@@ -2642,8 +2670,8 @@ var Xt = class e extends Kt {
|
|
|
2642
2670
|
}
|
|
2643
2671
|
return n;
|
|
2644
2672
|
}
|
|
2645
|
-
if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof
|
|
2646
|
-
let n = this._getOptions(t), r =
|
|
2673
|
+
if (console.assert(!this._sounds[e], `Sound with alias ${e} already exists.`), t instanceof J) return this._sounds[e] = t, t;
|
|
2674
|
+
let n = this._getOptions(t), r = J.from(n);
|
|
2647
2675
|
return this._sounds[e] = r, r;
|
|
2648
2676
|
}
|
|
2649
2677
|
_getOptions(e, t) {
|
|
@@ -2743,14 +2771,14 @@ var Xt = class e extends Kt {
|
|
|
2743
2771
|
close() {
|
|
2744
2772
|
return this.removeAll(), this._sounds = null, this._webAudioContext &&= (this._webAudioContext.destroy(), null), this._htmlAudioContext &&= (this._htmlAudioContext.destroy(), null), this._context = null, this;
|
|
2745
2773
|
}
|
|
2746
|
-
},
|
|
2774
|
+
}, Zt = (e) => {
|
|
2747
2775
|
let t = e.src, n = e?.alias?.[0];
|
|
2748
2776
|
return (!n || e.src === n) && (n = f.basename(t, f.extname(t))), n;
|
|
2749
|
-
},
|
|
2777
|
+
}, Qt = {
|
|
2750
2778
|
extension: a.Asset,
|
|
2751
2779
|
detection: {
|
|
2752
2780
|
test: async () => !0,
|
|
2753
|
-
add: async (e) => [...e, ...
|
|
2781
|
+
add: async (e) => [...e, ...G.filter((e) => K[e])],
|
|
2754
2782
|
remove: async (e) => e.filter((t) => e.includes(t))
|
|
2755
2783
|
},
|
|
2756
2784
|
loader: {
|
|
@@ -2760,10 +2788,10 @@ var Xt = class e extends Kt {
|
|
|
2760
2788
|
priority: s.High
|
|
2761
2789
|
},
|
|
2762
2790
|
test(e) {
|
|
2763
|
-
return !!
|
|
2791
|
+
return !!K[f.extname(e).slice(1)] || Vt.some((t) => e.startsWith(`data:${t}`));
|
|
2764
2792
|
},
|
|
2765
2793
|
async load(e, t) {
|
|
2766
|
-
let n = await new Promise((n, r) =>
|
|
2794
|
+
let n = await new Promise((n, r) => J.from({
|
|
2767
2795
|
...t.data,
|
|
2768
2796
|
url: e,
|
|
2769
2797
|
preload: !0,
|
|
@@ -2771,20 +2799,20 @@ var Xt = class e extends Kt {
|
|
|
2771
2799
|
e ? r(e) : n(i), t.data?.loaded?.(e, i);
|
|
2772
2800
|
}
|
|
2773
2801
|
}));
|
|
2774
|
-
return B().add(
|
|
2802
|
+
return B().add(Zt(t), n), n;
|
|
2775
2803
|
},
|
|
2776
2804
|
async unload(e, t) {
|
|
2777
|
-
B().remove(
|
|
2805
|
+
B().remove(Zt(t));
|
|
2778
2806
|
}
|
|
2779
2807
|
}
|
|
2780
2808
|
};
|
|
2781
|
-
ee.add(
|
|
2809
|
+
ee.add(Qt);
|
|
2782
2810
|
//#endregion
|
|
2783
2811
|
//#region ../../node_modules/.pnpm/@pixi+sound@6.0.1_pixi.js@8.19.0/node_modules/@pixi/sound/lib/index.mjs
|
|
2784
|
-
var
|
|
2812
|
+
var Y = Pt(new Xt());
|
|
2785
2813
|
//#endregion
|
|
2786
2814
|
//#region src/plugins/audio/AudioManagerPlugin.ts
|
|
2787
|
-
|
|
2815
|
+
Y.add = function(e, t) {
|
|
2788
2816
|
if (typeof e == "object") {
|
|
2789
2817
|
let n = {};
|
|
2790
2818
|
for (let r in e) {
|
|
@@ -2793,16 +2821,16 @@ J.add = function(e, t) {
|
|
|
2793
2821
|
}
|
|
2794
2822
|
return n;
|
|
2795
2823
|
}
|
|
2796
|
-
if (t instanceof
|
|
2797
|
-
let n = this._getOptions(t), r =
|
|
2824
|
+
if (t instanceof J) return this._sounds[e] = t, t;
|
|
2825
|
+
let n = this._getOptions(t), r = J.from(n);
|
|
2798
2826
|
return this._sounds[e] = r, r;
|
|
2799
2827
|
};
|
|
2800
|
-
var
|
|
2828
|
+
var $t = class extends N {
|
|
2801
2829
|
constructor(e = "audio") {
|
|
2802
|
-
super(e), this.onSoundStarted = new
|
|
2830
|
+
super(e), this.onSoundStarted = new j(), this.onSoundEnded = new j(), this.onMuted = new j(), this.onMasterVolumeChanged = new j(), this.onChannelVolumeChanged = new j(), this.onChannelMuted = new j(), this._storedVolume = void 0, this._paused = !1, this._idMap = /* @__PURE__ */ new Map(), this._masterVolume = 1, this._muted = !1, this._channels = /* @__PURE__ */ new Map(), this.createChannel("music"), this.createChannel("sfx"), this.createChannel("voiceover");
|
|
2803
2831
|
}
|
|
2804
2832
|
get audioContext() {
|
|
2805
|
-
return
|
|
2833
|
+
return Y.context?.audioContext;
|
|
2806
2834
|
}
|
|
2807
2835
|
get masterVolume() {
|
|
2808
2836
|
return this._masterVolume;
|
|
@@ -2834,14 +2862,14 @@ var en = class extends M {
|
|
|
2834
2862
|
destroy() {
|
|
2835
2863
|
this._channels.forEach((e) => {
|
|
2836
2864
|
e.destroy();
|
|
2837
|
-
}), this._channels.clear(), this.onSoundStarted.disconnectAll(), this.onSoundEnded.disconnectAll(), this.onMuted.disconnectAll(), this.onMasterVolumeChanged.disconnectAll(), this.onChannelVolumeChanged.disconnectAll(), super.destroy();
|
|
2865
|
+
}), this._channels.clear(), this.onSoundStarted.disconnectAll(), this.onSoundEnded.disconnectAll(), this.onMuted.disconnectAll(), this.onMasterVolumeChanged.disconnectAll(), this.onChannelVolumeChanged.disconnectAll(), this.onChannelMuted.disconnectAll(), super.destroy();
|
|
2838
2866
|
}
|
|
2839
2867
|
initialize(e, t) {
|
|
2840
|
-
return
|
|
2868
|
+
return Y.disableAutoPause = !0, typeof t?.manifest == "object" && this.addAllFromManifest(t.manifest), Promise.resolve();
|
|
2841
2869
|
}
|
|
2842
2870
|
createChannel(e) {
|
|
2843
2871
|
if (this._channels.has(e)) throw Error(`Channel with name ${e} already exists.`);
|
|
2844
|
-
let t = new
|
|
2872
|
+
let t = new jt(e, this);
|
|
2845
2873
|
this._channels.set(e, t);
|
|
2846
2874
|
}
|
|
2847
2875
|
setChannelVolume(e, t) {
|
|
@@ -2891,8 +2919,8 @@ var en = class extends M {
|
|
|
2891
2919
|
if (Array.isArray(e.alias) || (t = [e.alias]), !t) return;
|
|
2892
2920
|
let n = {}, r = !1;
|
|
2893
2921
|
t.forEach((t) => {
|
|
2894
|
-
t === void 0 ||
|
|
2895
|
-
}), r &&
|
|
2922
|
+
t === void 0 || Y.exists(t) || (n[t] = e.src, r = !0);
|
|
2923
|
+
}), r && Y.add(n);
|
|
2896
2924
|
}
|
|
2897
2925
|
isPlaying(e, t) {
|
|
2898
2926
|
let n = this._channels.get(t);
|
|
@@ -2906,15 +2934,15 @@ var en = class extends M {
|
|
|
2906
2934
|
let n = e?.destination;
|
|
2907
2935
|
return !n?.context || n.context === t;
|
|
2908
2936
|
});
|
|
2909
|
-
return n.length !== e.length &&
|
|
2937
|
+
return n.length !== e.length && x.error("AudioManager: ignoring filter(s) built on a different AudioContext — playing dry. Build filter nodes on `app.audio.audioContext` (an app bundling its own copy of @pixi/sound gets a separate context)."), n.length ? n : void 0;
|
|
2910
2938
|
}
|
|
2911
2939
|
async play(e, t = "sfx", n) {
|
|
2912
2940
|
this._idMap.has(e) && (e = this._idMap.get(e));
|
|
2913
2941
|
let r = this._channels.get(t);
|
|
2914
2942
|
if (r) {
|
|
2915
2943
|
e = this._verifySoundId(e);
|
|
2916
|
-
let i = r.add(e, new
|
|
2917
|
-
return i.media = await
|
|
2944
|
+
let i = r.add(e, new Mt(e, r, this)), a = (n?.volume ?? 1) * r.volume * this.masterVolume;
|
|
2945
|
+
return i.media = await Y.play(e, {
|
|
2918
2946
|
...n,
|
|
2919
2947
|
filters: this._usableFilters(n?.filters),
|
|
2920
2948
|
volume: r.muted ? 0 : a,
|
|
@@ -2935,7 +2963,7 @@ var en = class extends M {
|
|
|
2935
2963
|
}
|
|
2936
2964
|
async fadeIn(e, t = "music", n) {
|
|
2937
2965
|
let r = this._channels.get(t);
|
|
2938
|
-
r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 &&
|
|
2966
|
+
r && (e = this._verifySoundId(e)), r?.get(e) || await this.play(e, t, { volume: 0 }), n?.volume === 0 && x.warn("fadeIn volume is 0", e, t, n);
|
|
2939
2967
|
let i = Object.assign({
|
|
2940
2968
|
volume: n?.volume ?? 1,
|
|
2941
2969
|
duration: 1,
|
|
@@ -2944,7 +2972,7 @@ var en = class extends M {
|
|
|
2944
2972
|
return this.fade(e, t, i);
|
|
2945
2973
|
}
|
|
2946
2974
|
async fadeOut(e, t = "music", n = { volume: 0 }) {
|
|
2947
|
-
n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 &&
|
|
2975
|
+
n ||= {}, n?.volume === void 0 && (n.volume = 0), n?.volume > 0 && x.warn("fadeOut volume should probably be 0", e, t, n);
|
|
2948
2976
|
let r = Object.assign({
|
|
2949
2977
|
volume: 0,
|
|
2950
2978
|
duration: 1,
|
|
@@ -2972,7 +3000,7 @@ var en = class extends M {
|
|
|
2972
3000
|
return null;
|
|
2973
3001
|
}
|
|
2974
3002
|
async restore() {
|
|
2975
|
-
let e =
|
|
3003
|
+
let e = Y?.context?.audioContext;
|
|
2976
3004
|
e && await e.resume(), this.resume(), this._storedVolume !== void 0 && (this.masterVolume = this._storedVolume), this._channels.forEach((e) => {
|
|
2977
3005
|
e.restore();
|
|
2978
3006
|
}), this.muted = this._muted;
|
|
@@ -2988,17 +3016,17 @@ var en = class extends M {
|
|
|
2988
3016
|
load(e, t = "sfx", n) {
|
|
2989
3017
|
Array.isArray(e) || (e = [e]);
|
|
2990
3018
|
for (let r of e) {
|
|
2991
|
-
this._idMap.has(r) && (
|
|
2992
|
-
let
|
|
2993
|
-
if (
|
|
3019
|
+
this._idMap.has(r) && (r = this._idMap.get(r));
|
|
3020
|
+
let e = this._channels.get(t);
|
|
3021
|
+
if (e) {
|
|
2994
3022
|
r = this._verifySoundId(r);
|
|
2995
|
-
let
|
|
2996
|
-
|
|
3023
|
+
let t = Y.find(r);
|
|
3024
|
+
t.options = {
|
|
2997
3025
|
...n,
|
|
2998
3026
|
autoPlay: !1
|
|
2999
3027
|
};
|
|
3000
|
-
let
|
|
3001
|
-
|
|
3028
|
+
let i = e.add(r, new Mt(r, e, this));
|
|
3029
|
+
i.media = t.instances[0], i.pause();
|
|
3002
3030
|
} else throw Error(`Channel ${t} does not exist.`);
|
|
3003
3031
|
}
|
|
3004
3032
|
}
|
|
@@ -3019,7 +3047,7 @@ var en = class extends M {
|
|
|
3019
3047
|
});
|
|
3020
3048
|
}
|
|
3021
3049
|
});
|
|
3022
|
-
} else
|
|
3050
|
+
} else Y.stopAll();
|
|
3023
3051
|
}
|
|
3024
3052
|
getCoreSignals() {
|
|
3025
3053
|
return [
|
|
@@ -3034,16 +3062,16 @@ var en = class extends M {
|
|
|
3034
3062
|
_verifySoundId(e) {
|
|
3035
3063
|
let n = e;
|
|
3036
3064
|
if (this._idMap.has(e)) return this._idMap.get(e);
|
|
3037
|
-
if (!
|
|
3038
|
-
else if (
|
|
3039
|
-
else if (
|
|
3065
|
+
if (!Y.exists(e)) if (Y.exists(e + ".mp3")) e += ".mp3";
|
|
3066
|
+
else if (Y.exists(e + ".ogg")) e += ".ogg";
|
|
3067
|
+
else if (Y.exists(e + ".wav")) e += ".wav";
|
|
3040
3068
|
else {
|
|
3041
3069
|
e = n;
|
|
3042
3070
|
let r = t.get(e);
|
|
3043
3071
|
if (r ||= (e = n + ".mp3", t.get(e)), r ||= (e = n + ".ogg", t.get(e)), r ||= (e = n + ".wav", t.get(e)), r) this._findAndAddFromManifest(e, r);
|
|
3044
3072
|
else throw Error(`Sound with ID ${e} does not exist.`);
|
|
3045
3073
|
}
|
|
3046
|
-
return this._idMap.set(
|
|
3074
|
+
return this._idMap.set(n, e), e;
|
|
3047
3075
|
}
|
|
3048
3076
|
_findAndAddFromManifest(e, t) {
|
|
3049
3077
|
let n = this.app.manifest;
|
|
@@ -3070,10 +3098,10 @@ var en = class extends M {
|
|
|
3070
3098
|
}
|
|
3071
3099
|
}
|
|
3072
3100
|
_setMuted() {
|
|
3073
|
-
this._muted ?
|
|
3101
|
+
this._muted ? Y.muteAll() : Y.unmuteAll(), this.onMuted.emit(this._muted);
|
|
3074
3102
|
}
|
|
3075
3103
|
_setPaused() {
|
|
3076
|
-
this._paused ?
|
|
3104
|
+
this._paused ? Y.pauseAll() : Y.resumeAll();
|
|
3077
3105
|
}
|
|
3078
3106
|
_setChannelVolume(e, t) {
|
|
3079
3107
|
let n = this._channels.get(e);
|
|
@@ -3094,9 +3122,9 @@ var en = class extends M {
|
|
|
3094
3122
|
channelName: n
|
|
3095
3123
|
});
|
|
3096
3124
|
}
|
|
3097
|
-
},
|
|
3125
|
+
}, en = class extends n {
|
|
3098
3126
|
constructor(e) {
|
|
3099
|
-
super(),
|
|
3127
|
+
super(), _(this), this._config = {
|
|
3100
3128
|
color: 65535,
|
|
3101
3129
|
shape: "rounded rectangle",
|
|
3102
3130
|
radius: 8,
|
|
@@ -3137,7 +3165,7 @@ var en = class extends M {
|
|
|
3137
3165
|
}
|
|
3138
3166
|
this.position.set(e.x, e.y);
|
|
3139
3167
|
}
|
|
3140
|
-
},
|
|
3168
|
+
}, tn = class {
|
|
3141
3169
|
constructor(e) {
|
|
3142
3170
|
this.id = e, this.currentFocusable = null, this.lastFocusable = null, this.defaultFocusable = null, this._focusables = [], this._currentIndex = 0, this._current = !1;
|
|
3143
3171
|
}
|
|
@@ -3181,9 +3209,9 @@ var en = class extends M {
|
|
|
3181
3209
|
prev() {
|
|
3182
3210
|
return --this._currentIndex, this._currentIndex < 0 && (this._currentIndex = this._focusables.length - 1), this.currentFocusable = this._focusables[this._currentIndex], this.availableFocusables.length === 0 ? null : this.currentFocusable.focusEnabled ? this.currentFocusable : this.prev();
|
|
3183
3211
|
}
|
|
3184
|
-
},
|
|
3212
|
+
}, nn = class extends N {
|
|
3185
3213
|
constructor(...e) {
|
|
3186
|
-
super(...e), this.id = "focus", this.view = new n({ label: "FocusManager" }), this.onFocusManagerActivated = new
|
|
3214
|
+
super(...e), this.id = "focus", this.view = new n({ label: "FocusManager" }), this.onFocusManagerActivated = new j(), this.onFocusManagerDeactivated = new j(), this.onFocusLayerChange = new j(), this.onFocusChange = new j(), this._focusTarget = null, this._keyboardActive = !1, this._layers = /* @__PURE__ */ new Map(), this._currentLayerId = null, this._active = !1, this._enabled = !0;
|
|
3187
3215
|
}
|
|
3188
3216
|
get layers() {
|
|
3189
3217
|
return this._layers;
|
|
@@ -3210,9 +3238,9 @@ var en = class extends M {
|
|
|
3210
3238
|
this._getCurrentLayer()?.sortFocusablesByPosition();
|
|
3211
3239
|
}
|
|
3212
3240
|
initialize(e, t) {
|
|
3213
|
-
|
|
3241
|
+
he(this, "removeAllFocusLayers", "_handleGlobalMouseMove", "_handleGlobalPointerDown");
|
|
3214
3242
|
let n = t.config?.focus || {};
|
|
3215
|
-
n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new
|
|
3243
|
+
n.usePixiAccessibility = n.usePixiAccessibility ?? !1, this._focusOutliner = typeof n?.outliner == "function" ? new n.outliner() : new en(n.outliner), this._options = n, this.view.addChild(this._focusOutliner), this._updatePixiAccessibility(), this._setupKeyboardListeners(), this._setupAppListeners();
|
|
3216
3244
|
}
|
|
3217
3245
|
destroy() {
|
|
3218
3246
|
this._removeGlobalListeners(), this.deactivate(), this._focusOutliner.destroy(), this._layers.clear(), super.destroy();
|
|
@@ -3227,7 +3255,7 @@ var en = class extends M {
|
|
|
3227
3255
|
(t === void 0 || t == null) && (t = this._currentLayerId ?? null);
|
|
3228
3256
|
let r = this._layers.get(t);
|
|
3229
3257
|
if (!r) {
|
|
3230
|
-
|
|
3258
|
+
x.error(`Layer with ID ${t} does not exist.`);
|
|
3231
3259
|
return;
|
|
3232
3260
|
}
|
|
3233
3261
|
Array.isArray(e) || (e = [e]), e.forEach((e, t) => {
|
|
@@ -3254,12 +3282,12 @@ var en = class extends M {
|
|
|
3254
3282
|
addFocusLayer(e, t = !0, n) {
|
|
3255
3283
|
e === void 0 && (e = this._layers.size);
|
|
3256
3284
|
let r;
|
|
3257
|
-
return this._layers.has(e) ? (
|
|
3285
|
+
return this._layers.has(e) ? (x.error(`Layer with ID ${e} already exists.`), r = this._layers.get(e)) : (r = new tn(e), this._layers.set(e, r)), (t || this._currentLayerId === null) && this.setFocusLayer(e), n && this.addFocusable(n, e), r;
|
|
3258
3286
|
}
|
|
3259
3287
|
removeFocusLayer(e, t = !0) {
|
|
3260
3288
|
if (e === void 0 && t) return this._removeTopLayer();
|
|
3261
|
-
this._layers.has(e) ||
|
|
3262
|
-
let n =
|
|
3289
|
+
this._layers.has(e) || x.warn(`Layer with ID ${e} does not exist.`);
|
|
3290
|
+
let n = De(this._layers, e)?.[0];
|
|
3263
3291
|
this._layers.delete(e), this._postDelete(n);
|
|
3264
3292
|
}
|
|
3265
3293
|
restart(e = !1) {
|
|
@@ -3335,7 +3363,7 @@ var en = class extends M {
|
|
|
3335
3363
|
_next() {
|
|
3336
3364
|
let e = this._getCurrentLayer()?.next();
|
|
3337
3365
|
if (!e) {
|
|
3338
|
-
|
|
3366
|
+
x.error("FocusManager:: _next():: No focusable found in the current layer.");
|
|
3339
3367
|
return;
|
|
3340
3368
|
}
|
|
3341
3369
|
this._setTarget(e);
|
|
@@ -3343,7 +3371,7 @@ var en = class extends M {
|
|
|
3343
3371
|
_prev() {
|
|
3344
3372
|
let e = this._getCurrentLayer()?.prev();
|
|
3345
3373
|
if (!e) {
|
|
3346
|
-
|
|
3374
|
+
x.error("FocusManager:: _prev():: No focusable found in the current layer.");
|
|
3347
3375
|
return;
|
|
3348
3376
|
}
|
|
3349
3377
|
this._setTarget(e);
|
|
@@ -3361,7 +3389,7 @@ var en = class extends M {
|
|
|
3361
3389
|
return this._currentLayerId == null ? null : this._layers.get(this._currentLayerId) || null;
|
|
3362
3390
|
}
|
|
3363
3391
|
_removeTopLayer() {
|
|
3364
|
-
let e =
|
|
3392
|
+
let e = ke(this._layers)?.[0], t = De(this._layers, e)?.[0];
|
|
3365
3393
|
e !== void 0 && (this._layers.delete(e), this._postDelete(t));
|
|
3366
3394
|
}
|
|
3367
3395
|
_postDelete(e) {
|
|
@@ -3371,7 +3399,7 @@ var en = class extends M {
|
|
|
3371
3399
|
let n = this._getCurrentLayer(), r = this._focusTarget;
|
|
3372
3400
|
if (this._focusTarget = e, r && this._active && this._clearFocusTarget(r), this.app.renderer.accessibility.isActive || this._keyboardActive) this._focusTarget ? (this._active ||= !0, this._options.usePixiAccessibility && !this._focusTarget._accessibleDiv && this.app.renderer.accessibility.postrender(), this._options.usePixiAccessibility && this.app.ticker.addOnce(() => {
|
|
3373
3401
|
this._focusTarget?._accessibleDiv?.focus();
|
|
3374
|
-
}), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) :
|
|
3402
|
+
}), n?.hasFocusable(e) ? this._focusTarget && (this._focusTarget.focusIn(), this._focusTarget.isFocused = !0, this._focusTarget.onFocusIn.emit(this._focusTarget), n.setCurrentFocusable(this._focusTarget), this._updateOutliner()) : x.warn("The focusable", e, `does not exist on the current focus layer: ${this._currentLayerId}`)) : this._focusOutliner.clear();
|
|
3375
3403
|
else if (this._focusOutliner.clear(), this._active && t) {
|
|
3376
3404
|
this._active = !1, this.onFocusManagerDeactivated.emit();
|
|
3377
3405
|
return;
|
|
@@ -3391,7 +3419,7 @@ var en = class extends M {
|
|
|
3391
3419
|
globalThis.document.addEventListener("mousemove", this._handleGlobalMouseMove), globalThis.document.addEventListener("pointerdown", this._handleGlobalPointerDown);
|
|
3392
3420
|
}
|
|
3393
3421
|
_removeGlobalListeners() {
|
|
3394
|
-
globalThis.document.removeEventListener("mousemove", this._handleGlobalMouseMove), globalThis.document.removeEventListener("pointerdown", this._handleGlobalPointerDown);
|
|
3422
|
+
globalThis.document.removeEventListener("mousemove", this._handleGlobalMouseMove), globalThis.document.removeEventListener("pointerdown", this._handleGlobalPointerDown), window.removeEventListener("keydown", this._onKeyDown, !1), globalThis.removeEventListener("keydown", this._onKeyDown, !1), globalThis.removeEventListener("keyup", this._onKeyUp, !1), globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0);
|
|
3395
3423
|
}
|
|
3396
3424
|
_handleGlobalMouseMove() {
|
|
3397
3425
|
this._enabled && this._active && this.deactivate();
|
|
@@ -3405,8 +3433,8 @@ var en = class extends M {
|
|
|
3405
3433
|
_updateOutliner() {
|
|
3406
3434
|
this._focusTarget ? this._focusOutliner.draw(this._focusTarget) : this._focusOutliner.clear();
|
|
3407
3435
|
}
|
|
3408
|
-
},
|
|
3409
|
-
function
|
|
3436
|
+
}, rn = .01;
|
|
3437
|
+
function X(e) {
|
|
3410
3438
|
let t = e.length;
|
|
3411
3439
|
if (t === 0) return {
|
|
3412
3440
|
centerX: 0,
|
|
@@ -3423,24 +3451,24 @@ function Y(e) {
|
|
|
3423
3451
|
spread: o / t
|
|
3424
3452
|
};
|
|
3425
3453
|
}
|
|
3426
|
-
function
|
|
3454
|
+
function an(e, t) {
|
|
3427
3455
|
return {
|
|
3428
3456
|
dx: t.centerX - e.centerX,
|
|
3429
3457
|
dy: t.centerY - e.centerY,
|
|
3430
|
-
scale: e.spread <
|
|
3458
|
+
scale: e.spread < rn ? 1 : t.spread / e.spread
|
|
3431
3459
|
};
|
|
3432
3460
|
}
|
|
3433
3461
|
//#endregion
|
|
3434
3462
|
//#region src/plugins/gesture/types.ts
|
|
3435
|
-
var
|
|
3463
|
+
var on = {
|
|
3436
3464
|
enabled: !0,
|
|
3437
3465
|
pointerTypes: ["touch"],
|
|
3438
3466
|
pinchThreshold: 8,
|
|
3439
3467
|
panThreshold: 8,
|
|
3440
3468
|
preventDefault: !0
|
|
3441
|
-
},
|
|
3469
|
+
}, sn = .01, cn = class extends N {
|
|
3442
3470
|
constructor(...e) {
|
|
3443
|
-
super(...e), this.id = "gesture", this.onGestureStart = new
|
|
3471
|
+
super(...e), this.id = "gesture", this.onGestureStart = new j(), this.onGestureChange = new j(), this.onGestureEnd = new j(), this._pointers = /* @__PURE__ */ new Map(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this._canvas = null, this._previousTouchAction = "", this._onPointerDown = (e) => {
|
|
3444
3472
|
if (!this._options.pointerTypes.includes(e.pointerType)) return;
|
|
3445
3473
|
let t = this._state, n = this._pointers.size >= 2;
|
|
3446
3474
|
if (this._pointers.set(e.pointerId, {
|
|
@@ -3448,9 +3476,9 @@ var sn = {
|
|
|
3448
3476
|
x: e.clientX,
|
|
3449
3477
|
y: e.clientY
|
|
3450
3478
|
}), this._state === "idle" && this._pointers.size === 2) {
|
|
3451
|
-
let e =
|
|
3479
|
+
let e = X([...this._pointers.values()]);
|
|
3452
3480
|
this._startFrame = e, this._lastFrame = e, this._state = "pending";
|
|
3453
|
-
} else this._state !== "idle" && n && (this._lastFrame =
|
|
3481
|
+
} else this._state !== "idle" && n && (this._lastFrame = X([...this._pointers.values()]));
|
|
3454
3482
|
this._maybePreventDefault(e, t, this._state);
|
|
3455
3483
|
}, this._onPointerMove = (e) => {
|
|
3456
3484
|
if (!this._pointers.has(e.pointerId)) return;
|
|
@@ -3461,16 +3489,16 @@ var sn = {
|
|
|
3461
3489
|
});
|
|
3462
3490
|
let t = this._state;
|
|
3463
3491
|
if (this._pointers.size >= 2) {
|
|
3464
|
-
let e =
|
|
3492
|
+
let e = X([...this._pointers.values()]);
|
|
3465
3493
|
if (this._state === "pending") {
|
|
3466
|
-
let t =
|
|
3494
|
+
let t = an(this._lastFrame, e), n = Math.abs(e.spread - this._lastFrame.spread), r = Math.hypot(t.dx, t.dy);
|
|
3467
3495
|
(n >= this._options.pinchThreshold || r >= this._options.panThreshold) && (this._lastFrame = e, this._state = "active", this.onGestureStart.emit({
|
|
3468
3496
|
centerX: e.centerX,
|
|
3469
3497
|
centerY: e.centerY,
|
|
3470
3498
|
pointerCount: this._pointers.size
|
|
3471
3499
|
}));
|
|
3472
3500
|
} else if (this._state === "active") {
|
|
3473
|
-
let t =
|
|
3501
|
+
let t = an(this._lastFrame, e), n = this._computeTotalScale(e);
|
|
3474
3502
|
this._lastFrame = e, this.onGestureChange.emit({
|
|
3475
3503
|
centerX: e.centerX,
|
|
3476
3504
|
centerY: e.centerY,
|
|
@@ -3497,14 +3525,14 @@ var sn = {
|
|
|
3497
3525
|
}
|
|
3498
3526
|
async initialize(e = {}, t) {
|
|
3499
3527
|
if (this._options = {
|
|
3500
|
-
...
|
|
3528
|
+
...on,
|
|
3501
3529
|
...e
|
|
3502
3530
|
}, !this._options.enabled) return;
|
|
3503
3531
|
let n = t.canvas;
|
|
3504
|
-
this._canvas = n, this._options.preventDefault && (this._previousTouchAction = n.style.touchAction, n.style.touchAction = "none"),
|
|
3532
|
+
this._canvas = n, this._options.preventDefault && (this._previousTouchAction = n.style.touchAction, n.style.touchAction = "none"), this.listen(n, "pointerdown", this._onPointerDown), this.listen(window, "pointermove", this._onPointerMove), this.listen(window, "pointerup", this._onPointerUp), this.listen(window, "pointercancel", this._onPointerCancel);
|
|
3505
3533
|
}
|
|
3506
3534
|
destroy() {
|
|
3507
|
-
this._canvas &&= (this.
|
|
3535
|
+
this._canvas &&= (this._options.preventDefault && (this._canvas.style.touchAction = this._previousTouchAction), null), this._pointers.clear(), this._state = "idle", this._startFrame = null, this._lastFrame = null, this.onGestureStart.disconnectAll(), this.onGestureChange.disconnectAll(), this.onGestureEnd.disconnectAll(), super.destroy();
|
|
3508
3536
|
}
|
|
3509
3537
|
getCoreSignals() {
|
|
3510
3538
|
return [
|
|
@@ -3520,21 +3548,21 @@ var sn = {
|
|
|
3520
3548
|
centerX: this._lastFrame.centerX,
|
|
3521
3549
|
centerY: this._lastFrame.centerY,
|
|
3522
3550
|
totalScale: this._computeTotalScale(this._lastFrame)
|
|
3523
|
-
}), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame =
|
|
3551
|
+
}), this._state = "idle", this._startFrame = null, this._lastFrame = null) : this._state !== "idle" && (this._lastFrame = X([...this._pointers.values()])), this._maybePreventDefault(e, t, this._state);
|
|
3524
3552
|
}
|
|
3525
3553
|
_computeTotalScale(e) {
|
|
3526
|
-
return !this._startFrame || this._startFrame.spread <
|
|
3554
|
+
return !this._startFrame || this._startFrame.spread < sn ? 1 : e.spread / this._startFrame.spread;
|
|
3527
3555
|
}
|
|
3528
3556
|
_maybePreventDefault(e, t, n) {
|
|
3529
3557
|
this._options.preventDefault && (t !== "idle" || n !== "idle") && e.preventDefault();
|
|
3530
3558
|
}
|
|
3531
|
-
},
|
|
3559
|
+
}, ln = {
|
|
3532
3560
|
defaultLocale: "en",
|
|
3533
3561
|
locales: ["en"],
|
|
3534
3562
|
loadAll: !1,
|
|
3535
3563
|
files: []
|
|
3536
3564
|
};
|
|
3537
|
-
function
|
|
3565
|
+
function un(e, t) {
|
|
3538
3566
|
if (t in e) return e[t];
|
|
3539
3567
|
if (!t.includes(".")) return;
|
|
3540
3568
|
let n = e;
|
|
@@ -3542,9 +3570,9 @@ function dn(e, t) {
|
|
|
3542
3570
|
else return;
|
|
3543
3571
|
return n;
|
|
3544
3572
|
}
|
|
3545
|
-
var
|
|
3573
|
+
var dn = class extends N {
|
|
3546
3574
|
constructor(...e) {
|
|
3547
|
-
super(...e), this.id = "i18n", this.onLocaleChanged = new
|
|
3575
|
+
super(...e), this.id = "i18n", this.onLocaleChanged = new j(), this._dicts = {};
|
|
3548
3576
|
}
|
|
3549
3577
|
get locale() {
|
|
3550
3578
|
return this._locale;
|
|
@@ -3554,7 +3582,7 @@ var fn = class extends M {
|
|
|
3554
3582
|
}
|
|
3555
3583
|
async initialize(e) {
|
|
3556
3584
|
if (this._options = {
|
|
3557
|
-
...
|
|
3585
|
+
...ln,
|
|
3558
3586
|
...e
|
|
3559
3587
|
}, this._locale = this._options.defaultLocale, this._options.loadAll && this._options.files.length > 0) {
|
|
3560
3588
|
let e = this._options.files.filter((e) => this._options.locales.includes(e.id));
|
|
@@ -3566,9 +3594,9 @@ var fn = class extends M {
|
|
|
3566
3594
|
}
|
|
3567
3595
|
t(e, t, n = this._locale) {
|
|
3568
3596
|
let r = this._dicts[n];
|
|
3569
|
-
if (!r) return
|
|
3570
|
-
let i =
|
|
3571
|
-
if (!a) return
|
|
3597
|
+
if (!r) return x.error(`i18n:: No dictionary loaded for current locale: ${n}`), e;
|
|
3598
|
+
let i = un(r, e), a = typeof i == "string" ? i : void 0;
|
|
3599
|
+
if (!a) return x.error(`i18n:: No result found for the key ${e} in the locale: ${this._locale}`), e;
|
|
3572
3600
|
let o = t?.variant;
|
|
3573
3601
|
if (a = a.replace(/\[(.*?)\]/g, (e, t) => {
|
|
3574
3602
|
let n = t.split("|");
|
|
@@ -3584,14 +3612,14 @@ var fn = class extends M {
|
|
|
3584
3612
|
}
|
|
3585
3613
|
tCount(e, t, n, r = this._locale) {
|
|
3586
3614
|
let i = new Intl.PluralRules(r).select(t), a = this._dicts[r], o = `${e}.${i}`;
|
|
3587
|
-
return (!a || typeof
|
|
3615
|
+
return (!a || typeof un(a, o) != "string") && (o = `${e}.other`), this.t(o, {
|
|
3588
3616
|
count: t,
|
|
3589
3617
|
...n
|
|
3590
3618
|
}, r);
|
|
3591
3619
|
}
|
|
3592
3620
|
parse(e, t = this._locale) {
|
|
3593
3621
|
let n = this._dicts[t];
|
|
3594
|
-
if (!n) return
|
|
3622
|
+
if (!n) return x.error(`i18n:: No dictionary loaded for current locale: ${this._locale}`), "";
|
|
3595
3623
|
let r = e, i = r.match(/{(.*?)}/g);
|
|
3596
3624
|
return i && i.forEach((e) => {
|
|
3597
3625
|
let t = e.slice(1, -1);
|
|
@@ -3601,10 +3629,10 @@ var fn = class extends M {
|
|
|
3601
3629
|
async loadLocale(e) {
|
|
3602
3630
|
let n = this._options.files.find((t) => e === t.id);
|
|
3603
3631
|
if (!n) {
|
|
3604
|
-
|
|
3632
|
+
x.error(`i18n:: Could not find locale file for ${e}`);
|
|
3605
3633
|
return;
|
|
3606
3634
|
}
|
|
3607
|
-
this._dicts[e] = n.json ? await t.load(n.json) : await
|
|
3635
|
+
this._dicts[e] = n.json ? await t.load(n.json) : await T(n);
|
|
3608
3636
|
}
|
|
3609
3637
|
getCoreFunctions() {
|
|
3610
3638
|
return [
|
|
@@ -3620,15 +3648,15 @@ var fn = class extends M {
|
|
|
3620
3648
|
async _loadAndSetLocale(e) {
|
|
3621
3649
|
this._dicts[e] || await this.loadLocale(e), this.onLocaleChanged.emit(e);
|
|
3622
3650
|
}
|
|
3623
|
-
},
|
|
3651
|
+
}, Z = /* @__PURE__ */ function(e) {
|
|
3624
3652
|
return e.Keyboard = "keyboard", e.GamePad = "gamepad", e.Mouse = "mouse", e.Touch = "touch", e;
|
|
3625
3653
|
}({});
|
|
3626
3654
|
//#endregion
|
|
3627
3655
|
//#region src/mixins/signals.ts
|
|
3628
|
-
function
|
|
3656
|
+
function fn(e) {
|
|
3629
3657
|
return class extends e {
|
|
3630
3658
|
constructor(...e) {
|
|
3631
|
-
super(...e), this.signalConnections = new
|
|
3659
|
+
super(...e), this.signalConnections = new A.SignalConnections();
|
|
3632
3660
|
}
|
|
3633
3661
|
addSignalConnection(...e) {
|
|
3634
3662
|
for (let t of e) this.signalConnections.add(t);
|
|
@@ -3645,66 +3673,122 @@ function Z(e) {
|
|
|
3645
3673
|
};
|
|
3646
3674
|
}
|
|
3647
3675
|
//#endregion
|
|
3676
|
+
//#region src/plugins/input/controlsCore.ts
|
|
3677
|
+
function pn(e, t) {
|
|
3678
|
+
return e === "*" ? !0 : Array.isArray(e) ? e.includes(t) : e === t;
|
|
3679
|
+
}
|
|
3680
|
+
function mn(e, t, n, r) {
|
|
3681
|
+
let i = [], a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
3682
|
+
return vn(e, t, n, r, (e, t) => {
|
|
3683
|
+
if (t.includes("+")) {
|
|
3684
|
+
let n = t.split("+");
|
|
3685
|
+
i.push(n), a.set(n, e);
|
|
3686
|
+
} else o.set(t, e);
|
|
3687
|
+
}), i.sort((e, t) => t.length - e.length), {
|
|
3688
|
+
combinations: i,
|
|
3689
|
+
combinationsMap: a,
|
|
3690
|
+
singles: o
|
|
3691
|
+
};
|
|
3692
|
+
}
|
|
3693
|
+
function hn(e, t, n, r) {
|
|
3694
|
+
let i = /* @__PURE__ */ new Map();
|
|
3695
|
+
return vn(e, t, n, r, (e, t) => {
|
|
3696
|
+
i.set(t, e);
|
|
3697
|
+
}), i;
|
|
3698
|
+
}
|
|
3699
|
+
function gn(e, t, n = t) {
|
|
3700
|
+
return e.includes("+") ? e.split("+").every((e) => n(e)) : t(e);
|
|
3701
|
+
}
|
|
3702
|
+
function _n(e, t) {
|
|
3703
|
+
let n = [], r = /* @__PURE__ */ new Set();
|
|
3704
|
+
for (let i = 0; i < e.length; i++) {
|
|
3705
|
+
let a = e[i];
|
|
3706
|
+
a.some((e) => r.has(e)) || a.every((e) => t(e)) && (a.forEach((e) => r.add(e)), n.push(a));
|
|
3707
|
+
}
|
|
3708
|
+
return {
|
|
3709
|
+
fired: n,
|
|
3710
|
+
eliminated: r
|
|
3711
|
+
};
|
|
3712
|
+
}
|
|
3713
|
+
function vn(e, t, n, r, i) {
|
|
3714
|
+
e && Object.keys(e).forEach((a) => {
|
|
3715
|
+
let o = t[a];
|
|
3716
|
+
if (!o) {
|
|
3717
|
+
r(a);
|
|
3718
|
+
return;
|
|
3719
|
+
}
|
|
3720
|
+
if (!pn(o.context, n)) return;
|
|
3721
|
+
let s = e[a];
|
|
3722
|
+
s && (Array.isArray(s) ? s : [s]).forEach((e) => i(a, e));
|
|
3723
|
+
});
|
|
3724
|
+
}
|
|
3725
|
+
//#endregion
|
|
3648
3726
|
//#region src/plugins/input/AbstractControls.ts
|
|
3649
|
-
var
|
|
3727
|
+
var yn = class {
|
|
3728
|
+
static {
|
|
3729
|
+
this.__caper_method_binding_root = !0;
|
|
3730
|
+
}
|
|
3731
|
+
destroy() {}
|
|
3732
|
+
}, bn = class extends fn(yn) {
|
|
3733
|
+
constructor(...e) {
|
|
3734
|
+
super(...e), this.combinations = [], this.combinationsMap = /* @__PURE__ */ new Map(), this.activeDownInputs = /* @__PURE__ */ new Map(), this.activeUpInputs = /* @__PURE__ */ new Map(), this._warnedMissingActions = /* @__PURE__ */ new Set();
|
|
3735
|
+
}
|
|
3650
3736
|
get app() {
|
|
3651
3737
|
return $.getInstance();
|
|
3652
3738
|
}
|
|
3653
3739
|
initialize(e) {
|
|
3654
|
-
this.scheme = e;
|
|
3740
|
+
this.scheme = e, this.addSignalConnection(this.app.signal.onActionContextChanged.connect(this._sortActions)), this._sortActions();
|
|
3655
3741
|
}
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
super(), this._keyCombinations = [], this._singleDownKeys = /* @__PURE__ */ new Set(), this._keyCombinationsMap = /* @__PURE__ */ new Map(), this._activeDownKeys = /* @__PURE__ */ new Map(), this._activeUpKeys = /* @__PURE__ */ new Map(), g(this);
|
|
3742
|
+
connect() {
|
|
3743
|
+
this.app.ticker.add(this._update);
|
|
3659
3744
|
}
|
|
3660
|
-
|
|
3661
|
-
|
|
3745
|
+
destroy() {
|
|
3746
|
+
this.app.ticker.remove(this._update), super.destroy();
|
|
3662
3747
|
}
|
|
3663
3748
|
isActionActive(e) {
|
|
3664
|
-
let t = this.scheme
|
|
3665
|
-
return t ? Array.isArray(t) ?
|
|
3749
|
+
let t = this.scheme?.down?.[e] ?? null;
|
|
3750
|
+
return t ? Array.isArray(t) ? t.some((e) => this._isInputActive(e)) : this._isInputActive(t) : !1;
|
|
3666
3751
|
}
|
|
3667
|
-
|
|
3668
|
-
|
|
3752
|
+
get downSection() {
|
|
3753
|
+
return this.scheme?.down;
|
|
3669
3754
|
}
|
|
3670
|
-
|
|
3671
|
-
|
|
3755
|
+
get upSection() {
|
|
3756
|
+
return this.scheme?.up;
|
|
3757
|
+
}
|
|
3758
|
+
isComboPartDown(e) {
|
|
3759
|
+
return this.isInputDown(e);
|
|
3760
|
+
}
|
|
3761
|
+
_isInputActive(e) {
|
|
3762
|
+
return gn(e, this.isInputDown, this.isComboPartDown);
|
|
3672
3763
|
}
|
|
3673
3764
|
_sortActions() {
|
|
3674
|
-
let e = this.app.actionsPlugin.getActions();
|
|
3675
|
-
this.
|
|
3676
|
-
let t = Object.keys(this._keyDownMap);
|
|
3677
|
-
t.forEach((t) => {
|
|
3678
|
-
let n = this._keyDownMap[t], r = e[t];
|
|
3679
|
-
if (r.context !== "*" && r.context !== this.app.actionContext && !r.context.includes(this.app.actionContext)) return;
|
|
3680
|
-
let i = n;
|
|
3681
|
-
i && (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
3682
|
-
if (e.includes("+")) {
|
|
3683
|
-
let n = e.split("+");
|
|
3684
|
-
this._keyCombinations.push(n), this._keyCombinationsMap.set(n, t);
|
|
3685
|
-
} else this._activeDownKeys.set(e, t);
|
|
3686
|
-
}));
|
|
3687
|
-
}), this._keyCombinations.sort((e, t) => t.length - e.length), t = Object.keys(this._keyUpMap), t.forEach((e) => {
|
|
3688
|
-
let t = this._keyUpMap[e];
|
|
3689
|
-
t && (Array.isArray(t) || (t = [t]), t.forEach((t) => {
|
|
3690
|
-
this._activeUpKeys.set(t, e);
|
|
3691
|
-
}));
|
|
3692
|
-
});
|
|
3765
|
+
let e = this.app.actionsPlugin.getActions(), t = this.app.actionContext, { combinations: n, combinationsMap: r, singles: i } = mn(this.downSection, e, t, this._warnMissingAction);
|
|
3766
|
+
this.combinations = n, this.combinationsMap = r, this.activeDownInputs = i, this.activeUpInputs = hn(this.upSection, e, t, this._warnMissingAction);
|
|
3693
3767
|
}
|
|
3694
|
-
|
|
3695
|
-
this.
|
|
3768
|
+
_warnMissingAction(e) {
|
|
3769
|
+
this._warnedMissingActions.has(e) || (this._warnedMissingActions.add(e), x.warn(`${this.logLabel}: scheme references unknown action "${e}"`));
|
|
3696
3770
|
}
|
|
3697
|
-
|
|
3698
|
-
|
|
3771
|
+
}, xn = class extends bn {
|
|
3772
|
+
constructor() {
|
|
3773
|
+
super(), this.logLabel = "KeyboardControls", this._singleDownKeys = /* @__PURE__ */ new Set(), _(this);
|
|
3774
|
+
}
|
|
3775
|
+
initialize(e) {
|
|
3776
|
+
super.initialize(e);
|
|
3777
|
+
}
|
|
3778
|
+
connect() {
|
|
3779
|
+
this.addSignalConnection(this.app.keyboard.onKeyDown().connect(this._handleKeyDown), this.app.keyboard.onKeyUp().connect(this._handleKeyUp)), super.connect();
|
|
3780
|
+
}
|
|
3781
|
+
isInputDown(e) {
|
|
3782
|
+
return this._singleDownKeys.has(e);
|
|
3699
3783
|
}
|
|
3700
3784
|
_handleKeyDown(e) {
|
|
3701
|
-
let t =
|
|
3785
|
+
let t = F(e.event.key);
|
|
3702
3786
|
this._singleDownKeys.add(t);
|
|
3703
3787
|
}
|
|
3704
3788
|
_handleKeyUp(e) {
|
|
3705
|
-
let t =
|
|
3789
|
+
let t = F(e.event.key);
|
|
3706
3790
|
this._singleDownKeys.delete(t);
|
|
3707
|
-
let n = this.
|
|
3791
|
+
let n = this.activeUpInputs.get(t);
|
|
3708
3792
|
n && this.app.action(n, {
|
|
3709
3793
|
combination: !1,
|
|
3710
3794
|
inputState: "up",
|
|
@@ -3715,33 +3799,28 @@ var pn = class {
|
|
|
3715
3799
|
if (!this.app.keyboard) return;
|
|
3716
3800
|
let e = this.app.keyboard.keysDown;
|
|
3717
3801
|
if (e.size === 0) return;
|
|
3718
|
-
let t
|
|
3719
|
-
|
|
3720
|
-
let
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
}
|
|
3730
|
-
}
|
|
3731
|
-
this._singleDownKeys.forEach((n) => {
|
|
3732
|
-
if (!t.has(n) && e.has(n)) {
|
|
3733
|
-
let e = this._activeDownKeys.get(n);
|
|
3802
|
+
let { fired: t, eliminated: n } = _n(this.combinations, (t) => e.has(t));
|
|
3803
|
+
t.forEach((e) => {
|
|
3804
|
+
let t = this.combinationsMap.get(e);
|
|
3805
|
+
t && this.app.action(t, {
|
|
3806
|
+
key: e,
|
|
3807
|
+
combination: !0,
|
|
3808
|
+
inputState: "down"
|
|
3809
|
+
});
|
|
3810
|
+
}), this._singleDownKeys.forEach((t) => {
|
|
3811
|
+
if (!n.has(t) && e.has(t)) {
|
|
3812
|
+
let e = this.activeDownInputs.get(t);
|
|
3734
3813
|
e && this.app.action(e, {
|
|
3735
|
-
key:
|
|
3814
|
+
key: t,
|
|
3736
3815
|
combination: !1,
|
|
3737
3816
|
inputState: "down"
|
|
3738
3817
|
});
|
|
3739
3818
|
}
|
|
3740
3819
|
});
|
|
3741
3820
|
}
|
|
3742
|
-
},
|
|
3821
|
+
}, Sn = class extends bn {
|
|
3743
3822
|
constructor() {
|
|
3744
|
-
super(), this.
|
|
3823
|
+
super(), this.logLabel = "VirtualControls", this._buttons = /* @__PURE__ */ new Set(), this._singleDownButtons = /* @__PURE__ */ new Set(), this._activeJoystickDirections = /* @__PURE__ */ new Map(), this._buttonConnections = /* @__PURE__ */ new Map(), _(this);
|
|
3745
3824
|
}
|
|
3746
3825
|
get joystick() {
|
|
3747
3826
|
return this._joystick;
|
|
@@ -3749,51 +3828,40 @@ var pn = class {
|
|
|
3749
3828
|
set joystick(e) {
|
|
3750
3829
|
this._joystick = e;
|
|
3751
3830
|
}
|
|
3752
|
-
get app() {
|
|
3753
|
-
return $.getInstance();
|
|
3754
|
-
}
|
|
3755
3831
|
addButton(e) {
|
|
3756
|
-
!e || this._buttons.has(e)
|
|
3832
|
+
if (!e || this._buttons.has(e)) return;
|
|
3833
|
+
let t = [
|
|
3834
|
+
e.onDown.connect(() => this._handleButtonDown(e)),
|
|
3835
|
+
e.onUp.connect(() => this._handleButtonUp(e)),
|
|
3836
|
+
e.onUpOutside.connect(() => this._handleButtonUp(e)),
|
|
3837
|
+
e.onDestroy.connect(() => this.removeButton(e))
|
|
3838
|
+
];
|
|
3839
|
+
this.addSignalConnection(...t), this._buttonConnections.set(e, t), this._buttons.add(e);
|
|
3757
3840
|
}
|
|
3758
3841
|
removeButton(e) {
|
|
3759
|
-
!e || !this._buttons.has(e) || (
|
|
3842
|
+
!e || !this._buttons.has(e) || (this._buttonConnections.get(e)?.forEach((e) => e.disconnect()), this._buttonConnections.delete(e), this._singleDownButtons.delete(e.id), this._buttons.delete(e));
|
|
3760
3843
|
}
|
|
3761
3844
|
initialize(e) {
|
|
3762
|
-
super.initialize(e)
|
|
3763
|
-
}
|
|
3764
|
-
connect() {
|
|
3765
|
-
this.app.ticker.add(this._update);
|
|
3845
|
+
super.initialize(e);
|
|
3766
3846
|
}
|
|
3767
3847
|
isActionActive(e) {
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3848
|
+
if (this.scheme.down?.[e] ?? null) return super.isActionActive(e);
|
|
3849
|
+
let t = this.scheme.joystick?.[e] ?? null;
|
|
3850
|
+
return this._joystick && t ? Array.isArray(t) ? t.includes(this._joystick.direction) : t === this._joystick?.direction : !1;
|
|
3851
|
+
}
|
|
3852
|
+
isInputDown(e) {
|
|
3853
|
+
return this._singleDownButtons.has(e);
|
|
3854
|
+
}
|
|
3855
|
+
isComboPartDown(e) {
|
|
3856
|
+
return this._singleDownButtons.has(e) || this._joystick?.direction === e;
|
|
3775
3857
|
}
|
|
3776
3858
|
_sortActions() {
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
let i = n;
|
|
3784
|
-
i && (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
3785
|
-
if (e.includes("+")) {
|
|
3786
|
-
let n = e.split("+");
|
|
3787
|
-
this._combinations.push(n), this._combinationsMap.set(n, t);
|
|
3788
|
-
} else this._activeButtonDownIds.set(e, t);
|
|
3789
|
-
}));
|
|
3790
|
-
}), this._combinations.sort((e, t) => t.length - e.length), t = Object.keys(this._buttonUpMap), t.forEach((t) => {
|
|
3791
|
-
let n = this._buttonUpMap[t], r = e[t];
|
|
3792
|
-
r.context !== "*" && r.context !== this.app.actionContext && !r.context.includes(this.app.actionContext) || this._activeButtonUpIds.set(n, t);
|
|
3793
|
-
}), Object.keys(this._joystickMap).forEach((e) => {
|
|
3794
|
-
let t = this._joystickMap[e];
|
|
3795
|
-
t && (Array.isArray(t) || (t = [t]), t.forEach((t) => {
|
|
3796
|
-
this._activeJoystickDirections.set(t, e);
|
|
3859
|
+
super._sortActions(), this._activeJoystickDirections.clear();
|
|
3860
|
+
let e = this.scheme.joystick || {};
|
|
3861
|
+
Object.keys(e).forEach((t) => {
|
|
3862
|
+
let n = e[t];
|
|
3863
|
+
n && (Array.isArray(n) || (n = [n]), n.forEach((e) => {
|
|
3864
|
+
this._activeJoystickDirections.set(e, t);
|
|
3797
3865
|
}));
|
|
3798
3866
|
});
|
|
3799
3867
|
}
|
|
@@ -3802,7 +3870,7 @@ var pn = class {
|
|
|
3802
3870
|
}
|
|
3803
3871
|
_handleButtonUp(e) {
|
|
3804
3872
|
this._singleDownButtons.delete(e.id);
|
|
3805
|
-
let t = this.
|
|
3873
|
+
let t = this.activeUpInputs.get(e.id);
|
|
3806
3874
|
t && this.app.action(t, {
|
|
3807
3875
|
combination: !1,
|
|
3808
3876
|
inputState: "up",
|
|
@@ -3810,22 +3878,17 @@ var pn = class {
|
|
|
3810
3878
|
});
|
|
3811
3879
|
}
|
|
3812
3880
|
_update() {
|
|
3813
|
-
let e = this._joystick?.direction ?? null, t = this._singleDownButtons, n
|
|
3814
|
-
|
|
3815
|
-
let
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
}
|
|
3825
|
-
}
|
|
3826
|
-
if (this._singleDownButtons.forEach((e) => {
|
|
3827
|
-
if (!n.has(e) && t.has(e)) {
|
|
3828
|
-
let t = this._activeButtonDownIds.get(e);
|
|
3881
|
+
let e = this._joystick?.direction ?? null, t = this._singleDownButtons, { fired: n, eliminated: r } = _n(this.combinations, (n) => t.has(n) || e === n);
|
|
3882
|
+
if (n.forEach((e) => {
|
|
3883
|
+
let t = this.combinationsMap.get(e);
|
|
3884
|
+
t && this.app.action(t, {
|
|
3885
|
+
button: e,
|
|
3886
|
+
combination: !0,
|
|
3887
|
+
inputState: "down"
|
|
3888
|
+
});
|
|
3889
|
+
}), this._singleDownButtons.forEach((e) => {
|
|
3890
|
+
if (!r.has(e) && t.has(e)) {
|
|
3891
|
+
let t = this.activeDownInputs.get(e);
|
|
3829
3892
|
t && this.app.action(t, {
|
|
3830
3893
|
button: e,
|
|
3831
3894
|
combination: !1,
|
|
@@ -3837,9 +3900,9 @@ var pn = class {
|
|
|
3837
3900
|
t && this.app.action(t, { inputState: "joystick" });
|
|
3838
3901
|
}
|
|
3839
3902
|
}
|
|
3840
|
-
},
|
|
3903
|
+
}, Cn = class {
|
|
3841
3904
|
constructor() {
|
|
3842
|
-
|
|
3905
|
+
_(this);
|
|
3843
3906
|
}
|
|
3844
3907
|
get app() {
|
|
3845
3908
|
return $.getInstance();
|
|
@@ -3854,14 +3917,14 @@ var pn = class {
|
|
|
3854
3917
|
return this.keyboard?.isActionActive(e) || this.touch?.isActionActive(e) || !1;
|
|
3855
3918
|
}
|
|
3856
3919
|
initialize(e) {
|
|
3857
|
-
e.keyboard && (this.keyboard = new
|
|
3920
|
+
e.keyboard && (this.keyboard = new xn(), this.keyboard.initialize(e.keyboard)), e.touch && (this.touch = new Sn(), this.touch.initialize(e.touch));
|
|
3858
3921
|
}
|
|
3859
3922
|
connect() {
|
|
3860
3923
|
this.keyboard && this.keyboard.connect(), this.touch && this.touch.connect();
|
|
3861
3924
|
}
|
|
3862
|
-
},
|
|
3925
|
+
}, wn = { actions: vt }, Tn = class extends N {
|
|
3863
3926
|
constructor(...e) {
|
|
3864
|
-
super(...e), this.id = "input", this.controls = new
|
|
3927
|
+
super(...e), this.id = "input", this.controls = new Cn(), this.activeGamepads = /* @__PURE__ */ new Map(), this.activeControllers = /* @__PURE__ */ new Set([]), this._lastUsedController = null, this._canvas = null, this.onGamepadConnected = new j(), this.onGamepadDisconnected = new j(), this.onControllerActivated = new j(), this.onControllerDeactivated = new j(), this.onControllerChanged = new j();
|
|
3865
3928
|
}
|
|
3866
3929
|
get lastUsedController() {
|
|
3867
3930
|
return this._lastUsedController;
|
|
@@ -3869,17 +3932,17 @@ var pn = class {
|
|
|
3869
3932
|
isActionActive(e) {
|
|
3870
3933
|
return this.controls.isActionActive(e);
|
|
3871
3934
|
}
|
|
3872
|
-
async initialize(e =
|
|
3935
|
+
async initialize(e = wn, t) {
|
|
3873
3936
|
this._options = {
|
|
3874
|
-
...
|
|
3937
|
+
...wn,
|
|
3875
3938
|
...e
|
|
3876
|
-
}, t.stage.eventMode = "static", this._canvas = t.canvas, this._canvas
|
|
3939
|
+
}, t.stage.eventMode = "static", this._canvas = t.canvas, this.listen(this._canvas, "pointerdown", this._onPointerDown), this.listen(this._canvas, "pointermove", this._onPointerMove), this.listen(window, "keydown", this._onKeyDown), this.listen(window, "gamepadconnected", this._onGamepadConnected), this.listen(window, "gamepaddisconnected", this._onGamepadDisconnected), this._options.controls && this.controls.initialize(this._options.controls);
|
|
3877
3940
|
}
|
|
3878
3941
|
postInitialize() {
|
|
3879
3942
|
this.controls && this.controls.connect();
|
|
3880
3943
|
}
|
|
3881
3944
|
destroy() {
|
|
3882
|
-
this._canvas
|
|
3945
|
+
this._canvas = null, this.controls.destroy(), this.onGamepadConnected.disconnectAll(), this.onGamepadDisconnected.disconnectAll(), this.onControllerActivated.disconnectAll(), this.onControllerDeactivated.disconnectAll(), this.onControllerChanged.disconnectAll(), super.destroy();
|
|
3883
3946
|
}
|
|
3884
3947
|
isControllerActive(e) {
|
|
3885
3948
|
return this.activeControllers.has(e);
|
|
@@ -3897,7 +3960,7 @@ var pn = class {
|
|
|
3897
3960
|
];
|
|
3898
3961
|
}
|
|
3899
3962
|
_isInputControllerType(e) {
|
|
3900
|
-
return Object.values(
|
|
3963
|
+
return Object.values(Z).includes(e);
|
|
3901
3964
|
}
|
|
3902
3965
|
_activateController(e) {
|
|
3903
3966
|
let t = !this.activeControllers.has(e);
|
|
@@ -3913,34 +3976,34 @@ var pn = class {
|
|
|
3913
3976
|
this.activeGamepads.delete(e);
|
|
3914
3977
|
}
|
|
3915
3978
|
_onPointerDown(e) {
|
|
3916
|
-
e.pointerType === "touch" && this._activateController(
|
|
3979
|
+
e.pointerType === "touch" && this._activateController(Z.Touch);
|
|
3917
3980
|
}
|
|
3918
3981
|
_onPointerMove(e) {
|
|
3919
|
-
e.pointerType === "mouse" && this._activateController(
|
|
3982
|
+
e.pointerType === "mouse" && this._activateController(Z.Mouse);
|
|
3920
3983
|
}
|
|
3921
3984
|
_onKeyDown() {
|
|
3922
|
-
this._activateController(
|
|
3985
|
+
this._activateController(Z.Keyboard);
|
|
3923
3986
|
}
|
|
3924
3987
|
_onGamepadConnected(e) {
|
|
3925
|
-
this._activateController(
|
|
3988
|
+
this._activateController(Z.GamePad), this._activateController(e.gamepad.id), this._activateGamepad(e.gamepad), this.onGamepadConnected.emit(e.gamepad);
|
|
3926
3989
|
}
|
|
3927
3990
|
_onGamepadDisconnected(e) {
|
|
3928
|
-
this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(
|
|
3991
|
+
this._deactivateGamepad(e.gamepad.id), this.actionsPlugin.sendAction("pause"), this.onGamepadDisconnected.emit(e.gamepad), this.activeGamepads.size === 0 && this._deactivateController(Z.GamePad);
|
|
3929
3992
|
}
|
|
3930
3993
|
get actionsPlugin() {
|
|
3931
3994
|
return this.app.getPlugin("actions");
|
|
3932
3995
|
}
|
|
3933
|
-
},
|
|
3996
|
+
}, En = {
|
|
3934
3997
|
x: !0,
|
|
3935
3998
|
y: !0,
|
|
3936
3999
|
intensity: 3,
|
|
3937
4000
|
duration: .05,
|
|
3938
4001
|
times: 4
|
|
3939
4002
|
};
|
|
3940
|
-
function
|
|
4003
|
+
function Dn(e) {
|
|
3941
4004
|
return class extends e {
|
|
3942
4005
|
constructor(...e) {
|
|
3943
|
-
super(...e), this.onAnimationStart = new
|
|
4006
|
+
super(...e), this.onAnimationStart = new j(), this.onAnimationUpdate = new j(), this.onAnimationComplete = new j(), this._activeTweens = [];
|
|
3944
4007
|
}
|
|
3945
4008
|
animate(e, t = this) {
|
|
3946
4009
|
let n = p.to(t, {
|
|
@@ -4010,7 +4073,7 @@ function bn(e) {
|
|
|
4010
4073
|
}
|
|
4011
4074
|
shake(e, t = this) {
|
|
4012
4075
|
let n = {
|
|
4013
|
-
...
|
|
4076
|
+
...En,
|
|
4014
4077
|
...e
|
|
4015
4078
|
}, r = {
|
|
4016
4079
|
x: t.x,
|
|
@@ -4056,24 +4119,24 @@ function bn(e) {
|
|
|
4056
4119
|
}
|
|
4057
4120
|
//#endregion
|
|
4058
4121
|
//#region src/mixins/factory/Factory.ts
|
|
4059
|
-
function
|
|
4122
|
+
function On(e) {
|
|
4060
4123
|
return class extends n {
|
|
4061
4124
|
constructor() {
|
|
4062
|
-
super(), e = Object.assign({},
|
|
4125
|
+
super(), e = Object.assign({}, $e(), e), this.make = M(e, this, !1), this.add = M(e, this, !0);
|
|
4063
4126
|
}
|
|
4064
4127
|
};
|
|
4065
4128
|
}
|
|
4066
4129
|
//#endregion
|
|
4067
4130
|
//#region src/display/Container.ts
|
|
4068
|
-
var
|
|
4131
|
+
var kn = [
|
|
4069
4132
|
"autoResize",
|
|
4070
4133
|
"autoUpdate",
|
|
4071
4134
|
"priority"
|
|
4072
|
-
],
|
|
4135
|
+
], An = {
|
|
4073
4136
|
autoResize: !0,
|
|
4074
4137
|
autoUpdate: !1,
|
|
4075
4138
|
priority: 0
|
|
4076
|
-
}, Q = class e extends
|
|
4139
|
+
}, Q = class e extends Dn(fn(On())) {
|
|
4077
4140
|
static {
|
|
4078
4141
|
this.__caper_method_binding_root = !0;
|
|
4079
4142
|
}
|
|
@@ -4084,10 +4147,10 @@ var Sn = [
|
|
|
4084
4147
|
this._animationContext = e;
|
|
4085
4148
|
}
|
|
4086
4149
|
static {
|
|
4087
|
-
this.onGlobalChildAdded = new
|
|
4150
|
+
this.onGlobalChildAdded = new j();
|
|
4088
4151
|
}
|
|
4089
4152
|
static {
|
|
4090
|
-
this.onGlobalChildRemoved = new
|
|
4153
|
+
this.onGlobalChildRemoved = new j();
|
|
4091
4154
|
}
|
|
4092
4155
|
static childAdded(t) {
|
|
4093
4156
|
e.onGlobalChildAdded.emit(t);
|
|
@@ -4099,10 +4162,10 @@ var Sn = [
|
|
|
4099
4162
|
return $.getInstance();
|
|
4100
4163
|
}
|
|
4101
4164
|
constructor(e = {}) {
|
|
4102
|
-
super(), this.onDestroy = new
|
|
4103
|
-
...
|
|
4165
|
+
super(), this.onDestroy = new j(), this.__config = {
|
|
4166
|
+
...An,
|
|
4104
4167
|
...e
|
|
4105
|
-
},
|
|
4168
|
+
}, _(this), this.on("added", this._added), this.on("removed", this._removed), this.on("childAdded", this._childAdded), this.on("childRemoved", this._childRemoved);
|
|
4106
4169
|
}
|
|
4107
4170
|
addColoredBackground(e = 0, t = 1) {
|
|
4108
4171
|
let n = {
|
|
@@ -4153,9 +4216,9 @@ var Sn = [
|
|
|
4153
4216
|
addAnimation(e, t) {
|
|
4154
4217
|
return this.app.addAnimation(e, t ?? this.animationContext);
|
|
4155
4218
|
}
|
|
4156
|
-
},
|
|
4219
|
+
}, jn = class extends N {
|
|
4157
4220
|
constructor(...e) {
|
|
4158
|
-
super(...e), this.id = "popups", this.view = new Q(), this.onShowPopup = new
|
|
4221
|
+
super(...e), this.id = "popups", this.view = new Q(), this.onShowPopup = new j(), this.onHidePopup = new j(), this.onPopupChanged = new j(), this._popups = /* @__PURE__ */ new Map(), this._activePopups = /* @__PURE__ */ new Map(), this._currentPopupId = void 0;
|
|
4159
4222
|
}
|
|
4160
4223
|
get currentPopupId() {
|
|
4161
4224
|
return this._currentPopupId;
|
|
@@ -4170,7 +4233,7 @@ var Sn = [
|
|
|
4170
4233
|
return this._activePopups.size > 0;
|
|
4171
4234
|
}
|
|
4172
4235
|
initialize() {
|
|
4173
|
-
|
|
4236
|
+
_(this), this.view.label = "PopupManager", this._setupAppListeners(), this._registerDiscoveredPopups();
|
|
4174
4237
|
}
|
|
4175
4238
|
destroy() {
|
|
4176
4239
|
this._activePopups.clear(), super.destroy();
|
|
@@ -4198,7 +4261,7 @@ var Sn = [
|
|
|
4198
4261
|
}
|
|
4199
4262
|
async hidePopup(e, t) {
|
|
4200
4263
|
let n = this._activePopups.get(e);
|
|
4201
|
-
if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId =
|
|
4264
|
+
if (n) return n.beforeHide(), await n.hide(), this.view.removeChild(n), this._activePopups.delete(e), this._currentPopupId = ke(this._activePopups)?.[0] || void 0, new Promise((r) => {
|
|
4202
4265
|
this.app.ticker.addOnce(() => {
|
|
4203
4266
|
this.onHidePopup.emit({
|
|
4204
4267
|
id: e,
|
|
@@ -4211,9 +4274,8 @@ var Sn = [
|
|
|
4211
4274
|
});
|
|
4212
4275
|
}
|
|
4213
4276
|
removeAllPopups(e = !1) {
|
|
4214
|
-
e
|
|
4215
|
-
|
|
4216
|
-
}) : (this._activePopups.clear(), this.view.removeChildren());
|
|
4277
|
+
if (e) for (let e of [...this._activePopups.keys()]) this.hidePopup(e);
|
|
4278
|
+
else this._activePopups.clear(), this.view.removeChildren();
|
|
4217
4279
|
}
|
|
4218
4280
|
getCoreFunctions() {
|
|
4219
4281
|
return [
|
|
@@ -4250,7 +4312,7 @@ var Sn = [
|
|
|
4250
4312
|
_handleEscape() {
|
|
4251
4313
|
this.current && this.current.config.closeOnEscape && this.hidePopup(this.current.id);
|
|
4252
4314
|
}
|
|
4253
|
-
},
|
|
4315
|
+
}, Mn = {
|
|
4254
4316
|
autoScroll: !1,
|
|
4255
4317
|
minWidth: 0,
|
|
4256
4318
|
minHeight: 0,
|
|
@@ -4258,7 +4320,7 @@ var Sn = [
|
|
|
4258
4320
|
center: !1,
|
|
4259
4321
|
debug: !1,
|
|
4260
4322
|
useSafeArea: !0
|
|
4261
|
-
},
|
|
4323
|
+
}, Nn = class extends N {
|
|
4262
4324
|
constructor(...e) {
|
|
4263
4325
|
super(...e), this.id = "resizer", this._safeArea = {
|
|
4264
4326
|
top: 0,
|
|
@@ -4280,7 +4342,7 @@ var Sn = [
|
|
|
4280
4342
|
}
|
|
4281
4343
|
async initialize(e) {
|
|
4282
4344
|
this._options = {
|
|
4283
|
-
...
|
|
4345
|
+
...Mn,
|
|
4284
4346
|
...e
|
|
4285
4347
|
};
|
|
4286
4348
|
}
|
|
@@ -4362,7 +4424,7 @@ var Sn = [
|
|
|
4362
4424
|
color: 4095
|
|
4363
4425
|
});
|
|
4364
4426
|
}
|
|
4365
|
-
},
|
|
4427
|
+
}, Pn = {
|
|
4366
4428
|
view: null,
|
|
4367
4429
|
hideWhen: "firstSceneEnter",
|
|
4368
4430
|
zOrder: "top",
|
|
@@ -4370,9 +4432,9 @@ var Sn = [
|
|
|
4370
4432
|
assets: [],
|
|
4371
4433
|
bundles: []
|
|
4372
4434
|
}
|
|
4373
|
-
},
|
|
4435
|
+
}, Fn = class extends N {
|
|
4374
4436
|
constructor() {
|
|
4375
|
-
super(), this.id = "scenes", this.onSceneChangeStart = new
|
|
4437
|
+
super(), this.id = "scenes", this.onSceneChangeStart = new j(), this.onSceneChangeComplete = new j(), this.view = new n(), this.isFirstScene = !0, this.list = [], this.groupOrder = [], this.debugGroupsList = [], this._sceneModules = /* @__PURE__ */ new Map(), this._pendingLoadProps = void 0, this._lastScene = null, this._defaultLoadMethod = "immediate", this._debugVisible = !1, this._useHash = !1, _(this);
|
|
4376
4438
|
}
|
|
4377
4439
|
get ids() {
|
|
4378
4440
|
return this.list.map((e) => e.id);
|
|
@@ -4380,7 +4442,6 @@ var Sn = [
|
|
|
4380
4442
|
setDefaultLoadMethod(e) {
|
|
4381
4443
|
this._defaultLoadMethod = e;
|
|
4382
4444
|
}
|
|
4383
|
-
destroy() {}
|
|
4384
4445
|
async initialize(e, t) {
|
|
4385
4446
|
if (this._debugVisible = this.app.config?.showSceneDebugMenu === !0 || v && this.app.config?.showSceneDebugMenu !== !1, this._useHash = t.config?.useHash === !0 || this._debugVisible, this.view.sortableChildren = !0, this.list = (Caper.get("sceneList") || []).filter((e) => e.active !== !1), this.groupOrder = t.config?.sceneGroupOrder || [], (this._debugVisible || this._useHash) && (this.defaultScene = this.getSceneFromHash() || ""), !this.splash) {
|
|
4386
4447
|
this.splash = {
|
|
@@ -4389,12 +4450,12 @@ var Sn = [
|
|
|
4389
4450
|
zOrder: "top"
|
|
4390
4451
|
};
|
|
4391
4452
|
let e = {
|
|
4392
|
-
...
|
|
4453
|
+
...Pn,
|
|
4393
4454
|
...t.config?.splash ?? {}
|
|
4394
4455
|
};
|
|
4395
4456
|
e.view && (this.splash.view = typeof e.view == "function" ? new e.view() : e.view), this.splash.preload = e.preload;
|
|
4396
4457
|
}
|
|
4397
|
-
return this.defaultScene = this.defaultScene || t.config?.defaultScene || this.list?.[0]?.id, !this.transition && t.config?.sceneTransition && (this.transition = typeof t.config.sceneTransition == "function" ? new t.config.sceneTransition() : t.config.sceneTransition), this._defaultLoadMethod = t.config.defaultSceneLoadMethod || "immediate", this._debugVisible && this._createDebugMenu(), this._useHash && this._listenForHashChange(), this.app.onPause.connect(this._onPause, "highest"), this.app.onResume.connect(this._onResume, "highest"), Promise.resolve(void 0);
|
|
4458
|
+
return this.defaultScene = this.defaultScene || t.config?.defaultScene || this.list?.[0]?.id, !this.transition && t.config?.sceneTransition && (this.transition = typeof t.config.sceneTransition == "function" ? new t.config.sceneTransition() : t.config.sceneTransition), this._defaultLoadMethod = t.config.defaultSceneLoadMethod || "immediate", this._debugVisible && this._createDebugMenu(), this._useHash && this._listenForHashChange(), this.addSignalConnection(this.app.onPause.connect(this._onPause, "highest"), this.app.onResume.connect(this._onResume, "highest")), Promise.resolve(void 0);
|
|
4398
4459
|
}
|
|
4399
4460
|
_onPause(e) {
|
|
4400
4461
|
this.currentScene.onPause(e);
|
|
@@ -4410,12 +4471,12 @@ var Sn = [
|
|
|
4410
4471
|
let n = typeof e == "string" ? e : e.id, r = typeof e == "string" ? this._defaultLoadMethod : e?.method || this._defaultLoadMethod;
|
|
4411
4472
|
this.currentScene && (this._lastScene = this.currentScene);
|
|
4412
4473
|
let i = this.list.find((e) => e.id === n);
|
|
4413
|
-
if (!i) throw
|
|
4474
|
+
if (!i) throw w({ message: `Scene item not found for id ${n}` }), Error(`Scene item not found for id ${n}`);
|
|
4414
4475
|
if (i?.plugins?.length) for (let e of i.plugins) {
|
|
4415
4476
|
let t = this.app.getUnloadedPlugin(e);
|
|
4416
4477
|
t && await this.app.loadPlugin(t);
|
|
4417
4478
|
}
|
|
4418
|
-
switch (this._currentSceneId = n, this._queue =
|
|
4479
|
+
switch (this._currentSceneId = n, this._queue = we(this._createCurrentScene), r) {
|
|
4419
4480
|
case "exitEnter":
|
|
4420
4481
|
this._queue.add(this._exitLastScene, this._destroyLastScene, this._unloadLastScene, this._loadCurrentScene, this._initializeCurrentScene, this._addCurrentScene, this._enterCurrentScene, this._startCurrentScene);
|
|
4421
4482
|
break;
|
|
@@ -4451,16 +4512,17 @@ var Sn = [
|
|
|
4451
4512
|
return ["loadScene"];
|
|
4452
4513
|
}
|
|
4453
4514
|
_listenForHashChange() {
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4515
|
+
this.listen(window, "hashchange", this._onHashChange);
|
|
4516
|
+
}
|
|
4517
|
+
_onHashChange() {
|
|
4518
|
+
let e = this.getSceneFromHash();
|
|
4519
|
+
e && this.loadScene(e);
|
|
4458
4520
|
}
|
|
4459
4521
|
async _createCurrentScene() {
|
|
4460
4522
|
let e = this.list.find((e) => e.id === this._currentSceneId), t;
|
|
4461
4523
|
if (this._sceneModules.has(this._currentSceneId)) t = this._sceneModules.get(this._currentSceneId);
|
|
4462
4524
|
else {
|
|
4463
|
-
let n = await
|
|
4525
|
+
let n = await T(e);
|
|
4464
4526
|
if (!n) throw Error(`Couldn't load ${this._currentSceneId}"`);
|
|
4465
4527
|
t = n[this._currentSceneId] ? n[this._currentSceneId] : n, t && this._sceneModules.set(this._currentSceneId, t);
|
|
4466
4528
|
}
|
|
@@ -4519,7 +4581,7 @@ var Sn = [
|
|
|
4519
4581
|
_createDebugMenu() {
|
|
4520
4582
|
this._debugMenu = document.createElement("div"), this._debugMenu.id = "scene-debug", this._debugMenu.style.cssText = "position: absolute; bottom: 0; left:0; width:48px; height:48px; z-index: 1000; background-color:rgba(0,0,0,0.8); color:white; border-top-right-radius:8px;";
|
|
4521
4583
|
let e = document.createElement("i");
|
|
4522
|
-
e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), ($.containerElement || document.body).appendChild(this._debugMenu), this._sceneSelect = document.createElement("select"), this._sceneSelect.style.cssText = "padding:0; border-radius:5px; opacity:0; width:48px; height:48px; cursor:pointer", this._sceneSelect.value = this.defaultScene || "";
|
|
4584
|
+
e.style.cssText = "cursor:pointer; position:absolute;width:100%; font-style:normal; font-size:20px; top:50%; left:50%; transform:translate(-50%, -50%); text-align:center; pointer-events:none", e.innerHTML = "🎬", this._debugMenu.appendChild(e), ($.containerElement || document.body).appendChild(this._debugMenu), this.addDisposer(() => this._debugMenu?.parentElement?.removeChild(this._debugMenu)), this._sceneSelect = document.createElement("select"), this._sceneSelect.style.cssText = "padding:0; border-radius:5px; opacity:0; width:48px; height:48px; cursor:pointer", this._sceneSelect.value = this.defaultScene || "";
|
|
4523
4585
|
let t = document.createElement("option");
|
|
4524
4586
|
t.value = "", t.innerHTML = "Select a scene", t.setAttribute("disabled", "disabled"), this._sceneSelect.appendChild(t);
|
|
4525
4587
|
let n = /* @__PURE__ */ new Map(), r = [];
|
|
@@ -4542,14 +4604,14 @@ var Sn = [
|
|
|
4542
4604
|
t.value = e.id, t.innerHTML = e?.debugLabel || e.id, e.id === this.defaultScene && (t.selected = !0), e.debugGroup ? n.get(e.debugGroup)?.appendChild(t) : this._sceneSelect.appendChild(t);
|
|
4543
4605
|
}), r.sort((e, t) => this.groupOrder.indexOf(e.label) - this.groupOrder.indexOf(t.label)), r.forEach((e) => {
|
|
4544
4606
|
this._sceneSelect.appendChild(e);
|
|
4545
|
-
}), this._debugMenu.appendChild(this._sceneSelect), this._debugMenu
|
|
4607
|
+
}), this._debugMenu.appendChild(this._sceneSelect), this.listen(this._debugMenu, "change", (e) => {
|
|
4546
4608
|
if (this._queue) {
|
|
4547
4609
|
e.preventDefault();
|
|
4548
4610
|
return;
|
|
4549
4611
|
}
|
|
4550
4612
|
let t = e.target.value;
|
|
4551
4613
|
t && (window.location.hash = t.toLowerCase());
|
|
4552
|
-
}), this.onSceneChangeStart.connect(this._disableDebugMenu), this.onSceneChangeComplete.connect(this._enableDebugMenu);
|
|
4614
|
+
}), this.addSignalConnection(this.onSceneChangeStart.connect(this._disableDebugMenu), this.onSceneChangeComplete.connect(this._enableDebugMenu));
|
|
4553
4615
|
}
|
|
4554
4616
|
_enableDebugMenu() {
|
|
4555
4617
|
this._debugMenu?.querySelector("select")?.removeAttribute("disabled");
|
|
@@ -4560,7 +4622,7 @@ var Sn = [
|
|
|
4560
4622
|
};
|
|
4561
4623
|
//#endregion
|
|
4562
4624
|
//#region src/plugins/TimerPlugin.ts
|
|
4563
|
-
function
|
|
4625
|
+
function In() {
|
|
4564
4626
|
try {
|
|
4565
4627
|
let e = new Blob(["\n const timers = new Map();\n\n self.onmessage = (e) => {\n const { type, timerId, options, timeAdjustment } = e.data;\n \n switch (type) {\n case 'start': {\n let timer = timers.get(timerId);\n \n if (timer) {\n // Resume existing timer\n timer.startTime = performance.now() - (timer.pausedTime || 0);\n timer.interval = createInterval(timer, options, timerId);\n } else {\n // Create new timer\n timer = {\n startTime: performance.now(),\n duration: options.duration,\n loopCount: 0,\n pausedTime: 0,\n options // Store options with the timer\n };\n timer.interval = createInterval(timer, options, timerId);\n timers.set(timerId, timer);\n }\n break;\n }\n \n case 'stop': {\n const timer = timers.get(timerId);\n if (timer) {\n clearInterval(timer.interval);\n timer.interval = null;\n timer.pausedTime = performance.now() - timer.startTime;\n }\n break;\n }\n\n case 'reset': {\n const timer = timers.get(timerId);\n if (timer) {\n timer.startTime = performance.now();\n timer.loopCount = 0;\n timer.pausedTime = 0;\n }\n break;\n }\n\n case 'adjustTime': {\n const timer = timers.get(timerId);\n if (timer) {\n if (timer.duration !== undefined) {\n // For countdown timers, adjust the duration\n timer.duration = Math.max(0, timer.duration + timeAdjustment);\n } else {\n // For count-up timers, adjust the start time\n timer.startTime -= timeAdjustment;\n }\n }\n break;\n }\n }\n };\n\n function createInterval(timer, options, timerId) {\n return setInterval(() => {\n const currentTime = performance.now();\n const totalElapsed = currentTime - timer.startTime;\n \n if (timer.duration !== undefined) {\n // Calculate elapsed time within the current loop\n const loopElapsed = totalElapsed - (timer.loopCount * timer.duration);\n const remaining = Math.max(0, timer.duration - loopElapsed);\n \n self.postMessage({ type: 'tick', timerId, time: remaining });\n \n if (remaining <= 0) {\n self.postMessage({ type: 'complete', timerId, time: 0 });\n \n if (options.loop) {\n timer.loopCount++;\n } else {\n clearInterval(timer.interval);\n timers.delete(timerId);\n }\n }\n } else {\n self.postMessage({ type: 'tick', timerId, time: totalElapsed });\n }\n }, options.workerInterval || 16);\n }\n "], { type: "application/javascript" });
|
|
4566
4628
|
return new Worker(URL.createObjectURL(e));
|
|
@@ -4568,7 +4630,7 @@ function kn() {
|
|
|
4568
4630
|
return null;
|
|
4569
4631
|
}
|
|
4570
4632
|
}
|
|
4571
|
-
function
|
|
4633
|
+
function Ln(e, t = "mm:ss", n = "string") {
|
|
4572
4634
|
let r = Math.floor(e / 1e3), i = Math.floor(r / 3600), a = Math.floor(r % 3600 / 60), o = r % 60, s = Math.floor(e % 1e3 / 10);
|
|
4573
4635
|
if (n === "string") switch (t) {
|
|
4574
4636
|
case "hh:mm:ss": return `${i.toString().padStart(2, "0")}:${a.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}`;
|
|
@@ -4583,9 +4645,9 @@ function An(e, t = "mm:ss", n = "string") {
|
|
|
4583
4645
|
ms: s
|
|
4584
4646
|
};
|
|
4585
4647
|
}
|
|
4586
|
-
var
|
|
4648
|
+
var Rn = class {
|
|
4587
4649
|
constructor(e = {}, t) {
|
|
4588
|
-
this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (
|
|
4650
|
+
this.options = e, this.plugin = t, this.startTime = performance.now(), this.pausedTime = 0, this.isPaused = !0, this.isDestroyed = !1, this.timerId = ue(), e.useWorker && !t.hasWorkerSupport && (x.warn("Web Worker support not available, falling back to main thread timer"), e.useWorker = !1), this.isWorkerTimer = !!e.useWorker, e.autoStart && this.start();
|
|
4589
4651
|
}
|
|
4590
4652
|
start() {
|
|
4591
4653
|
this.isPaused && (this.isPaused = !1, this.isWorkerTimer ? this.plugin.startWorkerTimer(this.timerId, this.options) : this.startTime = performance.now() - this.pausedTime);
|
|
@@ -4631,12 +4693,12 @@ var jn = class {
|
|
|
4631
4693
|
removeTime(e) {
|
|
4632
4694
|
return this.addTime(-e);
|
|
4633
4695
|
}
|
|
4634
|
-
},
|
|
4696
|
+
}, zn = class extends N {
|
|
4635
4697
|
get hasWorkerSupport() {
|
|
4636
4698
|
return this._hasWorkerSupport;
|
|
4637
4699
|
}
|
|
4638
4700
|
constructor() {
|
|
4639
|
-
super("timers"), this.mainThreadTimers = /* @__PURE__ */ new Set(), this.workerTimers = /* @__PURE__ */ new Set(), this.isPageVisible = !0, this.worker = null, this.timerCallbacks = /* @__PURE__ */ new Map(), this._hasWorkerSupport = !1, this.onTimerCreated = new
|
|
4701
|
+
super("timers"), this.mainThreadTimers = /* @__PURE__ */ new Set(), this.workerTimers = /* @__PURE__ */ new Set(), this.isPageVisible = !0, this.worker = null, this.timerCallbacks = /* @__PURE__ */ new Map(), this._hasWorkerSupport = !1, this.onTimerCreated = new j(), this.onTimerDestroyed = new j(), this.onAllTimersPaused = new j(), this.onAllTimersResumed = new j(), this.handleWorkerMessage = (e) => {
|
|
4640
4702
|
let { type: t, timerId: n, time: r, timeAdjustment: i } = e.data, a = this.timerCallbacks.get(n);
|
|
4641
4703
|
if (a) switch (t) {
|
|
4642
4704
|
case "tick":
|
|
@@ -4670,10 +4732,10 @@ var jn = class {
|
|
|
4670
4732
|
];
|
|
4671
4733
|
}
|
|
4672
4734
|
postInitialize() {
|
|
4673
|
-
this.
|
|
4735
|
+
this.addTickerCallback(this.update), this.initWorker();
|
|
4674
4736
|
}
|
|
4675
4737
|
initWorker() {
|
|
4676
|
-
typeof Worker < "u" ? (this.worker =
|
|
4738
|
+
typeof Worker < "u" ? (this.worker = In(), this.worker ? (this._hasWorkerSupport = !0, this.worker.onmessage = this.handleWorkerMessage) : (x.warn("Failed to create Web Worker for TimerPlugin, all timers will run on main thread"), this._hasWorkerSupport = !1)) : (x.warn("Web Workers not supported in this environment, all timers will run on main thread"), this._hasWorkerSupport = !1);
|
|
4677
4739
|
}
|
|
4678
4740
|
startWorkerTimer(e, t) {
|
|
4679
4741
|
this.worker && (this.timerCallbacks.set(e, t), this.worker.postMessage({
|
|
@@ -4699,13 +4761,13 @@ var jn = class {
|
|
|
4699
4761
|
});
|
|
4700
4762
|
}
|
|
4701
4763
|
destroy() {
|
|
4702
|
-
this.
|
|
4764
|
+
this.worker?.terminate(), this.worker = null, this.timerCallbacks.clear(), this.mainThreadTimers.clear(), this.workerTimers.clear(), super.destroy();
|
|
4703
4765
|
}
|
|
4704
4766
|
update() {
|
|
4705
4767
|
for (let e of this.mainThreadTimers) e.update();
|
|
4706
4768
|
}
|
|
4707
4769
|
createTimer(e) {
|
|
4708
|
-
let t = new
|
|
4770
|
+
let t = new Rn(e, this);
|
|
4709
4771
|
return t.isWorker() ? this.workerTimers.add(t) : this.mainThreadTimers.add(t), this.onTimerCreated.emit(t), t;
|
|
4710
4772
|
}
|
|
4711
4773
|
destroyTimer(e) {
|
|
@@ -4730,20 +4792,17 @@ var jn = class {
|
|
|
4730
4792
|
timeAdjustment: t
|
|
4731
4793
|
});
|
|
4732
4794
|
}
|
|
4733
|
-
},
|
|
4795
|
+
}, Bn = class extends N {
|
|
4734
4796
|
constructor() {
|
|
4735
|
-
super(), this.id = "webEvents", this.onResize = new
|
|
4797
|
+
super(), this.id = "webEvents", this.onResize = new j(), this.onVisibilityChanged = new j(), this.onOrientationChanged = new j(), this._debouncedEmitVisibility = Pe((e) => {
|
|
4736
4798
|
this.onVisibilityChanged.emit(e);
|
|
4737
|
-
}, 1),
|
|
4799
|
+
}, 1), _(this);
|
|
4738
4800
|
}
|
|
4739
4801
|
get app() {
|
|
4740
4802
|
return $.getInstance();
|
|
4741
4803
|
}
|
|
4742
4804
|
initialize() {
|
|
4743
|
-
|
|
4744
|
-
}
|
|
4745
|
-
destroy() {
|
|
4746
|
-
document.removeEventListener("visibilitychange", this._onVisibilityChanged, !1), window.removeEventListener("resize", this._onResize), document.removeEventListener("fullscreenchange", this._onResize), window.removeEventListener("pagehide", this._onPageHide, !1), window.removeEventListener("pageshow", this._onPageShow, !1), window.visualViewport?.removeEventListener("resize", this._onVisualViewportResize);
|
|
4805
|
+
this.listen(document, "visibilitychange", this._onVisibilityChanged, !1), this.listen(window, "pagehide", this._onPageHide, !1), this.listen(window, "pageshow", this._onPageShow, !1), this.listen(window, "resize", this._onResize), this.listen(document, "fullscreenchange", this._onResize), this.listen(window, "orientationchange", this._onOrientationChanged), window.visualViewport && this.listen(window.visualViewport, "resize", this._onVisualViewportResize);
|
|
4747
4806
|
}
|
|
4748
4807
|
getCoreSignals() {
|
|
4749
4808
|
return ["onVisibilityChanged", "onOrientationChanged"];
|
|
@@ -4786,11 +4845,11 @@ var jn = class {
|
|
|
4786
4845
|
});
|
|
4787
4846
|
}, 10);
|
|
4788
4847
|
}
|
|
4789
|
-
},
|
|
4848
|
+
}, Vn = class extends N {
|
|
4790
4849
|
constructor(...e) {
|
|
4791
4850
|
super(...e), this.name = "lookup", this.pathToContainer = /* @__PURE__ */ new Map(), this.containerToPath = /* @__PURE__ */ new Map();
|
|
4792
4851
|
}
|
|
4793
|
-
|
|
4852
|
+
getCoreFunctions() {
|
|
4794
4853
|
return [
|
|
4795
4854
|
"getChildAtPath",
|
|
4796
4855
|
"getPathForChild",
|
|
@@ -4800,7 +4859,10 @@ var jn = class {
|
|
|
4800
4859
|
];
|
|
4801
4860
|
}
|
|
4802
4861
|
async initialize() {
|
|
4803
|
-
Q.onGlobalChildAdded.connect(this.onChildAdded), Q.onGlobalChildRemoved.connect(this.onChildRemoved);
|
|
4862
|
+
this.addSignalConnection(Q.onGlobalChildAdded.connect(this.onChildAdded), Q.onGlobalChildRemoved.connect(this.onChildRemoved));
|
|
4863
|
+
}
|
|
4864
|
+
destroy() {
|
|
4865
|
+
this.pathToContainer.clear(), this.containerToPath.clear(), super.destroy();
|
|
4804
4866
|
}
|
|
4805
4867
|
getChildAtPath(e) {
|
|
4806
4868
|
return this.pathToContainer.get(e);
|
|
@@ -4840,94 +4902,94 @@ var jn = class {
|
|
|
4840
4902
|
for (; n && n.label && (t.unshift(n.label), n = n.parent, n?.label !== "Stage"););
|
|
4841
4903
|
return t.length > 0 ? t.join("/") : "";
|
|
4842
4904
|
}
|
|
4843
|
-
},
|
|
4905
|
+
}, Hn = [
|
|
4844
4906
|
{
|
|
4845
4907
|
id: "lookup",
|
|
4846
|
-
module:
|
|
4908
|
+
module: Vn,
|
|
4847
4909
|
namedExport: "LookupPlugin"
|
|
4848
4910
|
},
|
|
4849
4911
|
{
|
|
4850
4912
|
id: "webEvents",
|
|
4851
|
-
module:
|
|
4913
|
+
module: Bn,
|
|
4852
4914
|
namedExport: "WebEventsPlugin"
|
|
4853
4915
|
},
|
|
4854
4916
|
{
|
|
4855
4917
|
id: "fullscreen",
|
|
4856
|
-
module:
|
|
4918
|
+
module: pt,
|
|
4857
4919
|
namedExport: "FullScreenPlugin"
|
|
4858
4920
|
},
|
|
4859
4921
|
{
|
|
4860
4922
|
id: "resizer",
|
|
4861
|
-
module:
|
|
4923
|
+
module: Nn,
|
|
4862
4924
|
namedExport: "ResizerPlugin"
|
|
4863
4925
|
},
|
|
4864
4926
|
{
|
|
4865
4927
|
id: "breakpoints",
|
|
4866
|
-
module:
|
|
4928
|
+
module: At,
|
|
4867
4929
|
namedExport: "BreakpointPlugin"
|
|
4868
4930
|
},
|
|
4869
4931
|
{
|
|
4870
4932
|
id: "assets",
|
|
4871
|
-
module:
|
|
4933
|
+
module: ft,
|
|
4872
4934
|
namedExport: "AssetsPlugin"
|
|
4873
4935
|
},
|
|
4874
4936
|
{
|
|
4875
4937
|
id: "scenes",
|
|
4876
|
-
module:
|
|
4938
|
+
module: Fn,
|
|
4877
4939
|
namedExport: "SceneManagerPlugin"
|
|
4878
4940
|
},
|
|
4879
4941
|
{
|
|
4880
4942
|
id: "actions",
|
|
4881
|
-
module:
|
|
4943
|
+
module: ht,
|
|
4882
4944
|
namedExport: "ActionsPlugin"
|
|
4883
4945
|
},
|
|
4884
4946
|
{
|
|
4885
4947
|
id: "input",
|
|
4886
|
-
module:
|
|
4948
|
+
module: Tn,
|
|
4887
4949
|
namedExport: "InputPlugin"
|
|
4888
4950
|
},
|
|
4889
4951
|
{
|
|
4890
4952
|
id: "gesture",
|
|
4891
|
-
module:
|
|
4953
|
+
module: cn,
|
|
4892
4954
|
namedExport: "GesturePlugin"
|
|
4893
4955
|
},
|
|
4894
4956
|
{
|
|
4895
4957
|
id: "keyboard",
|
|
4896
|
-
module:
|
|
4958
|
+
module: mt,
|
|
4897
4959
|
namedExport: "KeyboardPlugin"
|
|
4898
4960
|
},
|
|
4899
4961
|
{
|
|
4900
4962
|
id: "focus",
|
|
4901
|
-
module:
|
|
4963
|
+
module: nn,
|
|
4902
4964
|
namedExport: "FocusManagerPlugin"
|
|
4903
4965
|
},
|
|
4904
4966
|
{
|
|
4905
4967
|
id: "popups",
|
|
4906
|
-
module:
|
|
4968
|
+
module: jn,
|
|
4907
4969
|
namedExport: "PopupManagerPlugin"
|
|
4908
4970
|
},
|
|
4909
4971
|
{
|
|
4910
4972
|
id: "audio",
|
|
4911
|
-
module:
|
|
4973
|
+
module: $t,
|
|
4912
4974
|
namedExport: "AudioManagerPlugin"
|
|
4913
4975
|
},
|
|
4914
4976
|
{
|
|
4915
4977
|
id: "i18n",
|
|
4916
|
-
module:
|
|
4978
|
+
module: dn,
|
|
4917
4979
|
namedExport: "i18nPlugin"
|
|
4918
4980
|
},
|
|
4919
4981
|
{
|
|
4920
4982
|
id: "timers",
|
|
4921
|
-
module:
|
|
4983
|
+
module: zn,
|
|
4922
4984
|
namedExport: "TimerPlugin"
|
|
4923
4985
|
}
|
|
4924
4986
|
];
|
|
4925
4987
|
//#endregion
|
|
4926
4988
|
//#region src/core/Application.ts
|
|
4927
|
-
function
|
|
4989
|
+
function Un() {
|
|
4928
4990
|
return typeof window < "u" ? window.devicePixelRatio > 1 ? 2 : 1 : 2;
|
|
4929
4991
|
}
|
|
4930
|
-
var
|
|
4992
|
+
var Wn = {
|
|
4931
4993
|
antialias: !1,
|
|
4932
4994
|
autoStart: !0,
|
|
4933
4995
|
resizeToContainer: !0,
|
|
@@ -4965,7 +5027,7 @@ var Ln = {
|
|
|
4965
5027
|
wordWrap: !1,
|
|
4966
5028
|
wordWrapWidth: 100
|
|
4967
5029
|
},
|
|
4968
|
-
resolution:
|
|
5030
|
+
resolution: Un(),
|
|
4969
5031
|
useHash: v,
|
|
4970
5032
|
showSceneDebugMenu: v,
|
|
4971
5033
|
showStats: v,
|
|
@@ -4977,7 +5039,12 @@ var Ln = {
|
|
|
4977
5039
|
scenes: [],
|
|
4978
5040
|
defaultSceneLoadMethod: "immediate",
|
|
4979
5041
|
assets: { manifest: "./assets.json" }
|
|
4980
|
-
},
|
|
5042
|
+
}, Gn = {
|
|
5043
|
+
pauseAudio: !0,
|
|
5044
|
+
pauseAnimations: !0,
|
|
5045
|
+
pauseTicker: !0,
|
|
5046
|
+
pauseTimers: !0
|
|
5047
|
+
}, Kn = {
|
|
4981
5048
|
pauseAudio: !1,
|
|
4982
5049
|
pauseAnimations: !1,
|
|
4983
5050
|
pauseTicker: !1,
|
|
@@ -4987,7 +5054,7 @@ var Ln = {
|
|
|
4987
5054
|
this.__caper_method_binding_root = !0;
|
|
4988
5055
|
}
|
|
4989
5056
|
get make() {
|
|
4990
|
-
return this._makeFactory ||=
|
|
5057
|
+
return this._makeFactory ||= M($e(), this, !1), this._makeFactory;
|
|
4991
5058
|
}
|
|
4992
5059
|
get env() {
|
|
4993
5060
|
return this._env;
|
|
@@ -5003,9 +5070,9 @@ var Ln = {
|
|
|
5003
5070
|
}
|
|
5004
5071
|
pause(e) {
|
|
5005
5072
|
this._paused = !0, this._pauseConfig = {
|
|
5006
|
-
...
|
|
5073
|
+
...e ? Kn : Gn,
|
|
5007
5074
|
...e
|
|
5008
|
-
},
|
|
5075
|
+
}, this._pauseConfig.pauseAudio && this.audio.pause(), this._pauseConfig.pauseAnimations && p?.globalTimeline?.pause(), this._pauseConfig.pauseTicker && this.ticker.stop(), this._pauseConfig.pauseTimers && this.timers.pauseAllTimers(), this._pauseConfig.pauseOther && this._pauseConfig.pauseOther.forEach((e) => {
|
|
5009
5076
|
typeof e?.pause == "function" && e.pause();
|
|
5010
5077
|
}), this.onPause.emit(this._pauseConfig);
|
|
5011
5078
|
}
|
|
@@ -5018,13 +5085,13 @@ var Ln = {
|
|
|
5018
5085
|
this._paused = !this._paused, this._paused ? this.pause(e) : this.resume();
|
|
5019
5086
|
}
|
|
5020
5087
|
constructor() {
|
|
5021
|
-
super(), this.onPause = new
|
|
5088
|
+
super(), this.onPause = new j(), this.onResume = new j(), this.onResize = new j(), this.onPluginError = new j(), this.onPwaInstallAvailable = new j(), this.onPwaUpdateAvailable = new j(), this._plugins = /* @__PURE__ */ new Map(), this._env = {
|
|
5022
5089
|
BASE_URL: "/",
|
|
5023
5090
|
DEV: !1,
|
|
5024
5091
|
MODE: "production",
|
|
5025
5092
|
PROD: !0,
|
|
5026
5093
|
SSR: !1
|
|
5027
|
-
}, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0),
|
|
5094
|
+
}, this._isFullScreen = !1, this._fullScreenElement = null, this._paused = !1, this._pauseConfig = {}, this._center = new c(0, 0), _(this);
|
|
5028
5095
|
}
|
|
5029
5096
|
get appVersion() {
|
|
5030
5097
|
try {
|
|
@@ -5170,53 +5237,54 @@ var Ln = {
|
|
|
5170
5237
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
5171
5238
|
}
|
|
5172
5239
|
get signal() {
|
|
5173
|
-
return
|
|
5240
|
+
return qn;
|
|
5174
5241
|
}
|
|
5175
5242
|
get signals() {
|
|
5176
5243
|
return this.signal;
|
|
5177
5244
|
}
|
|
5178
5245
|
get func() {
|
|
5179
|
-
return
|
|
5246
|
+
return Jn;
|
|
5180
5247
|
}
|
|
5181
5248
|
get exec() {
|
|
5182
5249
|
return this.func;
|
|
5183
5250
|
}
|
|
5184
5251
|
get views() {
|
|
5185
|
-
|
|
5252
|
+
let e = [this.scenes.view, this.popups.view];
|
|
5253
|
+
return this.scenes.splash.view && e.push(this.scenes.splash.view), this.scenes.transition && e.push(this.scenes.transition), this.captions?.view && e.push(this.captions.view), e;
|
|
5186
5254
|
}
|
|
5187
5255
|
static getInstance() {
|
|
5188
|
-
return r.instance ||
|
|
5256
|
+
return r.instance || x.warn("Application not created yet"), r.instance;
|
|
5189
5257
|
}
|
|
5190
5258
|
destroy(e, t) {
|
|
5191
5259
|
this._plugins.forEach((e) => {
|
|
5192
5260
|
e.destroy();
|
|
5193
|
-
}), this.store
|
|
5261
|
+
}), this.store?.destroy(), super.destroy(e, t);
|
|
5194
5262
|
}
|
|
5195
5263
|
setContainer(e) {
|
|
5196
5264
|
r.containerElement = e;
|
|
5197
5265
|
}
|
|
5198
5266
|
async initialize(e, t) {
|
|
5199
5267
|
if (r.instance) throw Error("Application is already initialized");
|
|
5200
|
-
if (r.instance = this, this.config =
|
|
5268
|
+
if (r.instance = this, this.config = E(Wn, e), this.signals.onResize = this.onResize, e.container && (r.containerElement = e.container), x.initialize(this.config.logger), this.config.resolution !== 1 && this.config.resolution !== 2) {
|
|
5201
5269
|
let e = this.config.resolution;
|
|
5202
|
-
this.config.resolution =
|
|
5270
|
+
this.config.resolution = Un(), x.warn(`App resolution must be 1 or 2, setting to ${this.config.resolution} instead of ${e}. Modify your app config to set the resolution to 1 or 2.`);
|
|
5203
5271
|
}
|
|
5204
5272
|
if (await this.boot(this.config), await this.initAssets(), await this.init(this.config), this.stage.label = "Stage", this.config.defaultTextStyle && (l.defaultTextStyle = {
|
|
5205
|
-
...
|
|
5273
|
+
...Wn.defaultTextStyle,
|
|
5206
5274
|
...this.config.defaultTextStyle
|
|
5207
5275
|
}), this.config.defaultDropShadow && (l.defaultDropShadow = this.config.defaultDropShadow), t) t.appendChild(this.canvas), this.setContainer(t);
|
|
5208
5276
|
else throw Error("No element found to append the view to.");
|
|
5209
|
-
return await this.registerDefaultPlugins(), v && this.getPlugin("DevToolsPlugin").initializeDevTools(this), this.signals.onLoadRequiredComplete.connectOnce(this.requiredAssetsLoaded), await this._setup(), this.plugins = await Je(this.config.plugins || []), await this.registerPlugins(), await this.setup(), await this.loadDefaultScene(), this.renderer.canvas.focus(), this.config.container && this.config.container.classList.add("loaded"),
|
|
5277
|
+
return await this.registerDefaultPlugins(), v && this.getPlugin("DevToolsPlugin").initializeDevTools(this), this.signals.onLoadRequiredComplete.connectOnce(this.requiredAssetsLoaded), await this._setup(), this.plugins = await Je(this.config.plugins || []), await this.registerPlugins(), await this.setup(), await this.loadDefaultScene(), this.renderer.canvas.focus(), this.config.container && this.config.container.classList.add("loaded"), r.instance;
|
|
5210
5278
|
}
|
|
5211
5279
|
getPlugin(e, t = !1) {
|
|
5212
5280
|
let n = this._plugins.get(e);
|
|
5213
|
-
return !n && t &&
|
|
5281
|
+
return !n && t && x.warn(`Plugin with name "${e}" not found.`), n;
|
|
5214
5282
|
}
|
|
5215
5283
|
async _postInitialize() {
|
|
5216
5284
|
for (let e of this._plugins.values()) try {
|
|
5217
5285
|
await e.postInitialize(this);
|
|
5218
5286
|
} catch (t) {
|
|
5219
|
-
|
|
5287
|
+
w({
|
|
5220
5288
|
message: `Plugin "${e.id}" failed in postInitialize: ${t instanceof Error ? t.message : String(t)}`,
|
|
5221
5289
|
stack: t instanceof Error ? t.stack : void 0
|
|
5222
5290
|
}), this.onPluginError.emit({
|
|
@@ -5247,7 +5315,7 @@ var Ln = {
|
|
|
5247
5315
|
}
|
|
5248
5316
|
async loadPlugin(e, t = !1) {
|
|
5249
5317
|
if (this._plugins.has(e.id)) return await this.registerPlugin(this._plugins.get(e.id), e.options);
|
|
5250
|
-
let n = new (await (
|
|
5318
|
+
let n = new (await (T(e)))(e.id);
|
|
5251
5319
|
n.id !== e.id && (n.id = e.id);
|
|
5252
5320
|
let r = e.options;
|
|
5253
5321
|
return t && !r && (r = this.config[n.id]), await this.registerPlugin(n, r);
|
|
@@ -5262,14 +5330,14 @@ var Ln = {
|
|
|
5262
5330
|
this.sendAction(e, t);
|
|
5263
5331
|
}
|
|
5264
5332
|
isActionActive(e) {
|
|
5265
|
-
return this.
|
|
5333
|
+
return this.input.isActionActive(e);
|
|
5266
5334
|
}
|
|
5267
5335
|
get data() {
|
|
5268
5336
|
return this.getPlugin("data");
|
|
5269
5337
|
}
|
|
5270
5338
|
async boot(e) {
|
|
5271
5339
|
this.config = {
|
|
5272
|
-
...
|
|
5340
|
+
...Wn,
|
|
5273
5341
|
...e
|
|
5274
5342
|
}, await this.preInitialize(this.config);
|
|
5275
5343
|
}
|
|
@@ -5277,34 +5345,34 @@ var Ln = {
|
|
|
5277
5345
|
let { id: t } = e;
|
|
5278
5346
|
this._appName = t, v && await this.loadPlugin({
|
|
5279
5347
|
id: "DevToolsPlugin",
|
|
5280
|
-
module: () => import("./DevToolsPlugin-
|
|
5348
|
+
module: () => import("./DevToolsPlugin-B8GX3H9b.js"),
|
|
5281
5349
|
namedExport: "DevToolsPlugin"
|
|
5282
5350
|
}), e.useLayout && await this.loadPlugin({
|
|
5283
5351
|
id: "LayoutPlugin",
|
|
5284
|
-
module: () => import("./LayoutPlugin-
|
|
5352
|
+
module: () => import("./LayoutPlugin-BX3OP7pw.js"),
|
|
5285
5353
|
namedExport: "LayoutPlugin"
|
|
5286
5354
|
}), await this.loadPlugin({
|
|
5287
5355
|
id: "GSAPPlugin",
|
|
5288
|
-
module: () => import("./GSAPPlugin-
|
|
5356
|
+
module: () => import("./GSAPPlugin-Br9AjuTD.js"),
|
|
5289
5357
|
namedExport: "GSAPPlugin"
|
|
5290
5358
|
}), e.useSpine && await this.loadPlugin({
|
|
5291
5359
|
id: "SpinePlugin",
|
|
5292
|
-
module: () => import("./SpinePlugin-
|
|
5360
|
+
module: () => import("./SpinePlugin-C-JDdXpf.js"),
|
|
5293
5361
|
namedExport: "SpinePlugin"
|
|
5294
|
-
}), this.config.useStore && (this._store = new
|
|
5362
|
+
}), this.config.useStore && (this._store = new lt(), this._store.initialize(this), await this.loadPlugin({
|
|
5295
5363
|
id: "data",
|
|
5296
|
-
module: () => import("./DataAdapter-
|
|
5364
|
+
module: () => import("./DataAdapter-D2tc6hx9.js").then((e) => e.n),
|
|
5297
5365
|
namedExport: "DataAdapter",
|
|
5298
5366
|
options: this.config.data
|
|
5299
5367
|
}));
|
|
5300
5368
|
}
|
|
5301
5369
|
async registerPlugin(e, t) {
|
|
5302
|
-
if (this._plugins.has(e.id)) return
|
|
5370
|
+
if (this._plugins.has(e.id)) return x.warn(`Plugin with id "${e.id}" already registered. Not registering.`), e.initialize(t, this);
|
|
5303
5371
|
e.registerCoreFunctions(), e.registerCoreSignals(), this._plugins.set(e.id, e);
|
|
5304
5372
|
try {
|
|
5305
5373
|
return await e.initialize(t, this);
|
|
5306
5374
|
} catch (t) {
|
|
5307
|
-
|
|
5375
|
+
w({
|
|
5308
5376
|
message: `Plugin "${e.id}" failed to initialize: ${t instanceof Error ? t.message : String(t)}`,
|
|
5309
5377
|
stack: t instanceof Error ? t.stack : void 0
|
|
5310
5378
|
}), this.onPluginError.emit({
|
|
@@ -5316,36 +5384,36 @@ var Ln = {
|
|
|
5316
5384
|
}
|
|
5317
5385
|
}
|
|
5318
5386
|
async registerDefaultPlugins() {
|
|
5319
|
-
for (let e = 0; e <
|
|
5320
|
-
let t =
|
|
5387
|
+
for (let e = 0; e < Hn.length; e++) {
|
|
5388
|
+
let t = Hn[e];
|
|
5321
5389
|
await this.loadPlugin(t, !0);
|
|
5322
5390
|
}
|
|
5323
5391
|
(this.config.showStats === !0 || v && this.config.showStats !== !1) && await this.loadPlugin({
|
|
5324
5392
|
id: "stats",
|
|
5325
|
-
module: () => import("./StatsPlugin-
|
|
5393
|
+
module: () => import("./StatsPlugin-yJlJtoQ2.js"),
|
|
5326
5394
|
namedExport: "StatsPlugin"
|
|
5327
5395
|
}), this.config.useVoiceover && (await this.loadPlugin({
|
|
5328
5396
|
id: "voiceover",
|
|
5329
|
-
module: () => import("./VoiceOverPlugin-
|
|
5397
|
+
module: () => import("./VoiceOverPlugin-DjSZp4Ko.js"),
|
|
5330
5398
|
namedExport: "VoiceOverPlugin",
|
|
5331
5399
|
options: this.config.voiceover || void 0
|
|
5332
5400
|
}), await this.loadPlugin({
|
|
5333
5401
|
id: "captions",
|
|
5334
|
-
module: () => import("./CaptionsPlugin-
|
|
5402
|
+
module: () => import("./CaptionsPlugin-cSJj-R9M.js"),
|
|
5335
5403
|
namedExport: "CaptionsPlugin",
|
|
5336
5404
|
options: this.config.captions || void 0
|
|
5337
5405
|
}));
|
|
5338
5406
|
}
|
|
5339
5407
|
async registerPlugins() {
|
|
5340
5408
|
if (!this.plugins?.length) return;
|
|
5341
|
-
let e = Xe(this.plugins);
|
|
5409
|
+
let e = Xe(this.plugins, new Set(this._plugins.keys()));
|
|
5342
5410
|
for (let t of e) t.autoLoad && await this.loadPlugin(t);
|
|
5343
5411
|
}
|
|
5344
5412
|
async requiredAssetsLoaded() {}
|
|
5345
5413
|
async setup() {}
|
|
5346
5414
|
async initAssets() {
|
|
5347
5415
|
let e = this.config.assets?.initOptions || {}, n = this.config.assets?.manifest || e.manifest;
|
|
5348
|
-
|
|
5416
|
+
C(n) && (n = await n), e.manifest = n, e.basePath = e.basePath || "./assets", await t.init(e), this.manifest = t.resolver._manifest;
|
|
5349
5417
|
}
|
|
5350
5418
|
async loadDefaultScene() {
|
|
5351
5419
|
return this.scenes.loadDefaultScene();
|
|
@@ -5367,8 +5435,8 @@ var Ln = {
|
|
|
5367
5435
|
_addSplash() {
|
|
5368
5436
|
this.scenes.splash.view && (this.scenes.splash.view.label = "Splash", this.stage.addChild(this.scenes.splash.view));
|
|
5369
5437
|
}
|
|
5370
|
-
},
|
|
5438
|
+
}, qn = {}, Jn = {};
|
|
5371
5439
|
//#endregion
|
|
5372
|
-
export { Le as $,
|
|
5440
|
+
export { Le as $, At as A, ve as At, pt as B, pe as Bt, cn as C, Se as Ct, $t as D, x as Dt, en as E, S as Et, bt as F, _e as Ft, j as G, N as H, h as Ht, yt as I, me as It, Qe as J, A as K, ht as L, g as Lt, gt as M, ye as Mt, _t as N, _ as Nt, Mt as O, y as Ot, vt as P, he as Pt, qe as Q, mt as R, de as Rt, dn as S, we as St, nn as T, Ce as Tt, M as U, se as Ut, ft as V, ue as Vt, lt as W, le as Wt, Je as X, Ye as Y, Xe as Z, Cn as _, ke as _t, Bn as a, Ve as at, fn as b, T as bt, Ln as c, Be as ct, jn as d, Fe as dt, Re as et, Q as f, Pe as ft, Tn as g, Ae as gt, Dn as h, Me as ht, Vn as i, Ge as it, R as j, v as jt, jt as k, be as kt, Fn as l, E as lt, On as m, je as mt, qn as n, We as nt, Rn as o, Ke as ot, kn as p, Ne as pt, O as q, $ as r, He as rt, zn as s, ze as st, Jn as t, Ue as tt, Nn as u, Ie as ut, Sn as v, Oe as vt, on as w, C as wt, Z as x, Te as xt, xn as y, De as yt, F as z, fe as zt };
|
|
5373
5441
|
|
|
5374
|
-
//# sourceMappingURL=registries-
|
|
5442
|
+
//# sourceMappingURL=registries-BfV-VF7a.js.map
|