@moku-labs/game 0.15.119 → 0.15.121
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/README.md +10 -0
- package/dist/app/page.d.mts +1 -1
- package/dist/app/page.mjs +1 -1
- package/dist/app/system.d.mts +3 -3
- package/dist/app.d.mts +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/{commands-CzT9eYnf.d.mts → commands-BMeGOWws.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-OPEOQ5MS.d.mts → define-h7SEyejf.d.mts} +2 -2
- package/dist/{headless-C5kxf9oU.d.mts → headless-CwH40XSw.d.mts} +1 -1
- package/dist/{index-CKF3qS2-.d.mts → index-BhMPDwA9.d.mts} +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/inspect.d.mts +6 -6
- package/dist/inspect.mjs +1 -1
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-BbZtyfgH.d.mts → runtime-BoK0QMVt.d.mts} +1 -1
- package/dist/{sources-CdWn7B5r.mjs → sources-CuG-Vma9.mjs} +1 -1
- package/dist/{src-_nn6V6aX.mjs → src-uuF4Ry3D.mjs} +262 -61
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-CATC2vK8.d.mts → types-B3OYUVNR.d.mts} +2 -2
- package/dist/{types-BHEOjYV3.d.mts → types-Dpd8geJW.d.mts} +12 -4
- package/dist/{types-BUR4LWSa.d.mts → types-DuGiHe3k.d.mts} +77 -7
- package/dist/{types-XygtsVg3.d.mts → types-Lh8Ql5Lv.d.mts} +4 -4
- package/dist/{types-cEAJaK0D.d.mts → types-wsgkqOXF.d.mts} +14 -8
- package/dist/{visual-CVHirfkU.d.mts → visual-BN0LF0W1.d.mts} +6 -6
- package/dist/{visual-CYq-xUqz.mjs → visual-x0TPowBE.mjs} +143 -41
- package/dist/visual.d.mts +1 -1
- package/dist/visual.mjs +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
|
2
2
|
import { i as systemSource, r as MAX_TIMER_MS, t as memory } from "./memory-DeD9wis6.mjs";
|
|
3
3
|
import { a as finishDrafts, i as enableDraftPatches, n as deepFreeze$1, o as openDrafts, r as dropDrafts } from "./drafts-BawpSaVp.mjs";
|
|
4
4
|
import { _ as compact, c as collectFlows, d as findNode, f as framePath, g as slotNames, h as restlessCapOf, i as servePaused, l as describeGraph, m as isRestCheckpoint, n as captureFrame, o as epochOf, p as graphHash, r as serveCaptures, s as pageNow$1, t as cancelCaptures, v as pushEntry } from "./capture-BtS6_oWr.mjs";
|
|
5
|
-
import { $ as Overlay, A as unitOf, B as readStyle, C as UiCounters, F as boldLookOf, G as parentOf$1, H as applyPose, I as builtInStyles, J as rootPoseInto, K as poseUnder, M as Countdown, N as Text, O as formatBound, Q as NineSlice, S as UI_OWNER, T as uiFor, U as isLeaving, V as textFor, W as localPoseOf, X as Display, Y as rootPoseOf, Z as HudPart, _ as DebugTrigger, _t as systemsFor, a as fieldsLeftAlone, at as arcDefaults, b as Scroll, c as namedKeyOf, ct as Exiting, d as samePose, dt as Order, et as OverlayLevel, f as visualOf$1, ft as Tree, g as Covered, gt as system, h as Box, ht as resource, i as drawnRect, it as Transform, j as wholeValue, k as isTextFormat, l as namesFormat, lt as Layer, m as writtenKeyOf, n as CONTENT$1, nt as Shape, o as fitScaleOf, ot as componentsFor, p as visualRectOf, pt as component, q as rootPointOf, r as bindOf, rt as Sprite, s as livePatch, tt as Parent, u as restValueOf, ut as Now, v as Escapable, vt as tag, x as ScrollState, y as LocalWrite } from "./visual-
|
|
5
|
+
import { $ as Overlay, A as unitOf, B as readStyle, C as UiCounters, F as boldLookOf, G as parentOf$1, H as applyPose, I as builtInStyles, J as rootPoseInto, K as poseUnder, M as Countdown, N as Text, O as formatBound, Q as NineSlice, S as UI_OWNER, T as uiFor, U as isLeaving, V as textFor, W as localPoseOf, X as Display, Y as rootPoseOf, Z as HudPart, _ as DebugTrigger, _t as systemsFor, a as fieldsLeftAlone, at as arcDefaults, b as Scroll, c as namedKeyOf, ct as Exiting, d as samePose, dt as Order, et as OverlayLevel, f as visualOf$1, ft as Tree, g as Covered, gt as system, h as Box, ht as resource, i as drawnRect, it as Transform, j as wholeValue, k as isTextFormat, l as namesFormat, lt as Layer, m as writtenKeyOf, n as CONTENT$1, nt as Shape, o as fitScaleOf, ot as componentsFor, p as visualRectOf, pt as component, q as rootPointOf, r as bindOf, rt as Sprite, s as livePatch, tt as Parent, u as restValueOf, ut as Now, v as Escapable, vt as tag, x as ScrollState, y as LocalWrite, yt as neutralOf } from "./visual-x0TPowBE.mjs";
|
|
6
6
|
import { a as isDev$1 } from "./dev-BNndV-hU.mjs";
|
|
7
7
|
import { n as isComponentDefinition } from "./component-DGg5DqKK.mjs";
|
|
8
8
|
import { n as flatten } from "./flatten-nUX9PpGo.mjs";
|
|
@@ -10925,6 +10925,44 @@ function splitFields(value) {
|
|
|
10925
10925
|
};
|
|
10926
10926
|
}
|
|
10927
10927
|
/**
|
|
10928
|
+
* The rest value of a component with the neutral value of every optional field the stored value carries and the rest
|
|
10929
|
+
* leaves out (`Transform`'s `scaleX`: a stored `0` is brought home to 1). The rest itself comes back when there is
|
|
10930
|
+
* nothing to add, so a view that never set such a field copies nothing (the walk over the stored keys is its only cost).
|
|
10931
|
+
*
|
|
10932
|
+
* @param type - The component type, which may declare neutral values.
|
|
10933
|
+
* @param rest - The rest value.
|
|
10934
|
+
* @param stored - The value the entity carries now.
|
|
10935
|
+
* @returns The rest value, completed with neutrals where the stored value has a field the rest lacks.
|
|
10936
|
+
* @example
|
|
10937
|
+
* ```ts
|
|
10938
|
+
* restWithNeutrals(Transform, { x: 0 }, { x: 0, scaleX: 0 }); // { x: 0, scaleX: 1 }
|
|
10939
|
+
* restWithNeutrals(Transform, { x: 0 }, { x: 5 }); // the same object as the rest
|
|
10940
|
+
* ```
|
|
10941
|
+
*/
|
|
10942
|
+
function restWithNeutrals(type, rest, stored) {
|
|
10943
|
+
if (stored === void 0) return rest;
|
|
10944
|
+
let completed;
|
|
10945
|
+
for (const field of Object.keys(stored)) {
|
|
10946
|
+
if (field in rest) continue;
|
|
10947
|
+
const neutral = neutralOf(type, field);
|
|
10948
|
+
if (neutral === void 0) continue;
|
|
10949
|
+
completed ??= { ...rest };
|
|
10950
|
+
completed[field] = neutral;
|
|
10951
|
+
}
|
|
10952
|
+
return completed ?? rest;
|
|
10953
|
+
}
|
|
10954
|
+
/**
|
|
10955
|
+
* The values that bring a rest component home: its rest value, with the neutral of an optional field the entity carries.
|
|
10956
|
+
*
|
|
10957
|
+
* @param pctx - Domain context of the projection module.
|
|
10958
|
+
* @param view - The view to bring home.
|
|
10959
|
+
* @param value - The rest value of the component, which names its type.
|
|
10960
|
+
* @returns The fields to write.
|
|
10961
|
+
*/
|
|
10962
|
+
function restHome(pctx, view, value) {
|
|
10963
|
+
return restWithNeutrals(value.type, value.value, storedValue(pctx, view.entity, value.type));
|
|
10964
|
+
}
|
|
10965
|
+
/**
|
|
10928
10966
|
* Writes a patch, leaving out every field another writer owns.
|
|
10929
10967
|
*
|
|
10930
10968
|
* @param pctx - Domain context of the projection module.
|
|
@@ -10977,7 +11015,7 @@ function createViewHandle(pctx, view, peers) {
|
|
|
10977
11015
|
toRest: (component, options) => {
|
|
10978
11016
|
const target = view.rest.get(component.componentName);
|
|
10979
11017
|
if (target === void 0 || target.value === true) return inertHandle();
|
|
10980
|
-
const { numeric, other } = splitFields(target.value);
|
|
11018
|
+
const { numeric, other } = splitFields(restWithNeutrals(target.type, target.value, storedValue(pctx, view.entity, target.type)));
|
|
10981
11019
|
if (Object.keys(other).length > 0) writeUnmuted(pctx, view.entity, target, other);
|
|
10982
11020
|
return startTrack$2(pctx, view.entity, asComponent$1(component), numeric, {
|
|
10983
11021
|
ms: options?.ms ?? pctx.ctx.config.settleMs,
|
|
@@ -11110,7 +11148,7 @@ function looseComponents(pctx, view) {
|
|
|
11110
11148
|
for (const [name, value] of view.rest) {
|
|
11111
11149
|
if (driven.has(name) || value.value === true) continue;
|
|
11112
11150
|
const under = valueUnderLoop(pctx, view, value);
|
|
11113
|
-
if (under !== void 0 && !deepEquals(under, value.value)) loose.push(name);
|
|
11151
|
+
if (under !== void 0 && !deepEquals(under, restWithNeutrals(value.type, value.value, under))) loose.push(name);
|
|
11114
11152
|
}
|
|
11115
11153
|
return loose;
|
|
11116
11154
|
}
|
|
@@ -11193,7 +11231,7 @@ function writeRestUnderLoops(pctx, view, components) {
|
|
|
11193
11231
|
for (const name of components) {
|
|
11194
11232
|
const value = view.rest.get(name);
|
|
11195
11233
|
if (value === void 0 || value.value === true) continue;
|
|
11196
|
-
writeUnderLoop(pctx, view, value, value
|
|
11234
|
+
writeUnderLoop(pctx, view, value, restHome(pctx, view, value));
|
|
11197
11235
|
}
|
|
11198
11236
|
}
|
|
11199
11237
|
/**
|
|
@@ -11209,7 +11247,7 @@ function writeRestNow(pctx, view, components) {
|
|
|
11209
11247
|
for (const name of components) {
|
|
11210
11248
|
const value = view.rest.get(name);
|
|
11211
11249
|
if (value === void 0 || value.value === true) continue;
|
|
11212
|
-
writeUnmuted(pctx, view.entity, value, value
|
|
11250
|
+
writeUnmuted(pctx, view.entity, value, restHome(pctx, view, value));
|
|
11213
11251
|
}
|
|
11214
11252
|
}
|
|
11215
11253
|
/**
|
|
@@ -11279,7 +11317,8 @@ function offRestFields(pctx, view, name, value) {
|
|
|
11279
11317
|
const under = valueUnderLoop(pctx, view, value);
|
|
11280
11318
|
if (under === void 0) return patch;
|
|
11281
11319
|
const muted = mutedFields(pctx, view.entity, name);
|
|
11282
|
-
|
|
11320
|
+
const rest = restWithNeutrals(value.type, value.value, under);
|
|
11321
|
+
for (const [field, entry] of Object.entries(rest)) if (!muted.has(field) && !atRest(under[field], entry)) patch[field] = entry;
|
|
11283
11322
|
return patch;
|
|
11284
11323
|
}
|
|
11285
11324
|
/**
|
|
@@ -33388,7 +33427,8 @@ function writeVisual(sctx, entity, view) {
|
|
|
33388
33427
|
measureDisplay(view);
|
|
33389
33428
|
}
|
|
33390
33429
|
/**
|
|
33391
|
-
* Writes the `Transform` component: `position` is where the `pivot` lands
|
|
33430
|
+
* Writes the `Transform` component: `position` is where the `pivot` lands, and the drawn scale is `scale` times the
|
|
33431
|
+
* per-axis factor (`scaleX`, `scaleY`, 1 when absent) on each axis. The stretch of the
|
|
33392
33432
|
* visual (a sized sprite, the 64 x 64 placeholder) is folded into the object's scale, so the
|
|
33393
33433
|
* pivot is written in the object's own units. A wrapper carries the pose instead, and the visual
|
|
33394
33434
|
* inside it keeps only its stretch.
|
|
@@ -33401,14 +33441,18 @@ function applyTransform(sctx, entity, view) {
|
|
|
33401
33441
|
const value = sctx.ctx.deps.world.ecs.get(entity, Transform) ?? Transform.defaults;
|
|
33402
33442
|
const target = view.wrapper ?? view.object;
|
|
33403
33443
|
const stretch = view.drawScale;
|
|
33444
|
+
const factorX = "scaleX" in value ? value.scaleX ?? 1 : 1;
|
|
33445
|
+
const factorY = "scaleY" in value ? value.scaleY ?? 1 : 1;
|
|
33446
|
+
const scaleX = value.scale * factorX;
|
|
33447
|
+
const scaleY = value.scale * factorY;
|
|
33404
33448
|
writePoint(sctx, entity, target.position, value.x, value.y, markMoved);
|
|
33405
33449
|
writeRotation(sctx, entity, target, value.rotation, markMoved);
|
|
33406
33450
|
if (view.wrapper === void 0) {
|
|
33407
|
-
writePoint(sctx, entity, target.scale,
|
|
33451
|
+
writePoint(sctx, entity, target.scale, scaleX * stretch.x, scaleY * stretch.y, markMoved);
|
|
33408
33452
|
writePoint(sctx, entity, target.pivot, value.pivot.x / stretch.x, value.pivot.y / stretch.y, markMoved);
|
|
33409
33453
|
return;
|
|
33410
33454
|
}
|
|
33411
|
-
writePoint(sctx, entity, target.scale,
|
|
33455
|
+
writePoint(sctx, entity, target.scale, scaleX, scaleY, markMoved);
|
|
33412
33456
|
writePoint(sctx, entity, target.pivot, value.pivot.x, value.pivot.y, markMoved);
|
|
33413
33457
|
writePoint(sctx, entity, view.object.position, 0, 0);
|
|
33414
33458
|
writeRotation(sctx, entity, view.object, 0);
|
|
@@ -34762,6 +34806,8 @@ function takeWalk(sctx) {
|
|
|
34762
34806
|
y: 0,
|
|
34763
34807
|
rotation: 0,
|
|
34764
34808
|
scale: 1,
|
|
34809
|
+
scaleX: 1,
|
|
34810
|
+
scaleY: 1,
|
|
34765
34811
|
pivot: {
|
|
34766
34812
|
x: 0,
|
|
34767
34813
|
y: 0
|
|
@@ -34809,12 +34855,14 @@ function localPoint(sctx, walk, entity) {
|
|
|
34809
34855
|
}
|
|
34810
34856
|
const above = rootPoseInto(sctx.ctx.deps.world.ecs, entity, walk.pose);
|
|
34811
34857
|
const scale = above.scale === 0 ? 1 : above.scale;
|
|
34858
|
+
const scaleX = above.scaleX === 0 ? scale : scale * above.scaleX;
|
|
34859
|
+
const scaleY = above.scaleY === 0 ? scale : scale * above.scaleY;
|
|
34812
34860
|
const cos = Math.cos(-above.rotation);
|
|
34813
34861
|
const sin = Math.sin(-above.rotation);
|
|
34814
34862
|
const dx = walk.x - above.x;
|
|
34815
34863
|
const dy = walk.y - above.y;
|
|
34816
|
-
local.x = above.pivot.x + (dx * cos - dy * sin) /
|
|
34817
|
-
local.y = above.pivot.y + (dx * sin + dy * cos) /
|
|
34864
|
+
local.x = above.pivot.x + (dx * cos - dy * sin) / scaleX;
|
|
34865
|
+
local.y = above.pivot.y + (dx * sin + dy * cos) / scaleY;
|
|
34818
34866
|
return local;
|
|
34819
34867
|
}
|
|
34820
34868
|
/**
|
|
@@ -37220,6 +37268,14 @@ function createSyncApi(ctx, deps) {
|
|
|
37220
37268
|
for (const key of keys) state.invalidated.add(key);
|
|
37221
37269
|
dropPooled(state, keys);
|
|
37222
37270
|
},
|
|
37271
|
+
used: (keys) => {
|
|
37272
|
+
if (state.root === void 0) return false;
|
|
37273
|
+
for (let index = 0; index < keys.length; index += 1) {
|
|
37274
|
+
const key = keys[index];
|
|
37275
|
+
if (key !== void 0 && state.byKey.has(key)) return true;
|
|
37276
|
+
}
|
|
37277
|
+
return false;
|
|
37278
|
+
},
|
|
37223
37279
|
upload: (textures) => uploadTextures(sctx, textures)
|
|
37224
37280
|
},
|
|
37225
37281
|
displays: { provide: (component, adapter) => provideDisplay(sctx, component, adapter, {
|
|
@@ -39816,12 +39872,15 @@ const POSE_FIELDS = [
|
|
|
39816
39872
|
"x",
|
|
39817
39873
|
"y",
|
|
39818
39874
|
"rotation",
|
|
39819
|
-
"scale"
|
|
39875
|
+
"scale",
|
|
39876
|
+
"scaleX",
|
|
39877
|
+
"scaleY"
|
|
39820
39878
|
];
|
|
39821
39879
|
/**
|
|
39822
39880
|
* Turns the root-space target of a tween into the local target under the entity's parent. A field
|
|
39823
39881
|
* the step does not name is read from where the entity stands now and is not written, so a step
|
|
39824
|
-
* that names only `scale` leaves `x` and `y` alone.
|
|
39882
|
+
* that names only `scale` leaves `x` and `y` alone. `scale` is divided by the parents' uniform scale, `scaleX` and
|
|
39883
|
+
* `scaleY` by the parents' per-axis factors. A component other than `Transform`, and an
|
|
39825
39884
|
* entity without a parent, keep the target as it is.
|
|
39826
39885
|
*
|
|
39827
39886
|
* @param ecs - The world read, `world.ecs`.
|
|
@@ -39835,15 +39894,19 @@ function localTargetOf(ecs, entity, component, to) {
|
|
|
39835
39894
|
const parent = parentOf$1(ecs, entity);
|
|
39836
39895
|
if (component !== asComponent(Transform) || parent === 0) return local;
|
|
39837
39896
|
const now = rootPoseOf(ecs, entity);
|
|
39897
|
+
const scaleX = to.scaleX ?? now.scaleX;
|
|
39898
|
+
const scaleY = to.scaleY ?? now.scaleY;
|
|
39838
39899
|
const root = {
|
|
39839
39900
|
x: to.x ?? now.x,
|
|
39840
39901
|
y: to.y ?? now.y,
|
|
39841
39902
|
rotation: to.rotation ?? now.rotation,
|
|
39842
39903
|
scale: to.scale ?? now.scale,
|
|
39904
|
+
...scaleX === void 0 ? {} : { scaleX },
|
|
39905
|
+
...scaleY === void 0 ? {} : { scaleY },
|
|
39843
39906
|
pivot: now.pivot
|
|
39844
39907
|
};
|
|
39845
39908
|
const landed = localPoseOf(ecs, parent, root);
|
|
39846
|
-
for (const field of POSE_FIELDS) if (to[field] !== void 0) local[field] = landed[field];
|
|
39909
|
+
for (const field of POSE_FIELDS) if (to[field] !== void 0) local[field] = landed[field] ?? 1;
|
|
39847
39910
|
return local;
|
|
39848
39911
|
}
|
|
39849
39912
|
//#endregion
|
|
@@ -40110,7 +40173,7 @@ function beginTrack(actx, track, stored) {
|
|
|
40110
40173
|
if (track.live[slot] === 0 || field === void 0 || key === void 0) continue;
|
|
40111
40174
|
const base = actx.state.bases.get(key);
|
|
40112
40175
|
const current = stored[field];
|
|
40113
|
-
const read = typeof current === "number" ? current : track.targets[slot] ?? 0;
|
|
40176
|
+
const read = typeof current === "number" ? current : neutralOf(track.component, field) ?? track.targets[slot] ?? 0;
|
|
40114
40177
|
if (base !== void 0 && actx.state.offsets.has(key)) track.starts[slot] = cellValue(base);
|
|
40115
40178
|
else {
|
|
40116
40179
|
track.starts[slot] = read;
|
|
@@ -41678,6 +41741,22 @@ function indexKeys(manifest) {
|
|
|
41678
41741
|
return index;
|
|
41679
41742
|
}
|
|
41680
41743
|
/**
|
|
41744
|
+
* Builds the key list of every bundle, each list frozen: what the budget asks `renderer` about and what an unload
|
|
41745
|
+
* invalidates, read once here instead of a `files.map` per call.
|
|
41746
|
+
*
|
|
41747
|
+
* @param manifest - The parsed manifest.
|
|
41748
|
+
* @returns Bundle name to its asset keys, in manifest order.
|
|
41749
|
+
* @example
|
|
41750
|
+
* ```ts
|
|
41751
|
+
* keysOfBundles(parseManifest(json)).get("ui"); // ["ui.button.primary", "ui.panel"]
|
|
41752
|
+
* ```
|
|
41753
|
+
*/
|
|
41754
|
+
function keysOfBundles(manifest) {
|
|
41755
|
+
const keys = emptyMap$4();
|
|
41756
|
+
for (const [name, bundle] of Object.entries(manifest.bundles)) keys.set(name, Object.freeze(bundle.files.map((file) => file.key)));
|
|
41757
|
+
return keys;
|
|
41758
|
+
}
|
|
41759
|
+
/**
|
|
41681
41760
|
* Works out the prefix of every file URL: the configured one, the folder of the manifest URL, or
|
|
41682
41761
|
* the site root for an inline manifest.
|
|
41683
41762
|
*
|
|
@@ -42213,7 +42292,7 @@ function finish$1(ctx, bundle, entry, assets, reason) {
|
|
|
42213
42292
|
record.inflight = void 0;
|
|
42214
42293
|
touch(ctx.state, record);
|
|
42215
42294
|
ctx.state.readyFailed.delete(bundle);
|
|
42216
|
-
ctx.deps.renderer.sync.textures.invalidate(
|
|
42295
|
+
ctx.deps.renderer.sync.textures.invalidate(bundleKeys(ctx.state, bundle));
|
|
42217
42296
|
ctx.emit("assets:bundle-loaded", {
|
|
42218
42297
|
bundle,
|
|
42219
42298
|
tier: entry.tier,
|
|
@@ -42228,7 +42307,7 @@ function finish$1(ctx, bundle, entry, assets, reason) {
|
|
|
42228
42307
|
reason
|
|
42229
42308
|
});
|
|
42230
42309
|
ctx.deps.time.wake();
|
|
42231
|
-
enforceBudget(ctx);
|
|
42310
|
+
enforceBudget(ctx, bundle);
|
|
42232
42311
|
}
|
|
42233
42312
|
/**
|
|
42234
42313
|
* Rolls one failed or aborted load back: what was uploaded is destroyed, every companion of the
|
|
@@ -42509,7 +42588,7 @@ async function fetchManifest(ctx, url) {
|
|
|
42509
42588
|
return response.json();
|
|
42510
42589
|
}
|
|
42511
42590
|
/**
|
|
42512
|
-
* Reads the manifest into the state and builds the key index.
|
|
42591
|
+
* Reads the manifest into the state and builds the key index and the key list of every bundle.
|
|
42513
42592
|
*
|
|
42514
42593
|
* @param ctx - Domain context of the plugin.
|
|
42515
42594
|
* @throws {Error} In a browser, when the manifest cannot be read.
|
|
@@ -42521,6 +42600,7 @@ async function readManifest(ctx) {
|
|
|
42521
42600
|
const raw = typeof source === "string" ? await fetchManifest(ctx, source) : source;
|
|
42522
42601
|
ctx.state.manifest = parseManifest(raw);
|
|
42523
42602
|
ctx.state.bundleOfKey = indexKeys(ctx.state.manifest);
|
|
42603
|
+
ctx.state.keysOf = keysOfBundles(ctx.state.manifest);
|
|
42524
42604
|
} catch (error) {
|
|
42525
42605
|
if (ctx.state.io !== void 0) throw error;
|
|
42526
42606
|
ctx.log.warn("assets: the manifest could not be read", { error: String(error) });
|
|
@@ -42552,6 +42632,8 @@ async function bootTiers(ctx) {
|
|
|
42552
42632
|
const HEAVIEST = 5;
|
|
42553
42633
|
/** No feature holds a bundle: the stack as a leaving scene's non-`feature` bundle sees it. */
|
|
42554
42634
|
const NO_FEATURES = Object.freeze(/* @__PURE__ */ new Set());
|
|
42635
|
+
/** The key list of a bundle the manifest walk did not list: nothing drawn, nothing to invalidate. */
|
|
42636
|
+
const NO_KEYS = Object.freeze([]);
|
|
42555
42637
|
/**
|
|
42556
42638
|
* Adds up the estimated texture memory of every loaded bundle.
|
|
42557
42639
|
*
|
|
@@ -42567,24 +42649,50 @@ function usedMb(state) {
|
|
|
42567
42649
|
return total;
|
|
42568
42650
|
}
|
|
42569
42651
|
/**
|
|
42570
|
-
*
|
|
42571
|
-
*
|
|
42572
|
-
*
|
|
42652
|
+
* Reads the asset keys of a bundle from the list the manifest walk froze; a bundle it did not list
|
|
42653
|
+
* has none. Nothing is built per call.
|
|
42654
|
+
*
|
|
42655
|
+
* @param state - The plugin state.
|
|
42656
|
+
* @param bundle - Name of the bundle.
|
|
42657
|
+
* @returns Its keys, frozen.
|
|
42658
|
+
*/
|
|
42659
|
+
function bundleKeys(state, bundle) {
|
|
42660
|
+
return state.keysOf.get(bundle) ?? NO_KEYS;
|
|
42661
|
+
}
|
|
42662
|
+
/**
|
|
42663
|
+
* Tells whether the budget must leave a loaded bundle alone by the state alone: pinned, permanent, named by the
|
|
42664
|
+
* mounted, a leaving or the coming scene, in the preload queue, held after a reload, or the `except` of the pass.
|
|
42573
42665
|
*
|
|
42574
42666
|
* @param state - The plugin state.
|
|
42667
|
+
* @param name - Name of the bundle.
|
|
42668
|
+
* @param entry - Its manifest entry.
|
|
42669
|
+
* @param except - The bundle whose load started the pass, if any.
|
|
42670
|
+
* @returns True when it may not go.
|
|
42671
|
+
*/
|
|
42672
|
+
function keptByState(state, name, entry, except) {
|
|
42673
|
+
return name === except || state.pinned.has(name) || isPermanent(entry.tier) || state.reloadHeld.has(name) || state.sceneNamed.includes(name) || state.sceneLeaving.includes(name) || state.sceneComing.includes(name) || state.queue?.bundles.includes(name) === true;
|
|
42674
|
+
}
|
|
42675
|
+
/**
|
|
42676
|
+
* Picks the bundle that leaves next: the loaded one with the smallest use counter that is not
|
|
42677
|
+
* pinned, not named by the mounted, a leaving or the coming scene, not permanent, not in the preload queue, not held
|
|
42678
|
+
* after a reload, not `except` and drawn by no view (`renderer.sync.textures.used`, asked last: it walks the keys).
|
|
42679
|
+
* Its `release` is not read: a `"leave"` bundle is a candidate like any other.
|
|
42680
|
+
*
|
|
42681
|
+
* @param ctx - Domain context of the plugin.
|
|
42682
|
+
* @param except - The bundle that may not go: the one whose load started this pass.
|
|
42575
42683
|
* @returns The bundle name, or `undefined` when nothing may go.
|
|
42576
42684
|
*/
|
|
42577
|
-
function pickVictim(
|
|
42685
|
+
function pickVictim(ctx, except) {
|
|
42686
|
+
const state = ctx.state;
|
|
42687
|
+
const textures = ctx.deps.renderer.sync.textures;
|
|
42578
42688
|
let victim;
|
|
42579
42689
|
let smallest = Number.POSITIVE_INFINITY;
|
|
42580
42690
|
for (const [name, record] of state.records) {
|
|
42581
42691
|
const entry = state.manifest.bundles[name];
|
|
42582
42692
|
if (record.status !== "loaded" || entry === void 0) continue;
|
|
42583
|
-
if (state
|
|
42584
|
-
if (state.sceneNamed.includes(name) || state.sceneLeaving.includes(name)) continue;
|
|
42585
|
-
if (state.sceneComing.includes(name)) continue;
|
|
42586
|
-
if (state.queue?.bundles.includes(name) === true) continue;
|
|
42693
|
+
if (keptByState(state, name, entry, except)) continue;
|
|
42587
42694
|
if (record.lastUsed >= smallest) continue;
|
|
42695
|
+
if (textures.used(bundleKeys(state, name))) continue;
|
|
42588
42696
|
smallest = record.lastUsed;
|
|
42589
42697
|
victim = name;
|
|
42590
42698
|
}
|
|
@@ -42619,9 +42727,25 @@ function releaseAssets(io, assets) {
|
|
|
42619
42727
|
assets.audio.clear();
|
|
42620
42728
|
}
|
|
42621
42729
|
/**
|
|
42730
|
+
* Notes why a bundle went, for the loop guard: a budget unload is remembered until the next rest, so a view that asks
|
|
42731
|
+
* again for it right away starts its hold; any other reason ends both the mark and the hold (F184).
|
|
42732
|
+
*
|
|
42733
|
+
* @param state - The plugin state.
|
|
42734
|
+
* @param bundle - Name of the bundle.
|
|
42735
|
+
* @param reason - Why it was unloaded.
|
|
42736
|
+
*/
|
|
42737
|
+
function noteUnload(state, bundle, reason) {
|
|
42738
|
+
if (reason === "budget") {
|
|
42739
|
+
state.budgetUnloaded.add(bundle);
|
|
42740
|
+
return;
|
|
42741
|
+
}
|
|
42742
|
+
state.budgetUnloaded.delete(bundle);
|
|
42743
|
+
state.reloadHeld.delete(bundle);
|
|
42744
|
+
}
|
|
42745
|
+
/**
|
|
42622
42746
|
* Frees one loaded bundle: the textures are destroyed, its warm is forgotten, every companion drops
|
|
42623
|
-
* what travels with it, `renderer` is told that its keys are gone and the event goes
|
|
42624
|
-
* that is not loaded is left alone.
|
|
42747
|
+
* what travels with it, the loop guard notes the reason, `renderer` is told that its keys are gone and the event goes
|
|
42748
|
+
* out. A bundle that is not loaded is left alone.
|
|
42625
42749
|
*
|
|
42626
42750
|
* @param ctx - Domain context of the plugin.
|
|
42627
42751
|
* @param bundle - Name of the bundle.
|
|
@@ -42637,7 +42761,8 @@ function unloadBundle(ctx, bundle, reason) {
|
|
|
42637
42761
|
record.lastUsed = 0;
|
|
42638
42762
|
state.warmed.delete(bundle);
|
|
42639
42763
|
unloadCompanions(ctx, state.companions, bundle);
|
|
42640
|
-
|
|
42764
|
+
noteUnload(state, bundle, reason);
|
|
42765
|
+
const keys = bundleKeys(state, bundle);
|
|
42641
42766
|
ctx.deps.renderer.sync.textures.invalidate(keys);
|
|
42642
42767
|
ctx.emit("assets:bundle-unloaded", {
|
|
42643
42768
|
bundle,
|
|
@@ -42697,12 +42822,13 @@ function warnOverBudget(ctx) {
|
|
|
42697
42822
|
* Headless there is no texture memory, so it does nothing.
|
|
42698
42823
|
*
|
|
42699
42824
|
* @param ctx - Domain context of the plugin.
|
|
42825
|
+
* @param except - The bundle a load just published: never undone by its own pass. A rest passes none.
|
|
42700
42826
|
*/
|
|
42701
|
-
function enforceBudget(ctx) {
|
|
42827
|
+
function enforceBudget(ctx, except) {
|
|
42702
42828
|
const state = ctx.state;
|
|
42703
42829
|
if (state.io === void 0) return;
|
|
42704
42830
|
while (usedMb(state) > ctx.config.textureBudgetMb) {
|
|
42705
|
-
const victim = pickVictim(
|
|
42831
|
+
const victim = pickVictim(ctx, except);
|
|
42706
42832
|
if (victim === void 0) {
|
|
42707
42833
|
warnOverBudget(ctx);
|
|
42708
42834
|
return;
|
|
@@ -43648,6 +43774,10 @@ function releaseAll(state) {
|
|
|
43648
43774
|
state.removers.length = 0;
|
|
43649
43775
|
state.records.clear();
|
|
43650
43776
|
state.bundleOfKey.clear();
|
|
43777
|
+
state.keysOf.clear();
|
|
43778
|
+
state.budgetUnloaded.clear();
|
|
43779
|
+
state.reloadHeld.clear();
|
|
43780
|
+
state.thrashWarned.clear();
|
|
43651
43781
|
state.scenes.clear();
|
|
43652
43782
|
state.featureOfFlow.clear();
|
|
43653
43783
|
state.pinned.clear();
|
|
@@ -43706,7 +43836,29 @@ function lookupTexture(ctx, key) {
|
|
|
43706
43836
|
bundle
|
|
43707
43837
|
});
|
|
43708
43838
|
}
|
|
43709
|
-
if (record?.status !== "loading")
|
|
43839
|
+
if (record?.status !== "loading") {
|
|
43840
|
+
holdAskedAgain(ctx, bundle);
|
|
43841
|
+
loadBundle(ctx, bundle, void 0, "request").catch(ignoreFailure$1);
|
|
43842
|
+
}
|
|
43843
|
+
}
|
|
43844
|
+
/**
|
|
43845
|
+
* The loop guard of a texture miss: a bundle the budget unloaded since the last rest that a view asks for again is
|
|
43846
|
+
* drawn by something `renderer` does not track, so it is held from now on and never a budget victim again, and the
|
|
43847
|
+
* first time per bundle one warning names it (F184).
|
|
43848
|
+
*
|
|
43849
|
+
* @param ctx - Domain context of the plugin.
|
|
43850
|
+
* @param bundle - The bundle whose key missed.
|
|
43851
|
+
*/
|
|
43852
|
+
function holdAskedAgain(ctx, bundle) {
|
|
43853
|
+
const state = ctx.state;
|
|
43854
|
+
if (!state.budgetUnloaded.has(bundle) || state.reloadHeld.has(bundle)) return;
|
|
43855
|
+
state.reloadHeld.add(bundle);
|
|
43856
|
+
if (state.thrashWarned.has(bundle)) return;
|
|
43857
|
+
state.thrashWarned.add(bundle);
|
|
43858
|
+
ctx.log.warn("assets: a view asked again for a bundle the budget unloaded", {
|
|
43859
|
+
bundle,
|
|
43860
|
+
budgetMb: ctx.config.textureBudgetMb
|
|
43861
|
+
});
|
|
43710
43862
|
}
|
|
43711
43863
|
/**
|
|
43712
43864
|
* Finds the loaded bundle that carries one asset key and stamps it as used. A font and an audio
|
|
@@ -44411,6 +44563,7 @@ function createHandlers$5(ctx, reload) {
|
|
|
44411
44563
|
assets.state.restPending = true;
|
|
44412
44564
|
assets.state.restedLive = true;
|
|
44413
44565
|
}
|
|
44566
|
+
assets.state.budgetUnloaded.clear();
|
|
44414
44567
|
enforceBudget(assets);
|
|
44415
44568
|
if (!live) return;
|
|
44416
44569
|
startPreload(assets);
|
|
@@ -44468,6 +44621,10 @@ function createAssetsState() {
|
|
|
44468
44621
|
io: void 0,
|
|
44469
44622
|
manifest: emptyManifest(),
|
|
44470
44623
|
bundleOfKey: emptyMap$3(),
|
|
44624
|
+
keysOf: emptyMap$3(),
|
|
44625
|
+
budgetUnloaded: emptySet$2(),
|
|
44626
|
+
reloadHeld: emptySet$2(),
|
|
44627
|
+
thrashWarned: emptySet$2(),
|
|
44471
44628
|
scenes: emptyMap$3(),
|
|
44472
44629
|
featureOfFlow: emptyMap$3(),
|
|
44473
44630
|
records: emptyMap$3(),
|
|
@@ -52618,7 +52775,7 @@ function syncDirty(ectx, pixi) {
|
|
|
52618
52775
|
return moved;
|
|
52619
52776
|
}
|
|
52620
52777
|
/**
|
|
52621
|
-
* Tells whether a box of a view, times the view's scale, covers the viewport on both axes.
|
|
52778
|
+
* Tells whether a box of a view, times the view's scale and its per-axis factors, covers the viewport on both axes.
|
|
52622
52779
|
*
|
|
52623
52780
|
* @param ectx - Domain context of the effects plugin.
|
|
52624
52781
|
* @param entity - The entity.
|
|
@@ -52628,8 +52785,11 @@ function syncDirty(ectx, pixi) {
|
|
|
52628
52785
|
* @returns True when the scaled box covers the viewport.
|
|
52629
52786
|
*/
|
|
52630
52787
|
function boxCovers(ectx, entity, width, height, size) {
|
|
52631
|
-
const
|
|
52632
|
-
|
|
52788
|
+
const transform = ectx.deps.world.ecs.get(entity, Transform);
|
|
52789
|
+
const scale = transform?.scale ?? 1;
|
|
52790
|
+
const factorX = transform !== void 0 && "scaleX" in transform ? transform.scaleX ?? 1 : 1;
|
|
52791
|
+
const factorY = transform !== void 0 && "scaleY" in transform ? transform.scaleY ?? 1 : 1;
|
|
52792
|
+
return width * scale * factorX >= size.width && height * scale * factorY >= size.height;
|
|
52633
52793
|
}
|
|
52634
52794
|
/**
|
|
52635
52795
|
* Tells whether a filtered view covers the whole viewport. A view whose enabled filters declare an
|
|
@@ -53626,6 +53786,8 @@ const POSE = {
|
|
|
53626
53786
|
y: 0,
|
|
53627
53787
|
rotation: 0,
|
|
53628
53788
|
scale: 1,
|
|
53789
|
+
scaleX: 1,
|
|
53790
|
+
scaleY: 1,
|
|
53629
53791
|
pivot: {
|
|
53630
53792
|
x: 0,
|
|
53631
53793
|
y: 0
|
|
@@ -62277,7 +62439,8 @@ function poseOf(reader, entity) {
|
|
|
62277
62439
|
* Writes where an entity really is: its pose composed through every entity it is drawn under,
|
|
62278
62440
|
* the arithmetic of `rootPoseInto`, over `upOf`. The answer keeps the entity's own pivot. Kept in
|
|
62279
62441
|
* step with `rootPoseInto` of `renderer/sync/pose.ts`: the same composition, step by step, over the
|
|
62280
|
-
* parents of `ui` elements and the rest pose of an element whose `Transform` has not landed.
|
|
62442
|
+
* parents of `ui` elements and the rest pose of an element whose `Transform` has not landed. Both
|
|
62443
|
+
* per-axis factors are written on every call, 1 for an entity without them.
|
|
62281
62444
|
*
|
|
62282
62445
|
* @param reader - What the resolver reads.
|
|
62283
62446
|
* @param entity - The entity.
|
|
@@ -62291,6 +62454,8 @@ function drawnPoseInto(reader, entity, out) {
|
|
|
62291
62454
|
out.y = own.y;
|
|
62292
62455
|
out.rotation = own.rotation;
|
|
62293
62456
|
out.scale = own.scale;
|
|
62457
|
+
out.scaleX = "scaleX" in own ? own.scaleX ?? 1 : 1;
|
|
62458
|
+
out.scaleY = "scaleY" in own ? own.scaleY ?? 1 : 1;
|
|
62294
62459
|
out.pivot.x = own.pivot.x;
|
|
62295
62460
|
out.pivot.y = own.pivot.y;
|
|
62296
62461
|
let current = entity;
|
|
@@ -62300,12 +62465,16 @@ function drawnPoseInto(reader, entity, out) {
|
|
|
62300
62465
|
const above = poseOf(reader, parent) ?? Transform.defaults;
|
|
62301
62466
|
const cos = Math.cos(above.rotation);
|
|
62302
62467
|
const sin = Math.sin(above.rotation);
|
|
62303
|
-
const
|
|
62304
|
-
const
|
|
62468
|
+
const factorX = "scaleX" in above ? above.scaleX ?? 1 : 1;
|
|
62469
|
+
const factorY = "scaleY" in above ? above.scaleY ?? 1 : 1;
|
|
62470
|
+
const dx = (out.x - above.pivot.x) * factorX;
|
|
62471
|
+
const dy = (out.y - above.pivot.y) * factorY;
|
|
62305
62472
|
out.x = above.x + above.scale * (dx * cos - dy * sin);
|
|
62306
62473
|
out.y = above.y + above.scale * (dx * sin + dy * cos);
|
|
62307
62474
|
out.rotation += above.rotation;
|
|
62308
62475
|
out.scale *= above.scale;
|
|
62476
|
+
out.scaleX *= factorX;
|
|
62477
|
+
out.scaleY *= factorY;
|
|
62309
62478
|
current = parent;
|
|
62310
62479
|
}
|
|
62311
62480
|
return true;
|
|
@@ -62345,17 +62514,24 @@ function visible(reader, entity) {
|
|
|
62345
62514
|
}
|
|
62346
62515
|
/**
|
|
62347
62516
|
* Moves a local box of an entity into root space, in place: moved by the pose, scaled around its
|
|
62348
|
-
* pivot, the rotation left out. The numbers stay in the rect: a fractional number handed to
|
|
62349
|
-
* is boxed.
|
|
62517
|
+
* pivot per axis, the rotation left out. The numbers stay in the rect: a fractional number handed to
|
|
62518
|
+
* a call is boxed. A size is a magnitude: a view flipped by a negative factor covers the same
|
|
62519
|
+
* ground mirrored, so its rect is as wide as the unflipped one and starts at its left edge.
|
|
62350
62520
|
*
|
|
62351
62521
|
* @param pose - The root pose of the entity.
|
|
62352
62522
|
* @param out - The box in the entity's own units, written in root space.
|
|
62353
62523
|
*/
|
|
62354
62524
|
function toRoot(pose, out) {
|
|
62355
|
-
|
|
62356
|
-
|
|
62357
|
-
out.w
|
|
62358
|
-
out.h
|
|
62525
|
+
const factorX = pose.scale * pose.scaleX;
|
|
62526
|
+
const factorY = pose.scale * pose.scaleY;
|
|
62527
|
+
const width = out.w * Math.abs(factorX);
|
|
62528
|
+
const height = out.h * Math.abs(factorY);
|
|
62529
|
+
const left = pose.x + factorX * (out.x - pose.pivot.x);
|
|
62530
|
+
const top = pose.y + factorY * (out.y - pose.pivot.y);
|
|
62531
|
+
out.x = factorX < 0 ? left - width : left;
|
|
62532
|
+
out.y = factorY < 0 ? top - height : top;
|
|
62533
|
+
out.w = width;
|
|
62534
|
+
out.h = height;
|
|
62359
62535
|
}
|
|
62360
62536
|
/**
|
|
62361
62537
|
* Writes the box of an entity in its own units, by what it draws: the layout box of a ui element,
|
|
@@ -62418,8 +62594,8 @@ function localBoxInto(reader, entity, pose, out) {
|
|
|
62418
62594
|
* Writes where an entity is drawn, in screen reference units, when it is shown. A box of no area is
|
|
62419
62595
|
* shown at its point: a width or a height of 0. Not shown: the entity belongs to a scene built
|
|
62420
62596
|
* aside, it or something it is drawn under is leaving, the alphas on its way up multiply to 0.01 or
|
|
62421
|
-
* less, its root pose is at scale 0 or less
|
|
62422
|
-
* parent), it draws no box, or the box is turned inside out (a size below 0).
|
|
62597
|
+
* less, its root pose is at scale 0 or less or has a per-axis factor (`scaleX`, `scaleY`) of exactly 0
|
|
62598
|
+
* (it pops in from scale 0, or hangs under a collapsed parent), it draws no box, or the box is turned inside out (a size below 0).
|
|
62423
62599
|
*
|
|
62424
62600
|
* @param reader - What the resolver reads.
|
|
62425
62601
|
* @param entity - The entity of the target.
|
|
@@ -62429,7 +62605,8 @@ function localBoxInto(reader, entity, pose, out) {
|
|
|
62429
62605
|
*/
|
|
62430
62606
|
function drawnInto(reader, entity, out, pose) {
|
|
62431
62607
|
if (building(reader, entity) || !visible(reader, entity)) return false;
|
|
62432
|
-
if (!drawnPoseInto(reader, entity, pose)
|
|
62608
|
+
if (!drawnPoseInto(reader, entity, pose)) return false;
|
|
62609
|
+
if (pose.scale <= 0 || pose.scaleX === 0 || pose.scaleY === 0) return false;
|
|
62433
62610
|
if (!localBoxInto(reader, entity, pose, out)) return false;
|
|
62434
62611
|
return out.w >= 0 && out.h >= 0;
|
|
62435
62612
|
}
|
|
@@ -62516,6 +62693,8 @@ function rectOfTargets(ctx, to) {
|
|
|
62516
62693
|
y: 0,
|
|
62517
62694
|
rotation: 0,
|
|
62518
62695
|
scale: 1,
|
|
62696
|
+
scaleX: 1,
|
|
62697
|
+
scaleY: 1,
|
|
62519
62698
|
pivot: {
|
|
62520
62699
|
x: 0,
|
|
62521
62700
|
y: 0
|
|
@@ -65344,7 +65523,7 @@ function checkLoop(name, keys) {
|
|
|
65344
65523
|
}
|
|
65345
65524
|
/**
|
|
65346
65525
|
* The pose one key gives the Transform: `dx` and `dy` as positions from the rest pose, rotation
|
|
65347
|
-
* and scale as written.
|
|
65526
|
+
* and scale, scaleX and scaleY as written.
|
|
65348
65527
|
*
|
|
65349
65528
|
* @param key - The key.
|
|
65350
65529
|
* @param rest - The rest position of the view.
|
|
@@ -65357,6 +65536,8 @@ function transformPose(key, rest) {
|
|
|
65357
65536
|
if (fields?.dy !== void 0) pose.y = rest.y + fields.dy;
|
|
65358
65537
|
if (fields?.rotation !== void 0) pose.rotation = fields.rotation;
|
|
65359
65538
|
if (fields?.scale !== void 0) pose.scale = fields.scale;
|
|
65539
|
+
if (fields?.scaleX !== void 0) pose.scaleX = fields.scaleX;
|
|
65540
|
+
if (fields?.scaleY !== void 0) pose.scaleY = fields.scaleY;
|
|
65360
65541
|
return pose;
|
|
65361
65542
|
}
|
|
65362
65543
|
/**
|
|
@@ -65396,7 +65577,9 @@ function lanesOf(view) {
|
|
|
65396
65577
|
x,
|
|
65397
65578
|
y,
|
|
65398
65579
|
rotation,
|
|
65399
|
-
scale
|
|
65580
|
+
scale,
|
|
65581
|
+
scaleX: transform.scaleX ?? 1,
|
|
65582
|
+
scaleY: transform.scaleY ?? 1
|
|
65400
65583
|
},
|
|
65401
65584
|
pose: (key) => transformPose(key, {
|
|
65402
65585
|
x,
|
|
@@ -65504,7 +65687,7 @@ function exitLane(view, lane, keys, ms, reduced) {
|
|
|
65504
65687
|
* @returns The offsets the key names.
|
|
65505
65688
|
* @example
|
|
65506
65689
|
* ```ts
|
|
65507
|
-
* loopTransformPose({ at: 0.5, Transform: { dx: 4,
|
|
65690
|
+
* loopTransformPose({ at: 0.5, Transform: { dx: 4, scaleX: 0.05 } }); // { x: 4, scaleX: 0.05 }
|
|
65508
65691
|
* ```
|
|
65509
65692
|
*/
|
|
65510
65693
|
function loopTransformPose(key) {
|
|
@@ -65514,6 +65697,8 @@ function loopTransformPose(key) {
|
|
|
65514
65697
|
if (fields?.dy !== void 0) pose.y = fields.dy;
|
|
65515
65698
|
if (fields?.rotation !== void 0) pose.rotation = fields.rotation;
|
|
65516
65699
|
if (fields?.scale !== void 0) pose.scale = fields.scale;
|
|
65700
|
+
if (fields?.scaleX !== void 0) pose.scaleX = fields.scaleX;
|
|
65701
|
+
if (fields?.scaleY !== void 0) pose.scaleY = fields.scaleY;
|
|
65517
65702
|
return pose;
|
|
65518
65703
|
}
|
|
65519
65704
|
/**
|
|
@@ -67436,6 +67621,8 @@ function createAnchor() {
|
|
|
67436
67621
|
y: 0,
|
|
67437
67622
|
rotation: 0,
|
|
67438
67623
|
scale: 1,
|
|
67624
|
+
scaleX: 1,
|
|
67625
|
+
scaleY: 1,
|
|
67439
67626
|
pivot: {
|
|
67440
67627
|
x: 0,
|
|
67441
67628
|
y: 0
|
|
@@ -70108,7 +70295,7 @@ function pivotOf(origin, width, height) {
|
|
|
70108
70295
|
*
|
|
70109
70296
|
* @param rect - The rect of the element in root coordinates.
|
|
70110
70297
|
* @param parent - The rect of its parent, or nothing for a root element.
|
|
70111
|
-
* @param style - The resolved style, for `origin`, `offsetX`, `offsetY`, `scale` and `rotation`.
|
|
70298
|
+
* @param style - The resolved style, for `origin`, `offsetX`, `offsetY`, `scale`, `scaleX`, `scaleY` and `rotation`.
|
|
70112
70299
|
* @param fit - The element's own fit scale, 1 without `fit: "contain"`.
|
|
70113
70300
|
* @returns The rest transform.
|
|
70114
70301
|
* @example
|
|
@@ -70117,6 +70304,8 @@ function pivotOf(origin, width, height) {
|
|
|
70117
70304
|
* // { x: 45, y: 85, rotation: 0, scale: 1, pivot: { x: 5, y: 5 } }
|
|
70118
70305
|
* restTransform({ x: 0, y: 0, w: 200, h: 80 }, undefined, { rotation: -0.026, origin: "top" });
|
|
70119
70306
|
* // { x: 100, y: 0, rotation: -0.026, scale: 1, pivot: { x: 100, y: 0 } }
|
|
70307
|
+
* restTransform({ x: 0, y: 0, w: 200, h: 80 }, undefined, { scaleX: 0.5, origin: "topLeft" });
|
|
70308
|
+
* // { x: 0, y: 0, rotation: 0, scale: 1, scaleX: 0.5, pivot: { x: 0, y: 0 } }
|
|
70120
70309
|
* ```
|
|
70121
70310
|
*/
|
|
70122
70311
|
function restTransform(rect, parent, style = {}, fit = 1) {
|
|
@@ -70129,13 +70318,16 @@ function restTransform(rect, parent, style = {}, fit = 1) {
|
|
|
70129
70318
|
x: rect.x - (parent?.x ?? 0),
|
|
70130
70319
|
y: rect.y - (parent?.y ?? 0)
|
|
70131
70320
|
};
|
|
70132
|
-
|
|
70321
|
+
const rest = {
|
|
70133
70322
|
x: local.x + centre.x + fit * (pivot.x + (style.offsetX ?? 0) - centre.x),
|
|
70134
70323
|
y: local.y + centre.y + fit * (pivot.y + (style.offsetY ?? 0) - centre.y),
|
|
70135
70324
|
rotation: style.rotation ?? 0,
|
|
70136
70325
|
scale: fit * (style.scale ?? 1),
|
|
70137
70326
|
pivot
|
|
70138
70327
|
};
|
|
70328
|
+
if (style.scaleX !== void 0) rest.scaleX = style.scaleX;
|
|
70329
|
+
if (style.scaleY !== void 0) rest.scaleY = style.scaleY;
|
|
70330
|
+
return rest;
|
|
70139
70331
|
}
|
|
70140
70332
|
/**
|
|
70141
70333
|
* Records the rest pose of one element before a hook runs: the transform from `Box` and the
|
|
@@ -71145,6 +71337,8 @@ function createGuide(payload, veil) {
|
|
|
71145
71337
|
y: 0,
|
|
71146
71338
|
rotation: 0,
|
|
71147
71339
|
scale: 1,
|
|
71340
|
+
scaleX: 1,
|
|
71341
|
+
scaleY: 1,
|
|
71148
71342
|
pivot: {
|
|
71149
71343
|
x: 0,
|
|
71150
71344
|
y: 0
|
|
@@ -73006,12 +73200,14 @@ function createAnchorPass(ctx, jsx) {
|
|
|
73006
73200
|
/**
|
|
73007
73201
|
* Maps the union of the targets into the root coordinates of the anchor: through the root pose of
|
|
73008
73202
|
* the entity it is drawn under (its parent, or the slot of its root), then by its parent's rect,
|
|
73009
|
-
* then padded outward
|
|
73010
|
-
* targets: the anchor stands on that
|
|
73203
|
+
* then padded outward, each axis by its own factor (`scale × scaleX`, `scale × scaleY`). A size an
|
|
73204
|
+
* inward pad turns below 0 stops at 0, about the centre of the targets: the anchor stands on that
|
|
73205
|
+
* point.
|
|
73011
73206
|
*
|
|
73012
73207
|
* @param element - The anchor.
|
|
73013
73208
|
* @param anchor - Its record: `screen` is read, `next` written.
|
|
73014
|
-
* @returns False when the space it is drawn in is collapsed: nothing of it
|
|
73209
|
+
* @returns False when the space it is drawn in is collapsed on an axis, or flipped: nothing of it
|
|
73210
|
+
* could be seen, or no rect maps back.
|
|
73015
73211
|
*/
|
|
73016
73212
|
function mapInto(element, anchor) {
|
|
73017
73213
|
const above = element.parent ?? state.roots.get(element.root)?.slot ?? 0;
|
|
@@ -73020,19 +73216,22 @@ function createAnchorPass(ctx, jsx) {
|
|
|
73020
73216
|
pose.x = 0;
|
|
73021
73217
|
pose.y = 0;
|
|
73022
73218
|
pose.scale = 1;
|
|
73219
|
+
pose.scaleX = 1;
|
|
73220
|
+
pose.scaleY = 1;
|
|
73023
73221
|
pose.pivot.x = 0;
|
|
73024
73222
|
pose.pivot.y = 0;
|
|
73025
73223
|
}
|
|
73026
|
-
const
|
|
73027
|
-
|
|
73224
|
+
const scaleX = pose.scale * pose.scaleX;
|
|
73225
|
+
const scaleY = pose.scale * pose.scaleY;
|
|
73226
|
+
if (scaleX <= 0 || scaleY <= 0) return false;
|
|
73028
73227
|
const parent = element.parent === void 0 ? void 0 : lookup(element.parent);
|
|
73029
73228
|
const given = element.node.props.pad;
|
|
73030
73229
|
const pad = typeof given === "number" && Number.isFinite(given) ? given : 0;
|
|
73031
73230
|
const { screen, next } = anchor;
|
|
73032
|
-
next.x = pose.pivot.x + (screen.x - pose.x) /
|
|
73033
|
-
next.y = pose.pivot.y + (screen.y - pose.y) /
|
|
73034
|
-
next.w = screen.w /
|
|
73035
|
-
next.h = screen.h /
|
|
73231
|
+
next.x = pose.pivot.x + (screen.x - pose.x) / scaleX + (parent?.rect.x ?? 0) - pad;
|
|
73232
|
+
next.y = pose.pivot.y + (screen.y - pose.y) / scaleY + (parent?.rect.y ?? 0) - pad;
|
|
73233
|
+
next.w = screen.w / scaleX + 2 * pad;
|
|
73234
|
+
next.h = screen.h / scaleY + 2 * pad;
|
|
73036
73235
|
if (next.w < 0) {
|
|
73037
73236
|
next.x += next.w / 2;
|
|
73038
73237
|
next.w = 0;
|
|
@@ -73315,6 +73514,8 @@ function createAnchorPass(ctx, jsx) {
|
|
|
73315
73514
|
pose.y = rest.y;
|
|
73316
73515
|
pose.rotation = rest.rotation;
|
|
73317
73516
|
pose.scale = rest.scale;
|
|
73517
|
+
if ("scaleX" in rest || "scaleX" in pose) pose.scaleX = "scaleX" in rest ? rest.scaleX ?? 1 : 1;
|
|
73518
|
+
if ("scaleY" in rest || "scaleY" in pose) pose.scaleY = "scaleY" in rest ? rest.scaleY ?? 1 : 1;
|
|
73318
73519
|
ecs.set(element.entity, Transform, NO_PATCH);
|
|
73319
73520
|
}
|
|
73320
73521
|
/**
|