@caperjs/core 0.6.1 → 0.7.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/index.d.mts +6 -0
- package/build/index.mjs +7 -0
- package/build/plugins/solid.mjs +30 -0
- package/cli/doctor.mjs +128 -0
- package/cli/doctor.test.mjs +154 -0
- package/extras/llms.txt +192 -4
- package/extras/skills/caper/SKILL.md +51 -3
- package/lib/{CaptionsPlugin-BtVJiQs_.js → CaptionsPlugin-Boj-gm3A.js} +5 -5
- package/lib/{CaptionsPlugin-BtVJiQs_.js.map → CaptionsPlugin-Boj-gm3A.js.map} +1 -1
- package/lib/{DataAdapter-BtNz4yi2.js → DataAdapter-Cra9dJ6W.js} +9 -9
- package/lib/{DataAdapter-BtNz4yi2.js.map → DataAdapter-Cra9dJ6W.js.map} +1 -1
- package/lib/{DebugRenderer-DK8FAED1.js → DebugRenderer-19S58S4h.js} +2 -2
- package/lib/{DebugRenderer-DK8FAED1.js.map → DebugRenderer-19S58S4h.js.map} +1 -1
- package/lib/{DevToolsPlugin-BS9idGRi.js → DevToolsPlugin-BTSkRsdS.js} +2 -2
- package/lib/{DevToolsPlugin-BS9idGRi.js.map → DevToolsPlugin-BTSkRsdS.js.map} +1 -1
- package/lib/{GSAPPlugin-DVDbDVP8.js → GSAPPlugin-BcL7vjyw.js} +5 -5
- package/lib/{GSAPPlugin-DVDbDVP8.js.map → GSAPPlugin-BcL7vjyw.js.map} +1 -1
- package/lib/{LayoutPlugin-qQJ5qJud.js → LayoutPlugin-BDhSngz_.js} +4 -4
- package/lib/{LayoutPlugin-qQJ5qJud.js.map → LayoutPlugin-BDhSngz_.js.map} +1 -1
- package/lib/ScreenDebugPlugin-C6pxs_3O.js +103 -0
- package/lib/ScreenDebugPlugin-C6pxs_3O.js.map +1 -0
- package/lib/{SpinePlugin-CPNRM2J1.js → SpinePlugin-CrQhaK6r.js} +2 -2
- package/lib/{SpinePlugin-CPNRM2J1.js.map → SpinePlugin-CrQhaK6r.js.map} +1 -1
- package/lib/{StatsPlugin-BHihicBl.js → StatsPlugin-Cu625dmk.js} +2 -2
- package/lib/{StatsPlugin-BHihicBl.js.map → StatsPlugin-Cu625dmk.js.map} +1 -1
- package/lib/{VoiceOverPlugin-BdTHxgku.js → VoiceOverPlugin-D4rfHFyJ.js} +5 -5
- package/lib/{VoiceOverPlugin-BdTHxgku.js.map → VoiceOverPlugin-D4rfHFyJ.js.map} +1 -1
- package/lib/caper.mjs +98 -97
- package/lib/caper.mjs.map +1 -1
- package/lib/{const-BQItSP39.js → const-BQ2iMCtc.js} +180 -180
- package/lib/{const-BQItSP39.js.map → const-BQ2iMCtc.js.map} +1 -1
- package/lib/core/Application.d.ts.map +1 -1
- package/lib/plugins/ScreenDebugPlugin.d.ts +22 -0
- package/lib/plugins/ScreenDebugPlugin.d.ts.map +1 -0
- package/lib/plugins/ScreenDebugPlugin.test.d.ts +2 -0
- package/lib/plugins/ScreenDebugPlugin.test.d.ts.map +1 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/screenDebugFlag.d.ts +2 -0
- package/lib/plugins/screenDebugFlag.d.ts.map +1 -0
- package/lib/plugins/screenDebugFlag.test.d.ts +2 -0
- package/lib/plugins/screenDebugFlag.test.d.ts.map +1 -0
- package/lib/{registries-DlqHRO90.js → registries-BmDw_GV1.js} +237 -221
- package/lib/registries-BmDw_GV1.js.map +1 -0
- package/package.json +1 -1
- package/src/core/Application.ts +8 -0
- package/src/plugins/ScreenDebugPlugin.test.ts +61 -0
- package/src/plugins/ScreenDebugPlugin.ts +174 -0
- package/src/plugins/index.ts +2 -0
- package/src/plugins/screenDebugFlag.test.ts +45 -0
- package/src/plugins/screenDebugFlag.ts +26 -0
- package/src/version.ts +1 -1
- package/lib/registries-DlqHRO90.js.map +0 -1
package/lib/caper.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
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
|
|
2
|
-
import { A as
|
|
3
|
-
import { n as
|
|
4
|
-
import { r as
|
|
5
|
-
import {
|
|
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 p, K as ae, L as oe, Lt as se, M as ce, Mt as le, N as ue, Nt as de, O as fe, Ot as pe, P as me, Pt as he, Q as ge, R as m, Rt as _e, S as h, St as ve, T as ye, Tt as be, U as xe, Ut as Se, V as Ce, Vt as g, W as we, X as Te, Y as Ee, Z as De, _ as Oe, _t as ke, a as Ae, at as je, b as _, bt as Me, c as Ne, ct as v, d as y, dt as b, et as Pe, f as Fe, 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 x, l as Ke, lt as qe, m as Je, mt as Ye, n as Xe, nt as Ze, o as Qe, ot as $e, p as S, pt as et, q as C, r as w, rt as tt, s as nt, st as rt, t as it, tt as at, u as ot, ut as st, v as ct, vt as lt, w as ut, wt as dt, x as ft, xt as pt, y as mt, yt as ht, z as gt, zt as _t } from "./registries-BmDw_GV1.js";
|
|
2
|
+
import { A as vt, C as yt, D as bt, E as xt, F as St, I as Ct, L as wt, M as Tt, N as Et, O as Dt, P as Ot, S as kt, T as At, _ as T, a as jt, b as Mt, c as Nt, d as Pt, f as Ft, g as E, h as It, i as Lt, j as Rt, k as zt, l as Bt, m as Vt, n as Ht, o as Ut, p as Wt, r as Gt, s as Kt, u as qt, v as Jt, w as Yt, x as Xt, y as Zt } from "./const-BQ2iMCtc.js";
|
|
3
|
+
import { n as Qt, t as D } from "./padding-1kHDpGlQ.js";
|
|
4
|
+
import { r as $t, t as en } from "./DataAdapter-Cra9dJ6W.js";
|
|
5
|
+
import { t as tn } from "./ScreenDebugPlugin-C6pxs_3O.js";
|
|
6
|
+
import { CanvasTextMetrics as O, Container as nn, Graphics as k, Point as A, Polygon as rn, Rectangle as an, Sprite as on, Texture as j, isMobile as M } from "pixi.js";
|
|
6
7
|
import { gsap as N } from "gsap";
|
|
7
8
|
//#region src/utils/array.ts
|
|
8
|
-
function
|
|
9
|
+
function sn(e) {
|
|
9
10
|
let t, n;
|
|
10
|
-
for (let r = 0; r < e.length; ++r) n =
|
|
11
|
+
for (let r = 0; r < e.length; ++r) n = g(0, e.length), t = e[r], e[r] = e[n], e[n] = t;
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
return e[
|
|
13
|
+
function cn(e) {
|
|
14
|
+
return e[g(0, e.length)];
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region src/utils/canvas.ts
|
|
17
|
-
function
|
|
18
|
+
function ln(e) {
|
|
18
19
|
let t = e.getContext("webgl");
|
|
19
20
|
if (t) {
|
|
20
21
|
let e = t.getExtension("WEBGL_lose_context");
|
|
@@ -25,13 +26,13 @@ function sn(e) {
|
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/utils/color.ts
|
|
28
|
-
function
|
|
29
|
+
function un(e) {
|
|
29
30
|
return `#${e.toString(16)}`;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function dn(e) {
|
|
32
33
|
return parseInt(e.replace(/^#/, ""), 16);
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
+
var fn = class e {
|
|
35
36
|
static {
|
|
36
37
|
this.WHITE = new e(255, 255, 255);
|
|
37
38
|
}
|
|
@@ -99,44 +100,44 @@ var un = class e {
|
|
|
99
100
|
};
|
|
100
101
|
//#endregion
|
|
101
102
|
//#region src/utils/define.ts
|
|
102
|
-
function
|
|
103
|
+
function pn(e) {
|
|
103
104
|
return e;
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function mn(e) {
|
|
106
107
|
return e;
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function hn(e) {
|
|
109
110
|
return e;
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function gn(e) {
|
|
112
113
|
return e;
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
+
function _n(e) {
|
|
115
116
|
return e;
|
|
116
117
|
}
|
|
117
118
|
//#endregion
|
|
118
119
|
//#region src/utils/pixi.ts
|
|
119
|
-
function
|
|
120
|
+
function vn(e, t) {
|
|
120
121
|
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
122
|
}
|
|
122
|
-
function
|
|
123
|
+
function yn(e) {
|
|
123
124
|
return Math.sqrt(e.width * e.width + e.height * e.height);
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function bn(e) {
|
|
126
127
|
let t = e.parent;
|
|
127
128
|
t && (t.removeChild(e), t.addChild(e));
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function xn(e) {
|
|
130
131
|
let t = e.parent;
|
|
131
132
|
t && (t.removeChild(e), t.addChildAt(e, 0));
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
-
if (e instanceof
|
|
134
|
+
function Sn(e, t) {
|
|
135
|
+
if (e instanceof rn) {
|
|
135
136
|
for (let n = 0; n < e.points.length; n += 2) e.points[n] += t.x, e.points[n + 1] += t.y;
|
|
136
137
|
return e;
|
|
137
138
|
} else return e.x += t.x, e.y += t.y, e;
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function Cn(e, t) {
|
|
140
141
|
return e.x += t.x, e.y += t.y, e;
|
|
141
142
|
}
|
|
142
143
|
function P(e, t, n = "width") {
|
|
@@ -149,41 +150,41 @@ function F(e, t) {
|
|
|
149
150
|
function I(e, t) {
|
|
150
151
|
P(e, t, "height");
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function wn(e, t, n = "width") {
|
|
153
154
|
let r;
|
|
154
155
|
r = t?.width && t?.height ? {
|
|
155
156
|
x: t.width,
|
|
156
157
|
y: t.height
|
|
157
|
-
} :
|
|
158
|
+
} : v(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
159
|
}
|
|
159
160
|
//#endregion
|
|
160
161
|
//#region src/utils/platform.ts
|
|
161
|
-
var
|
|
162
|
+
var Tn = 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, En = M.apple.device;
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/utils/rect.ts
|
|
164
|
-
function
|
|
165
|
+
function Dn(e, t) {
|
|
165
166
|
return e.x += t.x, e.y += t.y, e;
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function On(e, t) {
|
|
168
169
|
return t === void 0 && (t = new A()), t.set(e.x + e.width * .5, e.y + e.height * .5), t;
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
+
function kn(e, t) {
|
|
171
172
|
return e.x *= t, e.y *= t, e.width *= t, e.height *= t, e;
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
+
function An(e, t) {
|
|
174
175
|
return t === void 0 && (t = new A()), t.set(e.width, e.height), t;
|
|
175
176
|
}
|
|
176
177
|
//#endregion
|
|
177
178
|
//#region src/utils/set.ts
|
|
178
|
-
function
|
|
179
|
+
function jn(e, t) {
|
|
179
180
|
let n = /* @__PURE__ */ new Set();
|
|
180
181
|
for (let r of e) t(r) && n.add(r);
|
|
181
182
|
return n;
|
|
182
183
|
}
|
|
183
|
-
function
|
|
184
|
+
function Mn(e) {
|
|
184
185
|
return e?.values().next().value;
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
+
function Nn(e) {
|
|
187
188
|
let t;
|
|
188
189
|
for (let n of e) t = n;
|
|
189
190
|
return t;
|
|
@@ -204,35 +205,35 @@ function B(e, t) {
|
|
|
204
205
|
}
|
|
205
206
|
//#endregion
|
|
206
207
|
//#region src/version.ts
|
|
207
|
-
var V = "0.
|
|
208
|
+
var V = "0.7.0", H = "8.20.0", Pn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
|
|
208
209
|
function U() {
|
|
209
|
-
let e = `\n${
|
|
210
|
+
let e = `\n${Pn}\n\n v${V} | %cPixi.js v${H} %c| %chttps://github.com/anthonysapp/caper\n\n`;
|
|
210
211
|
console.log(e, "color: #E91E63; font-weight: 600;", "color: inherit;", "color: #00BCD4; text-decoration: underline;");
|
|
211
212
|
}
|
|
212
213
|
//#endregion
|
|
213
214
|
//#region src/webgl-check.ts
|
|
214
|
-
function
|
|
215
|
+
function Fn() {
|
|
215
216
|
if (typeof document > "u") return;
|
|
216
217
|
let e = document.createElement("canvas");
|
|
217
218
|
e.getContext("webgl") || e.getContext("experimental-webgl") || console.error("Your browser does not support WebGL.");
|
|
218
219
|
}
|
|
219
220
|
//#endregion
|
|
220
221
|
//#region src/plugins/actions/methods.ts
|
|
221
|
-
function
|
|
222
|
-
return e ??
|
|
222
|
+
function In(e) {
|
|
223
|
+
return e ?? d;
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function Ln(e, t, n = !0) {
|
|
225
226
|
return n && (t = {
|
|
226
227
|
...m,
|
|
227
228
|
...t
|
|
228
229
|
}), t;
|
|
229
230
|
}
|
|
230
|
-
function
|
|
231
|
+
function Rn(e) {
|
|
231
232
|
return e || [];
|
|
232
233
|
}
|
|
233
234
|
//#endregion
|
|
234
235
|
//#region src/plugins/breakpoints/methods.ts
|
|
235
|
-
function
|
|
236
|
+
function zn(e) {
|
|
236
237
|
return {
|
|
237
238
|
tiers: e.tiers,
|
|
238
239
|
modes: e.modes ?? {}
|
|
@@ -242,7 +243,7 @@ function Ln(e) {
|
|
|
242
243
|
//#region src/plugins/input/touch/constants.ts
|
|
243
244
|
var W = /* @__PURE__ */ function(e) {
|
|
244
245
|
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
|
-
}({}),
|
|
246
|
+
}({}), Bn = [
|
|
246
247
|
W.None,
|
|
247
248
|
W.Left,
|
|
248
249
|
W.Top,
|
|
@@ -255,20 +256,20 @@ var W = /* @__PURE__ */ function(e) {
|
|
|
255
256
|
];
|
|
256
257
|
//#endregion
|
|
257
258
|
//#region src/plugins/input/methods.ts
|
|
258
|
-
function
|
|
259
|
+
function Vn(e, t, n) {
|
|
259
260
|
return n || [];
|
|
260
261
|
}
|
|
261
262
|
//#endregion
|
|
262
263
|
//#region src/core/globals.ts
|
|
263
|
-
var G = 200,
|
|
264
|
-
function
|
|
264
|
+
var G = 200, Hn = "CaperApplication";
|
|
265
|
+
function Un() {
|
|
265
266
|
try {
|
|
266
267
|
return globalThis.Caper?.__dev === !0;
|
|
267
268
|
} catch {
|
|
268
269
|
return !1;
|
|
269
270
|
}
|
|
270
271
|
}
|
|
271
|
-
function
|
|
272
|
+
function Wn() {
|
|
272
273
|
try {
|
|
273
274
|
return !1;
|
|
274
275
|
} catch {
|
|
@@ -298,13 +299,13 @@ function q() {
|
|
|
298
299
|
return a.promise;
|
|
299
300
|
}), t;
|
|
300
301
|
}
|
|
301
|
-
function
|
|
302
|
+
function Gn() {
|
|
302
303
|
q();
|
|
303
304
|
}
|
|
304
305
|
function J(e) {
|
|
305
|
-
return e.config?.id ||
|
|
306
|
+
return e.config?.id || Hn;
|
|
306
307
|
}
|
|
307
|
-
function
|
|
308
|
+
function Kn(e) {
|
|
308
309
|
let t = J(e), n = [], r, i = [], a = (e) => {
|
|
309
310
|
n.push(e), n.length > G && n.splice(0, n.length - G);
|
|
310
311
|
}, o = () => r ? r() : void 0, s = (e) => {
|
|
@@ -378,8 +379,8 @@ function Wn(e) {
|
|
|
378
379
|
}
|
|
379
380
|
function Y(e) {
|
|
380
381
|
let t = q(), n = J(e);
|
|
381
|
-
if (t.apps.set(n, e), t.app = e,
|
|
382
|
-
let r =
|
|
382
|
+
if (t.apps.set(n, e), t.app = e, Un() || e.config?.automation === !0 || Wn()) {
|
|
383
|
+
let r = Kn(e);
|
|
383
384
|
t.automation[n] = r, e.automation = r;
|
|
384
385
|
}
|
|
385
386
|
}
|
|
@@ -393,21 +394,21 @@ function X(e) {
|
|
|
393
394
|
}
|
|
394
395
|
//#endregion
|
|
395
396
|
//#region src/core/create.ts
|
|
396
|
-
var
|
|
397
|
+
var qn = "caper-game-container";
|
|
397
398
|
function Z(e) {
|
|
398
399
|
let t = document.createElement("div");
|
|
399
400
|
return t.setAttribute("id", e), document.body.appendChild(t), t;
|
|
400
401
|
}
|
|
401
|
-
async function
|
|
402
|
+
async function Jn() {
|
|
402
403
|
return new Promise((e) => {
|
|
403
404
|
document.readyState === "complete" || document.readyState === "interactive" ? e(!0) : document.addEventListener("DOMContentLoaded", () => {
|
|
404
405
|
e(!0);
|
|
405
406
|
});
|
|
406
407
|
});
|
|
407
408
|
}
|
|
408
|
-
async function
|
|
409
|
-
let { defaultFactoryMethods: r } = await import("./const-
|
|
410
|
-
|
|
409
|
+
async function Q(e = { id: "CaperApplication" }, t = qn, n = !0) {
|
|
410
|
+
let { defaultFactoryMethods: r } = await import("./const-BQ2iMCtc.js").then((e) => e.t);
|
|
411
|
+
Te(r), await Jn(), Fn(), n && U();
|
|
411
412
|
let i = null;
|
|
412
413
|
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
414
|
e.resizeToContainer && (e.resizeTo = i), e.useLayout && (e.layout = {
|
|
@@ -416,7 +417,7 @@ async function qn(e = { id: "CaperApplication" }, t = Gn, n = !0) {
|
|
|
416
417
|
debugModificationCount: 0,
|
|
417
418
|
throttle: 100
|
|
418
419
|
}), e.container = i;
|
|
419
|
-
let a = new (e.application ||
|
|
420
|
+
let a = new (e.application || w)();
|
|
420
421
|
return await a.initialize(e, i), e.useLayout && (a.stage.layout = {
|
|
421
422
|
position: "absolute",
|
|
422
423
|
width: "100%",
|
|
@@ -425,11 +426,11 @@ async function qn(e = { id: "CaperApplication" }, t = Gn, n = !0) {
|
|
|
425
426
|
}
|
|
426
427
|
//#endregion
|
|
427
428
|
//#region src/display/Entity.ts
|
|
428
|
-
var
|
|
429
|
+
var Yn = class extends S {
|
|
429
430
|
constructor(e) {
|
|
430
431
|
super(), this.props = e ?? {};
|
|
431
432
|
}
|
|
432
|
-
},
|
|
433
|
+
}, Xn = class extends S {
|
|
433
434
|
get animationContext() {
|
|
434
435
|
return this._animationContext ?? `__scene_${this.id}`;
|
|
435
436
|
}
|
|
@@ -464,7 +465,7 @@ var Jn = class extends y {
|
|
|
464
465
|
}
|
|
465
466
|
onPause(e) {}
|
|
466
467
|
onResume(e) {}
|
|
467
|
-
},
|
|
468
|
+
}, Zn = class extends S {
|
|
468
469
|
get active() {
|
|
469
470
|
return this._active;
|
|
470
471
|
}
|
|
@@ -505,9 +506,9 @@ var Jn = class extends y {
|
|
|
505
506
|
_update(e) {
|
|
506
507
|
this.active && this.initialized && this.update(e);
|
|
507
508
|
}
|
|
508
|
-
},
|
|
509
|
+
}, Qn = class extends nn {
|
|
509
510
|
constructor(e) {
|
|
510
|
-
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new
|
|
511
|
+
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new C(), this.onZoomComplete = new C(), 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), f(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
512
|
}
|
|
512
513
|
get zooming() {
|
|
513
514
|
return this._zooming;
|
|
@@ -538,10 +539,10 @@ var Jn = class extends y {
|
|
|
538
539
|
return this._followOffset;
|
|
539
540
|
}
|
|
540
541
|
set followOffset(e) {
|
|
541
|
-
this._followOffset =
|
|
542
|
+
this._followOffset = v(e, !0);
|
|
542
543
|
}
|
|
543
544
|
get app() {
|
|
544
|
-
return
|
|
545
|
+
return w.getInstance();
|
|
545
546
|
}
|
|
546
547
|
follow(e, t) {
|
|
547
548
|
t ||= {
|
|
@@ -578,12 +579,12 @@ var Jn = class extends y {
|
|
|
578
579
|
} else this.pivot.set(this._targetPivot.x, this._targetPivot.y);
|
|
579
580
|
this.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
|
|
580
581
|
}
|
|
581
|
-
},
|
|
582
|
+
}, $n = class {
|
|
582
583
|
constructor(e, t) {
|
|
583
|
-
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null,
|
|
584
|
+
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null, f(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
585
|
}
|
|
585
586
|
get app() {
|
|
586
|
-
return
|
|
587
|
+
return w.getInstance();
|
|
587
588
|
}
|
|
588
589
|
destroy() {
|
|
589
590
|
this.interactiveArea.removeAllListeners(), this.app.stage.off("pointerup", this.onPointerUp.bind(this)), this.app.stage.off("pointerupoutside", this.onPointerUp.bind(this));
|
|
@@ -625,13 +626,13 @@ var Jn = class extends y {
|
|
|
625
626
|
getEventPosition(e) {
|
|
626
627
|
return e instanceof TouchEvent ? new A(e.touches[0].clientX, e.touches[0].clientY) : new A(e.clientX, e.clientY);
|
|
627
628
|
}
|
|
628
|
-
},
|
|
629
|
+
}, er = [
|
|
629
630
|
"text",
|
|
630
631
|
"anchor",
|
|
631
632
|
"roundPixels",
|
|
632
633
|
"style",
|
|
633
634
|
"pivot"
|
|
634
|
-
],
|
|
635
|
+
], $ = {
|
|
635
636
|
value: "",
|
|
636
637
|
type: "text",
|
|
637
638
|
fixed: !0,
|
|
@@ -670,32 +671,32 @@ var Jn = class extends y {
|
|
|
670
671
|
scale: 1,
|
|
671
672
|
marginTop: 60
|
|
672
673
|
}
|
|
673
|
-
},
|
|
674
|
+
}, tr = [
|
|
674
675
|
"text",
|
|
675
676
|
"password",
|
|
676
677
|
"number",
|
|
677
678
|
"email",
|
|
678
679
|
"tel",
|
|
679
680
|
"url"
|
|
680
|
-
],
|
|
681
|
+
], nr = class e extends T(E(h(S))) {
|
|
681
682
|
constructor(e, t = !1, n = null) {
|
|
682
683
|
if (super({
|
|
683
684
|
autoUpdate: !0,
|
|
684
685
|
autoResize: !t
|
|
685
|
-
}), this.isClone = t, this.clone = n, this.onEnter = new
|
|
686
|
-
|
|
686
|
+
}), this.isClone = t, this.clone = n, this.onEnter = new C(), this.onChange = new C(), this.onError = new C(), this._lastWidth = 0, this._lastHeight = 0, this._placeholderPositioned = !1, this._placeholderAnimating = !1, this._caretPosition = -1, this._value = "", this.options = {
|
|
687
|
+
...$,
|
|
687
688
|
...e,
|
|
688
689
|
style: {
|
|
689
|
-
|
|
690
|
+
...$.style,
|
|
690
691
|
...e?.style ?? {}
|
|
691
692
|
},
|
|
692
|
-
padding: D(e.padding ??
|
|
693
|
+
padding: D(e.padding ?? $.padding),
|
|
693
694
|
bg: {
|
|
694
|
-
|
|
695
|
+
...$.bg,
|
|
695
696
|
...e.bg ?? {}
|
|
696
697
|
},
|
|
697
698
|
focusOverlay: {
|
|
698
|
-
|
|
699
|
+
...$.focusOverlay,
|
|
699
700
|
...e.focusOverlay ?? {}
|
|
700
701
|
}
|
|
701
702
|
}, 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: {
|
|
@@ -856,7 +857,7 @@ var Jn = class extends y {
|
|
|
856
857
|
break;
|
|
857
858
|
}
|
|
858
859
|
if (this.options.placeholder.offsetOnType) {
|
|
859
|
-
let n =
|
|
860
|
+
let n = v(this.options.placeholder.offsetOnType);
|
|
860
861
|
e += n.x, t += n.y;
|
|
861
862
|
}
|
|
862
863
|
if (this.options.placeholder.animationOnType) {
|
|
@@ -869,7 +870,7 @@ var Jn = class extends y {
|
|
|
869
870
|
alpha: this.options.placeholder.animationOnType.alpha ?? this.options.placeholder.alpha ?? 1,
|
|
870
871
|
overwrite: !0
|
|
871
872
|
})), this.options.placeholder.scaleOnType) {
|
|
872
|
-
let e =
|
|
873
|
+
let e = v(this.options.placeholder.scaleOnType);
|
|
873
874
|
this.addAnimation(N.to(this.placeholder.scale, {
|
|
874
875
|
x: e.x,
|
|
875
876
|
y: e.y,
|
|
@@ -957,7 +958,7 @@ var Jn = class extends y {
|
|
|
957
958
|
this.domElement = this.clone.domElement, this._addDomElementListeners();
|
|
958
959
|
return;
|
|
959
960
|
}
|
|
960
|
-
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type &&
|
|
961
|
+
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type && tr.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
962
|
let t = this.getGlobalPosition(), n = this.getBounds();
|
|
962
963
|
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
964
|
}
|
|
@@ -1009,7 +1010,7 @@ var Jn = class extends y {
|
|
|
1009
1010
|
if (r) {
|
|
1010
1011
|
let t = structuredClone(this.options), n = this.options.focusOverlay?.scale || 1;
|
|
1011
1012
|
t.focusOverlay = { activeFilter: !1 };
|
|
1012
|
-
let r = Number(t.style?.fontSize ||
|
|
1013
|
+
let r = Number(t.style?.fontSize || $.style?.fontSize || 20) * n;
|
|
1013
1014
|
if (t.style ||= {}, t.style.fontSize = r, t.padding && (t.padding.left *= n, t.padding.top *= n, t.padding.right *= n, t.padding.bottom *= n), t.bg?.radius && (t.bg.radius *= n), t.bg?.stroke?.width && (t.bg.stroke.width *= n), t.minWidth && (t.minWidth *= n, t.minWidth > this.app.size.width && (t.minWidth = this.app.size.width - (t.bg?.stroke?.width ? t.bg.stroke.width * 2 + 20 : 20))), this.options.focusOverlay?.backing?.active) {
|
|
1014
1015
|
let e = this.make.sprite({
|
|
1015
1016
|
asset: j.WHITE,
|
|
@@ -1065,7 +1066,7 @@ var Jn = class extends y {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
_updateCaretAndSelection() {
|
|
1067
1068
|
if (!this.domElement) {
|
|
1068
|
-
|
|
1069
|
+
x.warn(this.label, "No dom element");
|
|
1069
1070
|
return;
|
|
1070
1071
|
}
|
|
1071
1072
|
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 +1074,7 @@ var Jn = class extends y {
|
|
|
1073
1074
|
else {
|
|
1074
1075
|
r = i.substring(e > t ? t : e, e > t ? e : t);
|
|
1075
1076
|
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
|
|
1077
|
+
this._selectionRect = new an(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
|
|
1077
1078
|
}
|
|
1078
1079
|
}
|
|
1079
1080
|
_handleDomElementChange(e) {
|
|
@@ -1092,9 +1093,9 @@ var Jn = class extends y {
|
|
|
1092
1093
|
let e = this._inputContainer.getBounds();
|
|
1093
1094
|
return e.width = this._lastWidth, e.height = this._lastHeight, e;
|
|
1094
1095
|
}
|
|
1095
|
-
},
|
|
1096
|
+
}, rr = class extends S {
|
|
1096
1097
|
constructor(e) {
|
|
1097
|
-
if (super(), this.onChange = new
|
|
1098
|
+
if (super(), this.onChange = new C(), this.onStart = new C(), this.onEnd = new C(), this.onDestroy = new C(), 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
1099
|
outerScale: 1,
|
|
1099
1100
|
innerScale: 1
|
|
1100
1101
|
}, e), !this.settings.outer) {
|
|
@@ -1162,22 +1163,22 @@ var Jn = class extends y {
|
|
|
1162
1163
|
let t = Math.atan2(e.y, e.x);
|
|
1163
1164
|
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
1165
|
}
|
|
1165
|
-
},
|
|
1166
|
+
}, ir = {
|
|
1166
1167
|
color: 0,
|
|
1167
1168
|
alpha: .75
|
|
1168
|
-
},
|
|
1169
|
+
}, ar = {
|
|
1169
1170
|
backing: !0,
|
|
1170
1171
|
closeOnEscape: !0,
|
|
1171
1172
|
closeOnPointerDownOutside: !0,
|
|
1172
1173
|
actionContext: "popup"
|
|
1173
|
-
},
|
|
1174
|
+
}, or = class e extends S {
|
|
1174
1175
|
get actionContext() {
|
|
1175
1176
|
return this.config.actionContext;
|
|
1176
1177
|
}
|
|
1177
1178
|
constructor(e, t = {}) {
|
|
1178
1179
|
super(), this.id = e, this.isShowing = !1, this._storedActionContext = void 0, this.config = Object.assign({
|
|
1179
1180
|
id: e,
|
|
1180
|
-
...
|
|
1181
|
+
...ar
|
|
1181
1182
|
}, t), this._initialize();
|
|
1182
1183
|
}
|
|
1183
1184
|
get data() {
|
|
@@ -1186,7 +1187,7 @@ var Jn = class extends y {
|
|
|
1186
1187
|
static makeBacking(e, t) {
|
|
1187
1188
|
let n = {};
|
|
1188
1189
|
typeof e == "object" && (n = e);
|
|
1189
|
-
let r = Object.assign({
|
|
1190
|
+
let r = Object.assign({ ...ir }, n), i = new on(j.WHITE);
|
|
1190
1191
|
return i.anchor.set(.5), i.alpha = r.alpha, i.tint = r.color, i.width = t.width, i.height = t.height, i;
|
|
1191
1192
|
}
|
|
1192
1193
|
initialize() {}
|
|
@@ -1220,15 +1221,15 @@ var Jn = class extends y {
|
|
|
1220
1221
|
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
1222
|
}
|
|
1222
1223
|
setActionContext() {
|
|
1223
|
-
this.actionContext && (this.app.actionContext = this.actionContext,
|
|
1224
|
+
this.actionContext && (this.app.actionContext = this.actionContext, x.log("Popup", "Setting action context", this.app.actionContext));
|
|
1224
1225
|
}
|
|
1225
1226
|
storeActionContext() {
|
|
1226
|
-
this._storedActionContext = this.app.actionContext,
|
|
1227
|
+
this._storedActionContext = this.app.actionContext, x.log("Popup", "Storing action context", this._storedActionContext);
|
|
1227
1228
|
}
|
|
1228
1229
|
restoreActionContext() {
|
|
1229
|
-
this._storedActionContext && (
|
|
1230
|
+
this._storedActionContext && (x.log("Popup", "Restoring action context", this._storedActionContext), this.app.actionContext = this._storedActionContext), this._storedActionContext = void 0;
|
|
1230
1231
|
}
|
|
1231
|
-
},
|
|
1232
|
-
export {
|
|
1232
|
+
}, sr = p.Collector, cr = p.CollectorArray, lr = p.CollectorLast, ur = p.CollectorUntil0, dr = p.CollectorWhile0, fr = p.SignalConnections;
|
|
1233
|
+
export { gt as ActionsPlugin, Oe as Animated, Zt as AnimatedSprite, w as Application, xe as AssetsPlugin, Ue as AudioChannel, t as AudioInstance, Ge as AudioManagerPlugin, ce as BreakpointPlugin, Vt as Button, It as ButtonConfigKeys, Qn as Camera, $n as CameraController, pe as CaperEvent, sr as Collector, cr as CollectorArray, lr as CollectorLast, ur as CollectorUntil0, dr as CollectorWhile0, fn as Color, S as Container, Je as ContainerConfigKeys, mt as Controls, en as DataAdapter, Rt as DebugAlpha, Tt as DebugColors, me as DefaultActionContexts, d as DefaultActionContextsArray, re as DefaultActions, oe as DefaultButtonIds, Yn as Entity, Le as Factory, Pt as FlexContainer, Ft as FlexContainerConfigKeys, s as FocusManagerPlugin, fe as FocusOutliner, T as Focusable, te as FullScreenPlugin, ye as GesturePlugin, nr as Input, a as InputControllerTypes, ct as InputPlugin, E as Interactive, Bn as JOYSTICK_DIRECTIONS, rr as Joystick, W as JoystickDirection, ft as KeyboardControls, r as KeyboardPlugin, x as Logger, Ve as LookupPlugin, Dt as ParticleContainer, zt as ParticleContainerConfigKeys, we as Plugin, or as Popup, Fe as PopupManagerPlugin, o as Queue, y as ResizerPlugin, Xn as Scene, Ke as SceneManagerPlugin, Zn as SceneTransition, tn as ScreenDebugPlugin, C as Signal, fr as SignalConnections, Jt as SpineAnimation, ae as Store, bt as Svg, er as TextPropsKeys, Qe as Timer, nt as TimerPlugin, Bt as Toast, Nt as Toaster, _ as TouchControls, _ as VirtualControls, jt as UICanvas, Ut as UICanvasConfigKeys, Ae as WebEventsPlugin, ze as WithLifecycle, h as WithSignals, at as add, Ze as addToPoint, f as bindAllMethods, ie as bindMethods, _e as bool, n as capitalize, We as capitalizeWords, On as center, se as checkAndInvokeMethod, Re as clamp, Kt as computeEffectivePadding, it as coreFunctionRegistry, Xe as coreSignalRegistry, Q as create, Z as createContainer, Et as createDebugGraphics, Ot as createDebugLabel, ee as createFactoryMethods, dt as createQueue, Ye as debounce, b as deepMerge, m as defaultActionsList, ue as defaultBreakpoints, Ht as defaultFactoryMethods, l as defaultGestureOptions, qt as defaultToastConfig, Ln as defineActions, zn as defineBreakpoints, Rn as defineButtons, De as defineConfig, In as defineContexts, Vn as defineControls, $t as defineData, gn as defineEntity, mn as definePlugin, hn as definePopup, pn as defineScene, _n as defineUI, be as delay, ln as destroyCanvas, tt as distance, He as distanceSq, D as ensurePadding, le as env, jn as filterSet, Mn as firstFromSet, _t as floatBetween, i as floatBetweenPoint, Ne as formatTime, ge as generatePluginList, St as getDebugRegistry, ve as getDynamicModuleFromImportListItem, Mt as getErrorTexture, lt as getFirstMapEntry, ht as getLastMapEntry, B as getNearestCharacterIndex, Me as getNextMapEntry, Pe as getOrientation, pt as getPreviousMapEntry, cn as getRandomElement, Lt as getRegisteredEntityIds, Gt as getRegisteredUIIds, vt as getZeroPaddedNumber, ut as i18nPlugin, Gn as installCaperGlobal, g as intBetween, ne as intBetweenPoint, z as isAndroid, de as isDev, En as isIos, R as isMobile, he as isProduction, u as isPromise, Tn as isRetina, Ee as isStorageCapable, Wt as isText, L as isTouch, Nn as lastFromSet, ke as lerp, je as lerpPoint, $e as magnitude, rt as multiply, Ce as normalizeKey, yn as objectDiagonal, Dn as offset, Sn as offsetShape, Cn as offsetSimpleShape, Ie as omitKeys, H as pixiVersion, et as pluck, Se as randomUUID, vn as reParent, Y as registerCaperApp, Ct as registerDebug, Xt as resolveAnchor, Qt as resolvePadding, kt as resolvePivot, v as resolvePointLike, yt as resolvePosition, Yt as resolveScale, Be as resolveSizeLike, At as resolveTexture, xt as resolveUnknownKeys, U as sayHello, kn as scale, I as scaleToHeight, wn as scaleToSize, F as scaleToWidth, P as scaleUniform, xn as sendToBack, bn as sendToFront, ot as shouldEnableScreenDebug, sn as shuffle, X as signalCaperReady, An as size, e as sortPluginsByRequires, qe as subtract, st as subtractFromPoint, un as toHex, dn as toRgb, wt as unregisterDebug, V as version, c as wait };
|
|
1233
1234
|
|
|
1234
1235
|
//# sourceMappingURL=caper.mjs.map
|