@caperjs/core 0.4.1 → 0.5.1
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/internal/manifest.mjs +2 -2
- package/build/internal/validate.mjs +2 -1
- package/build/plugins/assetTypes.mjs +27 -23
- package/build/plugins/caperConfig.mjs +5 -3
- package/build/plugins/lists.mjs +0 -15
- package/lib/{CaptionsPlugin-cSJj-R9M.js → CaptionsPlugin-CDbGZrN9.js} +11 -11
- package/lib/CaptionsPlugin-CDbGZrN9.js.map +1 -0
- package/lib/{DataAdapter-D2tc6hx9.js → DataAdapter-BTlNzWqg.js} +2 -2
- package/lib/{DataAdapter-D2tc6hx9.js.map → DataAdapter-BTlNzWqg.js.map} +1 -1
- package/lib/{DebugRenderer-CGUKy6Fy.js → DebugRenderer-eSVpon4c.js} +2 -2
- package/lib/{DebugRenderer-CGUKy6Fy.js.map → DebugRenderer-eSVpon4c.js.map} +1 -1
- package/lib/{DevToolsPlugin-B8GX3H9b.js → DevToolsPlugin-Ci6r9j-m.js} +2 -2
- package/lib/{DevToolsPlugin-B8GX3H9b.js.map → DevToolsPlugin-Ci6r9j-m.js.map} +1 -1
- package/lib/{GSAPPlugin-Br9AjuTD.js → GSAPPlugin-C8zo-fyt.js} +2 -2
- package/lib/{GSAPPlugin-Br9AjuTD.js.map → GSAPPlugin-C8zo-fyt.js.map} +1 -1
- package/lib/{LayoutPlugin-BX3OP7pw.js → LayoutPlugin-Cs2lcXKb.js} +4 -4
- package/lib/{LayoutPlugin-BX3OP7pw.js.map → LayoutPlugin-Cs2lcXKb.js.map} +1 -1
- package/lib/{SpinePlugin-C-JDdXpf.js → SpinePlugin-CLgSXBQm.js} +2 -2
- package/lib/{SpinePlugin-C-JDdXpf.js.map → SpinePlugin-CLgSXBQm.js.map} +1 -1
- package/lib/{StatsPlugin-yJlJtoQ2.js → StatsPlugin-D_90U3BG.js} +4 -4
- package/lib/{StatsPlugin-yJlJtoQ2.js.map → StatsPlugin-D_90U3BG.js.map} +1 -1
- package/lib/{VoiceOverPlugin-DjSZp4Ko.js → VoiceOverPlugin-CAE1dtOw.js} +33 -33
- package/lib/{VoiceOverPlugin-DjSZp4Ko.js.map → VoiceOverPlugin-CAE1dtOw.js.map} +1 -1
- package/lib/caper.mjs +87 -87
- package/lib/caper.mjs.map +1 -1
- package/lib/{const-C3sxeYhl.js → const-BTDpIdRO.js} +192 -199
- package/lib/const-BTDpIdRO.js.map +1 -0
- package/lib/display/Container.d.ts +1 -28
- package/lib/display/Container.d.ts.map +1 -1
- package/lib/display/ParticleContainer.d.ts +20 -29
- package/lib/display/ParticleContainer.d.ts.map +1 -1
- package/lib/display/ParticleContainer.test.d.ts +2 -0
- package/lib/display/ParticleContainer.test.d.ts.map +1 -0
- package/lib/display/SpineAnimation.d.ts +1 -2
- package/lib/display/SpineAnimation.d.ts.map +1 -1
- package/lib/display/SpineAnimation.test.d.ts +1 -0
- package/lib/display/SpineAnimation.test.d.ts.map +1 -0
- package/lib/mixins/factory/const.d.ts.map +1 -1
- package/lib/mixins/focus.d.ts.map +1 -1
- package/lib/mixins/index.d.ts +1 -0
- package/lib/mixins/index.d.ts.map +1 -1
- package/lib/mixins/lifecycle.d.ts +56 -0
- package/lib/mixins/lifecycle.d.ts.map +1 -0
- package/lib/plugins/FullScreenPlugin.d.ts.map +1 -1
- package/lib/plugins/KeyboardPlugin.d.ts.map +1 -1
- package/lib/plugins/Plugin.d.ts.map +1 -1
- package/lib/plugins/WebEventsPlugin.d.ts +1 -0
- package/lib/plugins/WebEventsPlugin.d.ts.map +1 -1
- package/lib/plugins/audio/AudioInstance.d.ts +3 -3
- package/lib/plugins/audio/AudioInstance.d.ts.map +1 -1
- package/lib/plugins/captions/CaptionsRenderer.d.ts.map +1 -1
- package/lib/plugins/focus/FocusManagerPlugin.d.ts.map +1 -1
- package/lib/{registries-BfV-VF7a.js → registries-nN_hU44y.js} +109 -77
- package/lib/registries-nN_hU44y.js.map +1 -0
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/core/Application.ts +2 -2
- package/src/display/Container.ts +5 -72
- package/src/display/ParticleContainer.test.ts +127 -0
- package/src/display/ParticleContainer.ts +28 -62
- package/src/display/SpineAnimation.test.ts +79 -0
- package/src/display/SpineAnimation.ts +4 -6
- package/src/mixins/factory/const.ts +2 -1
- package/src/mixins/focus.ts +0 -2
- package/src/mixins/index.ts +4 -0
- package/src/mixins/lifecycle.ts +160 -0
- package/src/plugins/DataAdapter.ts +1 -1
- package/src/plugins/FullScreenPlugin.test.ts +9 -0
- package/src/plugins/FullScreenPlugin.ts +0 -1
- package/src/plugins/KeyboardPlugin.ts +0 -1
- package/src/plugins/Plugin.ts +0 -2
- package/src/plugins/TimerPlugin.ts +1 -1
- package/src/plugins/WebEventsPlugin.test.ts +13 -0
- package/src/plugins/WebEventsPlugin.ts +12 -1
- package/src/plugins/audio/AudioInstance.ts +2 -2
- package/src/plugins/captions/CaptionsPlugin.test.ts +48 -3
- package/src/plugins/captions/CaptionsPlugin.ts +5 -5
- package/src/plugins/captions/CaptionsRenderer.ts +0 -1
- package/src/plugins/focus/FocusManagerPlugin.ts +0 -1
- package/src/ui/Input.ts +2 -2
- package/src/utils/types.ts +0 -1
- package/src/version.ts +1 -1
- package/lib/CaptionsPlugin-cSJj-R9M.js.map +0 -1
- package/lib/const-C3sxeYhl.js.map +0 -1
- package/lib/registries-BfV-VF7a.js.map +0 -1
package/lib/caper.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as
|
|
2
|
-
import { A as
|
|
3
|
-
import { n as
|
|
4
|
-
import { r as
|
|
5
|
-
import { CanvasTextMetrics as O, Container as
|
|
1
|
+
import { $ as e, A as t, At as n, B as r, Bt as i, C as a, Ct as o, D as s, Dt as c, E as l, Et as u, F as d, Ft as f, G as ee, H as te, Ht as ne, I as re, It as ie, J as ae, K as p, L as m, Lt as oe, M as se, Mt as ce, N as le, Nt as ue, O as de, Ot as h, P as g, Pt as _, Q as fe, R as pe, Rt as me, S as he, St as ge, T as _e, Tt as ve, U as ye, V as be, Vt as xe, W as Se, X as Ce, Y as we, Z as Te, _ as Ee, _t as De, a as Oe, at as ke, b as Ae, bt as je, c as Me, ct as Ne, d as Pe, dt as Fe, et as v, f as y, ft as Ie, g as Le, gt as Re, h as ze, ht as Be, i as Ve, it as He, j as Ue, jt as We, k as Ge, kt as Ke, l as qe, lt as Je, m as Ye, mt as Xe, n as Ze, nt as Qe, o as $e, ot as et, p as tt, pt as nt, q as b, r as x, rt, s as it, st as S, t as at, tt as ot, u as st, ut as ct, v as lt, vt as ut, w as dt, wt as ft, x as C, xt as pt, y as w, yt as mt, z as ht, zt as gt } from "./registries-nN_hU44y.js";
|
|
2
|
+
import { A as _t, C as vt, D as yt, E as bt, F as xt, I as St, L as Ct, M as wt, N as Tt, O as Et, P as Dt, S as Ot, T as kt, _ as T, a as At, b as jt, c as Mt, d as Nt, f as Pt, g as E, h as Ft, i as It, j as Lt, k as Rt, l as zt, m as Bt, n as Vt, o as Ht, p as Ut, r as Wt, s as Gt, u as Kt, v as qt, w as Jt, x as Yt, y as Xt } from "./const-BTDpIdRO.js";
|
|
3
|
+
import { n as Zt, t as D } from "./padding-1kHDpGlQ.js";
|
|
4
|
+
import { r as Qt, t as $t } from "./DataAdapter-BTlNzWqg.js";
|
|
5
|
+
import { CanvasTextMetrics as O, Container as en, Graphics as k, Point as A, Polygon as tn, Rectangle as nn, Sprite as rn, Texture as j, isMobile as M } from "pixi.js";
|
|
6
6
|
import { gsap as N } from "gsap";
|
|
7
7
|
//#region src/utils/array.ts
|
|
8
|
-
function
|
|
8
|
+
function an(e) {
|
|
9
9
|
let t, n;
|
|
10
|
-
for (let r = 0; r < e.length; ++r) n =
|
|
10
|
+
for (let r = 0; r < e.length; ++r) n = i(0, e.length), t = e[r], e[r] = e[n], e[n] = t;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return e[
|
|
12
|
+
function on(e) {
|
|
13
|
+
return e[i(0, e.length)];
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/utils/canvas.ts
|
|
17
|
-
function
|
|
17
|
+
function sn(e) {
|
|
18
18
|
let t = e.getContext("webgl");
|
|
19
19
|
if (t) {
|
|
20
20
|
let e = t.getExtension("WEBGL_lose_context");
|
|
@@ -25,13 +25,13 @@ function on(e) {
|
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/utils/color.ts
|
|
28
|
-
function
|
|
28
|
+
function cn(e) {
|
|
29
29
|
return `#${e.toString(16)}`;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function ln(e) {
|
|
32
32
|
return parseInt(e.replace(/^#/, ""), 16);
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var un = class e {
|
|
35
35
|
static {
|
|
36
36
|
this.WHITE = new e(255, 255, 255);
|
|
37
37
|
}
|
|
@@ -99,9 +99,6 @@ var ln = class e {
|
|
|
99
99
|
};
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/utils/define.ts
|
|
102
|
-
function un(e) {
|
|
103
|
-
return e;
|
|
104
|
-
}
|
|
105
102
|
function dn(e) {
|
|
106
103
|
return e;
|
|
107
104
|
}
|
|
@@ -114,29 +111,32 @@ function pn(e) {
|
|
|
114
111
|
function mn(e) {
|
|
115
112
|
return e;
|
|
116
113
|
}
|
|
114
|
+
function hn(e) {
|
|
115
|
+
return e;
|
|
116
|
+
}
|
|
117
117
|
//#endregion
|
|
118
118
|
//#region src/utils/pixi.ts
|
|
119
|
-
function
|
|
119
|
+
function gn(e, t) {
|
|
120
120
|
e.parent && e.parent.worldTransform.apply(e.position, e.position), t.worldTransform.applyInverse(e.position, e.position), e.parent?.removeChild(e), t.addChild(e);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function _n(e) {
|
|
123
123
|
return Math.sqrt(e.width * e.width + e.height * e.height);
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function vn(e) {
|
|
126
126
|
let t = e.parent;
|
|
127
127
|
t && (t.removeChild(e), t.addChild(e));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function yn(e) {
|
|
130
130
|
let t = e.parent;
|
|
131
131
|
t && (t.removeChild(e), t.addChildAt(e, 0));
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
if (e instanceof
|
|
133
|
+
function bn(e, t) {
|
|
134
|
+
if (e instanceof tn) {
|
|
135
135
|
for (let n = 0; n < e.points.length; n += 2) e.points[n] += t.x, e.points[n + 1] += t.y;
|
|
136
136
|
return e;
|
|
137
137
|
} else return e.x += t.x, e.y += t.y, e;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function xn(e, t) {
|
|
140
140
|
return e.x += t.x, e.y += t.y, e;
|
|
141
141
|
}
|
|
142
142
|
function P(e, t, n = "width") {
|
|
@@ -149,41 +149,41 @@ function F(e, t) {
|
|
|
149
149
|
function I(e, t) {
|
|
150
150
|
P(e, t, "height");
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Sn(e, t, n = "width") {
|
|
153
153
|
let r;
|
|
154
154
|
r = t?.width && t?.height ? {
|
|
155
155
|
x: t.width,
|
|
156
156
|
y: t.height
|
|
157
|
-
} :
|
|
157
|
+
} : S(t), n === "width" ? (F(e, r.x), e.height < r.y && I(e, r.y)) : (I(e, r.y), e.width < r.x && F(e, r.x));
|
|
158
158
|
}
|
|
159
159
|
//#endregion
|
|
160
160
|
//#region src/utils/platform.ts
|
|
161
|
-
var
|
|
161
|
+
var Cn = typeof window < "u" ? window.devicePixelRatio > 1 || window.matchMedia && window.matchMedia("(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)").matches : !1, L = typeof window < "u" ? "ontouchstart" in window || navigator.maxTouchPoints > 0 : !1, R = M.any, z = M.android.device, wn = M.apple.device;
|
|
162
162
|
//#endregion
|
|
163
163
|
//#region src/utils/rect.ts
|
|
164
|
-
function
|
|
164
|
+
function Tn(e, t) {
|
|
165
165
|
return e.x += t.x, e.y += t.y, e;
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function En(e, t) {
|
|
168
168
|
return t === void 0 && (t = new A()), t.set(e.x + e.width * .5, e.y + e.height * .5), t;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Dn(e, t) {
|
|
171
171
|
return e.x *= t, e.y *= t, e.width *= t, e.height *= t, e;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function On(e, t) {
|
|
174
174
|
return t === void 0 && (t = new A()), t.set(e.width, e.height), t;
|
|
175
175
|
}
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region src/utils/set.ts
|
|
178
|
-
function
|
|
178
|
+
function kn(e, t) {
|
|
179
179
|
let n = /* @__PURE__ */ new Set();
|
|
180
180
|
for (let r of e) t(r) && n.add(r);
|
|
181
181
|
return n;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function An(e) {
|
|
184
184
|
return e?.values().next().value;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function jn(e) {
|
|
187
187
|
let t;
|
|
188
188
|
for (let n of e) t = n;
|
|
189
189
|
return t;
|
|
@@ -204,35 +204,35 @@ function B(e, t) {
|
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/version.ts
|
|
207
|
-
var V = "0.
|
|
207
|
+
var V = "0.5.1", H = "8.19.0", Mn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
|
|
208
208
|
function U() {
|
|
209
|
-
let e = `\n${
|
|
209
|
+
let e = `\n${Mn}\n\n v${V} | %cPixi.js v${H} %c| %chttps://github.com/anthonysapp/caper\n\n`;
|
|
210
210
|
console.log(e, "color: #E91E63; font-weight: 600;", "color: inherit;", "color: #00BCD4; text-decoration: underline;");
|
|
211
211
|
}
|
|
212
212
|
//#endregion
|
|
213
213
|
//#region src/webgl-check.ts
|
|
214
|
-
function
|
|
214
|
+
function Nn() {
|
|
215
215
|
if (typeof document > "u") return;
|
|
216
216
|
let e = document.createElement("canvas");
|
|
217
217
|
e.getContext("webgl") || e.getContext("experimental-webgl") || console.error("Your browser does not support WebGL.");
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/plugins/actions/methods.ts
|
|
221
|
-
function
|
|
222
|
-
return e ??
|
|
221
|
+
function Pn(e) {
|
|
222
|
+
return e ?? g;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Fn(e, t, n = !0) {
|
|
225
225
|
return n && (t = {
|
|
226
226
|
...m,
|
|
227
227
|
...t
|
|
228
228
|
}), t;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function In(e) {
|
|
231
231
|
return e || [];
|
|
232
232
|
}
|
|
233
233
|
//#endregion
|
|
234
234
|
//#region src/plugins/breakpoints/methods.ts
|
|
235
|
-
function
|
|
235
|
+
function Ln(e) {
|
|
236
236
|
return {
|
|
237
237
|
tiers: e.tiers,
|
|
238
238
|
modes: e.modes ?? {}
|
|
@@ -242,7 +242,7 @@ function In(e) {
|
|
|
242
242
|
//#region src/plugins/input/touch/constants.ts
|
|
243
243
|
var W = /* @__PURE__ */ function(e) {
|
|
244
244
|
return e.None = "none", e.Left = "left", e.Top = "top", e.Bottom = "bottom", e.Right = "right", e.TopLeft = "top_left", e.TopRight = "top_right", e.BottomLeft = "bottom_left", e.BottomRight = "bottom_right", e;
|
|
245
|
-
}({}),
|
|
245
|
+
}({}), Rn = [
|
|
246
246
|
W.None,
|
|
247
247
|
W.Left,
|
|
248
248
|
W.Top,
|
|
@@ -255,20 +255,20 @@ var W = /* @__PURE__ */ function(e) {
|
|
|
255
255
|
];
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/plugins/input/methods.ts
|
|
258
|
-
function
|
|
258
|
+
function zn(e, t, n) {
|
|
259
259
|
return n || [];
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region src/core/globals.ts
|
|
263
|
-
var G = 200,
|
|
264
|
-
function
|
|
263
|
+
var G = 200, Bn = "CaperApplication";
|
|
264
|
+
function Vn() {
|
|
265
265
|
try {
|
|
266
266
|
return globalThis.Caper?.__dev === !0;
|
|
267
267
|
} catch {
|
|
268
268
|
return !1;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Hn() {
|
|
272
272
|
try {
|
|
273
273
|
return !1;
|
|
274
274
|
} catch {
|
|
@@ -298,13 +298,13 @@ function q() {
|
|
|
298
298
|
return a.promise;
|
|
299
299
|
}), t;
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function Un() {
|
|
302
302
|
q();
|
|
303
303
|
}
|
|
304
304
|
function J(e) {
|
|
305
|
-
return e.config?.id ||
|
|
305
|
+
return e.config?.id || Bn;
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function Wn(e) {
|
|
308
308
|
let t = J(e), n = [], r, i = [], a = (e) => {
|
|
309
309
|
n.push(e), n.length > G && n.splice(0, n.length - G);
|
|
310
310
|
}, o = () => r ? r() : void 0, s = (e) => {
|
|
@@ -378,8 +378,8 @@ function Un(e) {
|
|
|
378
378
|
}
|
|
379
379
|
function Y(e) {
|
|
380
380
|
let t = q(), n = J(e);
|
|
381
|
-
if (t.apps.set(n, e), t.app = e,
|
|
382
|
-
let r =
|
|
381
|
+
if (t.apps.set(n, e), t.app = e, Vn() || e.config?.automation === !0 || Hn()) {
|
|
382
|
+
let r = Wn(e);
|
|
383
383
|
t.automation[n] = r, e.automation = r;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -393,21 +393,21 @@ function X(e) {
|
|
|
393
393
|
}
|
|
394
394
|
//#endregion
|
|
395
395
|
//#region src/core/create.ts
|
|
396
|
-
var
|
|
396
|
+
var Gn = "caper-game-container";
|
|
397
397
|
function Z(e) {
|
|
398
398
|
let t = document.createElement("div");
|
|
399
399
|
return t.setAttribute("id", e), document.body.appendChild(t), t;
|
|
400
400
|
}
|
|
401
|
-
async function
|
|
401
|
+
async function Kn() {
|
|
402
402
|
return new Promise((e) => {
|
|
403
403
|
document.readyState === "complete" || document.readyState === "interactive" ? e(!0) : document.addEventListener("DOMContentLoaded", () => {
|
|
404
404
|
e(!0);
|
|
405
405
|
});
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
|
-
async function
|
|
409
|
-
let { defaultFactoryMethods: r } = await import("./const-
|
|
410
|
-
|
|
408
|
+
async function qn(e = { id: "CaperApplication" }, t = Gn, n = !0) {
|
|
409
|
+
let { defaultFactoryMethods: r } = await import("./const-BTDpIdRO.js").then((e) => e.t);
|
|
410
|
+
we(r), await Kn(), Nn(), n && U();
|
|
411
411
|
let i = null;
|
|
412
412
|
if (typeof t == "string" ? (i = document.getElementById(t), i ||= Z(t)) : t instanceof HTMLElement ? i = t : t === window && (i = document.body), !i) throw Error("You passed in a DOM Element, but none was found. If you instead pass in a string, a container will be created for you, using the string for its id.");
|
|
413
413
|
e.resizeToContainer && (e.resizeTo = i), e.useLayout && (e.layout = {
|
|
@@ -416,7 +416,7 @@ async function Kn(e = { id: "CaperApplication" }, t = Wn, n = !0) {
|
|
|
416
416
|
debugModificationCount: 0,
|
|
417
417
|
throttle: 100
|
|
418
418
|
}), e.container = i;
|
|
419
|
-
let a = new (e.application ||
|
|
419
|
+
let a = new (e.application || x)();
|
|
420
420
|
return await a.initialize(e, i), e.useLayout && (a.stage.layout = {
|
|
421
421
|
position: "absolute",
|
|
422
422
|
width: "100%",
|
|
@@ -425,11 +425,11 @@ async function Kn(e = { id: "CaperApplication" }, t = Wn, n = !0) {
|
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/display/Entity.ts
|
|
428
|
-
var
|
|
428
|
+
var Jn = class extends y {
|
|
429
429
|
constructor(e) {
|
|
430
430
|
super(), this.props = e ?? {};
|
|
431
431
|
}
|
|
432
|
-
},
|
|
432
|
+
}, Yn = class extends y {
|
|
433
433
|
get animationContext() {
|
|
434
434
|
return this._animationContext ?? `__scene_${this.id}`;
|
|
435
435
|
}
|
|
@@ -464,7 +464,7 @@ var qn = class extends b {
|
|
|
464
464
|
}
|
|
465
465
|
onPause(e) {}
|
|
466
466
|
onResume(e) {}
|
|
467
|
-
},
|
|
467
|
+
}, Xn = class extends y {
|
|
468
468
|
get active() {
|
|
469
469
|
return this._active;
|
|
470
470
|
}
|
|
@@ -505,9 +505,9 @@ var qn = class extends b {
|
|
|
505
505
|
_update(e) {
|
|
506
506
|
this.active && this.initialized && this.update(e);
|
|
507
507
|
}
|
|
508
|
-
},
|
|
508
|
+
}, Zn = class extends en {
|
|
509
509
|
constructor(e) {
|
|
510
|
-
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new p(), this.onZoomComplete = new p(), this.minX = 0, this.minY = 0, this._zooming = !1, this._zoomLerp = .1, this._targetPivot = new A(0, 0), this._targetScale = new A(1, 1), this._lerp = 0, this._target = null, this._followOffset = new A(0, 0),
|
|
510
|
+
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new p(), this.onZoomComplete = new p(), this.minX = 0, this.minY = 0, this._zooming = !1, this._zoomLerp = .1, this._targetPivot = new A(0, 0), this._targetScale = new A(1, 1), this._lerp = 0, this._target = null, this._followOffset = new A(0, 0), _(this), e && (this.container = e.container, this.addChild(this.container), e.minX && (this.minX = e.minX), e.maxX && (this.maxX = e.maxX), e.minY && (this.minY = e.minY), this.viewportWidth = e.viewportWidth ?? this.app.size.width, this.viewportHeight = e.viewportHeight ?? this.app.size.height, this.worldWidth = e.worldWidth ?? this.viewportWidth, this.worldHeight = e.worldHeight ?? this.viewportHeight, this.maxX = e.maxX ?? this.worldWidth - this.viewportWidth, this.maxY = e.maxY ?? this.worldHeight - this.viewportHeight), this._targetPivot.set(this.viewportWidth * .5, this.viewportHeight * .5), e.target && (this.target = e.target), this._lerp = 1, this.update(), e.lerp && (this.lerp = e.lerp), this;
|
|
511
511
|
}
|
|
512
512
|
get zooming() {
|
|
513
513
|
return this._zooming;
|
|
@@ -538,10 +538,10 @@ var qn = class extends b {
|
|
|
538
538
|
return this._followOffset;
|
|
539
539
|
}
|
|
540
540
|
set followOffset(e) {
|
|
541
|
-
this._followOffset =
|
|
541
|
+
this._followOffset = S(e, !0);
|
|
542
542
|
}
|
|
543
543
|
get app() {
|
|
544
|
-
return
|
|
544
|
+
return x.getInstance();
|
|
545
545
|
}
|
|
546
546
|
follow(e, t) {
|
|
547
547
|
t ||= {
|
|
@@ -578,12 +578,12 @@ var qn = class extends b {
|
|
|
578
578
|
} else this.pivot.set(this._targetPivot.x, this._targetPivot.y);
|
|
579
579
|
this.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
|
|
580
580
|
}
|
|
581
|
-
},
|
|
581
|
+
}, Qn = class {
|
|
582
582
|
constructor(e, t) {
|
|
583
|
-
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null,
|
|
583
|
+
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null, _(this), this.camera = e, this.interactiveArea = t, this.app.keyboard.onKeyDown().connect(this.handleKeyDown), this.interactiveArea.on("pointerdown", this.onPointerDown.bind(this)), this.interactiveArea.on("pointermove", this.onPointerMove.bind(this)), this.app.stage.on("pointerup", this.onPointerUp.bind(this)), this.app.stage.on("pointerupoutside", this.onPointerUp.bind(this)), this.interactiveArea.on("touchstart", this.onPointerDown.bind(this)), this.interactiveArea.on("touchmove", this.onPointerMove.bind(this)), this.interactiveArea.on("touchend", this.onPointerUp.bind(this));
|
|
584
584
|
}
|
|
585
585
|
get app() {
|
|
586
|
-
return
|
|
586
|
+
return x.getInstance();
|
|
587
587
|
}
|
|
588
588
|
destroy() {
|
|
589
589
|
this.interactiveArea.removeAllListeners(), this.app.stage.off("pointerup", this.onPointerUp.bind(this)), this.app.stage.off("pointerupoutside", this.onPointerUp.bind(this));
|
|
@@ -625,7 +625,7 @@ var qn = class extends b {
|
|
|
625
625
|
getEventPosition(e) {
|
|
626
626
|
return e instanceof TouchEvent ? new A(e.touches[0].clientX, e.touches[0].clientY) : new A(e.clientX, e.clientY);
|
|
627
627
|
}
|
|
628
|
-
},
|
|
628
|
+
}, $n = [
|
|
629
629
|
"text",
|
|
630
630
|
"anchor",
|
|
631
631
|
"roundPixels",
|
|
@@ -670,14 +670,14 @@ var qn = class extends b {
|
|
|
670
670
|
scale: 1,
|
|
671
671
|
marginTop: 60
|
|
672
672
|
}
|
|
673
|
-
},
|
|
673
|
+
}, er = [
|
|
674
674
|
"text",
|
|
675
675
|
"password",
|
|
676
676
|
"number",
|
|
677
677
|
"email",
|
|
678
678
|
"tel",
|
|
679
679
|
"url"
|
|
680
|
-
],
|
|
680
|
+
], tr = class e extends T(E(C(y))) {
|
|
681
681
|
constructor(e, t = !1, n = null) {
|
|
682
682
|
if (super({
|
|
683
683
|
autoUpdate: !0,
|
|
@@ -698,7 +698,7 @@ var qn = class extends b {
|
|
|
698
698
|
...Q.focusOverlay,
|
|
699
699
|
...e.focusOverlay ?? {}
|
|
700
700
|
}
|
|
701
|
-
}, this.options.layout && typeof this.options.layout == "object" ? this.layout = { ...this.options.layout } : this.layout = { transformOrigin: "top left" }, this.options.placeholder || (this.options.placeholder = { color: Number(this.options.style?.fill)
|
|
701
|
+
}, this.options.layout && typeof this.options.layout == "object" ? this.layout = { ...this.options.layout } : this.layout = { transformOrigin: "top left" }, this.options.placeholder || (this.options.placeholder = { color: Number(this.options.style?.fill) }), this._inner = this.add.container({ layout: {
|
|
702
702
|
position: "relative",
|
|
703
703
|
top: 0,
|
|
704
704
|
left: 0,
|
|
@@ -856,7 +856,7 @@ var qn = class extends b {
|
|
|
856
856
|
break;
|
|
857
857
|
}
|
|
858
858
|
if (this.options.placeholder.offsetOnType) {
|
|
859
|
-
let n =
|
|
859
|
+
let n = S(this.options.placeholder.offsetOnType);
|
|
860
860
|
e += n.x, t += n.y;
|
|
861
861
|
}
|
|
862
862
|
if (this.options.placeholder.animationOnType) {
|
|
@@ -869,7 +869,7 @@ var qn = class extends b {
|
|
|
869
869
|
alpha: this.options.placeholder.animationOnType.alpha ?? this.options.placeholder.alpha ?? 1,
|
|
870
870
|
overwrite: !0
|
|
871
871
|
})), this.options.placeholder.scaleOnType) {
|
|
872
|
-
let e =
|
|
872
|
+
let e = S(this.options.placeholder.scaleOnType);
|
|
873
873
|
this.addAnimation(N.to(this.placeholder.scale, {
|
|
874
874
|
x: e.x,
|
|
875
875
|
y: e.y,
|
|
@@ -957,7 +957,7 @@ var qn = class extends b {
|
|
|
957
957
|
this.domElement = this.clone.domElement, this._addDomElementListeners();
|
|
958
958
|
return;
|
|
959
959
|
}
|
|
960
|
-
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type &&
|
|
960
|
+
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type && er.includes(this.options.type) && (this.domElement.type = this.options.type), this.options.pattern && (this.domElement.pattern = this.options.pattern), this.options.regex && (this._regex = this.options.regex);
|
|
961
961
|
let t = this.getGlobalPosition(), n = this.getBounds();
|
|
962
962
|
n.x = t.x, n.y = t.y, n.width = this.width - this.options.padding.left, this.domElement.style.position = "fixed", this.domElement.style.border = "none", this.domElement.style.outline = "none", this.domElement.style.left = z ? "0" : `${n.left}px`, this.domElement.style.top = z ? "0" : `${n.top}px`, this.domElement.style.width = `${n.width}px`, this.domElement.style.height = `${n.height}px`, this.domElement.style.padding = "0", this.options.debug ? this.domElement.style.opacity = "0.8" : this.domElement.style.opacity = "0.0000001", this.app.canvas.parentElement?.appendChild(this.domElement), this.domElement.value = this.value, this.domElement.setAttribute("placeholder", this.options?.placeholder?.text ?? ""), this.options?.maxLength && this.domElement.setAttribute("maxLength", this.options.maxLength.toString()), this._addDomElementListeners(), this._focusDomElement(e);
|
|
963
963
|
}
|
|
@@ -1065,7 +1065,7 @@ var qn = class extends b {
|
|
|
1065
1065
|
}
|
|
1066
1066
|
_updateCaretAndSelection() {
|
|
1067
1067
|
if (!this.domElement) {
|
|
1068
|
-
|
|
1068
|
+
h.warn(this.label, "No dom element");
|
|
1069
1069
|
return;
|
|
1070
1070
|
}
|
|
1071
1071
|
let e = this.domElement.selectionStart || 0, t = this.domElement.selectionEnd || -1, n = this.domElement.selectionDirection, r = "", i = this.options.type === "password" ? this.input.text : this._value;
|
|
@@ -1073,7 +1073,7 @@ var qn = class extends b {
|
|
|
1073
1073
|
else {
|
|
1074
1074
|
r = i.substring(e > t ? t : e, e > t ? e : t);
|
|
1075
1075
|
let a = i.substring(0, e > t ? t : e), o = O.measureText(a, this.input.style), s = O.measureText(r, this.input.style);
|
|
1076
|
-
this._selectionRect = new
|
|
1076
|
+
this._selectionRect = new nn(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
_handleDomElementChange(e) {
|
|
@@ -1092,7 +1092,7 @@ var qn = class extends b {
|
|
|
1092
1092
|
let e = this._inputContainer.getBounds();
|
|
1093
1093
|
return e.width = this._lastWidth, e.height = this._lastHeight, e;
|
|
1094
1094
|
}
|
|
1095
|
-
},
|
|
1095
|
+
}, nr = class extends y {
|
|
1096
1096
|
constructor(e) {
|
|
1097
1097
|
if (super(), this.onChange = new p(), this.onStart = new p(), this.onEnd = new p(), this.onDestroy = new p(), this.outerRadius = 0, this.innerRadius = 0, this.innerAlphaStandby = .5, this.dragging = !1, this.pointData = new A(), this.direction = W.None, this.settings = Object.assign({
|
|
1098
1098
|
outerScale: 1,
|
|
@@ -1162,22 +1162,22 @@ var qn = class extends b {
|
|
|
1162
1162
|
let t = Math.atan2(e.y, e.x);
|
|
1163
1163
|
return t >= -Math.PI / 8 && t < 0 || t >= 0 && t < Math.PI / 8 ? W.Right : t >= Math.PI / 8 && t < 3 * Math.PI / 8 ? W.BottomRight : t >= 3 * Math.PI / 8 && t < 5 * Math.PI / 8 ? W.Bottom : t >= 5 * Math.PI / 8 && t < 7 * Math.PI / 8 ? W.BottomLeft : t >= 7 * Math.PI / 8 && t < Math.PI || t >= -Math.PI && t < -7 * Math.PI / 8 ? W.Left : t >= -7 * Math.PI / 8 && t < -5 * Math.PI / 8 ? W.TopLeft : t >= -5 * Math.PI / 8 && t < -3 * Math.PI / 8 ? W.Top : W.TopRight;
|
|
1164
1164
|
}
|
|
1165
|
-
},
|
|
1165
|
+
}, $ = {
|
|
1166
1166
|
color: 0,
|
|
1167
1167
|
alpha: .75
|
|
1168
|
-
},
|
|
1168
|
+
}, rr = {
|
|
1169
1169
|
backing: !0,
|
|
1170
1170
|
closeOnEscape: !0,
|
|
1171
1171
|
closeOnPointerDownOutside: !0,
|
|
1172
1172
|
actionContext: "popup"
|
|
1173
|
-
},
|
|
1173
|
+
}, ir = class e extends y {
|
|
1174
1174
|
get actionContext() {
|
|
1175
1175
|
return this.config.actionContext;
|
|
1176
1176
|
}
|
|
1177
1177
|
constructor(e, t = {}) {
|
|
1178
1178
|
super(), this.id = e, this.isShowing = !1, this._storedActionContext = void 0, this.config = Object.assign({
|
|
1179
1179
|
id: e,
|
|
1180
|
-
|
|
1180
|
+
...rr
|
|
1181
1181
|
}, t), this._initialize();
|
|
1182
1182
|
}
|
|
1183
1183
|
get data() {
|
|
@@ -1186,7 +1186,7 @@ var qn = class extends b {
|
|
|
1186
1186
|
static makeBacking(e, t) {
|
|
1187
1187
|
let n = {};
|
|
1188
1188
|
typeof e == "object" && (n = e);
|
|
1189
|
-
let r = Object.assign({
|
|
1189
|
+
let r = Object.assign({ ...$ }, n), i = new rn(j.WHITE);
|
|
1190
1190
|
return i.anchor.set(.5), i.alpha = r.alpha, i.tint = r.color, i.width = t.width, i.height = t.height, i;
|
|
1191
1191
|
}
|
|
1192
1192
|
initialize() {}
|
|
@@ -1220,15 +1220,15 @@ var qn = class extends b {
|
|
|
1220
1220
|
this.app.focus.addFocusLayer(this.id, !1), this.config.backing && (this.backing = this.add.existing(e.makeBacking(this.config.backing, this.app.size)), this.backing.eventMode = "static", this.config.closeOnPointerDownOutside && (this.backing.once("click", this.close), this.backing.once("tap", this.close))), this.view = this.add.container(), this.view.eventMode = "static";
|
|
1221
1221
|
}
|
|
1222
1222
|
setActionContext() {
|
|
1223
|
-
this.actionContext && (this.app.actionContext = this.actionContext,
|
|
1223
|
+
this.actionContext && (this.app.actionContext = this.actionContext, h.log("Popup", "Setting action context", this.app.actionContext));
|
|
1224
1224
|
}
|
|
1225
1225
|
storeActionContext() {
|
|
1226
|
-
this._storedActionContext = this.app.actionContext,
|
|
1226
|
+
this._storedActionContext = this.app.actionContext, h.log("Popup", "Storing action context", this._storedActionContext);
|
|
1227
1227
|
}
|
|
1228
1228
|
restoreActionContext() {
|
|
1229
|
-
this._storedActionContext && (
|
|
1229
|
+
this._storedActionContext && (h.log("Popup", "Restoring action context", this._storedActionContext), this.app.actionContext = this._storedActionContext), this._storedActionContext = void 0;
|
|
1230
1230
|
}
|
|
1231
|
-
},
|
|
1232
|
-
export {
|
|
1231
|
+
}, ar = b.Collector, or = b.CollectorArray, sr = b.CollectorLast, cr = b.CollectorUntil0, lr = b.CollectorWhile0, ur = b.SignalConnections;
|
|
1232
|
+
export { pe as ActionsPlugin, Le as Animated, Xt as AnimatedSprite, x as Application, te as AssetsPlugin, t as AudioChannel, Ge as AudioInstance, de as AudioManagerPlugin, Ue as BreakpointPlugin, Bt as Button, Ft as ButtonConfigKeys, Zn as Camera, Qn as CameraController, c as CaperEvent, ar as Collector, or as CollectorArray, sr as CollectorLast, cr as CollectorUntil0, lr as CollectorWhile0, un as Color, y as Container, tt as ContainerConfigKeys, lt as Controls, $t as DataAdapter, Lt as DebugAlpha, wt as DebugColors, le as DefaultActionContexts, g as DefaultActionContextsArray, d as DefaultActions, re as DefaultButtonIds, Jn as Entity, ze as Factory, Nt as FlexContainer, Pt as FlexContainerConfigKeys, l as FocusManagerPlugin, s as FocusOutliner, T as Focusable, be as FullScreenPlugin, dt as GesturePlugin, tr as Input, he as InputControllerTypes, Ee as InputPlugin, E as Interactive, Rn as JOYSTICK_DIRECTIONS, nr as Joystick, W as JoystickDirection, Ae as KeyboardControls, ht as KeyboardPlugin, h as Logger, Ve as LookupPlugin, Et as ParticleContainer, Rt as ParticleContainerConfigKeys, ye as Plugin, ir as Popup, Pe as PopupManagerPlugin, ge as Queue, st as ResizerPlugin, Yn as Scene, qe as SceneManagerPlugin, Xn as SceneTransition, p as Signal, ur as SignalConnections, qt as SpineAnimation, ee as Store, yt as Svg, $n as TextPropsKeys, $e as Timer, it as TimerPlugin, zt as Toast, Mt as Toaster, w as TouchControls, w as VirtualControls, At as UICanvas, Ht as UICanvasConfigKeys, Oe as WebEventsPlugin, Ye as WithLifecycle, C as WithSignals, v as add, ot as addToPoint, _ as bindAllMethods, f as bindMethods, oe as bool, Ke as capitalize, n as capitalizeWords, En as center, ie as checkAndInvokeMethod, Be as clamp, Gt as computeEffectivePadding, at as coreFunctionRegistry, Ze as coreSignalRegistry, qn as create, Z as createContainer, Tt as createDebugGraphics, Dt as createDebugLabel, Se as createFactoryMethods, o as createQueue, nt as debounce, ct as deepMerge, m as defaultActionsList, se as defaultBreakpoints, Vt as defaultFactoryMethods, _e as defaultGestureOptions, Kt as defaultToastConfig, Fn as defineActions, Ln as defineBreakpoints, In as defineButtons, Ce as defineConfig, Pn as defineContexts, zn as defineControls, Qt as defineData, mn as defineEntity, fn as definePlugin, pn as definePopup, dn as defineScene, hn as defineUI, ft as delay, sn as destroyCanvas, Qe as distance, rt as distanceSq, D as ensurePadding, We as env, kn as filterSet, An as firstFromSet, me as floatBetween, gt as floatBetweenPoint, Me as formatTime, Te as generatePluginList, xt as getDebugRegistry, pt as getDynamicModuleFromImportListItem, jt as getErrorTexture, De as getFirstMapEntry, ut as getLastMapEntry, B as getNearestCharacterIndex, mt as getNextMapEntry, e as getOrientation, je as getPreviousMapEntry, on as getRandomElement, It as getRegisteredEntityIds, Wt as getRegisteredUIIds, _t as getZeroPaddedNumber, a as i18nPlugin, Un as installCaperGlobal, i as intBetween, xe as intBetweenPoint, z as isAndroid, ce as isDev, wn as isIos, R as isMobile, ue as isProduction, ve as isPromise, Cn as isRetina, ae as isStorageCapable, Ut as isText, L as isTouch, jn as lastFromSet, Re as lerp, He as lerpPoint, ke as magnitude, et as multiply, r as normalizeKey, _n as objectDiagonal, Tn as offset, bn as offsetShape, xn as offsetSimpleShape, Fe as omitKeys, H as pixiVersion, Ie as pluck, ne as randomUUID, gn as reParent, Y as registerCaperApp, St as registerDebug, Yt as resolveAnchor, Zt as resolvePadding, Ot as resolvePivot, S as resolvePointLike, vt as resolvePosition, Jt as resolveScale, Xe as resolveSizeLike, kt as resolveTexture, bt as resolveUnknownKeys, U as sayHello, Dn as scale, I as scaleToHeight, Sn as scaleToSize, F as scaleToWidth, P as scaleUniform, yn as sendToBack, vn as sendToFront, an as shuffle, X as signalCaperReady, On as size, fe as sortPluginsByRequires, Ne as subtract, Je as subtractFromPoint, cn as toHex, ln as toRgb, Ct as unregisterDebug, V as version, u as wait };
|
|
1233
1233
|
|
|
1234
1234
|
//# sourceMappingURL=caper.mjs.map
|