@caperjs/core 0.7.2 → 0.7.3
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/cli/native.mjs +21 -4
- package/cli/native.test.mjs +35 -3
- package/extras/llms.txt +10 -1
- package/lib/caper.mjs +86 -86
- package/lib/caper.mjs.map +1 -1
- package/lib/{const-Cj14a5U2.js → const-BClauBNo.js} +103 -95
- package/lib/{const-Cj14a5U2.js.map → const-BClauBNo.js.map} +1 -1
- package/lib/ui/UICanvas.d.ts +10 -2
- package/lib/ui/UICanvas.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ui/UICanvas.test.ts +23 -1
- package/src/ui/UICanvas.ts +22 -3
- package/src/version.ts +1 -1
package/lib/caper.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
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-DmNGVLAi.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,
|
|
3
|
-
import { n as
|
|
4
|
-
import { r as
|
|
5
|
-
import { t as
|
|
6
|
-
import { CanvasTextMetrics as O, Container as
|
|
7
|
-
import { gsap as
|
|
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, R as kt, S as At, T as jt, _ as T, a as Mt, b as Nt, c as Pt, d as Ft, f as It, g as Lt, h as Rt, i as zt, j as Bt, k as Vt, l as Ht, m as Ut, n as Wt, o as Gt, p as Kt, r as qt, s as Jt, u as Yt, v as E, w as Xt, x as Zt, y as Qt } from "./const-BClauBNo.js";
|
|
3
|
+
import { n as $t, t as D } from "./padding-1kHDpGlQ.js";
|
|
4
|
+
import { r as en, t as tn } from "./DataAdapter-T-22-_D1.js";
|
|
5
|
+
import { t as nn } from "./ScreenDebugPlugin-kz9Mr6j1.js";
|
|
6
|
+
import { CanvasTextMetrics as O, Container as rn, Graphics as k, Point as A, Polygon as an, Rectangle as on, Sprite as j, Texture as M, isMobile as N } from "pixi.js";
|
|
7
|
+
import { gsap as P } from "gsap";
|
|
8
8
|
//#region src/utils/array.ts
|
|
9
9
|
function sn(e) {
|
|
10
10
|
let t, n;
|
|
@@ -132,7 +132,7 @@ function xn(e) {
|
|
|
132
132
|
t && (t.removeChild(e), t.addChildAt(e, 0));
|
|
133
133
|
}
|
|
134
134
|
function Sn(e, t) {
|
|
135
|
-
if (e instanceof
|
|
135
|
+
if (e instanceof an) {
|
|
136
136
|
for (let n = 0; n < e.points.length; n += 2) e.points[n] += t.x, e.points[n + 1] += t.y;
|
|
137
137
|
return e;
|
|
138
138
|
} else return e.x += t.x, e.y += t.y, e;
|
|
@@ -140,26 +140,26 @@ function Sn(e, t) {
|
|
|
140
140
|
function Cn(e, t) {
|
|
141
141
|
return e.x += t.x, e.y += t.y, e;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function F(e, t, n = "width") {
|
|
144
144
|
let r = n === "width" ? "y" : "x", i = n === "width" ? "x" : "y";
|
|
145
145
|
e[n] = t, e.scale[r] = e.scale[i];
|
|
146
146
|
}
|
|
147
|
-
function F(e, t) {
|
|
148
|
-
P(e, t, "width");
|
|
149
|
-
}
|
|
150
147
|
function I(e, t) {
|
|
151
|
-
|
|
148
|
+
F(e, t, "width");
|
|
149
|
+
}
|
|
150
|
+
function L(e, t) {
|
|
151
|
+
F(e, t, "height");
|
|
152
152
|
}
|
|
153
153
|
function wn(e, t, n = "width") {
|
|
154
154
|
let r;
|
|
155
155
|
r = t?.width && t?.height ? {
|
|
156
156
|
x: t.width,
|
|
157
157
|
y: t.height
|
|
158
|
-
} : v(t), n === "width" ? (
|
|
158
|
+
} : v(t), n === "width" ? (I(e, r.x), e.height < r.y && L(e, r.y)) : (L(e, r.y), e.width < r.x && I(e, r.x));
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/utils/platform.ts
|
|
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,
|
|
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, R = typeof window < "u" ? "ontouchstart" in window || navigator.maxTouchPoints > 0 : !1, En = typeof window < "u" ? "__TAURI_INTERNALS__" in window : !1, z = N.any, B = N.android.device, Dn = N.apple.device;
|
|
163
163
|
//#endregion
|
|
164
164
|
//#region src/utils/rect.ts
|
|
165
165
|
function On(e, t) {
|
|
@@ -191,7 +191,7 @@ function Pn(e) {
|
|
|
191
191
|
}
|
|
192
192
|
//#endregion
|
|
193
193
|
//#region src/utils/text.ts
|
|
194
|
-
function
|
|
194
|
+
function V(e, t) {
|
|
195
195
|
let n = O.measureText(e.text, e.style), r = n.lines, i = n.lineHeight, a = e.toLocal(new A(t.pageX, t.pageY)), o = 0, s = Infinity, c = 0;
|
|
196
196
|
for (let t = 0; t < r.length; t++) {
|
|
197
197
|
let n = r[t];
|
|
@@ -205,9 +205,9 @@ function B(e, t) {
|
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/version.ts
|
|
208
|
-
var
|
|
209
|
-
function
|
|
210
|
-
let e = `\n${Fn}\n\n v${
|
|
208
|
+
var H = "0.7.3", U = "8.22.0", Fn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
|
|
209
|
+
function W() {
|
|
210
|
+
let e = `\n${Fn}\n\n v${H} | %cPixi.js v${U} %c| %chttps://github.com/anthonysapp/caper\n\n`;
|
|
211
211
|
console.log(e, "color: #E91E63; font-weight: 600;", "color: inherit;", "color: #00BCD4; text-decoration: underline;");
|
|
212
212
|
}
|
|
213
213
|
//#endregion
|
|
@@ -241,18 +241,18 @@ function Bn(e) {
|
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/plugins/input/touch/constants.ts
|
|
244
|
-
var
|
|
244
|
+
var G = /* @__PURE__ */ function(e) {
|
|
245
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;
|
|
246
246
|
}({}), Vn = [
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
247
|
+
G.None,
|
|
248
|
+
G.Left,
|
|
249
|
+
G.Top,
|
|
250
|
+
G.Bottom,
|
|
251
|
+
G.Right,
|
|
252
|
+
G.TopLeft,
|
|
253
|
+
G.TopRight,
|
|
254
|
+
G.BottomLeft,
|
|
255
|
+
G.BottomRight
|
|
256
256
|
];
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/plugins/input/methods.ts
|
|
@@ -261,7 +261,7 @@ function Hn(e, t, n) {
|
|
|
261
261
|
}
|
|
262
262
|
//#endregion
|
|
263
263
|
//#region src/core/globals.ts
|
|
264
|
-
var
|
|
264
|
+
var K = 200, Un = "CaperApplication";
|
|
265
265
|
function Wn() {
|
|
266
266
|
try {
|
|
267
267
|
return globalThis.Caper?.__dev === !0;
|
|
@@ -276,8 +276,8 @@ function Gn() {
|
|
|
276
276
|
return !1;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
function
|
|
279
|
+
var q = "__first__";
|
|
280
|
+
function J() {
|
|
281
281
|
let e = globalThis, t = e.Caper ||= {};
|
|
282
282
|
return t.apps instanceof Map || (t.apps = /* @__PURE__ */ new Map()), (typeof t.automation != "object" || t.automation === null) && (t.automation = {}), t.__readyResolvers instanceof Map || (t.__readyResolvers = /* @__PURE__ */ new Map()), t.__readyApps instanceof Set || (t.__readyApps = /* @__PURE__ */ new Set()), typeof t.ready != "function" && (t.ready = (e) => {
|
|
283
283
|
let n = t.__readyResolvers, r = t.__readyApps;
|
|
@@ -286,7 +286,7 @@ function q() {
|
|
|
286
286
|
let e = r.values().next().value;
|
|
287
287
|
return Promise.resolve(t.apps.get(e));
|
|
288
288
|
}
|
|
289
|
-
let i = e ??
|
|
289
|
+
let i = e ?? q, a = n.get(i);
|
|
290
290
|
if (!a) {
|
|
291
291
|
let e, t = new Promise((t) => {
|
|
292
292
|
e = t;
|
|
@@ -300,14 +300,14 @@ function q() {
|
|
|
300
300
|
}), t;
|
|
301
301
|
}
|
|
302
302
|
function Kn() {
|
|
303
|
-
|
|
303
|
+
J();
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function Y(e) {
|
|
306
306
|
return e.config?.id || Un;
|
|
307
307
|
}
|
|
308
308
|
function qn(e) {
|
|
309
|
-
let t =
|
|
310
|
-
n.push(e), n.length >
|
|
309
|
+
let t = Y(e), n = [], r, i = [], a = (e) => {
|
|
310
|
+
n.push(e), n.length > K && n.splice(0, n.length - K);
|
|
311
311
|
}, o = () => r ? r() : void 0, s = (e) => {
|
|
312
312
|
if (i.length !== 0) for (let t = i.length - 1; t >= 0; t--) {
|
|
313
313
|
let n = !1;
|
|
@@ -377,40 +377,40 @@ function qn(e) {
|
|
|
377
377
|
});
|
|
378
378
|
})), c;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
381
|
-
let t =
|
|
380
|
+
function X(e) {
|
|
381
|
+
let t = J(), n = Y(e);
|
|
382
382
|
if (t.apps.set(n, e), t.app = e, Wn() || e.config?.automation === !0 || Gn()) {
|
|
383
383
|
let r = qn(e);
|
|
384
384
|
t.automation[n] = r, e.automation = r;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
function
|
|
388
|
-
let t =
|
|
387
|
+
function Z(e) {
|
|
388
|
+
let t = J(), n = Y(e);
|
|
389
389
|
t.__readyApps.add(n);
|
|
390
390
|
let r = t.__readyResolvers, i = r.get(n);
|
|
391
391
|
i && (i.resolve(e), r.delete(n));
|
|
392
|
-
let a = r.get(
|
|
393
|
-
a && (a.resolve(e), r.delete(
|
|
392
|
+
let a = r.get(q);
|
|
393
|
+
a && (a.resolve(e), r.delete(q));
|
|
394
394
|
}
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/core/create.ts
|
|
397
397
|
var Jn = "caper-game-container";
|
|
398
|
-
function
|
|
398
|
+
function Q(e) {
|
|
399
399
|
let t = document.createElement("div");
|
|
400
400
|
return t.setAttribute("id", e), document.body.appendChild(t), t;
|
|
401
401
|
}
|
|
402
|
-
async function
|
|
402
|
+
async function Yn() {
|
|
403
403
|
return new Promise((e) => {
|
|
404
404
|
document.readyState === "complete" || document.readyState === "interactive" ? e(!0) : document.addEventListener("DOMContentLoaded", () => {
|
|
405
405
|
e(!0);
|
|
406
406
|
});
|
|
407
407
|
});
|
|
408
408
|
}
|
|
409
|
-
async function
|
|
410
|
-
let { defaultFactoryMethods: r } = await import("./const-
|
|
411
|
-
Te(r), await
|
|
409
|
+
async function Xn(e = { id: "CaperApplication" }, t = Jn, n = !0) {
|
|
410
|
+
let { defaultFactoryMethods: r } = await import("./const-BClauBNo.js").then((e) => e.t);
|
|
411
|
+
Te(r), await Yn(), In(), n && W();
|
|
412
412
|
let i = null;
|
|
413
|
-
if (typeof t == "string" ? (i = document.getElementById(t), i ||=
|
|
413
|
+
if (typeof t == "string" ? (i = document.getElementById(t), i ||= Q(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.");
|
|
414
414
|
e.resizeToContainer && (e.resizeTo = i), e.useLayout && (e.layout = {
|
|
415
415
|
autoUpdate: !1,
|
|
416
416
|
enableDebug: !1,
|
|
@@ -422,15 +422,15 @@ async function Yn(e = { id: "CaperApplication" }, t = Jn, n = !0) {
|
|
|
422
422
|
position: "absolute",
|
|
423
423
|
width: "100%",
|
|
424
424
|
height: "100%"
|
|
425
|
-
}), await a._postInitialize(),
|
|
425
|
+
}), await a._postInitialize(), X(a), globalThis.Caper?.__runtimeManaged || Z(a), a;
|
|
426
426
|
}
|
|
427
427
|
//#endregion
|
|
428
428
|
//#region src/display/Entity.ts
|
|
429
|
-
var
|
|
429
|
+
var Zn = class extends S {
|
|
430
430
|
constructor(e) {
|
|
431
431
|
super(), this.props = e ?? {};
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, Qn = class extends S {
|
|
434
434
|
get animationContext() {
|
|
435
435
|
return this._animationContext ?? `__scene_${this.id}`;
|
|
436
436
|
}
|
|
@@ -465,7 +465,7 @@ var Xn = class extends S {
|
|
|
465
465
|
}
|
|
466
466
|
onPause(e) {}
|
|
467
467
|
onResume(e) {}
|
|
468
|
-
},
|
|
468
|
+
}, $n = class extends S {
|
|
469
469
|
get active() {
|
|
470
470
|
return this._active;
|
|
471
471
|
}
|
|
@@ -506,7 +506,7 @@ var Xn = class extends S {
|
|
|
506
506
|
_update(e) {
|
|
507
507
|
this.active && this.initialized && this.update(e);
|
|
508
508
|
}
|
|
509
|
-
},
|
|
509
|
+
}, er = class extends rn {
|
|
510
510
|
constructor(e) {
|
|
511
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;
|
|
512
512
|
}
|
|
@@ -579,7 +579,7 @@ var Xn = class extends S {
|
|
|
579
579
|
} else this.pivot.set(this._targetPivot.x, this._targetPivot.y);
|
|
580
580
|
this.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
|
|
581
581
|
}
|
|
582
|
-
},
|
|
582
|
+
}, tr = class {
|
|
583
583
|
constructor(e, t) {
|
|
584
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));
|
|
585
585
|
}
|
|
@@ -626,7 +626,7 @@ var Xn = class extends S {
|
|
|
626
626
|
getEventPosition(e) {
|
|
627
627
|
return e instanceof TouchEvent ? new A(e.touches[0].clientX, e.touches[0].clientY) : new A(e.clientX, e.clientY);
|
|
628
628
|
}
|
|
629
|
-
},
|
|
629
|
+
}, nr = [
|
|
630
630
|
"text",
|
|
631
631
|
"anchor",
|
|
632
632
|
"roundPixels",
|
|
@@ -671,14 +671,14 @@ var Xn = class extends S {
|
|
|
671
671
|
scale: 1,
|
|
672
672
|
marginTop: 60
|
|
673
673
|
}
|
|
674
|
-
},
|
|
674
|
+
}, rr = [
|
|
675
675
|
"text",
|
|
676
676
|
"password",
|
|
677
677
|
"number",
|
|
678
678
|
"email",
|
|
679
679
|
"tel",
|
|
680
680
|
"url"
|
|
681
|
-
],
|
|
681
|
+
], ir = class e extends E(T(h(S))) {
|
|
682
682
|
constructor(e, t = !1, n = null) {
|
|
683
683
|
if (super({
|
|
684
684
|
autoUpdate: !0,
|
|
@@ -723,7 +723,7 @@ var Xn = class extends S {
|
|
|
723
723
|
width: "100%",
|
|
724
724
|
height: "100%"
|
|
725
725
|
}
|
|
726
|
-
}), this._placeholderContainer.eventMode = "none", this.addSelection(), this.addCaret(), this.addInput(), this.addPlaceholder(), this.placeholder.text = this.options.placeholder.text || `Enter ${this.options.type}`, this.input.eventMode = this.placeholder.eventMode = "none",
|
|
726
|
+
}), this._placeholderContainer.eventMode = "none", this.addSelection(), this.addCaret(), this.addInput(), this.addPlaceholder(), this.placeholder.text = this.options.placeholder.text || `Enter ${this.options.type}`, this.input.eventMode = this.placeholder.eventMode = "none", R && this.addSignalConnection(this.onInteraction("pointertap").connect(this.handleClick, -1)), this.addSignalConnection(this.onInteraction("click").connect(this.handleClick, -1)), this.options.fixed) {
|
|
727
727
|
let e = this.isClone ? this.clone?.options?.focusOverlay?.scale ?? 1 : 1;
|
|
728
728
|
this._mask = this._inner.add.graphics().rect(0, 0, this.bg.width * e - this.options.padding.left - this.options.padding.right, this.bg.height * e - this.options.padding.top - this.options.padding.bottom).fill({ color: 0 }), this._inputContainer.mask = this._mask;
|
|
729
729
|
}
|
|
@@ -771,7 +771,7 @@ var Xn = class extends S {
|
|
|
771
771
|
handleClick(e) {
|
|
772
772
|
if (e?.originalEvent?.key) return;
|
|
773
773
|
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer);
|
|
774
|
-
let t = e ?
|
|
774
|
+
let t = e ? V(this.input, e) : this.input.text?.length ?? 0;
|
|
775
775
|
this.createDomElement(t);
|
|
776
776
|
}
|
|
777
777
|
focusIn() {
|
|
@@ -825,7 +825,7 @@ var Xn = class extends S {
|
|
|
825
825
|
if (this.placeholder.visible = !0, !this.isClone && this._placeholderPositioned && !this._placeholderAnimating) {
|
|
826
826
|
this._placeholderAnimating = !0;
|
|
827
827
|
let e = this.input.x, t = this.input.y;
|
|
828
|
-
this.options.placeholder.animationOnType ? this.addAnimation([
|
|
828
|
+
this.options.placeholder.animationOnType ? this.addAnimation([P.to(this.placeholder, {
|
|
829
829
|
x: e,
|
|
830
830
|
y: t,
|
|
831
831
|
tint: 16777215,
|
|
@@ -836,7 +836,7 @@ var Xn = class extends S {
|
|
|
836
836
|
onComplete: () => {
|
|
837
837
|
this._placeholderPositioned = !1, this._placeholderAnimating = !1;
|
|
838
838
|
}
|
|
839
|
-
}),
|
|
839
|
+
}), P.to(this.placeholder.scale, {
|
|
840
840
|
x: 1,
|
|
841
841
|
y: 1,
|
|
842
842
|
duration: this.options.placeholder.animationOnType.duration || .4,
|
|
@@ -861,7 +861,7 @@ var Xn = class extends S {
|
|
|
861
861
|
e += n.x, t += n.y;
|
|
862
862
|
}
|
|
863
863
|
if (this.options.placeholder.animationOnType) {
|
|
864
|
-
if (this.addAnimation(
|
|
864
|
+
if (this.addAnimation(P.to(this.placeholder, {
|
|
865
865
|
x: e,
|
|
866
866
|
y: t,
|
|
867
867
|
duration: this.options.placeholder.animationOnType.duration || .4,
|
|
@@ -871,7 +871,7 @@ var Xn = class extends S {
|
|
|
871
871
|
overwrite: !0
|
|
872
872
|
})), this.options.placeholder.scaleOnType) {
|
|
873
873
|
let e = v(this.options.placeholder.scaleOnType);
|
|
874
|
-
this.addAnimation(
|
|
874
|
+
this.addAnimation(P.to(this.placeholder.scale, {
|
|
875
875
|
x: e.x,
|
|
876
876
|
y: e.y,
|
|
877
877
|
duration: this.options.placeholder.animationOnType.duration || .4,
|
|
@@ -917,7 +917,7 @@ var Xn = class extends S {
|
|
|
917
917
|
}
|
|
918
918
|
addCaret() {
|
|
919
919
|
this.caret = this._inputContainer.add.sprite({
|
|
920
|
-
asset:
|
|
920
|
+
asset: M.WHITE,
|
|
921
921
|
width: 3,
|
|
922
922
|
height: 10,
|
|
923
923
|
tint: this.options.caret.color ?? 0,
|
|
@@ -958,9 +958,9 @@ var Xn = class extends S {
|
|
|
958
958
|
this.domElement = this.clone.domElement, this._addDomElementListeners();
|
|
959
959
|
return;
|
|
960
960
|
}
|
|
961
|
-
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 && rr.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);
|
|
962
962
|
let t = this.getGlobalPosition(), n = this.getBounds();
|
|
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 =
|
|
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 = B ? "0" : `${n.left}px`, this.domElement.style.top = B ? "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);
|
|
964
964
|
}
|
|
965
965
|
destroyDomElement() {
|
|
966
966
|
this.isClone || (this.domElement &&= (this._removeDomElementListeners(), this.domElement.remove(), this.domElement.parentNode && this.domElement.parentNode.removeChild(this.domElement), null));
|
|
@@ -972,7 +972,7 @@ var Xn = class extends S {
|
|
|
972
972
|
this.cursorAnimation?.kill(), this.caret.visible = !1;
|
|
973
973
|
}
|
|
974
974
|
blinkCaret() {
|
|
975
|
-
this.cursorAnimation && this.cursorAnimation.kill(), this.cursorAnimation =
|
|
975
|
+
this.cursorAnimation && this.cursorAnimation.kill(), this.cursorAnimation = P.fromTo(this.caret, { alpha: 0 }, {
|
|
976
976
|
duration: .5,
|
|
977
977
|
alpha: 1,
|
|
978
978
|
yoyo: !0,
|
|
@@ -1005,7 +1005,7 @@ var Xn = class extends S {
|
|
|
1005
1005
|
let n = Array.isArray(this.options.focusOverlay.activeFilter), r = !1;
|
|
1006
1006
|
if (n) {
|
|
1007
1007
|
let e = this.options.focusOverlay.activeFilter;
|
|
1008
|
-
(
|
|
1008
|
+
(z && e.includes("mobile") || R && e.includes("touch") || !z && !R && e.includes("desktop")) && (r = !0);
|
|
1009
1009
|
} else r = typeof this.options.focusOverlay.activeFilter == "function" ? this.options.focusOverlay.activeFilter() : t;
|
|
1010
1010
|
if (r) {
|
|
1011
1011
|
let t = structuredClone(this.options), n = this.options.focusOverlay?.scale || 1;
|
|
@@ -1013,7 +1013,7 @@ var Xn = class extends S {
|
|
|
1013
1013
|
let r = Number(t.style?.fontSize || $.style?.fontSize || 20) * n;
|
|
1014
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) {
|
|
1015
1015
|
let e = this.make.sprite({
|
|
1016
|
-
asset:
|
|
1016
|
+
asset: M.WHITE,
|
|
1017
1017
|
tint: this.options.focusOverlay.backing.options?.color ?? 0,
|
|
1018
1018
|
alpha: this.options.focusOverlay.backing.options?.alpha ?? .8,
|
|
1019
1019
|
width: this.app.size.width,
|
|
@@ -1028,12 +1028,12 @@ var Xn = class extends S {
|
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
_showCloneOverlay() {
|
|
1031
|
-
this.cloneOverlay.pivot.y = -20, this.addAnimation(
|
|
1031
|
+
this.cloneOverlay.pivot.y = -20, this.addAnimation(P.to(this.cloneOverlay, {
|
|
1032
1032
|
duration: .5,
|
|
1033
1033
|
alpha: .8,
|
|
1034
1034
|
ease: "sine.out",
|
|
1035
1035
|
delay: .1
|
|
1036
|
-
})), this.addAnimation(
|
|
1036
|
+
})), this.addAnimation(P.to(this.cloneOverlay.pivot, {
|
|
1037
1037
|
duration: .5,
|
|
1038
1038
|
y: 0,
|
|
1039
1039
|
ease: "sine.out",
|
|
@@ -1074,7 +1074,7 @@ var Xn = class extends S {
|
|
|
1074
1074
|
else {
|
|
1075
1075
|
r = i.substring(e > t ? t : e, e > t ? e : t);
|
|
1076
1076
|
let a = i.substring(0, e > t ? t : e), o = O.measureText(a, this.input.style), s = O.measureText(r, this.input.style);
|
|
1077
|
-
this._selectionRect = new
|
|
1077
|
+
this._selectionRect = new on(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
_handleDomElementChange(e) {
|
|
@@ -1093,9 +1093,9 @@ var Xn = class extends S {
|
|
|
1093
1093
|
let e = this._inputContainer.getBounds();
|
|
1094
1094
|
return e.width = this._lastWidth, e.height = this._lastHeight, e;
|
|
1095
1095
|
}
|
|
1096
|
-
},
|
|
1096
|
+
}, ar = class extends S {
|
|
1097
1097
|
constructor(e) {
|
|
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 =
|
|
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 = G.None, this.settings = Object.assign({
|
|
1099
1099
|
outerScale: 1,
|
|
1100
1100
|
innerScale: 1
|
|
1101
1101
|
}, e), !this.settings.outer) {
|
|
@@ -1113,12 +1113,12 @@ var Xn = class extends S {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
handleDragMove(e) {
|
|
1115
1115
|
if (!this.dragging || e.pointerId !== this._pointerId) return;
|
|
1116
|
-
let t = this.toLocal(e.global), n = t.x - this.startPosition.x, r = t.y - this.startPosition.y, i = new A(0, 0), a = 0, o =
|
|
1116
|
+
let t = this.toLocal(e.global), n = t.x - this.startPosition.x, r = t.y - this.startPosition.y, i = new A(0, 0), a = 0, o = G.None;
|
|
1117
1117
|
if (n == 0 && r == 0) {
|
|
1118
1118
|
this.direction = o;
|
|
1119
1119
|
return;
|
|
1120
1120
|
}
|
|
1121
|
-
if (n === 0 && (r > 0 ? (i.set(0, r > this.outerRadius ? this.outerRadius : r), a = 270, o =
|
|
1121
|
+
if (n === 0 && (r > 0 ? (i.set(0, r > this.outerRadius ? this.outerRadius : r), a = 270, o = G.Bottom) : (i.set(0, -(Math.abs(r) > this.outerRadius ? this.outerRadius : Math.abs(r))), a = 90, o = G.Top), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
|
|
1122
1122
|
this.direction = o, this.onChange.emit({
|
|
1123
1123
|
angle: a,
|
|
1124
1124
|
direction: o,
|
|
@@ -1126,7 +1126,7 @@ var Xn = class extends S {
|
|
|
1126
1126
|
});
|
|
1127
1127
|
return;
|
|
1128
1128
|
}
|
|
1129
|
-
if (r === 0 && (n > 0 ? (i.set(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n), 0), a = 0, o =
|
|
1129
|
+
if (r === 0 && (n > 0 ? (i.set(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n), 0), a = 0, o = G.Right) : (i.set(-(Math.abs(n) > this.outerRadius ? this.outerRadius : Math.abs(n)), 0), a = 180, o = G.Left), this.inner.position.set(i.x, i.y), this.power = this.getPower(i), this.power >= this.threshold)) {
|
|
1130
1130
|
this.direction = o, this.onChange.emit({
|
|
1131
1131
|
angle: a,
|
|
1132
1132
|
direction: o,
|
|
@@ -1150,7 +1150,7 @@ var Xn = class extends S {
|
|
|
1150
1150
|
this._pointerId === void 0 && (this._pointerId = e.pointerId, this.startPosition = this.toLocal(e.global), this.dragging = !0, this.inner.alpha = 1, this.onStart.emit());
|
|
1151
1151
|
}
|
|
1152
1152
|
handleDragEnd(e) {
|
|
1153
|
-
this._pointerId === e.pointerId && (this.direction =
|
|
1153
|
+
this._pointerId === e.pointerId && (this.direction = G.None, this.inner.position.set(0, 0), this.dragging = !1, this.inner.alpha = this.innerAlphaStandby, this.onEnd.emit(), this._pointerId = void 0);
|
|
1154
1154
|
}
|
|
1155
1155
|
bindEvents() {
|
|
1156
1156
|
this.eventMode = "static", this.on("pointerdown", this.handleDragStart).on("pointerup", this.handleDragEnd).on("pointerupoutside", this.handleDragEnd).on("pointermove", this.handleDragMove), window.addEventListener("pointerup", this.handleDragEnd);
|
|
@@ -1161,24 +1161,24 @@ var Xn = class extends S {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
getDirection(e) {
|
|
1163
1163
|
let t = Math.atan2(e.y, e.x);
|
|
1164
|
-
return t >= -Math.PI / 8 && t < 0 || t >= 0 && t < Math.PI / 8 ?
|
|
1164
|
+
return t >= -Math.PI / 8 && t < 0 || t >= 0 && t < Math.PI / 8 ? G.Right : t >= Math.PI / 8 && t < 3 * Math.PI / 8 ? G.BottomRight : t >= 3 * Math.PI / 8 && t < 5 * Math.PI / 8 ? G.Bottom : t >= 5 * Math.PI / 8 && t < 7 * Math.PI / 8 ? G.BottomLeft : t >= 7 * Math.PI / 8 && t < Math.PI || t >= -Math.PI && t < -7 * Math.PI / 8 ? G.Left : t >= -7 * Math.PI / 8 && t < -5 * Math.PI / 8 ? G.TopLeft : t >= -5 * Math.PI / 8 && t < -3 * Math.PI / 8 ? G.Top : G.TopRight;
|
|
1165
1165
|
}
|
|
1166
|
-
},
|
|
1166
|
+
}, or = {
|
|
1167
1167
|
color: 0,
|
|
1168
1168
|
alpha: .75
|
|
1169
|
-
},
|
|
1169
|
+
}, sr = {
|
|
1170
1170
|
backing: !0,
|
|
1171
1171
|
closeOnEscape: !0,
|
|
1172
1172
|
closeOnPointerDownOutside: !0,
|
|
1173
1173
|
actionContext: "popup"
|
|
1174
|
-
},
|
|
1174
|
+
}, cr = class e extends S {
|
|
1175
1175
|
get actionContext() {
|
|
1176
1176
|
return this.config.actionContext;
|
|
1177
1177
|
}
|
|
1178
1178
|
constructor(e, t = {}) {
|
|
1179
1179
|
super(), this.id = e, this.isShowing = !1, this._storedActionContext = void 0, this.config = Object.assign({
|
|
1180
1180
|
id: e,
|
|
1181
|
-
...
|
|
1181
|
+
...sr
|
|
1182
1182
|
}, t), this._initialize();
|
|
1183
1183
|
}
|
|
1184
1184
|
get data() {
|
|
@@ -1187,7 +1187,7 @@ var Xn = class extends S {
|
|
|
1187
1187
|
static makeBacking(e, t) {
|
|
1188
1188
|
let n = {};
|
|
1189
1189
|
typeof e == "object" && (n = e);
|
|
1190
|
-
let r = Object.assign({ ...
|
|
1190
|
+
let r = Object.assign({ ...or }, n), i = new j(M.WHITE);
|
|
1191
1191
|
return i.anchor.set(.5), i.alpha = r.alpha, i.tint = r.color, i.width = t.width, i.height = t.height, i;
|
|
1192
1192
|
}
|
|
1193
1193
|
initialize() {}
|
|
@@ -1229,7 +1229,7 @@ var Xn = class extends S {
|
|
|
1229
1229
|
restoreActionContext() {
|
|
1230
1230
|
this._storedActionContext && (x.log("Popup", "Restoring action context", this._storedActionContext), this.app.actionContext = this._storedActionContext), this._storedActionContext = void 0;
|
|
1231
1231
|
}
|
|
1232
|
-
},
|
|
1233
|
-
export { gt as ActionsPlugin, Oe as Animated,
|
|
1232
|
+
}, lr = p.Collector, ur = p.CollectorArray, dr = p.CollectorLast, fr = p.CollectorUntil0, pr = p.CollectorWhile0, mr = p.SignalConnections;
|
|
1233
|
+
export { gt as ActionsPlugin, Oe as Animated, Nt as AnimatedSprite, w as Application, xe as AssetsPlugin, Ue as AudioChannel, t as AudioInstance, Ge as AudioManagerPlugin, ce as BreakpointPlugin, Rt as Button, Lt as ButtonConfigKeys, er as Camera, tr as CameraController, pe as CaperEvent, lr as Collector, ur as CollectorArray, dr as CollectorLast, fr as CollectorUntil0, pr as CollectorWhile0, fn as Color, S as Container, Je as ContainerConfigKeys, mt as Controls, tn as DataAdapter, Tt as DebugAlpha, Et as DebugColors, me as DefaultActionContexts, d as DefaultActionContextsArray, re as DefaultActions, oe as DefaultButtonIds, Zn as Entity, Le as Factory, It as FlexContainer, Kt as FlexContainerConfigKeys, s as FocusManagerPlugin, fe as FocusOutliner, E as Focusable, te as FullScreenPlugin, ye as GesturePlugin, ir as Input, a as InputControllerTypes, ct as InputPlugin, T as Interactive, Vn as JOYSTICK_DIRECTIONS, ar as Joystick, G as JoystickDirection, ft as KeyboardControls, r as KeyboardPlugin, x as Logger, Ve as LookupPlugin, Vt as ParticleContainer, vt as ParticleContainerConfigKeys, we as Plugin, cr as Popup, Fe as PopupManagerPlugin, o as Queue, y as ResizerPlugin, Qn as Scene, Ke as SceneManagerPlugin, $n as SceneTransition, nn as ScreenDebugPlugin, C as Signal, mr as SignalConnections, Qt as SpineAnimation, ae as Store, Dt as Svg, nr as TextPropsKeys, Qe as Timer, nt as TimerPlugin, Yt as Toast, Ht as Toaster, _ as TouchControls, _ as VirtualControls, Mt as UICanvas, Gt 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, kn as center, se as checkAndInvokeMethod, Re as clamp, Jt as computeEffectivePadding, it as coreFunctionRegistry, Xe as coreSignalRegistry, Xn as create, Q as createContainer, Ot as createDebugGraphics, St as createDebugLabel, ee as createFactoryMethods, dt as createQueue, Ye as debounce, b as deepMerge, m as defaultActionsList, ue as defaultBreakpoints, Wt as defaultFactoryMethods, l as defaultGestureOptions, Ft as defaultToastConfig, Rn as defineActions, Bn as defineBreakpoints, zn as defineButtons, De as defineConfig, Ln as defineContexts, Hn as defineControls, en 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, Mn as filterSet, Nn as firstFromSet, _t as floatBetween, i as floatBetweenPoint, Ne as formatTime, ge as generatePluginList, Ct as getDebugRegistry, ve as getDynamicModuleFromImportListItem, Zt as getErrorTexture, lt as getFirstMapEntry, ht as getLastMapEntry, V as getNearestCharacterIndex, Me as getNextMapEntry, Pe as getOrientation, pt as getPreviousMapEntry, cn as getRandomElement, zt as getRegisteredEntityIds, qt as getRegisteredUIIds, Bt as getZeroPaddedNumber, ut as i18nPlugin, Kn as installCaperGlobal, g as intBetween, ne as intBetweenPoint, B as isAndroid, de as isDev, Dn as isIos, z as isMobile, he as isProduction, u as isPromise, Tn as isRetina, Ee as isStorageCapable, En as isTauri, Ut as isText, R as isTouch, Pn as lastFromSet, ke as lerp, je as lerpPoint, $e as magnitude, rt as multiply, Ce as normalizeKey, yn as objectDiagonal, On as offset, Sn as offsetShape, Cn as offsetSimpleShape, Ie as omitKeys, U as pixiVersion, et as pluck, Se as randomUUID, vn as reParent, X as registerCaperApp, wt as registerDebug, At as resolveAnchor, $t as resolvePadding, yt as resolvePivot, v as resolvePointLike, Xt as resolvePosition, Pt as resolveSafeArea, jt as resolveScale, Be as resolveSizeLike, xt as resolveTexture, bt as resolveUnknownKeys, W as sayHello, An as scale, L as scaleToHeight, wn as scaleToSize, I as scaleToWidth, F as scaleUniform, xn as sendToBack, bn as sendToFront, ot as shouldEnableScreenDebug, sn as shuffle, Z as signalCaperReady, jn as size, e as sortPluginsByRequires, qe as subtract, st as subtractFromPoint, un as toHex, dn as toRgb, kt as unregisterDebug, H as version, c as wait };
|
|
1234
1234
|
|
|
1235
1235
|
//# sourceMappingURL=caper.mjs.map
|