@moku-labs/game 0.15.162 → 0.15.163
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/dist/app/page.d.mts +1 -1
- package/dist/app/system.d.mts +2 -2
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +1 -1
- package/dist/{commands-Gi8RMNnU.d.mts → commands-CAvCuLaL.d.mts} +2 -2
- package/dist/control.d.mts +1 -1
- package/dist/{index-CbMDaUan.d.mts → index-oS9wiCoO.d.mts} +11 -11
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-CkJJvWKb.d.mts → runtime-Bb5sNTGb.d.mts} +1 -1
- package/dist/{src-mZkN8URR.mjs → src-DBhsppmi.mjs} +902 -261
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +1 -1
- package/dist/{types-CPiWOiSc.d.mts → types-C4d1Ptfc.d.mts} +1881 -39
- package/dist/{types-DkQbqqw0.d.mts → types-SUCTOeQZ.d.mts} +3 -3
- package/dist/types-dSup2_q9.d.mts +1841 -0
- package/dist/{visual-nAxiy1aK.d.mts → visual-BZrQT1r1.d.mts} +2 -3
- package/dist/visual.d.mts +1 -1
- package/package.json +3 -3
- package/dist/types-D8D2ZtEi.d.mts +0 -3632
|
@@ -29652,9 +29652,12 @@ function isDrawn(view, root) {
|
|
|
29652
29652
|
function passesOf(slots) {
|
|
29653
29653
|
let passes = 0;
|
|
29654
29654
|
let enabled = false;
|
|
29655
|
-
for (
|
|
29656
|
-
|
|
29657
|
-
enabled
|
|
29655
|
+
for (let index = 0; index < slots.length; index += 1) {
|
|
29656
|
+
const slot = slots[index];
|
|
29657
|
+
if (slot?.filter.enabled) {
|
|
29658
|
+
passes += slot.passes;
|
|
29659
|
+
enabled = true;
|
|
29660
|
+
}
|
|
29658
29661
|
}
|
|
29659
29662
|
return enabled ? 1 + passes : 0;
|
|
29660
29663
|
}
|
|
@@ -29675,7 +29678,9 @@ function addFiltered(slots, entity) {
|
|
|
29675
29678
|
const { sync, kept } = walk$1;
|
|
29676
29679
|
if (sync === void 0 || kept === void 0 || sync.root === void 0) return;
|
|
29677
29680
|
const cache = sync.passes;
|
|
29678
|
-
for (
|
|
29681
|
+
for (let index = 0; index < slots.length; index += 1) {
|
|
29682
|
+
const slot = slots[index];
|
|
29683
|
+
if (slot === void 0) continue;
|
|
29679
29684
|
cache.filters[cache.count] = slot.filter;
|
|
29680
29685
|
cache.enabled[cache.count] = slot.filter.enabled;
|
|
29681
29686
|
cache.count += 1;
|
|
@@ -32446,7 +32451,7 @@ const DOUBLE_SEED$1 = .5;
|
|
|
32446
32451
|
* (`position.x = x`) takes the number as an argument, and a double handed to a call that is not inlined is boxed: 16 B
|
|
32447
32452
|
* a frame, whether it is inlined or not depends on the optimizer's budget (`transition.perf.ts`).
|
|
32448
32453
|
*/
|
|
32449
|
-
const AT = {
|
|
32454
|
+
const AT$1 = {
|
|
32450
32455
|
x: DOUBLE_SEED$1,
|
|
32451
32456
|
y: DOUBLE_SEED$1
|
|
32452
32457
|
};
|
|
@@ -32746,8 +32751,8 @@ function paintSprite(sprite, picture, playing, screen) {
|
|
|
32746
32751
|
const eased = EASED[0] ?? 0;
|
|
32747
32752
|
const { transition } = playing;
|
|
32748
32753
|
if (sprite.texture !== picture) sprite.texture = picture;
|
|
32749
|
-
AT.x = screen.x;
|
|
32750
|
-
AT.y = screen.y;
|
|
32754
|
+
AT$1.x = screen.x;
|
|
32755
|
+
AT$1.y = screen.y;
|
|
32751
32756
|
SCALED.x = screen.width / picture.width;
|
|
32752
32757
|
SCALED.y = screen.height / picture.height;
|
|
32753
32758
|
if (transition.kind !== "slide") {
|
|
@@ -32758,15 +32763,15 @@ function paintSprite(sprite, picture, playing, screen) {
|
|
|
32758
32763
|
sprite.alpha = 1;
|
|
32759
32764
|
switch (transition.to) {
|
|
32760
32765
|
case "left":
|
|
32761
|
-
AT.x = screen.x - eased * screen.width;
|
|
32766
|
+
AT$1.x = screen.x - eased * screen.width;
|
|
32762
32767
|
break;
|
|
32763
32768
|
case "right":
|
|
32764
|
-
AT.x = screen.x + eased * screen.width;
|
|
32769
|
+
AT$1.x = screen.x + eased * screen.width;
|
|
32765
32770
|
break;
|
|
32766
32771
|
case "up":
|
|
32767
|
-
AT.y = screen.y - eased * screen.height;
|
|
32772
|
+
AT$1.y = screen.y - eased * screen.height;
|
|
32768
32773
|
break;
|
|
32769
|
-
case "down": AT.y = screen.y + eased * screen.height;
|
|
32774
|
+
case "down": AT$1.y = screen.y + eased * screen.height;
|
|
32770
32775
|
}
|
|
32771
32776
|
placeAt(sprite);
|
|
32772
32777
|
}
|
|
@@ -32777,7 +32782,7 @@ function paintSprite(sprite, picture, playing, screen) {
|
|
|
32777
32782
|
* @param shown - The sprite or the mesh.
|
|
32778
32783
|
*/
|
|
32779
32784
|
function placeAt(shown) {
|
|
32780
|
-
shown.position.copyFrom(AT);
|
|
32785
|
+
shown.position.copyFrom(AT$1);
|
|
32781
32786
|
shown.scale.copyFrom(SCALED);
|
|
32782
32787
|
}
|
|
32783
32788
|
/**
|
|
@@ -32986,8 +32991,8 @@ function paintMesh(sctx, pixi, objects, playing, screen) {
|
|
|
32986
32991
|
}
|
|
32987
32992
|
const { mesh } = picture;
|
|
32988
32993
|
if (mesh.shader !== shader) mesh.shader = shader;
|
|
32989
|
-
AT.x = screen.x;
|
|
32990
|
-
AT.y = screen.y;
|
|
32994
|
+
AT$1.x = screen.x;
|
|
32995
|
+
AT$1.y = screen.y;
|
|
32991
32996
|
SCALED.x = screen.width;
|
|
32992
32997
|
SCALED.y = screen.height;
|
|
32993
32998
|
placeAt(mesh);
|
|
@@ -38353,7 +38358,10 @@ function keeps(record, key) {
|
|
|
38353
38358
|
*/
|
|
38354
38359
|
function factorOf(order, key) {
|
|
38355
38360
|
let factor = 1;
|
|
38356
|
-
for (
|
|
38361
|
+
for (let index = 0; index < order.length; index += 1) {
|
|
38362
|
+
const record = order[index];
|
|
38363
|
+
if (record !== void 0) factor += (keeps(record, key) - factor) * record.level;
|
|
38364
|
+
}
|
|
38357
38365
|
return factor;
|
|
38358
38366
|
}
|
|
38359
38367
|
/**
|
|
@@ -38365,7 +38373,10 @@ function factorOf(order, key) {
|
|
|
38365
38373
|
*/
|
|
38366
38374
|
function targetOf$3(order, key) {
|
|
38367
38375
|
let target = 1;
|
|
38368
|
-
for (
|
|
38376
|
+
for (let index = 0; index < order.length; index += 1) {
|
|
38377
|
+
const record = order[index];
|
|
38378
|
+
if (record !== void 0 && record.phase !== "exiting") target = keeps(record, key);
|
|
38379
|
+
}
|
|
38369
38380
|
return target;
|
|
38370
38381
|
}
|
|
38371
38382
|
/**
|
|
@@ -38377,7 +38388,9 @@ function targetOf$3(order, key) {
|
|
|
38377
38388
|
* @returns True when a tap does not reach the part.
|
|
38378
38389
|
*/
|
|
38379
38390
|
function inertOf(order, key) {
|
|
38380
|
-
for (
|
|
38391
|
+
for (let index = 0; index < order.length; index += 1) {
|
|
38392
|
+
const record = order[index];
|
|
38393
|
+
if (record === void 0) continue;
|
|
38381
38394
|
const { hud, hudInert } = record.value;
|
|
38382
38395
|
if (!hudInert || hud === "none" || hud === "under") continue;
|
|
38383
38396
|
if (hud === "all" || hud.includes(key)) return true;
|
|
@@ -38393,7 +38406,10 @@ function inertOf(order, key) {
|
|
|
38393
38406
|
*/
|
|
38394
38407
|
function holdsSame(list, set) {
|
|
38395
38408
|
if (list.length !== set.size) return false;
|
|
38396
|
-
for (
|
|
38409
|
+
for (let index = 0; index < list.length; index += 1) {
|
|
38410
|
+
const node = list[index];
|
|
38411
|
+
if (node !== void 0 && !set.has(node)) return false;
|
|
38412
|
+
}
|
|
38397
38413
|
return true;
|
|
38398
38414
|
}
|
|
38399
38415
|
/**
|
|
@@ -38411,7 +38427,10 @@ function keepOff(sctx, count) {
|
|
|
38411
38427
|
if (holdsSame(offList, overlay.offTops)) return;
|
|
38412
38428
|
const next = overlay.nextOff;
|
|
38413
38429
|
if (next.size > 0) next.clear();
|
|
38414
|
-
for (
|
|
38430
|
+
for (let index = 0; index < offList.length; index += 1) {
|
|
38431
|
+
const top = offList[index];
|
|
38432
|
+
if (top !== void 0) next.add(top);
|
|
38433
|
+
}
|
|
38415
38434
|
overlay.nextOff = overlay.offTops;
|
|
38416
38435
|
overlay.offTops = next;
|
|
38417
38436
|
}
|
|
@@ -38433,6 +38452,41 @@ function warnOutside(sctx, entity, key) {
|
|
|
38433
38452
|
key
|
|
38434
38453
|
});
|
|
38435
38454
|
}
|
|
38455
|
+
/** What the walk of the HUD parts reads, set before the walk: one at a time, no closure per frame. */
|
|
38456
|
+
const partsWalk = {
|
|
38457
|
+
sctx: void 0,
|
|
38458
|
+
hud: void 0,
|
|
38459
|
+
settling: false,
|
|
38460
|
+
count: 0
|
|
38461
|
+
};
|
|
38462
|
+
/**
|
|
38463
|
+
* Steps one HUD part of the walk: judged against the HUD layer, faded by the factor of the overlays, and noted in the
|
|
38464
|
+
* list of the tops that take no tap when it fades, is going to fade, or is kept by an inert overlay.
|
|
38465
|
+
*
|
|
38466
|
+
* @param entity - The part.
|
|
38467
|
+
*/
|
|
38468
|
+
function stepPart(entity) {
|
|
38469
|
+
const { sctx, hud, settling } = partsWalk;
|
|
38470
|
+
if (sctx === void 0) return;
|
|
38471
|
+
const state = sctx.ctx.state.sync;
|
|
38472
|
+
const overlay = state.overlay;
|
|
38473
|
+
const view = state.views.get(entity);
|
|
38474
|
+
if (view === void 0) return;
|
|
38475
|
+
const key = sctx.ctx.deps.world.ecs.get(entity, HudPart)?.key ?? "";
|
|
38476
|
+
if (hud === void 0 || layerOf$1(sctx, entity) !== hud) {
|
|
38477
|
+
if (!(settling || sctx.ctx.deps.world.projection.isBuilding(entity))) warnOutside(sctx, entity, key);
|
|
38478
|
+
applyHud(sctx, entity, view, 1);
|
|
38479
|
+
return;
|
|
38480
|
+
}
|
|
38481
|
+
const factor = factorOf(overlay.order, key);
|
|
38482
|
+
applyHud(sctx, entity, view, factor);
|
|
38483
|
+
if (factor < 1 || targetOf$3(overlay.order, key) < 1 || inertOf(overlay.order, key)) {
|
|
38484
|
+
const top = view.wrapper ?? view.object;
|
|
38485
|
+
const { offList } = overlay;
|
|
38486
|
+
if (offList[partsWalk.count] !== top) offList[partsWalk.count] = top;
|
|
38487
|
+
partsWalk.count += 1;
|
|
38488
|
+
}
|
|
38489
|
+
}
|
|
38436
38490
|
/**
|
|
38437
38491
|
* The HUD parts: every part of the HUD layer is drawn with the factor of the overlays' levels of this frame, and the
|
|
38438
38492
|
* parts leaving or not fully back take no tap, and the parts an inert overlay keeps shown take no tap either. A part
|
|
@@ -38446,29 +38500,14 @@ function stepParts(sctx) {
|
|
|
38446
38500
|
const state = sctx.ctx.state.sync;
|
|
38447
38501
|
const overlay = state.overlay;
|
|
38448
38502
|
if (overlay.parts.size === 0 && overlay.offTops.size === 0) return;
|
|
38449
|
-
|
|
38450
|
-
|
|
38451
|
-
|
|
38452
|
-
|
|
38453
|
-
|
|
38454
|
-
|
|
38455
|
-
|
|
38456
|
-
|
|
38457
|
-
if (view === void 0) continue;
|
|
38458
|
-
const key = ecs.get(entity, HudPart)?.key ?? "";
|
|
38459
|
-
if (hud === void 0 || layerOf$1(sctx, entity) !== hud) {
|
|
38460
|
-
if (!(settling || projection.isBuilding(entity))) warnOutside(sctx, entity, key);
|
|
38461
|
-
applyHud(sctx, entity, view, 1);
|
|
38462
|
-
continue;
|
|
38463
|
-
}
|
|
38464
|
-
const factor = factorOf(overlay.order, key);
|
|
38465
|
-
applyHud(sctx, entity, view, factor);
|
|
38466
|
-
if (factor < 1 || targetOf$3(overlay.order, key) < 1 || inertOf(overlay.order, key)) {
|
|
38467
|
-
const top = view.wrapper ?? view.object;
|
|
38468
|
-
if (offList[count] !== top) offList[count] = top;
|
|
38469
|
-
count += 1;
|
|
38470
|
-
}
|
|
38471
|
-
}
|
|
38503
|
+
partsWalk.sctx = sctx;
|
|
38504
|
+
partsWalk.hud = state.hudLayer;
|
|
38505
|
+
partsWalk.settling = heldWaiting(sctx);
|
|
38506
|
+
partsWalk.count = 0;
|
|
38507
|
+
overlay.parts.forEach(stepPart);
|
|
38508
|
+
const count = partsWalk.count;
|
|
38509
|
+
partsWalk.sctx = void 0;
|
|
38510
|
+
partsWalk.hud = void 0;
|
|
38472
38511
|
keepOff(sctx, count);
|
|
38473
38512
|
}
|
|
38474
38513
|
//#endregion
|
|
@@ -39839,10 +39878,10 @@ const NONE = {
|
|
|
39839
39878
|
* The sizes of the probes: the public contract. A page, a game or the native shell sets `--moku-safe-*`; the editor sets
|
|
39840
39879
|
* `--moku-device-safe-*` from its device preset, which a page's own value still overrides.
|
|
39841
39880
|
*/
|
|
39842
|
-
const TOP = "var(--moku-safe-top, var(--moku-device-safe-top, env(safe-area-inset-top, 0px)))";
|
|
39843
|
-
const RIGHT = "var(--moku-safe-right, var(--moku-device-safe-right, env(safe-area-inset-right, 0px)))";
|
|
39844
|
-
const BOTTOM = "var(--moku-safe-bottom, var(--moku-device-safe-bottom, env(safe-area-inset-bottom, 0px)))";
|
|
39845
|
-
const LEFT = "var(--moku-safe-left, var(--moku-device-safe-left, env(safe-area-inset-left, 0px)))";
|
|
39881
|
+
const TOP$1 = "var(--moku-safe-top, var(--moku-device-safe-top, env(safe-area-inset-top, 0px)))";
|
|
39882
|
+
const RIGHT$1 = "var(--moku-safe-right, var(--moku-device-safe-right, env(safe-area-inset-right, 0px)))";
|
|
39883
|
+
const BOTTOM$1 = "var(--moku-safe-bottom, var(--moku-device-safe-bottom, env(safe-area-inset-bottom, 0px)))";
|
|
39884
|
+
const LEFT$1 = "var(--moku-safe-left, var(--moku-device-safe-left, env(safe-area-inset-left, 0px)))";
|
|
39846
39885
|
/**
|
|
39847
39886
|
* Reads one CSS length in pixels.
|
|
39848
39887
|
*
|
|
@@ -39899,12 +39938,12 @@ function createSafeAreaProbes() {
|
|
|
39899
39938
|
const { document } = globalThis;
|
|
39900
39939
|
return {
|
|
39901
39940
|
start: createProbe(document, "start", {
|
|
39902
|
-
width: LEFT,
|
|
39903
|
-
height: TOP
|
|
39941
|
+
width: LEFT$1,
|
|
39942
|
+
height: TOP$1
|
|
39904
39943
|
}),
|
|
39905
39944
|
end: createProbe(document, "end", {
|
|
39906
|
-
width: RIGHT,
|
|
39907
|
-
height: BOTTOM
|
|
39945
|
+
width: RIGHT$1,
|
|
39946
|
+
height: BOTTOM$1
|
|
39908
39947
|
})
|
|
39909
39948
|
};
|
|
39910
39949
|
}
|
|
@@ -42604,6 +42643,55 @@ function sumOffsets(actx, key) {
|
|
|
42604
42643
|
return cellValue(SUM);
|
|
42605
42644
|
}
|
|
42606
42645
|
//#endregion
|
|
42646
|
+
//#region src/plugins/anim/tween/slots.ts
|
|
42647
|
+
/** Bytes of one double. */
|
|
42648
|
+
const DOUBLE = 8;
|
|
42649
|
+
/** The cells of the clock: running time and normalised time. */
|
|
42650
|
+
const CLOCK_CELLS = 2;
|
|
42651
|
+
/** How many arrays of doubles follow the clock (`targets`, `starts`, `values`, `seen`). */
|
|
42652
|
+
const DOUBLE_ARRAYS = 4;
|
|
42653
|
+
/** How many arrays of bytes follow the doubles (`live`, `moved`, `colors`, `partialMoved`). */
|
|
42654
|
+
const BYTE_ARRAYS = 4;
|
|
42655
|
+
/**
|
|
42656
|
+
* Cuts the nine typed arrays of a track out of one buffer: the arrays of doubles first, so each
|
|
42657
|
+
* starts on an aligned offset, then the arrays of bytes. `live` starts at 1 and `seen` at `NaN`,
|
|
42658
|
+
* the rest at 0.
|
|
42659
|
+
*
|
|
42660
|
+
* @param count - How many slots the track has.
|
|
42661
|
+
* @returns The nine views, all over the same `ArrayBuffer`.
|
|
42662
|
+
* @example
|
|
42663
|
+
* ```ts
|
|
42664
|
+
* const cells = slotCellsOf(2);
|
|
42665
|
+
* cells.targets.buffer === cells.live.buffer; // true
|
|
42666
|
+
* cells.targets.length; // 2
|
|
42667
|
+
* ```
|
|
42668
|
+
*/
|
|
42669
|
+
function slotCellsOf(count) {
|
|
42670
|
+
const doubleBytes = (CLOCK_CELLS + DOUBLE_ARRAYS * count) * DOUBLE;
|
|
42671
|
+
const buffer = new ArrayBuffer(doubleBytes + BYTE_ARRAYS * count);
|
|
42672
|
+
const step = count * DOUBLE;
|
|
42673
|
+
const live = new Uint8Array(buffer, doubleBytes, count).fill(1);
|
|
42674
|
+
const targetsAt = 16;
|
|
42675
|
+
const startsAt = targetsAt + step;
|
|
42676
|
+
const valuesAt = startsAt + step;
|
|
42677
|
+
const seenAt = valuesAt + step;
|
|
42678
|
+
const movedAt = doubleBytes + count;
|
|
42679
|
+
const colorsAt = movedAt + count;
|
|
42680
|
+
const partialAt = colorsAt + count;
|
|
42681
|
+
const seen = new Float64Array(buffer, seenAt, count).fill(NaN);
|
|
42682
|
+
return {
|
|
42683
|
+
clock: new Float64Array(buffer, 0, CLOCK_CELLS),
|
|
42684
|
+
targets: new Float64Array(buffer, targetsAt, count),
|
|
42685
|
+
starts: new Float64Array(buffer, startsAt, count),
|
|
42686
|
+
values: new Float64Array(buffer, valuesAt, count),
|
|
42687
|
+
seen,
|
|
42688
|
+
live,
|
|
42689
|
+
moved: new Uint8Array(buffer, movedAt, count),
|
|
42690
|
+
colors: new Uint8Array(buffer, colorsAt, count),
|
|
42691
|
+
partialMoved: new Uint8Array(buffer, partialAt, count)
|
|
42692
|
+
};
|
|
42693
|
+
}
|
|
42694
|
+
//#endregion
|
|
42607
42695
|
//#region src/plugins/anim/tween/advance.ts
|
|
42608
42696
|
/**
|
|
42609
42697
|
* @file anim/tween — the one track table: starting a track, the retarget policy per field, the
|
|
@@ -43063,28 +43151,27 @@ function endTrack(actx, track) {
|
|
|
43063
43151
|
function dropField(actx, track, field) {
|
|
43064
43152
|
delete track.to[field];
|
|
43065
43153
|
track.live[track.names.indexOf(field)] = 0;
|
|
43154
|
+
track.kept -= 1;
|
|
43066
43155
|
track.patch = { ...track.to };
|
|
43067
|
-
if (
|
|
43156
|
+
if (track.kept === 0) endTrack(actx, track);
|
|
43068
43157
|
}
|
|
43069
43158
|
/**
|
|
43070
|
-
* Books every field of an absolute track and cancels the older owner of each, field by field
|
|
43159
|
+
* Books every field of an absolute track and cancels the older owner of each, field by field: the
|
|
43160
|
+
* older owner drops the field as the walk reaches it, and ends with its last one.
|
|
43071
43161
|
*
|
|
43072
43162
|
* @param actx - Domain context of the anim plugin.
|
|
43073
43163
|
* @param track - The new absolute track.
|
|
43074
43164
|
*/
|
|
43075
43165
|
function claimFields(actx, track) {
|
|
43076
|
-
const
|
|
43077
|
-
for (
|
|
43078
|
-
const
|
|
43166
|
+
const { names, slotKeys } = track;
|
|
43167
|
+
for (let slot = 0; slot < names.length; slot++) {
|
|
43168
|
+
const field = names[slot] ?? "";
|
|
43169
|
+
const key = slotKeys[slot] ?? "";
|
|
43079
43170
|
const ownerId = actx.state.owner.get(key);
|
|
43080
43171
|
const older = ownerId === void 0 ? void 0 : actx.state.tracks.get(ownerId);
|
|
43081
43172
|
actx.state.owner.set(key, track.id);
|
|
43082
|
-
if (older !== void 0)
|
|
43083
|
-
older,
|
|
43084
|
-
field
|
|
43085
|
-
});
|
|
43173
|
+
if (older !== void 0) dropField(actx, older, field);
|
|
43086
43174
|
}
|
|
43087
|
-
for (const entry of taken) dropField(actx, entry.older, entry.field);
|
|
43088
43175
|
}
|
|
43089
43176
|
/**
|
|
43090
43177
|
* Reports once each time the table grows past `maxTracks`, so a leak is visible in development
|
|
@@ -43140,6 +43227,24 @@ function targetOf$1(to, segments) {
|
|
|
43140
43227
|
return Object.assign(target, to);
|
|
43141
43228
|
}
|
|
43142
43229
|
/**
|
|
43230
|
+
* The typed arrays of a new track, over one buffer, with the target and the colour flag of each
|
|
43231
|
+
* slot written in.
|
|
43232
|
+
*
|
|
43233
|
+
* @param component - The component the track writes.
|
|
43234
|
+
* @param names - The target fields in slot order.
|
|
43235
|
+
* @param target - The target record the track owns.
|
|
43236
|
+
* @returns The nine views of the track.
|
|
43237
|
+
*/
|
|
43238
|
+
function cellsOf(component, names, target) {
|
|
43239
|
+
const cells = slotCellsOf(names.length);
|
|
43240
|
+
for (let slot = 0; slot < names.length; slot++) {
|
|
43241
|
+
const field = names[slot] ?? "";
|
|
43242
|
+
cells.targets[slot] = target[field] ?? 0;
|
|
43243
|
+
cells.colors[slot] = isColorField(component, field) ? 1 : 0;
|
|
43244
|
+
}
|
|
43245
|
+
return cells;
|
|
43246
|
+
}
|
|
43247
|
+
/**
|
|
43143
43248
|
* Tells whether a field sizes a built-in visual: a loop of it may bring the view onto the screen. Pure.
|
|
43144
43249
|
*
|
|
43145
43250
|
* @param field - A field of a Sprite, a NineSlice or a Shape.
|
|
@@ -43224,17 +43329,11 @@ function startTrack$1(actx, entity, component, to, options, muted, driven = fals
|
|
|
43224
43329
|
ms: instant ? 0 : options.ms,
|
|
43225
43330
|
ease: options.ease ?? "out",
|
|
43226
43331
|
delayMs: instant ? 0 : options.delayMs ?? 0,
|
|
43227
|
-
|
|
43332
|
+
...cellsOf(component, names, target),
|
|
43228
43333
|
begun: false,
|
|
43229
43334
|
names,
|
|
43335
|
+
kept: names.length,
|
|
43230
43336
|
slotKeys: names.map((field) => keys[field] ?? ""),
|
|
43231
|
-
targets: Float64Array.from(names, (field) => target[field] ?? 0),
|
|
43232
|
-
starts: new Float64Array(names.length),
|
|
43233
|
-
live: new Uint8Array(names.length).fill(1),
|
|
43234
|
-
moved: new Uint8Array(names.length),
|
|
43235
|
-
values: new Float64Array(names.length),
|
|
43236
|
-
colors: Uint8Array.from(names, (field) => isColorField(component, field) ? 1 : 0),
|
|
43237
|
-
seen: new Float64Array(names.length).fill(NaN),
|
|
43238
43337
|
muted,
|
|
43239
43338
|
additive: options.additive === true,
|
|
43240
43339
|
driven,
|
|
@@ -43247,8 +43346,7 @@ function startTrack$1(actx, entity, component, to, options, muted, driven = fals
|
|
|
43247
43346
|
keep,
|
|
43248
43347
|
reveals: revealsOf(component, target),
|
|
43249
43348
|
patch: { ...target },
|
|
43250
|
-
partial: void 0
|
|
43251
|
-
partialMoved: new Uint8Array(names.length)
|
|
43349
|
+
partial: void 0
|
|
43252
43350
|
};
|
|
43253
43351
|
actx.state.nextId += 1;
|
|
43254
43352
|
if (track.ended) return track;
|
|
@@ -64214,7 +64312,7 @@ function dropLayouts(state) {
|
|
|
64214
64312
|
* @param style - The style name it shows it in.
|
|
64215
64313
|
* @param box - The box of its `Text`.
|
|
64216
64314
|
*/
|
|
64217
|
-
function keepSize(ctx, entity, resolved, style, box) {
|
|
64315
|
+
function keepSize$1(ctx, entity, resolved, style, box) {
|
|
64218
64316
|
const layout = layoutFor(ctx, resolved, style, box);
|
|
64219
64317
|
const size = ctx.state.measured.get(entity);
|
|
64220
64318
|
if (size === void 0) ctx.state.measured.set(entity, sizeOf(layout));
|
|
@@ -64282,7 +64380,7 @@ function showBound(ctx, entity, text, next, value, style = text.style) {
|
|
|
64282
64380
|
const restyled = style !== text.style;
|
|
64283
64381
|
const changed = restyled || next !== text.resolved;
|
|
64284
64382
|
if (changed) writeBound(ctx, entity, text, next, value, restyled ? style : void 0);
|
|
64285
|
-
if (changed || !ctx.state.measured.has(entity)) keepSize(ctx, entity, next, style, text.box);
|
|
64383
|
+
if (changed || !ctx.state.measured.has(entity)) keepSize$1(ctx, entity, next, style, text.box);
|
|
64286
64384
|
}
|
|
64287
64385
|
/**
|
|
64288
64386
|
* Writes the new string of a bound label, its new style when a named format picked another, and
|
|
@@ -64315,7 +64413,7 @@ function writeBound(ctx, entity, text, next, value, style) {
|
|
|
64315
64413
|
*/
|
|
64316
64414
|
function showAgain(ctx, entity, text) {
|
|
64317
64415
|
ctx.deps.world.ecs.set(entity, Text, { resolved: text.resolved });
|
|
64318
|
-
keepSize(ctx, entity, text.resolved, text.style, text.box);
|
|
64416
|
+
keepSize$1(ctx, entity, text.resolved, text.style, text.box);
|
|
64319
64417
|
}
|
|
64320
64418
|
/**
|
|
64321
64419
|
* Reports a bound label whose style is not a digits style, once per style. An unknown style name
|
|
@@ -64410,7 +64508,7 @@ function stepNamed(ctx, entity, text, bind, format, value, frame) {
|
|
|
64410
64508
|
function standStill(ctx, entity, text, seen, marked) {
|
|
64411
64509
|
if (!marked && !boxMoved(ctx, seen, text)) return;
|
|
64412
64510
|
if (marked) showAgain(ctx, entity, text);
|
|
64413
|
-
else keepSize(ctx, entity, text.resolved, text.style, text.box);
|
|
64511
|
+
else keepSize$1(ctx, entity, text.resolved, text.style, text.box);
|
|
64414
64512
|
seen.box = text.box;
|
|
64415
64513
|
}
|
|
64416
64514
|
/**
|
|
@@ -64444,7 +64542,7 @@ function stepText(ctx, entity, text, frame) {
|
|
|
64444
64542
|
return;
|
|
64445
64543
|
}
|
|
64446
64544
|
if (!isStale(ctx, entity, text, frame)) return;
|
|
64447
|
-
keepSize(ctx, entity, resolveContent(ctx, entity, text), text.style, text.box);
|
|
64545
|
+
keepSize$1(ctx, entity, resolveContent(ctx, entity, text), text.style, text.box);
|
|
64448
64546
|
ctx.state.dirty.delete(entity);
|
|
64449
64547
|
remember(ctx, entity, text, frame);
|
|
64450
64548
|
}
|
|
@@ -66717,10 +66815,51 @@ const NO_HOSTS = Object.freeze([]);
|
|
|
66717
66815
|
*/
|
|
66718
66816
|
function isNameList(value) {
|
|
66719
66817
|
if (!Array.isArray(value)) return false;
|
|
66720
|
-
for (
|
|
66818
|
+
for (let index = 0; index < value.length; index += 1) if (typeof value[index] !== "string") return false;
|
|
66721
66819
|
return true;
|
|
66722
66820
|
}
|
|
66723
66821
|
/**
|
|
66822
|
+
* The walks of the hosting step over the host set and the hosted views: a callback each, made
|
|
66823
|
+
* once per jsx state, and the fields the walk under way reads and answers. A `for…of` over a set
|
|
66824
|
+
* or a map builds an iterator and its results while the code runs unoptimized (F230 U3).
|
|
66825
|
+
*
|
|
66826
|
+
* @param state - The jsx state the walks belong to.
|
|
66827
|
+
* @returns The walks.
|
|
66828
|
+
*/
|
|
66829
|
+
function createHostWalk(state) {
|
|
66830
|
+
const walk = {
|
|
66831
|
+
ctx: void 0,
|
|
66832
|
+
name: "",
|
|
66833
|
+
owner: void 0,
|
|
66834
|
+
owners: (host) => {
|
|
66835
|
+
if (walk.owner !== void 0) return;
|
|
66836
|
+
const element = liveHost(state, host);
|
|
66837
|
+
if (element !== void 0 && hostsOf(element.node).includes(walk.name)) walk.owner = host;
|
|
66838
|
+
},
|
|
66839
|
+
hosting: (host) => {
|
|
66840
|
+
const element = liveHost(state, host);
|
|
66841
|
+
if (element !== void 0 && walk.ctx !== void 0) hostNames(walk.ctx, state, element);
|
|
66842
|
+
},
|
|
66843
|
+
releasing: (host, view) => {
|
|
66844
|
+
const ctx = walk.ctx;
|
|
66845
|
+
if (ctx === void 0 || stillHosts(ctx, state, view, host)) return;
|
|
66846
|
+
state.hosted.delete(view);
|
|
66847
|
+
unparent(ctx, view, host);
|
|
66848
|
+
}
|
|
66849
|
+
};
|
|
66850
|
+
return walk;
|
|
66851
|
+
}
|
|
66852
|
+
/**
|
|
66853
|
+
* The walks of one jsx state, made at their first use.
|
|
66854
|
+
*
|
|
66855
|
+
* @param state - The jsx state.
|
|
66856
|
+
* @returns Its walks.
|
|
66857
|
+
*/
|
|
66858
|
+
function walkOf(state) {
|
|
66859
|
+
state.hostWalk ??= createHostWalk(state);
|
|
66860
|
+
return state.hostWalk;
|
|
66861
|
+
}
|
|
66862
|
+
/**
|
|
66724
66863
|
* The projection names an element hosts. Allocates nothing: the prop itself, or one shared
|
|
66725
66864
|
* empty list.
|
|
66726
66865
|
*
|
|
@@ -66790,10 +66929,11 @@ function liveHost(state, host) {
|
|
|
66790
66929
|
* @returns The owning host, `undefined` when no live host names the projection.
|
|
66791
66930
|
*/
|
|
66792
66931
|
function ownerOf(state, name) {
|
|
66793
|
-
|
|
66794
|
-
|
|
66795
|
-
|
|
66796
|
-
|
|
66932
|
+
const walk = walkOf(state);
|
|
66933
|
+
walk.name = name;
|
|
66934
|
+
walk.owner = void 0;
|
|
66935
|
+
state.hosts.forEach(walk.owners);
|
|
66936
|
+
return walk.owner;
|
|
66797
66937
|
}
|
|
66798
66938
|
/**
|
|
66799
66939
|
* Gives the host as parent to every view of one projection that has no parent and is not held
|
|
@@ -66811,7 +66951,10 @@ function parentViews(ctx, state, name, host) {
|
|
|
66811
66951
|
const ecs = ctx.deps.world.ecs;
|
|
66812
66952
|
const projection = ctx.deps.world.projection;
|
|
66813
66953
|
const aside = projection.isBuilding(host);
|
|
66814
|
-
|
|
66954
|
+
const views = projection.entitiesOf(name);
|
|
66955
|
+
for (let index = 0; index < views.length; index += 1) {
|
|
66956
|
+
const view = views[index];
|
|
66957
|
+
if (view === void 0) continue;
|
|
66815
66958
|
if (ecs.has(view, Held) || projection.isBuilding(view) !== aside) continue;
|
|
66816
66959
|
if (ecs.has(view, Parent) && !state.released.has(view)) continue;
|
|
66817
66960
|
ecs.add(view, Parent({ entity: host }));
|
|
@@ -66873,10 +67016,9 @@ function hostViews(ctx, state, only) {
|
|
|
66873
67016
|
state.membershipSeen = membership;
|
|
66874
67017
|
releaseLeft(ctx, state);
|
|
66875
67018
|
}
|
|
66876
|
-
|
|
66877
|
-
|
|
66878
|
-
|
|
66879
|
-
}
|
|
67019
|
+
const walk = walkOf(state);
|
|
67020
|
+
walk.ctx = ctx;
|
|
67021
|
+
(only ?? state.hosts).forEach(walk.hosting);
|
|
66880
67022
|
}
|
|
66881
67023
|
/**
|
|
66882
67024
|
* Takes the parent back from every hosted view its host no longer holds: the view falls back to
|
|
@@ -66887,12 +67029,9 @@ function hostViews(ctx, state, only) {
|
|
|
66887
67029
|
*/
|
|
66888
67030
|
function releaseLeft(ctx, state) {
|
|
66889
67031
|
if (state.released.size > 0) state.released.clear();
|
|
66890
|
-
|
|
66891
|
-
|
|
66892
|
-
|
|
66893
|
-
state.hosted.delete(view);
|
|
66894
|
-
unparent(ctx, view, host);
|
|
66895
|
-
}
|
|
67032
|
+
const walk = walkOf(state);
|
|
67033
|
+
walk.ctx = ctx;
|
|
67034
|
+
state.hosted.forEach(walk.releasing);
|
|
66896
67035
|
}
|
|
66897
67036
|
/**
|
|
66898
67037
|
* Hosts the views of every projection a live host names and owns; a name listed twice counts once.
|
|
@@ -68982,15 +69121,33 @@ function waits$1(state, root) {
|
|
|
68982
69121
|
return (root.popup?.released === true || root.covered) && !state.removing.has(root.entity);
|
|
68983
69122
|
}
|
|
68984
69123
|
/**
|
|
69124
|
+
* The walk of the popup step over the roots: its callback made once per jsx state.
|
|
69125
|
+
*
|
|
69126
|
+
* @param state - The jsx state the walk belongs to.
|
|
69127
|
+
* @returns The walk.
|
|
69128
|
+
*/
|
|
69129
|
+
function createPopupWalk(state) {
|
|
69130
|
+
const walk = {
|
|
69131
|
+
found: false,
|
|
69132
|
+
waiting: (root) => {
|
|
69133
|
+
if (!walk.found && waits$1(state, root)) walk.found = true;
|
|
69134
|
+
}
|
|
69135
|
+
};
|
|
69136
|
+
return walk;
|
|
69137
|
+
}
|
|
69138
|
+
/**
|
|
68985
69139
|
* Tells whether any root waits for the settle step. Allocates nothing, so a frame without a
|
|
68986
|
-
* released or covered popup costs one scan.
|
|
69140
|
+
* released or covered popup costs one scan: a callback made once, no iterator (F230 U3).
|
|
68987
69141
|
*
|
|
68988
69142
|
* @param state - The jsx state.
|
|
68989
69143
|
* @returns True when at least one root waits.
|
|
68990
69144
|
*/
|
|
68991
69145
|
function anyWaits(state) {
|
|
68992
|
-
|
|
68993
|
-
|
|
69146
|
+
state.popupWalk ??= createPopupWalk(state);
|
|
69147
|
+
const walk = state.popupWalk;
|
|
69148
|
+
walk.found = false;
|
|
69149
|
+
state.roots.forEach(walk.waiting);
|
|
69150
|
+
return walk.found;
|
|
68994
69151
|
}
|
|
68995
69152
|
/**
|
|
68996
69153
|
* The step at the top of every reconcile: released popup roots leave once the flow rests, the
|
|
@@ -71169,8 +71326,14 @@ function sameList(left, right) {
|
|
|
71169
71326
|
* ```
|
|
71170
71327
|
*/
|
|
71171
71328
|
function sameFieldsDeep(left, right) {
|
|
71172
|
-
|
|
71173
|
-
|
|
71329
|
+
let count = 0;
|
|
71330
|
+
for (const key in left) {
|
|
71331
|
+
if (!Object.hasOwn(left, key)) continue;
|
|
71332
|
+
if (!Object.hasOwn(right, key) || !sameValue(left[key], right[key])) return false;
|
|
71333
|
+
count += 1;
|
|
71334
|
+
}
|
|
71335
|
+
for (const key in right) if (Object.hasOwn(right, key)) count -= 1;
|
|
71336
|
+
return count === 0;
|
|
71174
71337
|
}
|
|
71175
71338
|
/**
|
|
71176
71339
|
* Tells whether two prop values say the same. Plain objects and arrays are compared by value,
|
|
@@ -71531,7 +71694,11 @@ const WRITTEN = [
|
|
|
71531
71694
|
* ```
|
|
71532
71695
|
*/
|
|
71533
71696
|
function writesSame(previous, next) {
|
|
71534
|
-
|
|
71697
|
+
for (let index = 0; index < WRITTEN.length; index += 1) {
|
|
71698
|
+
const name = WRITTEN[index] ?? "";
|
|
71699
|
+
if (!sameValue(previous.props[name], next.props[name])) return false;
|
|
71700
|
+
}
|
|
71701
|
+
return true;
|
|
71535
71702
|
}
|
|
71536
71703
|
/**
|
|
71537
71704
|
* The children one element is diffed against. A scroll container holds exactly one of them: the
|
|
@@ -71572,6 +71739,58 @@ function childrenOf(node, slots, axis = "y") {
|
|
|
71572
71739
|
function identityOf(parentIdentity, node, index) {
|
|
71573
71740
|
return `${parentIdentity}|${node.key ?? `${node.type}@${index}`}|${node.type}`;
|
|
71574
71741
|
}
|
|
71742
|
+
/** The char code of `|`, the separator of an identity. */
|
|
71743
|
+
const BAR = 124;
|
|
71744
|
+
/** The char code of `@`, between the type and the index of an unkeyed name. */
|
|
71745
|
+
const AT = 64;
|
|
71746
|
+
/** The char code of `0`. */
|
|
71747
|
+
const ZERO = 48;
|
|
71748
|
+
/**
|
|
71749
|
+
* Tells whether an identity is the one `identityOf` builds for a node, without building it: the
|
|
71750
|
+
* parent identity, `|`, the key or the type, `@` and the index, `|`, the type, compared in place.
|
|
71751
|
+
*
|
|
71752
|
+
* @param identity - The identity an element keeps.
|
|
71753
|
+
* @param parentIdentity - The identity of the parent element.
|
|
71754
|
+
* @param node - The node being placed.
|
|
71755
|
+
* @param index - Its position among its siblings.
|
|
71756
|
+
* @returns True when `identityOf(parentIdentity, node, index)` equals `identity`.
|
|
71757
|
+
* @example
|
|
71758
|
+
* ```ts
|
|
71759
|
+
* isIdentityOf("0|row@2|row", "0", { type: "row", props: {}, children: [] }, 2); // true
|
|
71760
|
+
* ```
|
|
71761
|
+
*/
|
|
71762
|
+
function isIdentityOf(identity, parentIdentity, node, index) {
|
|
71763
|
+
const type = node.type;
|
|
71764
|
+
const head = parentIdentity.length + 1;
|
|
71765
|
+
const tail = identity.length - type.length - 1;
|
|
71766
|
+
if (!(tail >= head && identity.startsWith(parentIdentity) && identity.charCodeAt(head - 1) === BAR && identity.charCodeAt(tail) === BAR && identity.endsWith(type))) return false;
|
|
71767
|
+
if (node.key !== void 0) return tail - head === node.key.length && identity.startsWith(node.key, head);
|
|
71768
|
+
const at = head + type.length;
|
|
71769
|
+
if (!identity.startsWith(type, head) || identity.charCodeAt(at) !== AT) return false;
|
|
71770
|
+
let digit = tail - 1;
|
|
71771
|
+
let rest = index;
|
|
71772
|
+
do {
|
|
71773
|
+
const last = rest % 10;
|
|
71774
|
+
if (digit <= at || identity.charCodeAt(digit) !== ZERO + last) return false;
|
|
71775
|
+
rest = (rest - last) / 10;
|
|
71776
|
+
digit -= 1;
|
|
71777
|
+
} while (rest > 0);
|
|
71778
|
+
return digit === at;
|
|
71779
|
+
}
|
|
71780
|
+
/**
|
|
71781
|
+
* The identity of a node placed where an element stood: the element's own string when it is the
|
|
71782
|
+
* one `identityOf` would build, so an element that stayed concatenates nothing; else a new one.
|
|
71783
|
+
*
|
|
71784
|
+
* @param parentIdentity - The identity of the parent element.
|
|
71785
|
+
* @param node - The node being placed.
|
|
71786
|
+
* @param index - Its position among its siblings.
|
|
71787
|
+
* @param old - The element that stood at that place at the last diff, if any.
|
|
71788
|
+
* @returns The identity.
|
|
71789
|
+
*/
|
|
71790
|
+
function identityAt(parentIdentity, node, index, old) {
|
|
71791
|
+
if (old !== void 0 && isIdentityOf(old.identity, parentIdentity, node, index)) return old.identity;
|
|
71792
|
+
return identityOf(parentIdentity, node, index);
|
|
71793
|
+
}
|
|
71575
71794
|
/**
|
|
71576
71795
|
* Gives the subtree of a component the key the component tag carried, so the element is
|
|
71577
71796
|
* addressable under the name the markup wrote.
|
|
@@ -71886,6 +72105,46 @@ function entitySet(entities) {
|
|
|
71886
72105
|
return new Set(entities);
|
|
71887
72106
|
}
|
|
71888
72107
|
/**
|
|
72108
|
+
* Tells whether the entities a diff placed are a child list as it stands: the same entities in the
|
|
72109
|
+
* same order.
|
|
72110
|
+
*
|
|
72111
|
+
* @param placed - The entities of this render, a scratch buffer.
|
|
72112
|
+
* @param count - How many of them this render placed.
|
|
72113
|
+
* @param children - The child list of the last diff.
|
|
72114
|
+
* @returns True when the list stays.
|
|
72115
|
+
*/
|
|
72116
|
+
function sameEntities(placed, count, children) {
|
|
72117
|
+
if (count !== children.length) return false;
|
|
72118
|
+
for (let index = 0; index < count; index += 1) if (placed[index] !== children[index]) return false;
|
|
72119
|
+
return true;
|
|
72120
|
+
}
|
|
72121
|
+
/**
|
|
72122
|
+
* The change record a reconciler writes every compare into, before its first compare.
|
|
72123
|
+
*
|
|
72124
|
+
* @returns A record with no flag set and an empty style.
|
|
72125
|
+
*/
|
|
72126
|
+
function emptyChange() {
|
|
72127
|
+
return {
|
|
72128
|
+
is: {
|
|
72129
|
+
pressed: false,
|
|
72130
|
+
hover: false,
|
|
72131
|
+
focus: false,
|
|
72132
|
+
disabled: false,
|
|
72133
|
+
active: false,
|
|
72134
|
+
selected: false,
|
|
72135
|
+
covered: false
|
|
72136
|
+
},
|
|
72137
|
+
style: {},
|
|
72138
|
+
rowHeight: void 0,
|
|
72139
|
+
resolved: false,
|
|
72140
|
+
moved: false,
|
|
72141
|
+
measures: false,
|
|
72142
|
+
keepsText: false,
|
|
72143
|
+
keepsKey: false,
|
|
72144
|
+
unchanged: false
|
|
72145
|
+
};
|
|
72146
|
+
}
|
|
72147
|
+
/**
|
|
71889
72148
|
* Collects the identities of the children of one render. Its own function, because lint rule L5
|
|
71890
72149
|
* refuses a collection built inside an exported declaration.
|
|
71891
72150
|
*
|
|
@@ -71981,6 +72240,35 @@ function createReconciler(ctx, modules, fields) {
|
|
|
71981
72240
|
whole: (element, value) => writeValue(element, value),
|
|
71982
72241
|
others: (element, type, next) => writeOthers(element, next, type)
|
|
71983
72242
|
};
|
|
72243
|
+
const change = emptyChange();
|
|
72244
|
+
let expandedNode;
|
|
72245
|
+
let expandedInstance;
|
|
72246
|
+
const identityStack = [];
|
|
72247
|
+
const entityStack = [];
|
|
72248
|
+
let depth = 0;
|
|
72249
|
+
let viewportMoved = false;
|
|
72250
|
+
let dirtyCount = 0;
|
|
72251
|
+
let pendingCount = 0;
|
|
72252
|
+
let scrollsAside = false;
|
|
72253
|
+
const listDirty = (root) => {
|
|
72254
|
+
if (state.removing.has(root.entity)) return;
|
|
72255
|
+
if (viewportMoved) root.needsSolve = true;
|
|
72256
|
+
else if (!root.dirty) return;
|
|
72257
|
+
dirtyList[dirtyCount] = root;
|
|
72258
|
+
dirtyCount += 1;
|
|
72259
|
+
};
|
|
72260
|
+
const notePending = (root) => {
|
|
72261
|
+
const waits = root.element !== void 0 && lookup(root.element) !== void 0 && (root.needsSolve || root.slot !== void 0);
|
|
72262
|
+
root.pending = waits;
|
|
72263
|
+
if (waits) pendingCount += 1;
|
|
72264
|
+
};
|
|
72265
|
+
const listScroll = (entity) => {
|
|
72266
|
+
const element = state.elements.get(entity);
|
|
72267
|
+
if (element?.live !== true) return;
|
|
72268
|
+
if (parts.working() && parts.waits(state.roots.get(element.root))) return;
|
|
72269
|
+
if (!scrollsAside && isAsideScroll(element)) return;
|
|
72270
|
+
scrollList.push(element);
|
|
72271
|
+
};
|
|
71984
72272
|
/**
|
|
71985
72273
|
* Registers the key of an element under its root, so `find` and `entityOf` answer for it. A key
|
|
71986
72274
|
* `ui` gave a node of its own, a spacer's, is never registered. A root built aside or held warm
|
|
@@ -72375,10 +72663,12 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72375
72663
|
function compare(root, element, node) {
|
|
72376
72664
|
const previous = element.node;
|
|
72377
72665
|
const parent = parentOf(element);
|
|
72378
|
-
const
|
|
72379
|
-
|
|
72380
|
-
|
|
72381
|
-
|
|
72666
|
+
const declared = node.props.state;
|
|
72667
|
+
const kept = element.is;
|
|
72668
|
+
const is = kept.covered === root.covered && kept.disabled === (declared?.disabled === true) && kept.active === (declared?.active === true) && kept.selected === (declared?.selected === true) ? kept : isFlagsOf(node, {
|
|
72669
|
+
pressed: kept.pressed,
|
|
72670
|
+
hover: kept.hover,
|
|
72671
|
+
focus: kept.focus,
|
|
72382
72672
|
covered: root.covered
|
|
72383
72673
|
});
|
|
72384
72674
|
const rowHeight = range.rowHeightOf(parent, node);
|
|
@@ -72388,17 +72678,16 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72388
72678
|
const style = keepsStyle ? element.style : styleFor(parent, node, is);
|
|
72389
72679
|
const sameContent = sameValue(previous.props.content, node.props.content);
|
|
72390
72680
|
const keepsKey = namedKeyOf(element.style, previous.props.style) === namedKeyOf(style, node.props.style);
|
|
72391
|
-
|
|
72392
|
-
|
|
72393
|
-
|
|
72394
|
-
|
|
72395
|
-
|
|
72396
|
-
|
|
72397
|
-
|
|
72398
|
-
|
|
72399
|
-
|
|
72400
|
-
|
|
72401
|
-
};
|
|
72681
|
+
change.is = is;
|
|
72682
|
+
change.style = style;
|
|
72683
|
+
change.rowHeight = rowHeight;
|
|
72684
|
+
change.resolved = !keepsStyle;
|
|
72685
|
+
change.moved = !keepsStyle && modules.layout.affectsRect(element.style, style);
|
|
72686
|
+
change.measures = !stands || !sameStyle || !sameContent;
|
|
72687
|
+
change.keepsText = sameStyle && sameContent && sameValue(previous.props.bind, node.props.bind);
|
|
72688
|
+
change.keepsKey = keepsKey;
|
|
72689
|
+
change.unchanged = keepsStyle && sameContent && writesSame(previous, node);
|
|
72690
|
+
return change;
|
|
72402
72691
|
}
|
|
72403
72692
|
/**
|
|
72404
72693
|
* Writes what a patch changed on one element: its style onto the layout node when a rect or a
|
|
@@ -72410,15 +72699,16 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72410
72699
|
* @param change - What the patch found.
|
|
72411
72700
|
*/
|
|
72412
72701
|
function rewrite(root, element, change) {
|
|
72413
|
-
const
|
|
72702
|
+
const { moved, keepsText, keepsKey } = change;
|
|
72703
|
+
const applies = moved || change.measures;
|
|
72414
72704
|
if (change.resolved || applies) state.styled += 1;
|
|
72415
72705
|
if (applies) {
|
|
72416
72706
|
modules.layout.applyStyle(element);
|
|
72417
72707
|
root.needsSolve = true;
|
|
72418
72708
|
}
|
|
72419
72709
|
if (!element.live) return;
|
|
72420
|
-
writeLive(element,
|
|
72421
|
-
if (!
|
|
72710
|
+
writeLive(element, keepsText, keepsKey);
|
|
72711
|
+
if (!moved) modules.layout.repose(element, parentRect(element), false, hintOf(state, element));
|
|
72422
72712
|
}
|
|
72423
72713
|
/**
|
|
72424
72714
|
* Updates one live element from its new node. An element whose description says what it said is
|
|
@@ -72439,11 +72729,12 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72439
72729
|
checkWindow(node);
|
|
72440
72730
|
warnAxis(element, node);
|
|
72441
72731
|
const change = compare(root, element, node);
|
|
72732
|
+
const { unchanged, rowHeight } = change;
|
|
72442
72733
|
const motion = node.props.motion;
|
|
72443
72734
|
const loopChanged = !sameLoop(element.motion?.loop, motion?.loop);
|
|
72444
72735
|
const motionChanged = motion !== element.motion;
|
|
72445
72736
|
if (typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__) countRebuild(element, element.motion?.loop, motion?.loop);
|
|
72446
|
-
if (!
|
|
72737
|
+
if (!unchanged) delete element.basis;
|
|
72447
72738
|
element.node = node;
|
|
72448
72739
|
element.is = change.is;
|
|
72449
72740
|
element.style = change.style;
|
|
@@ -72452,11 +72743,11 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72452
72743
|
trackHost(state, element);
|
|
72453
72744
|
if (element.type === "input") fields.patch(element);
|
|
72454
72745
|
if (loopChanged && element.entered) modules.layout.loop(element);
|
|
72455
|
-
if (!
|
|
72746
|
+
if (!unchanged) {
|
|
72456
72747
|
rewrite(root, element, change);
|
|
72457
72748
|
element.basis = {
|
|
72458
72749
|
epoch: state.epoch,
|
|
72459
|
-
rowHeight
|
|
72750
|
+
rowHeight
|
|
72460
72751
|
};
|
|
72461
72752
|
}
|
|
72462
72753
|
if (typeof __MOKU_GAME_DEV__ !== "undefined" && __MOKU_GAME_DEV__ && motionChanged && element.live) warnIdleChanges(ctx, element);
|
|
@@ -72498,24 +72789,23 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72498
72789
|
}
|
|
72499
72790
|
/**
|
|
72500
72791
|
* Expands a component node with its instance, so the view runs with the local state of that
|
|
72501
|
-
* identity.
|
|
72792
|
+
* identity. The subtree to place goes to `expandedNode`, the instance it belongs to to
|
|
72793
|
+
* `expandedInstance`: no object is built, and the caller reads both before it places anything.
|
|
72502
72794
|
*
|
|
72503
72795
|
* @param node - The node the markup wrote.
|
|
72504
72796
|
* @param identity - Its identity.
|
|
72505
|
-
* @returns The subtree to place and the instance it belongs to.
|
|
72506
72797
|
*/
|
|
72507
72798
|
function expand(node, identity) {
|
|
72508
72799
|
const definition = state.components.get(node.type);
|
|
72509
|
-
if (definition === void 0)
|
|
72510
|
-
node
|
|
72511
|
-
|
|
72512
|
-
|
|
72800
|
+
if (definition === void 0) {
|
|
72801
|
+
expandedNode = node;
|
|
72802
|
+
expandedInstance = void 0;
|
|
72803
|
+
return;
|
|
72804
|
+
}
|
|
72513
72805
|
const instance = instanceFor(state, identity, definition, node.props);
|
|
72514
72806
|
instance.dirty = false;
|
|
72515
|
-
|
|
72516
|
-
|
|
72517
|
-
instance: identity
|
|
72518
|
-
};
|
|
72807
|
+
expandedNode = runView(ctx, definition, instance, node.key);
|
|
72808
|
+
expandedInstance = identity;
|
|
72519
72809
|
}
|
|
72520
72810
|
/**
|
|
72521
72811
|
* Places one node: enter, patch, or exit and enter when the element at its identity is another
|
|
@@ -72532,10 +72822,11 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72532
72822
|
* @returns The entity of the element, or `undefined` when a component view threw.
|
|
72533
72823
|
*/
|
|
72534
72824
|
function diffNode(root, parent, node, index, identity, instance) {
|
|
72535
|
-
|
|
72536
|
-
const view =
|
|
72537
|
-
const
|
|
72538
|
-
const
|
|
72825
|
+
expand(node, identity);
|
|
72826
|
+
const view = expandedNode;
|
|
72827
|
+
const expansion = expandedInstance;
|
|
72828
|
+
const owner = expansion ?? instance;
|
|
72829
|
+
const effective = view !== void 0 && expansion !== void 0 ? withKey(view, node.key) : view;
|
|
72539
72830
|
if (effective === void 0) return state.byIdentity.get(identity);
|
|
72540
72831
|
const existing = state.byIdentity.get(identity);
|
|
72541
72832
|
const element = existing === void 0 ? void 0 : state.elements.get(existing);
|
|
@@ -72569,22 +72860,67 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72569
72860
|
* @param instance - The identity of the nearest component instance.
|
|
72570
72861
|
*/
|
|
72571
72862
|
function diffChildren(root, parent, nodes, instance) {
|
|
72572
|
-
const
|
|
72573
|
-
|
|
72574
|
-
|
|
72575
|
-
|
|
72576
|
-
|
|
72577
|
-
|
|
72863
|
+
const level = depth;
|
|
72864
|
+
depth += 1;
|
|
72865
|
+
try {
|
|
72866
|
+
diffChildrenAt(root, parent, nodes, instance, level);
|
|
72867
|
+
} finally {
|
|
72868
|
+
depth = level;
|
|
72869
|
+
}
|
|
72870
|
+
}
|
|
72871
|
+
/**
|
|
72872
|
+
* The diff of `diffChildren` on the scratch buffers of one depth: the identities of this render
|
|
72873
|
+
* and the entities they placed, counted, so an element whose children stayed builds no array, no
|
|
72874
|
+
* set and no string, and keeps its child list.
|
|
72875
|
+
*
|
|
72876
|
+
* @param root - The root being reconciled.
|
|
72877
|
+
* @param parent - The element whose children are diffed.
|
|
72878
|
+
* @param nodes - The children of this render.
|
|
72879
|
+
* @param instance - The identity of the nearest component instance.
|
|
72880
|
+
* @param level - The depth whose buffers this diff uses.
|
|
72881
|
+
*/
|
|
72882
|
+
function diffChildrenAt(root, parent, nodes, instance, level) {
|
|
72883
|
+
const identities = identityStack[level] ?? [];
|
|
72884
|
+
const placed = entityStack[level] ?? [];
|
|
72885
|
+
const before = parent.children;
|
|
72886
|
+
identityStack[level] = identities;
|
|
72887
|
+
entityStack[level] = placed;
|
|
72888
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
72889
|
+
const node = nodes[index];
|
|
72890
|
+
const old = before[index];
|
|
72891
|
+
if (node === void 0) continue;
|
|
72892
|
+
identities[index] = identityAt(parent.identity, node, index, old === void 0 ? void 0 : state.elements.get(old));
|
|
72578
72893
|
}
|
|
72894
|
+
leaveOut(parent, identities, nodes.length);
|
|
72895
|
+
let count = 0;
|
|
72896
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
72897
|
+
const node = nodes[index];
|
|
72898
|
+
if (node === void 0) continue;
|
|
72899
|
+
const identity = identities[index] ?? identityOf(parent.identity, node, index);
|
|
72900
|
+
const entity = diffNode(root, parent, node, index, identity, instance);
|
|
72901
|
+
if (entity === void 0) continue;
|
|
72902
|
+
placed[count] = entity;
|
|
72903
|
+
count += 1;
|
|
72904
|
+
}
|
|
72905
|
+
if (sameEntities(placed, count, parent.children)) return;
|
|
72906
|
+
commitChildren(root, parent, placed.slice(0, count));
|
|
72907
|
+
}
|
|
72908
|
+
/**
|
|
72909
|
+
* Makes a changed list of children the parent's: an old child no entity of this render took leaves,
|
|
72910
|
+
* the new ones are drawn in the order of the render and laid out again, and the root solves again.
|
|
72911
|
+
*
|
|
72912
|
+
* @param root - The root being reconciled.
|
|
72913
|
+
* @param parent - The element whose children changed.
|
|
72914
|
+
* @param next - The entities of this render, in markup order.
|
|
72915
|
+
*/
|
|
72916
|
+
function commitChildren(root, parent, next) {
|
|
72579
72917
|
const kept = entitySet(next);
|
|
72580
72918
|
for (const old of parent.children) {
|
|
72581
72919
|
if (kept.has(old) || state.exiting.has(old)) continue;
|
|
72582
72920
|
const element = state.elements.get(old);
|
|
72583
72921
|
if (element !== void 0) removeChild(parent, element);
|
|
72584
72922
|
}
|
|
72585
|
-
const same = next.length === parent.children.length && next.every((entity, index) => parent.children[index] === entity);
|
|
72586
72923
|
parent.children = next;
|
|
72587
|
-
if (same) return;
|
|
72588
72924
|
placeChildren(parent, next);
|
|
72589
72925
|
modules.layout.place(parent, next.map((entity) => state.elements.get(entity)).filter((element) => isElement(element)));
|
|
72590
72926
|
root.needsSolve = true;
|
|
@@ -72630,14 +72966,18 @@ function createReconciler(ctx, modules, fields) {
|
|
|
72630
72966
|
* starts, and everything under it plays its own, before a new child enters.
|
|
72631
72967
|
*
|
|
72632
72968
|
* @param parent - The element whose children are diffed.
|
|
72633
|
-
* @param identities - The identities of the children of this render, in markup order
|
|
72969
|
+
* @param identities - The identities of the children of this render, in markup order; a scratch
|
|
72970
|
+
* buffer, of which the first `count` are this render's.
|
|
72971
|
+
* @param count - How many children this render has.
|
|
72634
72972
|
*/
|
|
72635
|
-
function leaveOut(parent, identities) {
|
|
72973
|
+
function leaveOut(parent, identities, count) {
|
|
72636
72974
|
let listed;
|
|
72637
|
-
|
|
72638
|
-
|
|
72639
|
-
|
|
72640
|
-
|
|
72975
|
+
const children = parent.children;
|
|
72976
|
+
for (let index = 0; index < children.length; index += 1) {
|
|
72977
|
+
const old = children[index];
|
|
72978
|
+
const element = old === void 0 ? void 0 : state.elements.get(old);
|
|
72979
|
+
if (element === void 0 || index < count && identities[index] === element.identity) continue;
|
|
72980
|
+
listed ??= identitySet(identities.slice(0, count));
|
|
72641
72981
|
if (!listed.has(element.identity)) removeChild(parent, element);
|
|
72642
72982
|
}
|
|
72643
72983
|
}
|
|
@@ -73025,13 +73365,9 @@ function createReconciler(ctx, modules, fields) {
|
|
|
73025
73365
|
* @returns How many roots wait.
|
|
73026
73366
|
*/
|
|
73027
73367
|
function pendingRoots() {
|
|
73028
|
-
|
|
73029
|
-
|
|
73030
|
-
|
|
73031
|
-
root.pending = waits;
|
|
73032
|
-
if (waits) count += 1;
|
|
73033
|
-
}
|
|
73034
|
-
return count;
|
|
73368
|
+
pendingCount = 0;
|
|
73369
|
+
state.roots.forEach(notePending);
|
|
73370
|
+
return pendingCount;
|
|
73035
73371
|
}
|
|
73036
73372
|
/**
|
|
73037
73373
|
* The box a root in a slot is solved in: the slot's content box, once the slot's own root needs
|
|
@@ -73300,10 +73636,10 @@ function createReconciler(ctx, modules, fields) {
|
|
|
73300
73636
|
* @param root - The root to reconcile.
|
|
73301
73637
|
*/
|
|
73302
73638
|
function reconcileRoot(root) {
|
|
73303
|
-
const identity = identityOf(String(root.entity), root.tree, 0);
|
|
73304
73639
|
const first = root.element === void 0;
|
|
73305
73640
|
if (first) root.cause ??= ctx.deps.world.projection.causeOf(root.entity) ?? "change";
|
|
73306
73641
|
const previous = root.element === void 0 ? void 0 : lookup(root.element);
|
|
73642
|
+
const identity = identityAt(String(root.entity), root.tree, 0, previous);
|
|
73307
73643
|
if (previous !== void 0 && previous.identity !== identity) exitElement(previous, "change");
|
|
73308
73644
|
state.building = first ? root.cause : "change";
|
|
73309
73645
|
try {
|
|
@@ -73325,13 +73661,8 @@ function createReconciler(ctx, modules, fields) {
|
|
|
73325
73661
|
*/
|
|
73326
73662
|
function scrollContainers(aside) {
|
|
73327
73663
|
while (scrollList.length > 0) scrollList.pop();
|
|
73328
|
-
|
|
73329
|
-
|
|
73330
|
-
if (element?.live !== true) continue;
|
|
73331
|
-
if (parts.working() && parts.waits(state.roots.get(element.root))) continue;
|
|
73332
|
-
if (!aside && isAsideScroll(element)) continue;
|
|
73333
|
-
scrollList.push(element);
|
|
73334
|
-
}
|
|
73664
|
+
scrollsAside = aside;
|
|
73665
|
+
state.scrolls.forEach(listScroll);
|
|
73335
73666
|
return scrollList;
|
|
73336
73667
|
}
|
|
73337
73668
|
/**
|
|
@@ -73346,15 +73677,10 @@ function createReconciler(ctx, modules, fields) {
|
|
|
73346
73677
|
const root = state.roots.get(entity);
|
|
73347
73678
|
if (root !== void 0 && !state.removing.has(entity)) root.dirty = true;
|
|
73348
73679
|
}
|
|
73349
|
-
|
|
73350
|
-
|
|
73351
|
-
|
|
73352
|
-
|
|
73353
|
-
else if (!root.dirty) continue;
|
|
73354
|
-
dirtyList[count] = root;
|
|
73355
|
-
count += 1;
|
|
73356
|
-
}
|
|
73357
|
-
return count;
|
|
73680
|
+
dirtyCount = 0;
|
|
73681
|
+
viewportMoved = viewportChanged;
|
|
73682
|
+
state.roots.forEach(listDirty);
|
|
73683
|
+
return dirtyCount;
|
|
73358
73684
|
}
|
|
73359
73685
|
/**
|
|
73360
73686
|
* Takes the order the projection wrote on a root's entity (spec 16 U1.6) and gives it to the
|
|
@@ -73904,6 +74230,44 @@ const LAYOUT_FIELDS = [
|
|
|
73904
74230
|
"right",
|
|
73905
74231
|
"bottom"
|
|
73906
74232
|
];
|
|
74233
|
+
const FLEX_DIRECTION = 0;
|
|
74234
|
+
const FLEX_WRAP = 1;
|
|
74235
|
+
const JUSTIFY = 2;
|
|
74236
|
+
const ALIGN_ITEMS = 3;
|
|
74237
|
+
const ALIGN_SELF = 4;
|
|
74238
|
+
const GROW = 5;
|
|
74239
|
+
const SHRINK = 6;
|
|
74240
|
+
const ASPECT = 7;
|
|
74241
|
+
const OVERFLOW = 8;
|
|
74242
|
+
const POSITION_TYPE = 9;
|
|
74243
|
+
const GAP = 10;
|
|
74244
|
+
/** The first padding length; the edges follow in the order top, right, bottom, left. */
|
|
74245
|
+
const PADDING = 12;
|
|
74246
|
+
/** The first margin length, in the same edge order. */
|
|
74247
|
+
const MARGIN = 20;
|
|
74248
|
+
const WIDTH = 28;
|
|
74249
|
+
const HEIGHT = 30;
|
|
74250
|
+
const MIN_WIDTH = 32;
|
|
74251
|
+
const MIN_HEIGHT = 34;
|
|
74252
|
+
const MAX_WIDTH = 36;
|
|
74253
|
+
const MAX_HEIGHT = 38;
|
|
74254
|
+
const LEFT = 40;
|
|
74255
|
+
const TOP = 42;
|
|
74256
|
+
const RIGHT = 44;
|
|
74257
|
+
const BOTTOM = 46;
|
|
74258
|
+
/** Slots of a kept record. */
|
|
74259
|
+
const SLOTS = 48;
|
|
74260
|
+
/**
|
|
74261
|
+
* The kind of a length a number writes, and of an unset length (its number `NaN`). It is 0, so a
|
|
74262
|
+
* new record holds it in every kind slot: the gap, the edges and the positions only ever take it.
|
|
74263
|
+
*/
|
|
74264
|
+
const POINT = 0;
|
|
74265
|
+
/** The kind of a length a percent string writes. */
|
|
74266
|
+
const PERCENT = 1;
|
|
74267
|
+
/** The kind of a length `"auto"` writes; its number is `NaN`. */
|
|
74268
|
+
const AUTO = 2;
|
|
74269
|
+
/** The kind a staged extent takes when the style writes nothing for it. Never kept. */
|
|
74270
|
+
const SKIP = -1;
|
|
73907
74271
|
/**
|
|
73908
74272
|
* Tells whether two resolved styles would give the same rect.
|
|
73909
74273
|
*
|
|
@@ -73921,6 +74285,266 @@ function layoutChanged(first, second) {
|
|
|
73921
74285
|
return false;
|
|
73922
74286
|
}
|
|
73923
74287
|
/**
|
|
74288
|
+
* Reads what a node Yoga just made holds into a kept record: the enums and the flex factors through
|
|
74289
|
+
* their getters, once. A length is not read: its getter answers a `Value` object, so it starts
|
|
74290
|
+
* as Yoga's unset one, a point of `NaN`. The aspect ratio starts as one no style writes, so the
|
|
74291
|
+
* first write of every node calls `setAspectRatio`: the `isDirty()` of a node that never had
|
|
74292
|
+
* it called allocates 64 B a call (measured, `anchor.perf.ts`; a ratio of `NaN` does not cure it).
|
|
74293
|
+
*
|
|
74294
|
+
* @param yoga - The loaded Yoga module.
|
|
74295
|
+
* @returns The record of a fresh node.
|
|
74296
|
+
*/
|
|
74297
|
+
function readFresh(yoga) {
|
|
74298
|
+
const node = yoga.Node.create();
|
|
74299
|
+
const fresh = new Float64Array(SLOTS);
|
|
74300
|
+
fresh[FLEX_DIRECTION] = node.getFlexDirection();
|
|
74301
|
+
fresh[FLEX_WRAP] = node.getFlexWrap();
|
|
74302
|
+
fresh[JUSTIFY] = node.getJustifyContent();
|
|
74303
|
+
fresh[ALIGN_ITEMS] = node.getAlignItems();
|
|
74304
|
+
fresh[ALIGN_SELF] = node.getAlignSelf();
|
|
74305
|
+
fresh[GROW] = node.getFlexGrow();
|
|
74306
|
+
fresh[SHRINK] = node.getFlexShrink();
|
|
74307
|
+
fresh[OVERFLOW] = node.getOverflow();
|
|
74308
|
+
fresh[POSITION_TYPE] = node.getPositionType();
|
|
74309
|
+
node.free();
|
|
74310
|
+
for (let slot = 11; slot < SLOTS; slot += 2) fresh[slot] = NaN;
|
|
74311
|
+
fresh[ASPECT] = Number.NEGATIVE_INFINITY;
|
|
74312
|
+
return fresh;
|
|
74313
|
+
}
|
|
74314
|
+
/**
|
|
74315
|
+
* Builds the tables a style write reads for one loaded Yoga module: the enum of every word a style
|
|
74316
|
+
* names, what a fresh node holds, read once from a node made for it, and the record a write stages
|
|
74317
|
+
* its numbers in.
|
|
74318
|
+
*
|
|
74319
|
+
* @param yoga - The loaded Yoga module.
|
|
74320
|
+
* @returns The tables.
|
|
74321
|
+
*/
|
|
74322
|
+
function styleTablesOf(yoga) {
|
|
74323
|
+
return {
|
|
74324
|
+
yoga,
|
|
74325
|
+
justify: {
|
|
74326
|
+
start: yoga.JUSTIFY_FLEX_START,
|
|
74327
|
+
center: yoga.JUSTIFY_CENTER,
|
|
74328
|
+
end: yoga.JUSTIFY_FLEX_END,
|
|
74329
|
+
between: yoga.JUSTIFY_SPACE_BETWEEN,
|
|
74330
|
+
around: yoga.JUSTIFY_SPACE_AROUND,
|
|
74331
|
+
evenly: yoga.JUSTIFY_SPACE_EVENLY
|
|
74332
|
+
},
|
|
74333
|
+
align: {
|
|
74334
|
+
start: yoga.ALIGN_FLEX_START,
|
|
74335
|
+
center: yoga.ALIGN_CENTER,
|
|
74336
|
+
end: yoga.ALIGN_FLEX_END,
|
|
74337
|
+
stretch: yoga.ALIGN_STRETCH
|
|
74338
|
+
},
|
|
74339
|
+
alignSelf: {
|
|
74340
|
+
auto: yoga.ALIGN_AUTO,
|
|
74341
|
+
start: yoga.ALIGN_FLEX_START,
|
|
74342
|
+
center: yoga.ALIGN_CENTER,
|
|
74343
|
+
end: yoga.ALIGN_FLEX_END,
|
|
74344
|
+
stretch: yoga.ALIGN_STRETCH
|
|
74345
|
+
},
|
|
74346
|
+
overflow: {
|
|
74347
|
+
visible: yoga.OVERFLOW_VISIBLE,
|
|
74348
|
+
hidden: yoga.OVERFLOW_HIDDEN,
|
|
74349
|
+
scroll: yoga.OVERFLOW_SCROLL
|
|
74350
|
+
},
|
|
74351
|
+
fresh: readFresh(yoga),
|
|
74352
|
+
staged: new Float64Array(SLOTS)
|
|
74353
|
+
};
|
|
74354
|
+
}
|
|
74355
|
+
/**
|
|
74356
|
+
* The kept record of a node Yoga just made: a copy of what the tables read off a fresh node.
|
|
74357
|
+
*
|
|
74358
|
+
* @param tables - The tables of the loaded Yoga module.
|
|
74359
|
+
* @returns A record of its own.
|
|
74360
|
+
*/
|
|
74361
|
+
function freshKept(tables) {
|
|
74362
|
+
return new Float64Array(tables.fresh);
|
|
74363
|
+
}
|
|
74364
|
+
/**
|
|
74365
|
+
* Notes a width and a height written onto a node outside a style write, as the anchor pass sizes
|
|
74366
|
+
* the tree of an anchor, so a later style write that sets them back is not skipped.
|
|
74367
|
+
*
|
|
74368
|
+
* @param kept - The node's kept record; none for a node `ui` did not make.
|
|
74369
|
+
* @param size - The width and the height written, in points. Read here, not handed over as two
|
|
74370
|
+
* numbers: a fractional number passed to a call V8 does not inline is boxed.
|
|
74371
|
+
* @param size.w - The width.
|
|
74372
|
+
* @param size.h - The height.
|
|
74373
|
+
*/
|
|
74374
|
+
function keepSize(kept, size) {
|
|
74375
|
+
if (kept === void 0) return;
|
|
74376
|
+
kept[WIDTH] = POINT;
|
|
74377
|
+
kept[29] = size.w;
|
|
74378
|
+
kept[HEIGHT] = POINT;
|
|
74379
|
+
kept[31] = size.h;
|
|
74380
|
+
}
|
|
74381
|
+
/**
|
|
74382
|
+
* Whether an enum must be written, and keeps it when it must. With no record every value is
|
|
74383
|
+
* written, as before the records.
|
|
74384
|
+
*
|
|
74385
|
+
* @param kept - The node's kept record.
|
|
74386
|
+
* @param slot - The enum's slot.
|
|
74387
|
+
* @param value - The enum of this write.
|
|
74388
|
+
* @returns True when the setter must be called.
|
|
74389
|
+
*/
|
|
74390
|
+
function enumMoved(kept, slot, value) {
|
|
74391
|
+
if (kept === void 0) return true;
|
|
74392
|
+
if (kept[slot] === value) return false;
|
|
74393
|
+
kept[slot] = value;
|
|
74394
|
+
return true;
|
|
74395
|
+
}
|
|
74396
|
+
/**
|
|
74397
|
+
* Whether a staged number must be written, and keeps it when it must: it differs from the kept
|
|
74398
|
+
* one unless both are equal or both unset (`NaN`).
|
|
74399
|
+
*
|
|
74400
|
+
* @param kept - The node's kept record.
|
|
74401
|
+
* @param staged - The staged values of this write.
|
|
74402
|
+
* @param slot - The number's slot.
|
|
74403
|
+
* @returns True when the setter must be called.
|
|
74404
|
+
*/
|
|
74405
|
+
function numberMoved(kept, staged, slot) {
|
|
74406
|
+
if (kept === void 0) return true;
|
|
74407
|
+
const before = kept[slot];
|
|
74408
|
+
const after = staged[slot];
|
|
74409
|
+
if (before === after || Number.isNaN(before) && Number.isNaN(after)) return false;
|
|
74410
|
+
kept[slot] = after ?? NaN;
|
|
74411
|
+
return true;
|
|
74412
|
+
}
|
|
74413
|
+
/**
|
|
74414
|
+
* Whether a staged length must be written, and keeps it when it must: its kind and its number
|
|
74415
|
+
* both stand, or it is staged as nothing to write.
|
|
74416
|
+
*
|
|
74417
|
+
* @param kept - The node's kept record.
|
|
74418
|
+
* @param staged - The staged values of this write.
|
|
74419
|
+
* @param slot - The length's first slot.
|
|
74420
|
+
* @returns True when the setter must be called.
|
|
74421
|
+
*/
|
|
74422
|
+
function lengthMoved(kept, staged, slot) {
|
|
74423
|
+
const kind = staged[slot];
|
|
74424
|
+
if (kind === SKIP) return false;
|
|
74425
|
+
if (kept === void 0) return true;
|
|
74426
|
+
if (kept[slot] === kind && !numberMoved(kept, staged, slot + 1)) return false;
|
|
74427
|
+
kept[slot] = kind ?? POINT;
|
|
74428
|
+
kept[slot + 1] = staged[slot + 1] ?? NaN;
|
|
74429
|
+
return true;
|
|
74430
|
+
}
|
|
74431
|
+
/** Where each edge's number sits from the first slot of a padding or margin (a kind comes first). */
|
|
74432
|
+
const EDGE_TOP_AT = 1;
|
|
74433
|
+
const EDGE_RIGHT_AT = 3;
|
|
74434
|
+
const EDGE_BOTTOM_AT = 5;
|
|
74435
|
+
const EDGE_LEFT_AT = 7;
|
|
74436
|
+
/**
|
|
74437
|
+
* Stages the four edges of a padding or margin given per edge; an edge it leaves out is unset.
|
|
74438
|
+
*
|
|
74439
|
+
* @param staged - The staged values of this write.
|
|
74440
|
+
* @param slot - The first slot of the four lengths.
|
|
74441
|
+
* @param edges - The edges.
|
|
74442
|
+
* @param edges.top - The top edge.
|
|
74443
|
+
* @param edges.right - The right edge.
|
|
74444
|
+
* @param edges.bottom - The bottom edge.
|
|
74445
|
+
* @param edges.left - The left edge.
|
|
74446
|
+
*/
|
|
74447
|
+
function stageSides(staged, slot, edges) {
|
|
74448
|
+
staged[slot + EDGE_TOP_AT] = edges.top ?? NaN;
|
|
74449
|
+
staged[slot + EDGE_RIGHT_AT] = edges.right ?? NaN;
|
|
74450
|
+
staged[slot + EDGE_BOTTOM_AT] = edges.bottom ?? NaN;
|
|
74451
|
+
staged[slot + EDGE_LEFT_AT] = edges.left ?? NaN;
|
|
74452
|
+
}
|
|
74453
|
+
/**
|
|
74454
|
+
* Stages an extent that is not a number: a percent string, `"auto"`, or nothing. `undefined`
|
|
74455
|
+
* writes nothing, and so does `"auto"` on a min or max extent.
|
|
74456
|
+
*
|
|
74457
|
+
* @param staged - The staged values of this write.
|
|
74458
|
+
* @param slot - The extent's first slot.
|
|
74459
|
+
* @param value - What the style carries.
|
|
74460
|
+
* @param autoSkips - Whether `"auto"` writes nothing here.
|
|
74461
|
+
*/
|
|
74462
|
+
function stageWord(staged, slot, value, autoSkips) {
|
|
74463
|
+
if (value === void 0 || autoSkips && value === "auto") staged[slot] = SKIP;
|
|
74464
|
+
else if (value === "auto") {
|
|
74465
|
+
staged[slot] = AUTO;
|
|
74466
|
+
staged[slot + 1] = NaN;
|
|
74467
|
+
} else {
|
|
74468
|
+
staged[slot] = value.endsWith("%") ? PERCENT : POINT;
|
|
74469
|
+
staged[slot + 1] = Number.parseFloat(value);
|
|
74470
|
+
}
|
|
74471
|
+
}
|
|
74472
|
+
/**
|
|
74473
|
+
* Stages the edges of the padding and the margin.
|
|
74474
|
+
*
|
|
74475
|
+
* @param staged - The staged values of this write.
|
|
74476
|
+
* @param style - The resolved style.
|
|
74477
|
+
*/
|
|
74478
|
+
function stageEdges(staged, style) {
|
|
74479
|
+
const { padding, margin } = style;
|
|
74480
|
+
if (typeof padding === "object") stageSides(staged, PADDING, padding);
|
|
74481
|
+
else {
|
|
74482
|
+
const all = padding ?? NaN;
|
|
74483
|
+
staged[13] = all;
|
|
74484
|
+
staged[15] = all;
|
|
74485
|
+
staged[17] = all;
|
|
74486
|
+
staged[19] = all;
|
|
74487
|
+
}
|
|
74488
|
+
if (typeof margin === "object") stageSides(staged, MARGIN, margin);
|
|
74489
|
+
else {
|
|
74490
|
+
const all = margin ?? NaN;
|
|
74491
|
+
staged[21] = all;
|
|
74492
|
+
staged[23] = all;
|
|
74493
|
+
staged[25] = all;
|
|
74494
|
+
staged[27] = all;
|
|
74495
|
+
}
|
|
74496
|
+
}
|
|
74497
|
+
/**
|
|
74498
|
+
* Stages the six extents and the aspect ratio. A number is staged here, where it is read; a word by
|
|
74499
|
+
* `stageWord`.
|
|
74500
|
+
*
|
|
74501
|
+
* @param staged - The staged values of this write.
|
|
74502
|
+
* @param style - The resolved style.
|
|
74503
|
+
*/
|
|
74504
|
+
function stageExtents(staged, style) {
|
|
74505
|
+
const { width, height, minWidth, minHeight, maxWidth, maxHeight } = style;
|
|
74506
|
+
if (typeof width === "number") {
|
|
74507
|
+
staged[WIDTH] = POINT;
|
|
74508
|
+
staged[29] = width;
|
|
74509
|
+
} else stageWord(staged, WIDTH, width, false);
|
|
74510
|
+
if (typeof height === "number") {
|
|
74511
|
+
staged[HEIGHT] = POINT;
|
|
74512
|
+
staged[31] = height;
|
|
74513
|
+
} else stageWord(staged, HEIGHT, height, false);
|
|
74514
|
+
if (typeof minWidth === "number") {
|
|
74515
|
+
staged[MIN_WIDTH] = POINT;
|
|
74516
|
+
staged[33] = minWidth;
|
|
74517
|
+
} else stageWord(staged, MIN_WIDTH, minWidth, true);
|
|
74518
|
+
if (typeof minHeight === "number") {
|
|
74519
|
+
staged[MIN_HEIGHT] = POINT;
|
|
74520
|
+
staged[35] = minHeight;
|
|
74521
|
+
} else stageWord(staged, MIN_HEIGHT, minHeight, true);
|
|
74522
|
+
if (typeof maxWidth === "number") {
|
|
74523
|
+
staged[MAX_WIDTH] = POINT;
|
|
74524
|
+
staged[37] = maxWidth;
|
|
74525
|
+
} else stageWord(staged, MAX_WIDTH, maxWidth, true);
|
|
74526
|
+
if (typeof maxHeight === "number") {
|
|
74527
|
+
staged[MAX_HEIGHT] = POINT;
|
|
74528
|
+
staged[39] = maxHeight;
|
|
74529
|
+
} else stageWord(staged, MAX_HEIGHT, maxHeight, true);
|
|
74530
|
+
staged[ASPECT] = style.aspect ?? NaN;
|
|
74531
|
+
}
|
|
74532
|
+
/**
|
|
74533
|
+
* Stages the numbers of the flow and position groups: gap, grow, shrink and the four positions.
|
|
74534
|
+
*
|
|
74535
|
+
* @param staged - The staged values of this write.
|
|
74536
|
+
* @param style - The resolved style.
|
|
74537
|
+
*/
|
|
74538
|
+
function stageFlowAndPosition(staged, style) {
|
|
74539
|
+
staged[11] = style.gap ?? 0;
|
|
74540
|
+
staged[GROW] = style.grow ?? 0;
|
|
74541
|
+
staged[SHRINK] = style.shrink ?? 0;
|
|
74542
|
+
staged[41] = style.left ?? NaN;
|
|
74543
|
+
staged[43] = style.top ?? NaN;
|
|
74544
|
+
staged[45] = style.right ?? NaN;
|
|
74545
|
+
staged[47] = style.bottom ?? NaN;
|
|
74546
|
+
}
|
|
74547
|
+
/**
|
|
73924
74548
|
* Reads one edge of a padding or margin.
|
|
73925
74549
|
*
|
|
73926
74550
|
* @param edges - What the resolved style carries.
|
|
@@ -73935,127 +74559,121 @@ function edge(edges, edge) {
|
|
|
73935
74559
|
/**
|
|
73936
74560
|
* Writes the flow group onto a node.
|
|
73937
74561
|
*
|
|
73938
|
-
* @param
|
|
74562
|
+
* @param tables - The tables of the loaded Yoga module, its numbers staged.
|
|
73939
74563
|
* @param node - The node of the element.
|
|
73940
74564
|
* @param style - The resolved style.
|
|
73941
74565
|
* @param column - Whether the tag lays its children out in a column.
|
|
74566
|
+
* @param kept - The node's kept record.
|
|
74567
|
+
*/
|
|
74568
|
+
function applyFlow(tables, node, style, column, kept) {
|
|
74569
|
+
const { yoga, staged } = tables;
|
|
74570
|
+
const direction = (style.direction ?? (column ? "column" : "row")) === "row" ? yoga.FLEX_DIRECTION_ROW : yoga.FLEX_DIRECTION_COLUMN;
|
|
74571
|
+
const wrap = style.wrap === true ? yoga.WRAP_WRAP : yoga.WRAP_NO_WRAP;
|
|
74572
|
+
const justify = tables.justify[style.justify ?? "start"];
|
|
74573
|
+
const align = tables.align[style.align ?? "stretch"];
|
|
74574
|
+
const alignSelf = tables.alignSelf[style.alignSelf ?? "auto"];
|
|
74575
|
+
if (enumMoved(kept, FLEX_DIRECTION, direction)) node.setFlexDirection(direction);
|
|
74576
|
+
if (enumMoved(kept, FLEX_WRAP, wrap)) node.setFlexWrap(wrap);
|
|
74577
|
+
if (enumMoved(kept, JUSTIFY, justify)) node.setJustifyContent(justify);
|
|
74578
|
+
if (enumMoved(kept, ALIGN_ITEMS, align)) node.setAlignItems(align);
|
|
74579
|
+
if (enumMoved(kept, ALIGN_SELF, alignSelf)) node.setAlignSelf(alignSelf);
|
|
74580
|
+
if (lengthMoved(kept, staged, GAP)) node.setGap(yoga.GUTTER_ALL, style.gap ?? 0);
|
|
74581
|
+
if (numberMoved(kept, staged, GROW)) node.setFlexGrow(style.grow ?? 0);
|
|
74582
|
+
if (numberMoved(kept, staged, SHRINK)) node.setFlexShrink(style.shrink ?? 0);
|
|
74583
|
+
}
|
|
74584
|
+
/**
|
|
74585
|
+
* Writes the padding and the margin of one edge.
|
|
74586
|
+
*
|
|
74587
|
+
* @param node - The node of the element.
|
|
74588
|
+
* @param style - The resolved style.
|
|
74589
|
+
* @param kept - The node's kept record.
|
|
74590
|
+
* @param staged - The staged values of this write.
|
|
74591
|
+
* @param side - The edge, by name.
|
|
74592
|
+
* @param index - Its place in the order top, right, bottom, left.
|
|
74593
|
+
* @param which - The edge, as Yoga names it.
|
|
73942
74594
|
*/
|
|
73943
|
-
function
|
|
73944
|
-
|
|
73945
|
-
|
|
73946
|
-
|
|
73947
|
-
|
|
73948
|
-
|
|
73949
|
-
|
|
73950
|
-
end: yoga.JUSTIFY_FLEX_END,
|
|
73951
|
-
between: yoga.JUSTIFY_SPACE_BETWEEN,
|
|
73952
|
-
around: yoga.JUSTIFY_SPACE_AROUND,
|
|
73953
|
-
evenly: yoga.JUSTIFY_SPACE_EVENLY
|
|
73954
|
-
}[style.justify ?? "start"]);
|
|
73955
|
-
node.setAlignItems({
|
|
73956
|
-
start: yoga.ALIGN_FLEX_START,
|
|
73957
|
-
center: yoga.ALIGN_CENTER,
|
|
73958
|
-
end: yoga.ALIGN_FLEX_END,
|
|
73959
|
-
stretch: yoga.ALIGN_STRETCH
|
|
73960
|
-
}[style.align ?? "stretch"]);
|
|
73961
|
-
node.setAlignSelf({
|
|
73962
|
-
auto: yoga.ALIGN_AUTO,
|
|
73963
|
-
start: yoga.ALIGN_FLEX_START,
|
|
73964
|
-
center: yoga.ALIGN_CENTER,
|
|
73965
|
-
end: yoga.ALIGN_FLEX_END,
|
|
73966
|
-
stretch: yoga.ALIGN_STRETCH
|
|
73967
|
-
}[style.alignSelf ?? "auto"]);
|
|
73968
|
-
node.setGap(yoga.GUTTER_ALL, style.gap ?? 0);
|
|
73969
|
-
node.setFlexGrow(style.grow ?? 0);
|
|
73970
|
-
node.setFlexShrink(style.shrink ?? 0);
|
|
73971
|
-
}
|
|
73972
|
-
/**
|
|
73973
|
-
* Writes one extent through the right setter: `"auto"`, a percent string and a number are three
|
|
73974
|
-
* different Yoga calls.
|
|
74595
|
+
function applyEdge(node, style, kept, staged, side, index, which) {
|
|
74596
|
+
if (lengthMoved(kept, staged, PADDING + index * 2)) node.setPadding(which, edge(style.padding, side));
|
|
74597
|
+
if (lengthMoved(kept, staged, MARGIN + index * 2)) node.setMargin(which, edge(style.margin, side));
|
|
74598
|
+
}
|
|
74599
|
+
/**
|
|
74600
|
+
* Writes the six extents through the right setter: `"auto"`, a percent string and a number are
|
|
74601
|
+
* three different Yoga calls. An extent staged as nothing to write is left alone.
|
|
73975
74602
|
*
|
|
73976
74603
|
* @param node - The node of the element.
|
|
73977
|
-
* @param
|
|
73978
|
-
* @param
|
|
74604
|
+
* @param style - The resolved style.
|
|
74605
|
+
* @param kept - The node's kept record.
|
|
74606
|
+
* @param staged - The staged values of this write.
|
|
73979
74607
|
*/
|
|
73980
|
-
function
|
|
73981
|
-
|
|
73982
|
-
if (
|
|
73983
|
-
|
|
73984
|
-
|
|
73985
|
-
|
|
73986
|
-
|
|
73987
|
-
|
|
73988
|
-
case "minHeight":
|
|
73989
|
-
node.setMinHeight(value);
|
|
73990
|
-
break;
|
|
73991
|
-
case "maxWidth":
|
|
73992
|
-
node.setMaxWidth(value);
|
|
73993
|
-
break;
|
|
73994
|
-
default: node.setMaxHeight(value);
|
|
73995
|
-
}
|
|
74608
|
+
function applyExtents(node, style, kept, staged) {
|
|
74609
|
+
const { width, height, minWidth, minHeight, maxWidth, maxHeight } = style;
|
|
74610
|
+
if (lengthMoved(kept, staged, WIDTH)) node.setWidth(width);
|
|
74611
|
+
if (lengthMoved(kept, staged, HEIGHT)) node.setHeight(height);
|
|
74612
|
+
if (minWidth !== "auto" && lengthMoved(kept, staged, MIN_WIDTH)) node.setMinWidth(minWidth);
|
|
74613
|
+
if (minHeight !== "auto" && lengthMoved(kept, staged, MIN_HEIGHT)) node.setMinHeight(minHeight);
|
|
74614
|
+
if (maxWidth !== "auto" && lengthMoved(kept, staged, MAX_WIDTH)) node.setMaxWidth(maxWidth);
|
|
74615
|
+
if (maxHeight !== "auto" && lengthMoved(kept, staged, MAX_HEIGHT)) node.setMaxHeight(maxHeight);
|
|
73996
74616
|
}
|
|
73997
74617
|
/**
|
|
73998
74618
|
* Writes the box group onto a node.
|
|
73999
74619
|
*
|
|
74000
|
-
* @param
|
|
74620
|
+
* @param tables - The tables of the loaded Yoga module, its numbers staged.
|
|
74001
74621
|
* @param node - The node of the element.
|
|
74002
74622
|
* @param style - The resolved style.
|
|
74623
|
+
* @param kept - The node's kept record.
|
|
74003
74624
|
*/
|
|
74004
|
-
function applyBox(
|
|
74005
|
-
const
|
|
74006
|
-
|
|
74007
|
-
|
|
74008
|
-
|
|
74009
|
-
|
|
74010
|
-
|
|
74011
|
-
|
|
74012
|
-
|
|
74013
|
-
|
|
74014
|
-
}
|
|
74015
|
-
applyExtent(node, "width", style.width);
|
|
74016
|
-
applyExtent(node, "height", style.height);
|
|
74017
|
-
applyExtent(node, "minWidth", style.minWidth);
|
|
74018
|
-
applyExtent(node, "minHeight", style.minHeight);
|
|
74019
|
-
applyExtent(node, "maxWidth", style.maxWidth);
|
|
74020
|
-
applyExtent(node, "maxHeight", style.maxHeight);
|
|
74021
|
-
node.setAspectRatio(style.aspect);
|
|
74022
|
-
node.setOverflow({
|
|
74023
|
-
visible: yoga.OVERFLOW_VISIBLE,
|
|
74024
|
-
hidden: yoga.OVERFLOW_HIDDEN,
|
|
74025
|
-
scroll: yoga.OVERFLOW_SCROLL
|
|
74026
|
-
}[style.overflow ?? "visible"]);
|
|
74625
|
+
function applyBox(tables, node, style, kept) {
|
|
74626
|
+
const { yoga, staged } = tables;
|
|
74627
|
+
const overflow = tables.overflow[style.overflow ?? "visible"];
|
|
74628
|
+
applyEdge(node, style, kept, staged, "top", 0, yoga.EDGE_TOP);
|
|
74629
|
+
applyEdge(node, style, kept, staged, "right", 1, yoga.EDGE_RIGHT);
|
|
74630
|
+
applyEdge(node, style, kept, staged, "bottom", 2, yoga.EDGE_BOTTOM);
|
|
74631
|
+
applyEdge(node, style, kept, staged, "left", 3, yoga.EDGE_LEFT);
|
|
74632
|
+
applyExtents(node, style, kept, staged);
|
|
74633
|
+
if (numberMoved(kept, staged, ASPECT)) node.setAspectRatio(style.aspect);
|
|
74634
|
+
if (enumMoved(kept, OVERFLOW, overflow)) node.setOverflow(overflow);
|
|
74027
74635
|
}
|
|
74028
74636
|
/**
|
|
74029
74637
|
* Writes the position group onto a node. A child of a `stack` is absolute unless it says
|
|
74030
74638
|
* otherwise, which is what makes a stack a stack. A fitted element is absolute too: it keeps its
|
|
74031
74639
|
* own size and never stretches its parent, and the solve centres it in the parent's content box.
|
|
74032
74640
|
*
|
|
74033
|
-
* @param
|
|
74641
|
+
* @param tables - The tables of the loaded Yoga module, its numbers staged.
|
|
74034
74642
|
* @param node - The node of the element.
|
|
74035
74643
|
* @param style - The resolved style.
|
|
74036
74644
|
* @param stacked - Whether the parent tag is a `stack`.
|
|
74645
|
+
* @param kept - The node's kept record.
|
|
74037
74646
|
*/
|
|
74038
|
-
function applyPosition(
|
|
74039
|
-
const
|
|
74040
|
-
|
|
74041
|
-
|
|
74042
|
-
node.setPosition(yoga.
|
|
74043
|
-
node.setPosition(yoga.
|
|
74044
|
-
node.setPosition(yoga.
|
|
74647
|
+
function applyPosition(tables, node, style, stacked, kept) {
|
|
74648
|
+
const { yoga, staged } = tables;
|
|
74649
|
+
const type = style.position === "absolute" || style.fit === "contain" || stacked && style.position === void 0 ? yoga.POSITION_TYPE_ABSOLUTE : yoga.POSITION_TYPE_RELATIVE;
|
|
74650
|
+
if (enumMoved(kept, POSITION_TYPE, type)) node.setPositionType(type);
|
|
74651
|
+
if (lengthMoved(kept, staged, LEFT)) node.setPosition(yoga.EDGE_LEFT, style.left);
|
|
74652
|
+
if (lengthMoved(kept, staged, TOP)) node.setPosition(yoga.EDGE_TOP, style.top);
|
|
74653
|
+
if (lengthMoved(kept, staged, RIGHT)) node.setPosition(yoga.EDGE_RIGHT, style.right);
|
|
74654
|
+
if (lengthMoved(kept, staged, BOTTOM)) node.setPosition(yoga.EDGE_BOTTOM, style.bottom);
|
|
74045
74655
|
}
|
|
74046
74656
|
/**
|
|
74047
|
-
* Writes one resolved style onto one Yoga node.
|
|
74657
|
+
* Writes one resolved style onto one Yoga node. With the node's kept record, a setter is called
|
|
74658
|
+
* only for a value that differs from the one the record keeps, and the record takes what was
|
|
74659
|
+
* written; without one, every setter is called. The order of the calls is the order of the groups:
|
|
74660
|
+
* flow, box (each edge's padding then margin, the extents, the ratio, the overflow), position.
|
|
74048
74661
|
*
|
|
74049
74662
|
* @param yoga - The loaded Yoga module.
|
|
74050
74663
|
* @param node - The node of the element.
|
|
74051
74664
|
* @param style - The resolved style.
|
|
74052
74665
|
* @param tag - The intrinsic tag, which decides the default direction.
|
|
74053
74666
|
* @param parentTag - The tag of the parent, which decides whether children stack.
|
|
74667
|
+
* @param kept - The node's kept record, made with the node; none writes every value.
|
|
74668
|
+
* @param tables - The tables of the loaded module; built for this call when none is given.
|
|
74054
74669
|
*/
|
|
74055
|
-
function applyStyleToNode(yoga, node, style, tag, parentTag) {
|
|
74056
|
-
|
|
74057
|
-
|
|
74058
|
-
|
|
74670
|
+
function applyStyleToNode(yoga, node, style, tag, parentTag, kept, tables = styleTablesOf(yoga)) {
|
|
74671
|
+
stageEdges(tables.staged, style);
|
|
74672
|
+
stageExtents(tables.staged, style);
|
|
74673
|
+
stageFlowAndPosition(tables.staged, style);
|
|
74674
|
+
applyFlow(tables, node, style, tag !== "row", kept);
|
|
74675
|
+
applyBox(tables, node, style, kept);
|
|
74676
|
+
applyPosition(tables, node, style, parentTag === "stack", kept);
|
|
74059
74677
|
}
|
|
74060
74678
|
//#endregion
|
|
74061
74679
|
//#region src/plugins/ui/layout/motion.ts
|
|
@@ -74625,7 +75243,21 @@ function liftRest(ctx, element, units) {
|
|
|
74625
75243
|
//#endregion
|
|
74626
75244
|
//#region src/plugins/ui/layout/nodes.ts
|
|
74627
75245
|
/**
|
|
74628
|
-
*
|
|
75246
|
+
* The style tables of the loaded module, built the first time a node of it is made.
|
|
75247
|
+
*
|
|
75248
|
+
* @param state - The layout state.
|
|
75249
|
+
* @param yoga - The loaded Yoga module.
|
|
75250
|
+
* @returns The tables.
|
|
75251
|
+
*/
|
|
75252
|
+
function tablesOf(state, yoga) {
|
|
75253
|
+
const tables = state.tables;
|
|
75254
|
+
if (tables !== void 0 && tables.yoga === yoga) return tables;
|
|
75255
|
+
const built = styleTablesOf(yoga);
|
|
75256
|
+
state.tables = built;
|
|
75257
|
+
return built;
|
|
75258
|
+
}
|
|
75259
|
+
/**
|
|
75260
|
+
* Creates the node of an element and counts it, with the kept record of a fresh node.
|
|
74629
75261
|
*
|
|
74630
75262
|
* @param state - The layout state.
|
|
74631
75263
|
* @param element - The element that entered.
|
|
@@ -74637,6 +75269,7 @@ function createNode(state, element) {
|
|
|
74637
75269
|
if (existing !== void 0) return existing;
|
|
74638
75270
|
const node = state.yoga.Node.create();
|
|
74639
75271
|
state.byEntity.set(element.entity, node);
|
|
75272
|
+
state.kept.set(node, freshKept(tablesOf(state, state.yoga)));
|
|
74640
75273
|
state.nodes += 1;
|
|
74641
75274
|
return node;
|
|
74642
75275
|
}
|
|
@@ -74664,6 +75297,7 @@ function freeNode(state, element) {
|
|
|
74664
75297
|
detachNode(state, element);
|
|
74665
75298
|
node.setMeasureFunc(null);
|
|
74666
75299
|
node.free();
|
|
75300
|
+
state.kept.delete(node);
|
|
74667
75301
|
state.byEntity.delete(element.entity);
|
|
74668
75302
|
state.nodes -= 1;
|
|
74669
75303
|
}
|
|
@@ -76617,7 +77251,7 @@ function writeStyle(state, source, element) {
|
|
|
76617
77251
|
const node = state.byEntity.get(element.entity);
|
|
76618
77252
|
if (node === void 0 || state.yoga === void 0) return;
|
|
76619
77253
|
const tag = element.scroll?.axis === "x" ? "row" : element.type;
|
|
76620
|
-
applyStyleToNode(state.yoga, node, element.style, tag, element.parentType);
|
|
77254
|
+
applyStyleToNode(state.yoga, node, element.style, tag, element.parentType, state.kept.get(node), state.tables);
|
|
76621
77255
|
installMeasure(state, node, element, source);
|
|
76622
77256
|
}
|
|
76623
77257
|
/**
|
|
@@ -76637,7 +77271,9 @@ function createLayoutApi(ctx) {
|
|
|
76637
77271
|
};
|
|
76638
77272
|
return {
|
|
76639
77273
|
load: async () => {
|
|
76640
|
-
|
|
77274
|
+
const yoga = await loadYogaModule();
|
|
77275
|
+
state.yoga = yoga;
|
|
77276
|
+
state.tables = styleTablesOf(yoga);
|
|
76641
77277
|
},
|
|
76642
77278
|
loaded: () => state.yoga !== void 0,
|
|
76643
77279
|
attach: (element) => {
|
|
@@ -77160,6 +77796,7 @@ function createAnchorPass(ctx, jsx) {
|
|
|
77160
77796
|
if (yoga === void 0 || node === void 0) return;
|
|
77161
77797
|
node.setWidth(element.rect.w);
|
|
77162
77798
|
node.setHeight(element.rect.h);
|
|
77799
|
+
keepSize(layout.kept.get(node), element.rect);
|
|
77163
77800
|
node.calculateLayout(element.rect.w, element.rect.h, yoga.DIRECTION_LTR);
|
|
77164
77801
|
layout.solves += 1;
|
|
77165
77802
|
placeUnder(element);
|
|
@@ -78181,8 +78818,10 @@ function stopUi(state) {
|
|
|
78181
78818
|
node.free();
|
|
78182
78819
|
}
|
|
78183
78820
|
state.layout.byEntity.clear();
|
|
78821
|
+
state.layout.kept.clear();
|
|
78184
78822
|
state.layout.nodes = 0;
|
|
78185
78823
|
state.layout.yoga = void 0;
|
|
78824
|
+
state.layout.tables = void 0;
|
|
78186
78825
|
state.layout.scrolling = void 0;
|
|
78187
78826
|
state.layout.scrollSamples = 0;
|
|
78188
78827
|
state.layout.iconLine = void 0;
|
|
@@ -78555,6 +79194,8 @@ function createLayoutState() {
|
|
|
78555
79194
|
return {
|
|
78556
79195
|
yoga: void 0,
|
|
78557
79196
|
byEntity: emptyMap(),
|
|
79197
|
+
tables: void 0,
|
|
79198
|
+
kept: emptyMap(),
|
|
78558
79199
|
nodes: 0,
|
|
78559
79200
|
measured: 0,
|
|
78560
79201
|
solves: 0,
|