@caperjs/core 0.1.1 → 0.1.2
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/lib/{CaptionsPlugin-Dc8fIrjy.js → CaptionsPlugin-DKhbmJvH.js} +15 -15
- package/lib/{CaptionsPlugin-Dc8fIrjy.js.map → CaptionsPlugin-DKhbmJvH.js.map} +1 -1
- package/lib/{DataAdapter-BY2114sp.js → DataAdapter-BZFTkFQ4.js} +4 -4
- package/lib/{DataAdapter-BY2114sp.js.map → DataAdapter-BZFTkFQ4.js.map} +1 -1
- package/lib/{DebugRenderer-BJMLILqI.js → DebugRenderer-C7X-nlXE.js} +2 -2
- package/lib/{DebugRenderer-BJMLILqI.js.map → DebugRenderer-C7X-nlXE.js.map} +1 -1
- package/lib/{DevToolsPlugin-wQ5rOkn0.js → DevToolsPlugin-P-atJ-5U.js} +2 -2
- package/lib/{DevToolsPlugin-wQ5rOkn0.js.map → DevToolsPlugin-P-atJ-5U.js.map} +1 -1
- package/lib/{GSAPPlugin-DHhSZKv8.js → GSAPPlugin-CeH9275z.js} +2 -2
- package/lib/{GSAPPlugin-DHhSZKv8.js.map → GSAPPlugin-CeH9275z.js.map} +1 -1
- package/lib/{LayoutPlugin-B-DF9SYM.js → LayoutPlugin-iZ3k6RsK.js} +4 -4
- package/lib/{LayoutPlugin-B-DF9SYM.js.map → LayoutPlugin-iZ3k6RsK.js.map} +1 -1
- package/lib/{SpinePlugin-Dz_3dljz.js → SpinePlugin-BWiavCpO.js} +2 -2
- package/lib/{SpinePlugin-Dz_3dljz.js.map → SpinePlugin-BWiavCpO.js.map} +1 -1
- package/lib/{StatsPlugin-Cg82JMBD.js → StatsPlugin-CBpzDJL0.js} +4 -4
- package/lib/{StatsPlugin-Cg82JMBD.js.map → StatsPlugin-CBpzDJL0.js.map} +1 -1
- package/lib/{VoiceOverPlugin-BR3ImT8C.js → VoiceOverPlugin-YaiKJtJ6.js} +26 -26
- package/lib/{VoiceOverPlugin-BR3ImT8C.js.map → VoiceOverPlugin-YaiKJtJ6.js.map} +1 -1
- package/lib/caper.mjs +95 -95
- package/lib/caper.mjs.map +1 -1
- package/lib/core/Application.d.ts +1 -1
- package/lib/core/Application.d.ts.map +1 -1
- package/lib/core/interfaces/IApplicationOptions.d.ts +2 -1
- package/lib/core/interfaces/IApplicationOptions.d.ts.map +1 -1
- package/lib/core/interfaces/ICoreSignals.d.ts +5 -1
- package/lib/core/interfaces/ICoreSignals.d.ts.map +1 -1
- package/lib/display/Container.d.ts +1 -1
- package/lib/display/Container.d.ts.map +1 -1
- package/lib/display/ParticleContainer.d.ts +1 -1
- package/lib/display/ParticleContainer.d.ts.map +1 -1
- package/lib/plugins/Plugin.d.ts +1 -1
- package/lib/plugins/Plugin.d.ts.map +1 -1
- package/lib/plugins/defaults.d.ts.map +1 -1
- package/lib/plugins/gesture/GesturePlugin.d.ts +58 -0
- package/lib/plugins/gesture/GesturePlugin.d.ts.map +1 -0
- package/lib/plugins/gesture/gestureMath.d.ts +32 -0
- package/lib/plugins/gesture/gestureMath.d.ts.map +1 -0
- package/lib/plugins/gesture/gestureMath.test.d.ts +2 -0
- package/lib/plugins/gesture/gestureMath.test.d.ts.map +1 -0
- package/lib/plugins/gesture/index.d.ts +3 -0
- package/lib/plugins/gesture/index.d.ts.map +1 -0
- package/lib/plugins/gesture/types.d.ts +45 -0
- package/lib/plugins/gesture/types.d.ts.map +1 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/index.d.ts.map +1 -1
- package/lib/plugins/input/Controls.d.ts +5 -2
- package/lib/plugins/input/Controls.d.ts.map +1 -1
- package/lib/plugins/input/InputPlugin.d.ts +9 -2
- package/lib/plugins/input/InputPlugin.d.ts.map +1 -1
- package/lib/plugins/input/interfaces.d.ts +5 -3
- package/lib/plugins/input/interfaces.d.ts.map +1 -1
- package/lib/plugins/input/touch/{TouchControls.d.ts → VirtualControls.d.ts} +5 -4
- package/lib/plugins/input/touch/VirtualControls.d.ts.map +1 -0
- package/lib/plugins/input/touch/index.d.ts +1 -1
- package/lib/plugins/input/touch/index.d.ts.map +1 -1
- package/lib/{registries-CYCaYKZI.js → registries-qQmLeN0b.js} +505 -354
- package/lib/registries-qQmLeN0b.js.map +1 -0
- package/lib/utils/bind.test.d.ts +2 -0
- package/lib/utils/bind.test.d.ts.map +1 -0
- package/package.json +21 -20
- package/src/core/Application.ts +1 -1
- package/src/core/interfaces/IApplicationOptions.ts +2 -0
- package/src/core/interfaces/ICoreSignals.ts +9 -0
- package/src/display/Container.ts +1 -1
- package/src/display/ParticleContainer.ts +1 -1
- package/src/plugins/Plugin.ts +1 -1
- package/src/plugins/defaults.ts +6 -0
- package/src/plugins/gesture/GesturePlugin.ts +215 -0
- package/src/plugins/gesture/gestureMath.test.ts +75 -0
- package/src/plugins/gesture/gestureMath.ts +59 -0
- package/src/plugins/gesture/index.ts +2 -0
- package/src/plugins/gesture/types.ts +54 -0
- package/src/plugins/index.ts +1 -0
- package/src/plugins/input/Controls.ts +9 -3
- package/src/plugins/input/InputPlugin.ts +61 -14
- package/src/plugins/input/interfaces.ts +5 -3
- package/src/plugins/input/touch/{TouchControls.ts → VirtualControls.ts} +4 -1
- package/src/plugins/input/touch/index.ts +1 -1
- package/src/utils/bind.test.ts +99 -0
- package/src/version.ts +1 -1
- package/LICENSE +0 -22
- package/lib/plugins/input/touch/TouchControls.d.ts.map +0 -1
- package/lib/registries-CYCaYKZI.js.map +0 -1
package/lib/caper.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o,
|
|
2
|
-
import { r as
|
|
3
|
-
import { CanvasTextMetrics as O, Container as
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Cn as s, Ct as c, D as l, Dt as u, E as d, Et as f, F as ee, Ft as p, G as te, Gt as m, H as ne, Ht as re, I as ie, It as ae, J as h, Jt as oe, K as se, Kt as ce, L as le, Lt as ue, M as de, Mt as g, N as fe, Nt as pe, O as me, Ot as he, P as ge, Pt as _e, Q as ve, Qt as ye, R as be, Rt as xe, S as Se, Sn as Ce, St as we, T as Te, Tt as Ee, U as De, Ut as Oe, V as ke, Vt as Ae, W as je, Wt as Me, X as Ne, Xt as Pe, Y as Fe, Yt as Ie, Z as _, Zt as Le, _ as Re, _n as ze, _t as Be, a as Ve, an as He, at as Ue, b as We, bn as Ge, bt as Ke, c as qe, cn as Je, ct as Ye, d as Xe, dn as Ze, dt as Qe, en as $e, et, f as tt, fn as nt, ft as rt, g as it, gn as at, gt as v, h as ot, hn as y, ht as st, i as ct, in as lt, it as ut, j as dt, jt as ft, k as pt, kt as mt, l as ht, ln as b, lt as gt, m as _t, mn as vt, mt as x, n as yt, nn as bt, nt as xt, o as St, on as Ct, ot as wt, p as Tt, pn as Et, pt as S, q as Dt, qt as Ot, r as C, rn as kt, rt as At, s as jt, sn as Mt, st as Nt, t as Pt, tn as Ft, tt as It, u as Lt, un as Rt, ut as w, v as zt, vn as Bt, vt as T, w as Vt, wt as Ht, x as Ut, xn as E, xt as Wt, y as Gt, yn as Kt, yt as D, z as qt, zt as Jt } from "./registries-qQmLeN0b.js";
|
|
2
|
+
import { r as Yt, t as Xt } from "./DataAdapter-BZFTkFQ4.js";
|
|
3
|
+
import { CanvasTextMetrics as O, Container as Zt, Graphics as k, Point as A, Polygon as Qt, Rectangle as $t, Sprite as en, Texture as j, isMobile as M } from "pixi.js";
|
|
4
4
|
import { gsap as N } from "gsap";
|
|
5
5
|
//#region src/utils/array.ts
|
|
6
|
-
function
|
|
6
|
+
function tn(e) {
|
|
7
7
|
let t, n;
|
|
8
|
-
for (let r = 0; r < e.length; ++r) n =
|
|
8
|
+
for (let r = 0; r < e.length; ++r) n = E(0, e.length), t = e[r], e[r] = e[n], e[n] = t;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return e[
|
|
10
|
+
function nn(e) {
|
|
11
|
+
return e[E(0, e.length)];
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/utils/canvas.ts
|
|
15
|
-
function
|
|
15
|
+
function rn(e) {
|
|
16
16
|
let t = e.getContext("webgl");
|
|
17
17
|
if (t) {
|
|
18
18
|
let e = t.getExtension("WEBGL_lose_context");
|
|
@@ -23,13 +23,13 @@ function tn(e) {
|
|
|
23
23
|
}
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/utils/color.ts
|
|
26
|
-
function
|
|
26
|
+
function an(e) {
|
|
27
27
|
return `#${e.toString(16)}`;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function on(e) {
|
|
30
30
|
return parseInt(e.replace(/^#/, ""), 16);
|
|
31
31
|
}
|
|
32
|
-
var
|
|
32
|
+
var sn = class e {
|
|
33
33
|
static {
|
|
34
34
|
this.WHITE = new e(255, 255, 255);
|
|
35
35
|
}
|
|
@@ -97,44 +97,44 @@ var an = class e {
|
|
|
97
97
|
};
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region src/utils/define.ts
|
|
100
|
-
function
|
|
100
|
+
function cn(e) {
|
|
101
101
|
return e;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function ln(e) {
|
|
104
104
|
return e;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function un(e) {
|
|
107
107
|
return e;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function dn(e) {
|
|
110
110
|
return e;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function fn(e) {
|
|
113
113
|
return e;
|
|
114
114
|
}
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/utils/pixi.ts
|
|
117
|
-
function
|
|
117
|
+
function pn(e, t) {
|
|
118
118
|
e.parent && e.parent.worldTransform.apply(e.position, e.position), t.worldTransform.applyInverse(e.position, e.position), e.parent?.removeChild(e), t.addChild(e);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function mn(e) {
|
|
121
121
|
return Math.sqrt(e.width * e.width + e.height * e.height);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function hn(e) {
|
|
124
124
|
let t = e.parent;
|
|
125
125
|
t && (t.removeChild(e), t.addChild(e));
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function gn(e) {
|
|
128
128
|
let t = e.parent;
|
|
129
129
|
t && (t.removeChild(e), t.addChildAt(e, 0));
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
if (e instanceof
|
|
131
|
+
function _n(e, t) {
|
|
132
|
+
if (e instanceof Qt) {
|
|
133
133
|
for (let n = 0; n < e.points.length; n += 2) e.points[n] += t.x, e.points[n + 1] += t.y;
|
|
134
134
|
return e;
|
|
135
135
|
} else return e.x += t.x, e.y += t.y, e;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function vn(e, t) {
|
|
138
138
|
return e.x += t.x, e.y += t.y, e;
|
|
139
139
|
}
|
|
140
140
|
function P(e, t, n = "width") {
|
|
@@ -147,41 +147,41 @@ function F(e, t) {
|
|
|
147
147
|
function I(e, t) {
|
|
148
148
|
P(e, t, "height");
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
let
|
|
152
|
-
|
|
150
|
+
function yn(e, t, n = "width") {
|
|
151
|
+
let r;
|
|
152
|
+
r = t?.width && t?.height ? {
|
|
153
153
|
x: t.width,
|
|
154
154
|
y: t.height
|
|
155
|
-
} :
|
|
155
|
+
} : g(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));
|
|
156
156
|
}
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region src/utils/platform.ts
|
|
159
|
-
var
|
|
159
|
+
var bn = 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 || navigator?.maxTouchPoints > 0 : !1, R = M.any, z = M.android.device, xn = M.apple.device;
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/utils/rect.ts
|
|
162
|
-
function
|
|
162
|
+
function Sn(e, t) {
|
|
163
163
|
return e.x += t.x, e.y += t.y, e;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Cn(e, t) {
|
|
166
166
|
return t === void 0 && (t = new A()), t.set(e.x + e.width * .5, e.y + e.height * .5), t;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function wn(e, t) {
|
|
169
169
|
return e.x *= t, e.y *= t, e.width *= t, e.height *= t, e;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Tn(e, t) {
|
|
172
172
|
return t === void 0 && (t = new A()), t.set(e.width, e.height), t;
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/utils/set.ts
|
|
176
|
-
function
|
|
176
|
+
function En(e, t) {
|
|
177
177
|
let n = /* @__PURE__ */ new Set();
|
|
178
178
|
for (let r of e) t(r) && n.add(r);
|
|
179
179
|
return n;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Dn(e) {
|
|
182
182
|
return e?.values().next().value;
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function On(e) {
|
|
185
185
|
let t;
|
|
186
186
|
for (let n of e) t = n;
|
|
187
187
|
return t;
|
|
@@ -202,25 +202,25 @@ function B(e, t) {
|
|
|
202
202
|
}
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/version.ts
|
|
205
|
-
var V = "0.1.
|
|
205
|
+
var V = "0.1.2", H = "8.19.0", kn = " ........ ..... ............ ............. ........... \n ............. ....... ................ ............. .............. \n .............. ......... ............... ............. .............. \n ..... ........... .............. ............ .............. \n ..... ...... ...... .............. ............. ............. \n .............. ...... ..... ............ ............. ..... ...... \n ................... ..... ..... ............. ..... ....... \n ................ .......... ............. ..... ..... ";
|
|
206
206
|
function U() {
|
|
207
|
-
let e = `\n${
|
|
207
|
+
let e = `\n${kn}\n\n v${V} | %cPixi.js v${H} %c| %chttps://github.com/anthonysapp/caper\n\n`;
|
|
208
208
|
console.log(e, "color: #E91E63; font-weight: 600;", "color: inherit;", "color: #00BCD4; text-decoration: underline;");
|
|
209
209
|
}
|
|
210
210
|
//#endregion
|
|
211
211
|
//#region src/webgl-check.ts
|
|
212
|
-
function
|
|
212
|
+
function An() {
|
|
213
213
|
if (typeof document > "u") return;
|
|
214
214
|
let e = document.createElement("canvas");
|
|
215
215
|
e.getContext("webgl") || e.getContext("experimental-webgl") || console.error("Your browser does not support WebGL.");
|
|
216
216
|
}
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/display/Entity.ts
|
|
219
|
-
var
|
|
219
|
+
var jn = class extends w {
|
|
220
220
|
constructor(e) {
|
|
221
221
|
super(), this.props = e ?? {};
|
|
222
222
|
}
|
|
223
|
-
},
|
|
223
|
+
}, Mn = class extends w {
|
|
224
224
|
get animationContext() {
|
|
225
225
|
return this._animationContext ?? `__scene_${this.id}`;
|
|
226
226
|
}
|
|
@@ -255,7 +255,7 @@ var kn = class extends y {
|
|
|
255
255
|
}
|
|
256
256
|
onPause(e) {}
|
|
257
257
|
onResume(e) {}
|
|
258
|
-
},
|
|
258
|
+
}, Nn = class extends w {
|
|
259
259
|
get active() {
|
|
260
260
|
return this._active;
|
|
261
261
|
}
|
|
@@ -296,9 +296,9 @@ var kn = class extends y {
|
|
|
296
296
|
_update(e) {
|
|
297
297
|
this.active && this.initialized && this.update(e);
|
|
298
298
|
}
|
|
299
|
-
},
|
|
299
|
+
}, Pn = class extends Zt {
|
|
300
300
|
constructor(e) {
|
|
301
|
-
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new
|
|
301
|
+
return super({ isRenderGroup: !0 }), this.config = e, this.onZoom = new T(), this.onZoomComplete = new T(), 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), y(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.width, 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;
|
|
302
302
|
}
|
|
303
303
|
get zooming() {
|
|
304
304
|
return this._zooming;
|
|
@@ -329,10 +329,10 @@ var kn = class extends y {
|
|
|
329
329
|
return this._followOffset;
|
|
330
330
|
}
|
|
331
331
|
set followOffset(e) {
|
|
332
|
-
this._followOffset =
|
|
332
|
+
this._followOffset = g(e, !0);
|
|
333
333
|
}
|
|
334
334
|
get app() {
|
|
335
|
-
return
|
|
335
|
+
return C.getInstance();
|
|
336
336
|
}
|
|
337
337
|
follow(e, t) {
|
|
338
338
|
t ||= {
|
|
@@ -369,12 +369,12 @@ var kn = class extends y {
|
|
|
369
369
|
} else this.pivot.set(this._targetPivot.x, this._targetPivot.y);
|
|
370
370
|
this.position.set(this.viewportWidth / 2, this.viewportHeight / 2);
|
|
371
371
|
}
|
|
372
|
-
},
|
|
372
|
+
}, Fn = class {
|
|
373
373
|
constructor(e, t) {
|
|
374
|
-
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null,
|
|
374
|
+
this.camera = e, this.interactiveArea = t, this.dragging = !1, this.previousPointerPosition = null, y(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));
|
|
375
375
|
}
|
|
376
376
|
get app() {
|
|
377
|
-
return
|
|
377
|
+
return C.getInstance();
|
|
378
378
|
}
|
|
379
379
|
destroy() {
|
|
380
380
|
this.interactiveArea.removeAllListeners(), this.app.stage.off("pointerup", this.onPointerUp.bind(this)), this.app.stage.off("pointerupoutside", this.onPointerUp.bind(this));
|
|
@@ -455,26 +455,26 @@ var kn = class extends y {
|
|
|
455
455
|
scale: 1,
|
|
456
456
|
marginTop: 60
|
|
457
457
|
}
|
|
458
|
-
},
|
|
458
|
+
}, In = [
|
|
459
459
|
"text",
|
|
460
460
|
"password",
|
|
461
461
|
"number",
|
|
462
462
|
"email",
|
|
463
463
|
"tel",
|
|
464
464
|
"url"
|
|
465
|
-
],
|
|
465
|
+
], Ln = class e extends x(S(v(w))) {
|
|
466
466
|
constructor(e, t = !1, n = null) {
|
|
467
467
|
if (super({
|
|
468
468
|
autoUpdate: !0,
|
|
469
469
|
autoResize: !t
|
|
470
|
-
}), this.isClone = t, this.clone = n, this.onEnter = new
|
|
470
|
+
}), this.isClone = t, this.clone = n, this.onEnter = new T(), this.onChange = new T(), this.onError = new T(), this._lastWidth = 0, this._lastHeight = 0, this._placeholderPositioned = !1, this._placeholderAnimating = !1, this._caretPosition = -1, this._value = "", this.options = {
|
|
471
471
|
...W,
|
|
472
472
|
...e,
|
|
473
473
|
style: {
|
|
474
474
|
...W.style,
|
|
475
475
|
...e?.style ?? {}
|
|
476
476
|
},
|
|
477
|
-
padding:
|
|
477
|
+
padding: p(e.padding ?? W.padding),
|
|
478
478
|
bg: {
|
|
479
479
|
...W.bg,
|
|
480
480
|
...e.bg ?? {}
|
|
@@ -583,11 +583,11 @@ var kn = class extends y {
|
|
|
583
583
|
}
|
|
584
584
|
update() {
|
|
585
585
|
this.bg.x = 0, this.bg.y = 0;
|
|
586
|
-
let e = this.input.getLocalBounds().y + this.input.style.fontSize + this.options.padding.top + this.options.padding.bottom, t = this.options.fixed ? this.options.minWidth : Math.max(this.options.minWidth, this.input.width) + this.options.padding.left + this.options.padding.right, n = this.options.minWidth - t + this.options.padding.left + this.options.padding.right,
|
|
586
|
+
let e = this.input.getLocalBounds().y + this.input.style.fontSize + this.options.padding.top + this.options.padding.bottom, t = this.options.fixed ? this.options.minWidth : Math.max(this.options.minWidth, this.input.width) + this.options.padding.left + this.options.padding.right, n = this.options.minWidth - t + this.options.padding.left + this.options.padding.right, r = t - this.options.padding.left - this.options.padding.right;
|
|
587
587
|
switch (this.input.style.align) {
|
|
588
588
|
case "center":
|
|
589
589
|
if (this.input.x = t / 2 - this.input.width / 2, this._placeholderPositioned || (this.placeholder.x = t / 2 - this.placeholder.width / 2), this._inner.x = n >= 0 ? 0 : n / 2, this.options.fixed) {
|
|
590
|
-
let e = this.input.width -
|
|
590
|
+
let e = this.input.width - r;
|
|
591
591
|
e > 0 && (this.input.x -= e / 2);
|
|
592
592
|
}
|
|
593
593
|
break;
|
|
@@ -596,7 +596,7 @@ var kn = class extends y {
|
|
|
596
596
|
break;
|
|
597
597
|
default:
|
|
598
598
|
if (this.input.x = this.options.padding.left, this._placeholderPositioned || (this.placeholder.x = this.options.padding.left), this._inner.x = 0, this.options.fixed) {
|
|
599
|
-
let e = this.input.width -
|
|
599
|
+
let e = this.input.width - r;
|
|
600
600
|
e > 0 && (this.input.x -= e);
|
|
601
601
|
}
|
|
602
602
|
break;
|
|
@@ -641,7 +641,7 @@ var kn = class extends y {
|
|
|
641
641
|
break;
|
|
642
642
|
}
|
|
643
643
|
if (this.options.placeholder.offsetOnType) {
|
|
644
|
-
let n =
|
|
644
|
+
let n = g(this.options.placeholder.offsetOnType);
|
|
645
645
|
e += n.x, t += n.y;
|
|
646
646
|
}
|
|
647
647
|
if (this.options.placeholder.animationOnType) {
|
|
@@ -654,7 +654,7 @@ var kn = class extends y {
|
|
|
654
654
|
alpha: this.options.placeholder.animationOnType.alpha ?? this.options.placeholder.alpha ?? 1,
|
|
655
655
|
overwrite: !0
|
|
656
656
|
})), this.options.placeholder.scaleOnType) {
|
|
657
|
-
let e =
|
|
657
|
+
let e = g(this.options.placeholder.scaleOnType);
|
|
658
658
|
this.addAnimation(N.to(this.placeholder.scale, {
|
|
659
659
|
x: e.x,
|
|
660
660
|
y: e.y,
|
|
@@ -742,7 +742,7 @@ var kn = class extends y {
|
|
|
742
742
|
this.domElement = this.clone.domElement, this._addDomElementListeners();
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type &&
|
|
745
|
+
clearTimeout(this._focusTimer), clearTimeout(this._pointerDownTimer), this.domElement = document.createElement("input"), this.domElement.type = "text", this.options.type && In.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);
|
|
746
746
|
let t = this.getGlobalPosition(), n = this.getBounds();
|
|
747
747
|
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);
|
|
748
748
|
}
|
|
@@ -850,7 +850,7 @@ var kn = class extends y {
|
|
|
850
850
|
}
|
|
851
851
|
_updateCaretAndSelection() {
|
|
852
852
|
if (!this.domElement) {
|
|
853
|
-
|
|
853
|
+
b.warn(this.label, "No dom element");
|
|
854
854
|
return;
|
|
855
855
|
}
|
|
856
856
|
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;
|
|
@@ -858,7 +858,7 @@ var kn = class extends y {
|
|
|
858
858
|
else {
|
|
859
859
|
r = i.substring(e > t ? t : e, e > t ? e : t);
|
|
860
860
|
let a = i.substring(0, e > t ? t : e), o = O.measureText(a, this.input.style), s = O.measureText(r, this.input.style);
|
|
861
|
-
this._selectionRect = new
|
|
861
|
+
this._selectionRect = new $t(o.width, 0, s.width, this.input.height), this._caretPosition = n === "backward" ? this._selectionRect.left : this._selectionRect.left + this._selectionRect.width;
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
_handleDomElementChange(e) {
|
|
@@ -880,21 +880,21 @@ var kn = class extends y {
|
|
|
880
880
|
};
|
|
881
881
|
//#endregion
|
|
882
882
|
//#region src/plugins/actions/methods.ts
|
|
883
|
-
function
|
|
884
|
-
return e ??
|
|
883
|
+
function Rn(e) {
|
|
884
|
+
return e ?? h;
|
|
885
885
|
}
|
|
886
|
-
function
|
|
886
|
+
function zn(e, t, n = !0) {
|
|
887
887
|
return n && (t = {
|
|
888
|
-
...
|
|
888
|
+
..._,
|
|
889
889
|
...t
|
|
890
890
|
}), t;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function Bn(e) {
|
|
893
893
|
return e || [];
|
|
894
894
|
}
|
|
895
895
|
//#endregion
|
|
896
896
|
//#region src/plugins/breakpoints/methods.ts
|
|
897
|
-
function
|
|
897
|
+
function Vn(e) {
|
|
898
898
|
return {
|
|
899
899
|
tiers: e.tiers,
|
|
900
900
|
modes: e.modes ?? {}
|
|
@@ -904,7 +904,7 @@ function zn(e) {
|
|
|
904
904
|
//#region src/plugins/input/touch/constants.ts
|
|
905
905
|
var G = /* @__PURE__ */ function(e) {
|
|
906
906
|
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;
|
|
907
|
-
}({}),
|
|
907
|
+
}({}), Hn = [
|
|
908
908
|
G.None,
|
|
909
909
|
G.Left,
|
|
910
910
|
G.Top,
|
|
@@ -917,14 +917,14 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
917
917
|
];
|
|
918
918
|
//#endregion
|
|
919
919
|
//#region src/plugins/input/methods.ts
|
|
920
|
-
function
|
|
920
|
+
function Un(e, t, n) {
|
|
921
921
|
return n || [];
|
|
922
922
|
}
|
|
923
923
|
//#endregion
|
|
924
924
|
//#region src/ui/Joystick.ts
|
|
925
|
-
var
|
|
925
|
+
var Wn = class extends w {
|
|
926
926
|
constructor(e) {
|
|
927
|
-
if (super(), this.onChange = new
|
|
927
|
+
if (super(), this.onChange = new T(), this.onStart = new T(), this.onEnd = new T(), this.onDestroy = new T(), this.outerRadius = 0, this.innerRadius = 0, this.innerAlphaStandby = .5, this.dragging = !1, this.pointData = new A(), this.direction = G.None, this.settings = Object.assign({
|
|
928
928
|
outerScale: 1,
|
|
929
929
|
innerScale: 1
|
|
930
930
|
}, e), !this.settings.outer) {
|
|
@@ -992,22 +992,22 @@ var Hn = class extends y {
|
|
|
992
992
|
let t = Math.atan2(e.y, e.x);
|
|
993
993
|
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;
|
|
994
994
|
}
|
|
995
|
-
},
|
|
995
|
+
}, Gn = {
|
|
996
996
|
color: 0,
|
|
997
997
|
alpha: .75
|
|
998
|
-
},
|
|
998
|
+
}, Kn = {
|
|
999
999
|
backing: !0,
|
|
1000
1000
|
closeOnEscape: !0,
|
|
1001
1001
|
closeOnPointerDownOutside: !0,
|
|
1002
1002
|
actionContext: "popup"
|
|
1003
|
-
},
|
|
1003
|
+
}, qn = class e extends w {
|
|
1004
1004
|
get actionContext() {
|
|
1005
1005
|
return this.config.actionContext;
|
|
1006
1006
|
}
|
|
1007
1007
|
constructor(e, t = {}) {
|
|
1008
1008
|
super(), this.id = e, this.isShowing = !1, this._storedActionContext = void 0, this.config = Object.assign({
|
|
1009
1009
|
id: e,
|
|
1010
|
-
...
|
|
1010
|
+
...Kn
|
|
1011
1011
|
}, t), this._initialize();
|
|
1012
1012
|
}
|
|
1013
1013
|
get data() {
|
|
@@ -1016,7 +1016,7 @@ var Hn = class extends y {
|
|
|
1016
1016
|
static makeBacking(e, t) {
|
|
1017
1017
|
let n = {};
|
|
1018
1018
|
typeof e == "object" && (n = e);
|
|
1019
|
-
let r = Object.assign({ ...
|
|
1019
|
+
let r = Object.assign({ ...Gn }, n), i = new en(j.WHITE);
|
|
1020
1020
|
return i.anchor.set(.5), i.alpha = r.alpha, i.tint = r.color, i.width = t.width, i.height = t.height, i;
|
|
1021
1021
|
}
|
|
1022
1022
|
initialize() {}
|
|
@@ -1050,29 +1050,29 @@ var Hn = class extends y {
|
|
|
1050
1050
|
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";
|
|
1051
1051
|
}
|
|
1052
1052
|
setActionContext() {
|
|
1053
|
-
this.actionContext && (this.app.actionContext = this.actionContext,
|
|
1053
|
+
this.actionContext && (this.app.actionContext = this.actionContext, b.log("Popup", "Setting action context", this.app.actionContext));
|
|
1054
1054
|
}
|
|
1055
1055
|
storeActionContext() {
|
|
1056
|
-
this._storedActionContext = this.app.actionContext,
|
|
1056
|
+
this._storedActionContext = this.app.actionContext, b.log("Popup", "Storing action context", this._storedActionContext);
|
|
1057
1057
|
}
|
|
1058
1058
|
restoreActionContext() {
|
|
1059
|
-
this._storedActionContext && (
|
|
1059
|
+
this._storedActionContext && (b.log("Popup", "Restoring action context", this._storedActionContext), this.app.actionContext = this._storedActionContext), this._storedActionContext = void 0;
|
|
1060
1060
|
}
|
|
1061
|
-
},
|
|
1061
|
+
}, K = [
|
|
1062
1062
|
"text",
|
|
1063
1063
|
"anchor",
|
|
1064
1064
|
"roundPixels",
|
|
1065
1065
|
"style",
|
|
1066
1066
|
"pivot"
|
|
1067
|
-
],
|
|
1068
|
-
function
|
|
1067
|
+
], q = 200, Jn = "CaperApplication";
|
|
1068
|
+
function Yn() {
|
|
1069
1069
|
try {
|
|
1070
1070
|
return globalThis.Caper?.__dev === !0;
|
|
1071
1071
|
} catch {
|
|
1072
1072
|
return !1;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function Xn() {
|
|
1076
1076
|
try {
|
|
1077
1077
|
return !1;
|
|
1078
1078
|
} catch {
|
|
@@ -1102,15 +1102,15 @@ function Y() {
|
|
|
1102
1102
|
return a.promise;
|
|
1103
1103
|
}), t;
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function Zn() {
|
|
1106
1106
|
Y();
|
|
1107
1107
|
}
|
|
1108
1108
|
function X(e) {
|
|
1109
|
-
return e.config?.id ||
|
|
1109
|
+
return e.config?.id || Jn;
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function Qn(e) {
|
|
1112
1112
|
let t = X(e), n = [], r, i = [], a = (e) => {
|
|
1113
|
-
n.push(e), n.length >
|
|
1113
|
+
n.push(e), n.length > q && n.splice(0, n.length - q);
|
|
1114
1114
|
}, o = () => r ? r() : void 0, s = (e) => {
|
|
1115
1115
|
if (i.length !== 0) for (let t = i.length - 1; t >= 0; t--) {
|
|
1116
1116
|
let n = !1;
|
|
@@ -1182,8 +1182,8 @@ function Xn(e) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
function Z(e) {
|
|
1184
1184
|
let t = Y(), n = X(e);
|
|
1185
|
-
if (t.apps.set(n, e), t.app = e,
|
|
1186
|
-
let r =
|
|
1185
|
+
if (t.apps.set(n, e), t.app = e, Yn() || e.config?.automation === !0 || Xn()) {
|
|
1186
|
+
let r = Qn(e);
|
|
1187
1187
|
t.automation[n] = r, e.automation = r;
|
|
1188
1188
|
}
|
|
1189
1189
|
}
|
|
@@ -1197,20 +1197,20 @@ function Q(e) {
|
|
|
1197
1197
|
}
|
|
1198
1198
|
//#endregion
|
|
1199
1199
|
//#region src/core/create.ts
|
|
1200
|
-
var
|
|
1200
|
+
var $n = "caper-game-container";
|
|
1201
1201
|
function $(e) {
|
|
1202
1202
|
let t = document.createElement("div");
|
|
1203
1203
|
return t.setAttribute("id", e), document.body.appendChild(t), t;
|
|
1204
1204
|
}
|
|
1205
|
-
async function
|
|
1205
|
+
async function er() {
|
|
1206
1206
|
return new Promise((e) => {
|
|
1207
1207
|
document.readyState === "complete" || document.readyState === "interactive" ? e(!0) : document.addEventListener("DOMContentLoaded", () => {
|
|
1208
1208
|
e(!0);
|
|
1209
1209
|
});
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
1212
|
-
async function
|
|
1213
|
-
await
|
|
1212
|
+
async function tr(e = { id: "CaperApplication" }, t = $n, n = !0) {
|
|
1213
|
+
await er(), An(), n && U();
|
|
1214
1214
|
let r = null;
|
|
1215
1215
|
if (typeof t == "string" ? (r = document.getElementById(t), r ||= $(t)) : t instanceof HTMLElement ? r = t : t === window && (r = document.body), !r) 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.");
|
|
1216
1216
|
e.resizeToContainer && (e.resizeTo = r), e.useLayout && (e.layout = {
|
|
@@ -1219,7 +1219,7 @@ async function $n(e = { id: "CaperApplication" }, t = Zn, n = !0) {
|
|
|
1219
1219
|
debugModificationCount: 0,
|
|
1220
1220
|
throttle: 100
|
|
1221
1221
|
}), e.container = r;
|
|
1222
|
-
let i = new (e.application ||
|
|
1222
|
+
let i = new (e.application || C)();
|
|
1223
1223
|
return await i.initialize(e, r), e.useLayout && (i.stage.layout = {
|
|
1224
1224
|
position: "absolute",
|
|
1225
1225
|
width: "100%",
|
|
@@ -1227,7 +1227,7 @@ async function $n(e = { id: "CaperApplication" }, t = Zn, n = !0) {
|
|
|
1227
1227
|
}), await i._postInitialize(), Z(i), globalThis.Caper?.__runtimeManaged || Q(i), i;
|
|
1228
1228
|
}
|
|
1229
1229
|
//#endregion
|
|
1230
|
-
var
|
|
1231
|
-
export {
|
|
1230
|
+
var nr = D.Collector, rr = D.CollectorArray, ir = D.CollectorLast, ar = D.CollectorUntil0, or = D.CollectorWhile0, sr = D.SignalConnections;
|
|
1231
|
+
export { ve as ActionsPlugin, st as Animated, wt as AnimatedSprite, C as Application, se as AssetsPlugin, De as AudioChannel, ne as AudioInstance, ke as AudioManagerPlugin, je as BreakpointPlugin, At as Button, ut as ButtonConfigKeys, Pn as Camera, Fn as CameraController, Ft as CaperEvent, nr as Collector, rr as CollectorArray, ir as CollectorLast, ar as CollectorUntil0, or as CollectorWhile0, sn as Color, w as Container, Qe as ContainerConfigKeys, pt as Controls, Xt as DataAdapter, bt as DebugAlpha, kt as DebugColors, Dt as DefaultActionContexts, h as DefaultActionContextsArray, Fe as DefaultActions, Ne as DefaultButtonIds, jn as Entity, ct as Factory, et as FlexContainer, It as FlexContainerConfigKeys, qt as FocusManagerPlugin, i as FocusOutliner, x as Focusable, be as FullScreenPlugin, ie as GesturePlugin, Ln as Input, ge as InputControllerTypes, me as InputPlugin, S as Interactive, Hn as JOYSTICK_DIRECTIONS, Wn as Joystick, G as JoystickDirection, dt as KeyboardControls, de as KeyboardPlugin, b as Logger, l as LookupPlugin, Ye as ParticleContainer, gt as ParticleContainerConfigKeys, e as Plugin, qn as Popup, d as PopupManagerPlugin, Pe as Queue, Te as ResizerPlugin, Mn as Scene, Vt as SceneManagerPlugin, Nn as SceneTransition, T as Signal, sr as SignalConnections, Ue as SpineAnimation, Be as Store, Nt as Svg, K as TextPropsKeys, Ut as Timer, Se as TimerPlugin, zt as Toast, Re as Toaster, n as TouchControls, n as VirtualControls, ot as UICanvas, it as UICanvasConfigKeys, We as WebEventsPlugin, v as WithSignals, Ee as add, f as addToPoint, y as bindAllMethods, at as bindMethods, Bt as bool, Rt as capitalize, Ze as capitalizeWords, Cn as center, ze as checkAndInvokeMethod, Oe as clamp, Pt as coreFunctionRegistry, yt as coreSignalRegistry, tr as create, $ as createContainer, lt as createDebugGraphics, He as createDebugLabel, rt as createFactoryMethods, Le as createQueue, Ae as debounce, ue as deepMerge, _ as defaultActionsList, te as defaultBreakpoints, Ve as defaultFactoryMethods, le as defaultGestureOptions, Gt as defaultToastConfig, zn as defineActions, Vn as defineBreakpoints, Bn as defineButtons, Wt as defineConfig, Rn as defineContexts, Un as defineControls, Yt as defineData, dn as defineEntity, ln as definePlugin, un as definePopup, cn as defineScene, fn as defineUI, ye as delay, rn as destroyCanvas, u as distance, he as distanceSq, p as ensurePadding, nt as env, En as filterSet, Dn as firstFromSet, Kt as floatBetween, Ge as floatBetweenPoint, o as formatTime, we as generatePluginList, Ct as getDebugRegistry, Ie as getDynamicModuleFromImportListItem, St as getErrorTexture, m as getFirstMapEntry, ce as getLastMapEntry, B as getNearestCharacterIndex, Ot as getNextMapEntry, Ht as getOrientation, oe as getPreviousMapEntry, nn as getRandomElement, _t as getRegisteredEntityIds, Tt as getRegisteredUIIds, a as getZeroPaddedNumber, ee as i18nPlugin, Zn as installCaperGlobal, E as intBetween, Ce as intBetweenPoint, z as isAndroid, Et as isDev, xn as isIos, R as isMobile, vt as isProduction, t as isPromise, bn as isRetina, Ke as isStorageCapable, xt as isText, L as isTouch, On as lastFromSet, Me as lerp, mt as lerpPoint, r as magnitude, ft as multiply, fe as normalizeKey, mn as objectDiagonal, Sn as offset, _n as offsetShape, vn as offsetSimpleShape, xe as omitKeys, H as pixiVersion, Jt as pluck, s as randomUUID, pn as reParent, Z as registerCaperApp, Mt as registerDebug, jt as resolveAnchor, ae as resolvePadding, qe as resolvePivot, g as resolvePointLike, ht as resolvePosition, Lt as resolveScale, re as resolveSizeLike, Xe as resolveTexture, tt as resolveUnknownKeys, U as sayHello, wn as scale, I as scaleToHeight, yn as scaleToSize, F as scaleToWidth, P as scaleUniform, gn as sendToBack, hn as sendToFront, tn as shuffle, Q as signalCaperReady, Tn as size, c as sortPluginsByRequires, pe as subtract, _e as subtractFromPoint, an as toHex, on as toRgb, Je as unregisterDebug, V as version, $e as wait };
|
|
1232
1232
|
|
|
1233
1233
|
//# sourceMappingURL=caper.mjs.map
|