@wardic/core 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseValue.d.ts +1 -1
- package/dist/BaseValue.js +2 -2
- package/dist/BaseValue.js.map +1 -1
- package/dist/Batch.d.ts +5 -9
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +166 -20
- package/dist/Batch.js.map +1 -1
- package/dist/Clock.d.ts +16 -0
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +13 -0
- package/dist/Clock.js.map +1 -1
- package/dist/DragRecognizer.d.ts +10 -5
- package/dist/DragRecognizer.d.ts.map +1 -1
- package/dist/DragRecognizer.js +60 -24
- package/dist/DragRecognizer.js.map +1 -1
- package/dist/Frame.js +1 -1
- package/dist/Frame.js.map +1 -1
- package/dist/InputFeed.d.ts +10 -7
- package/dist/InputFeed.d.ts.map +1 -1
- package/dist/InputFeed.js +16 -35
- package/dist/InputFeed.js.map +1 -1
- package/dist/LiveValue.d.ts +9 -3
- package/dist/LiveValue.d.ts.map +1 -1
- package/dist/LiveValue.js +160 -14
- package/dist/LiveValue.js.map +1 -1
- package/dist/Machine.d.ts +16 -6
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +50 -27
- package/dist/Machine.js.map +1 -1
- package/dist/Playback.d.ts.map +1 -1
- package/dist/Playback.js +10 -8
- package/dist/Playback.js.map +1 -1
- package/dist/Recognizer.d.ts +1 -1
- package/dist/Recognizer.d.ts.map +1 -1
- package/dist/Recognizer.js +9 -4
- package/dist/Recognizer.js.map +1 -1
- package/dist/internal/frameLoop.d.ts +10 -2
- package/dist/internal/frameLoop.d.ts.map +1 -1
- package/dist/internal/frameLoop.js +148 -18
- package/dist/internal/frameLoop.js.map +1 -1
- package/dist/internal/guarded.d.ts +16 -0
- package/dist/internal/guarded.d.ts.map +1 -0
- package/dist/internal/guarded.js +68 -0
- package/dist/internal/guarded.js.map +1 -0
- package/dist/internal/stepper.d.ts +9 -3
- package/dist/internal/stepper.d.ts.map +1 -1
- package/dist/internal/stepper.js +5 -4
- package/dist/internal/stepper.js.map +1 -1
- package/dist/unstable/AnimationControls.d.ts +15 -8
- package/dist/unstable/AnimationControls.d.ts.map +1 -1
- package/dist/unstable/AnimationControls.js +36 -15
- package/dist/unstable/AnimationControls.js.map +1 -1
- package/dist/unstable/AppearHandoff.d.ts +6 -0
- package/dist/unstable/AppearHandoff.d.ts.map +1 -1
- package/dist/unstable/AppearHandoff.js.map +1 -1
- package/dist/unstable/Config.d.ts +5 -1
- package/dist/unstable/Config.d.ts.map +1 -1
- package/dist/unstable/Config.js.map +1 -1
- package/dist/unstable/FlushGate.d.ts +4 -2
- package/dist/unstable/FlushGate.d.ts.map +1 -1
- package/dist/unstable/FlushGate.js +155 -38
- package/dist/unstable/FlushGate.js.map +1 -1
- package/dist/unstable/FrameEffects.d.ts +4 -1
- package/dist/unstable/FrameEffects.d.ts.map +1 -1
- package/dist/unstable/FrameEffects.js +12 -1
- package/dist/unstable/FrameEffects.js.map +1 -1
- package/dist/unstable/Imperative.d.ts +13 -4
- package/dist/unstable/Imperative.d.ts.map +1 -1
- package/dist/unstable/Imperative.js +202 -43
- package/dist/unstable/Imperative.js.map +1 -1
- package/dist/unstable/MeasuredPairs.d.ts +6 -2
- package/dist/unstable/MeasuredPairs.d.ts.map +1 -1
- package/dist/unstable/MeasuredPairs.js.map +1 -1
- package/dist/unstable/PresenceRecord.d.ts +4 -0
- package/dist/unstable/PresenceRecord.d.ts.map +1 -1
- package/dist/unstable/PresenceRecord.js.map +1 -1
- package/dist/unstable/Report.d.ts +7 -0
- package/dist/unstable/Report.d.ts.map +1 -1
- package/dist/unstable/Report.js +17 -1
- package/dist/unstable/Report.js.map +1 -1
- package/dist/unstable/RetargetLegs.d.ts +6 -0
- package/dist/unstable/RetargetLegs.d.ts.map +1 -1
- package/dist/unstable/RetargetLegs.js +15 -0
- package/dist/unstable/RetargetLegs.js.map +1 -1
- package/dist/unstable/Spine.d.ts +53 -7
- package/dist/unstable/Spine.d.ts.map +1 -1
- package/dist/unstable/Spine.js +190 -40
- package/dist/unstable/Spine.js.map +1 -1
- package/dist/unstable/VariantTarget.d.ts +25 -3
- package/dist/unstable/VariantTarget.d.ts.map +1 -1
- package/dist/unstable/VariantTarget.js +66 -13
- package/dist/unstable/VariantTarget.js.map +1 -1
- package/dist/unstable/VariantTree.d.ts +37 -3
- package/dist/unstable/VariantTree.d.ts.map +1 -1
- package/dist/unstable/VariantTree.js +54 -7
- package/dist/unstable/VariantTree.js.map +1 -1
- package/package.json +1 -1
- package/src/BaseValue.ts +2 -2
- package/src/Batch.ts +167 -17
- package/src/Clock.ts +20 -0
- package/src/DragRecognizer.ts +82 -30
- package/src/Frame.ts +1 -1
- package/src/InputFeed.ts +37 -40
- package/src/LiveValue.ts +140 -14
- package/src/Machine.ts +67 -34
- package/src/Playback.ts +10 -8
- package/src/Recognizer.ts +9 -3
- package/src/internal/frameLoop.ts +165 -19
- package/src/internal/guarded.ts +69 -0
- package/src/internal/stepper.ts +14 -5
- package/src/unstable/AnimationControls.ts +49 -21
- package/src/unstable/AppearHandoff.ts +7 -0
- package/src/unstable/Config.ts +7 -1
- package/src/unstable/FlushGate.ts +169 -37
- package/src/unstable/FrameEffects.ts +15 -2
- package/src/unstable/Imperative.ts +219 -48
- package/src/unstable/MeasuredPairs.ts +7 -1
- package/src/unstable/PresenceRecord.ts +4 -0
- package/src/unstable/Report.ts +19 -1
- package/src/unstable/RetargetLegs.ts +14 -0
- package/src/unstable/Spine.ts +235 -40
- package/src/unstable/VariantTarget.ts +93 -14
- package/src/unstable/VariantTree.ts +87 -6
package/dist/BaseValue.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type * as Values from "./Values.ts";
|
|
|
15
15
|
/**
|
|
16
16
|
* Each transform key's identity: the value that leaves an element untransformed, 1 for a scale and 0 for
|
|
17
17
|
* a translation, rotation or skew. A transform key's Own value is its identity, as Motion's is. These are
|
|
18
|
-
* the keys
|
|
18
|
+
* the keys every Environment builds one `transform` from; an Environment may add keys of its own.
|
|
19
19
|
*/
|
|
20
20
|
export declare const TRANSFORM_IDENTITY: Readonly<Record<string, number>>;
|
|
21
21
|
/** A transform key's identity (see {@link TRANSFORM_IDENTITY}), or `None` for any other key, prototype names included. */
|
package/dist/BaseValue.js
CHANGED
|
@@ -18,11 +18,11 @@ import * as Rec from "effect/Record";
|
|
|
18
18
|
/**
|
|
19
19
|
* Each transform key's identity: the value that leaves an element untransformed, 1 for a scale and 0 for
|
|
20
20
|
* a translation, rotation or skew. A transform key's Own value is its identity, as Motion's is. These are
|
|
21
|
-
* the keys
|
|
21
|
+
* the keys every Environment builds one `transform` from; an Environment may add keys of its own.
|
|
22
22
|
*/
|
|
23
23
|
// Motion's `defaultTransformValue` (motion-dom parse-transform.ts:62-64 at 16c61222c4166bbef5ff6ab0051192faa79fa8c8),
|
|
24
24
|
// and what Motion uses at runtime, since every motion element's read takes its projected branch
|
|
25
|
-
// (HTMLVisualElement.ts:51). `@wardic/dom`'s
|
|
25
|
+
// (HTMLVisualElement.ts:51). `@wardic/dom`'s table extends this one with the DOM's own key (#887).
|
|
26
26
|
export const TRANSFORM_IDENTITY = Object.freeze({
|
|
27
27
|
x: 0,
|
|
28
28
|
y: 0,
|
package/dist/BaseValue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseValue.js","sourceRoot":"","sources":["../src/BaseValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,mGAAmG;AACnG,0FAA0F;AAC1F,2GAA2G;AAC3G,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAGpC;;;;GAIG;AACH,sHAAsH;AACtH,gGAAgG;AAChG,
|
|
1
|
+
{"version":3,"file":"BaseValue.js","sourceRoot":"","sources":["../src/BaseValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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GAAG,CAAC,EAAE,CAAC,KAAK,EAAa,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CACrF,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAa,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CACpG,CAAA"}
|
package/dist/Batch.d.ts
CHANGED
|
@@ -145,6 +145,11 @@ export declare const isMoving: <S>(self: Batch<S>) => boolean;
|
|
|
145
145
|
* outside a step set (an `enter`, a `replace`, a start from a given value, a play, seek, stop or cancel):
|
|
146
146
|
* whether nothing moves now. One a delay or a paused Playhead holds still isn't written. The run on the
|
|
147
147
|
* Frame loop calls it each tick.
|
|
148
|
+
*
|
|
149
|
+
* One member's failure is its own: a write or a start partway that throws is reported once, until a step
|
|
150
|
+
* runs every member's clean, and its member steps on with the others. A landing's callback that throws is
|
|
151
|
+
* reported each time, the other members told and the other changes landed; the writer's `flush` and
|
|
152
|
+
* `onFrame` once until they return. Each is reported on what the Batch last ran on.
|
|
148
153
|
*/
|
|
149
154
|
export declare const step: <S>(self: Batch<S>, dt: number) => boolean;
|
|
150
155
|
/**
|
|
@@ -232,15 +237,6 @@ export declare const cancel: (self: Animation) => void;
|
|
|
232
237
|
* start at 60 Hz as `Machine.durationOf` steps a machine. Worked out once.
|
|
233
238
|
*/
|
|
234
239
|
export declare const durationOf: (self: Animation) => number;
|
|
235
|
-
/**
|
|
236
|
-
* Runs `self` on the Frame loop while any member moves, from the next tick: each tick steps every
|
|
237
|
-
* moving member and writes it. It succeeds once nothing moves. While one runs, another does nothing,
|
|
238
|
-
* so a binding calls it after each change.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* Batch.retarget(grid, slots, targetOf)
|
|
242
|
-
* runtime.runFork(Batch.run(grid))
|
|
243
|
-
*/
|
|
244
240
|
export declare const run: <S>(self: Batch<S>) => Effect.Effect<void, never, FrameLoop.FrameLoop>;
|
|
245
241
|
/** A member's value for `key` now. */
|
|
246
242
|
export declare const get: <S>(self: Batch<S>, slot: number, key: string) => number;
|
package/dist/Batch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Batch.d.ts","sourceRoot":"","sources":["../src/Batch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Batch.d.ts","sourceRoot":"","sources":["../src/Batch.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,iBAAiB,CAAA;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAI7C,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAQ3C,QAAA,MAAM,MAAM,wBAAwB,CAAA;AAEpC;;;;GAIG;AAEH,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAA;IACzC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9G,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAA;CAC5B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M,IAAI,SAAU,SAAS,KAAG,IAWtC,CAAA;AAED,wFAAwF;AACxF,eAAO,MAAM,MAAM,SAAU,SAAS,KAAG,IASxC,CAAA;AAoBD;;;GAGG;AAEH,eAAO,MAAM,UAAU,SAAU,SAAS,KAAG,MA+D5C,CAAA;AA0CD,eAAO,MAAM,GAAG,GAAG,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,SAAS,CAsBjF,CAAA;AASJ,sCAAsC;AAEtC,eAAO,MAAM,GAAG,GAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO,MAAM,KAAG,MAGlE,CAAA;AAED,sGAAsG;AAEtG,eAAO,MAAM,MAAM,GAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO,MAAM,KAAG,MAGrE,CAAA;AAED,4GAA4G;AAE5G,eAAO,MAAM,QAAQ,GAAI,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,QAAQ,MAAM,OAAO,MAAM,KAAG,MAMvE,CAAA"}
|
package/dist/Batch.js
CHANGED
|
@@ -18,10 +18,11 @@
|
|
|
18
18
|
// a member's keys at `slot * stride + k` (#663's shape); stepped by `Spring.matrixFor`'s exact step
|
|
19
19
|
// (#370), the probe's loop (`.tmp/564-canvas/perf/group.ts` on `probe/564-canvas`).
|
|
20
20
|
import * as Arr from "effect/Array";
|
|
21
|
+
import * as Cause from "effect/Cause";
|
|
22
|
+
import * as Context from "effect/Context";
|
|
21
23
|
import * as Effect from "effect/Effect";
|
|
22
24
|
import { identity } from "effect/Function";
|
|
23
25
|
import * as Inspectable from "effect/Inspectable";
|
|
24
|
-
import * as Iter from "effect/Iterable";
|
|
25
26
|
import * as Match from "effect/Match";
|
|
26
27
|
import { pipeArguments } from "effect/Pipeable";
|
|
27
28
|
import * as Predicate from "effect/Predicate";
|
|
@@ -30,6 +31,7 @@ import * as Machine from "./Machine.js";
|
|
|
30
31
|
import * as Scalar from "./Scalar.js";
|
|
31
32
|
import * as Spring from "./Spring.js";
|
|
32
33
|
import * as UnitScale from "./UnitScale.js";
|
|
34
|
+
import * as Report from "./unstable/Report.js";
|
|
33
35
|
import { dual } from "./internal/dual.js";
|
|
34
36
|
import { tickOf, writableOf } from "./internal/playhead.js";
|
|
35
37
|
import { resolveKeyframes } from "./internal/keyframes.js";
|
|
@@ -271,6 +273,13 @@ export const make = (options) => {
|
|
|
271
273
|
frame: 0,
|
|
272
274
|
running: 0,
|
|
273
275
|
runs: 0,
|
|
276
|
+
services: Context.empty(),
|
|
277
|
+
writeThrewInStep: false,
|
|
278
|
+
writeReported: false,
|
|
279
|
+
startThrewInStep: false,
|
|
280
|
+
startReported: false,
|
|
281
|
+
flushReported: false,
|
|
282
|
+
onFrameReported: false,
|
|
274
283
|
};
|
|
275
284
|
// The Batch's own transitions, pinned: the first entries, rule 0 the first key's.
|
|
276
285
|
state.ownRules = rulesOf(state, options.transition, unnamedKey(state));
|
|
@@ -592,6 +601,49 @@ export const retarget = dual(isBatch, (self, slots, targetOf, options) => {
|
|
|
592
601
|
Arr.forEach(held, (rule) => release(state, rule));
|
|
593
602
|
return setOff;
|
|
594
603
|
});
|
|
604
|
+
/**
|
|
605
|
+
* `defect`, a failure on the Batch's path named by `message`, logged and handed to the ErrorReporters of
|
|
606
|
+
* what it runs on, annotated with its member's slot where it's one member's.
|
|
607
|
+
*/
|
|
608
|
+
// #977 (ADR-0074): one member's failure is its own. Its failure path, off the per-frame one.
|
|
609
|
+
const report = (state, message, defect, slot) => {
|
|
610
|
+
const failure = Report.failure(message, Cause.die(defect));
|
|
611
|
+
if (Predicate.isUndefined(slot)) {
|
|
612
|
+
Effect.runForkWith(state.services)(failure);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
Effect.runForkWith(state.services)(Effect.annotateLogs(failure, { member: slot }));
|
|
616
|
+
};
|
|
617
|
+
/** A member's write that threw: reported once, until a step writes every member clean. */
|
|
618
|
+
const writeFailed = (state, slot, defect) => {
|
|
619
|
+
state.writeThrewInStep = true;
|
|
620
|
+
if (state.writeReported)
|
|
621
|
+
return;
|
|
622
|
+
state.writeReported = true;
|
|
623
|
+
report(state, "wardic.batch: a member's write failed", defect, slot);
|
|
624
|
+
};
|
|
625
|
+
/** A member's start partway that threw: reported once, until a step starts every member clean. */
|
|
626
|
+
const startFailed = (state, slot, defect) => {
|
|
627
|
+
state.startThrewInStep = true;
|
|
628
|
+
if (state.startReported)
|
|
629
|
+
return;
|
|
630
|
+
state.startReported = true;
|
|
631
|
+
report(state, "wardic.batch: a member's start failed", defect, slot);
|
|
632
|
+
};
|
|
633
|
+
/** The writer's `flush`, a step's or a draw's: a throw reported once, until one returns. */
|
|
634
|
+
const flushed = (state) => {
|
|
635
|
+
try {
|
|
636
|
+
state.flush();
|
|
637
|
+
if (state.flushReported)
|
|
638
|
+
state.flushReported = false;
|
|
639
|
+
}
|
|
640
|
+
catch (defect) {
|
|
641
|
+
if (state.flushReported)
|
|
642
|
+
return;
|
|
643
|
+
state.flushReported = true;
|
|
644
|
+
report(state, "wardic.batch: its writer's flush failed", defect);
|
|
645
|
+
}
|
|
646
|
+
};
|
|
595
647
|
/** Whether any member moves: one `step` would move. */
|
|
596
648
|
export const isMoving = (self) => {
|
|
597
649
|
const state = stateOf(self);
|
|
@@ -602,6 +654,11 @@ export const isMoving = (self) => {
|
|
|
602
654
|
* outside a step set (an `enter`, a `replace`, a start from a given value, a play, seek, stop or cancel):
|
|
603
655
|
* whether nothing moves now. One a delay or a paused Playhead holds still isn't written. The run on the
|
|
604
656
|
* Frame loop calls it each tick.
|
|
657
|
+
*
|
|
658
|
+
* One member's failure is its own: a write or a start partway that throws is reported once, until a step
|
|
659
|
+
* runs every member's clean, and its member steps on with the others. A landing's callback that throws is
|
|
660
|
+
* reported each time, the other members told and the other changes landed; the writer's `flush` and
|
|
661
|
+
* `onFrame` once until they return. Each is reported on what the Batch last ran on.
|
|
605
662
|
*/
|
|
606
663
|
// Per frame (ADR-0025, ADR-0030 decisions 10 and 11): `dt` clamped once (#78), then the two moving
|
|
607
664
|
// lists. Each steps a key by `springValues`' exact step, or `Machine.tween`'s, its spring's matrix
|
|
@@ -610,16 +667,43 @@ export const step = (self, dt) => {
|
|
|
610
667
|
const state = stateOf(self);
|
|
611
668
|
const clamped = Math.min(dt, Machine.MAX_DT);
|
|
612
669
|
state.frame = state.frame + 1;
|
|
670
|
+
// Whether a member's write or start throws in this step: a `draw`'s between steps isn't one (#977).
|
|
671
|
+
state.writeThrewInStep = false;
|
|
672
|
+
state.startThrewInStep = false;
|
|
613
673
|
if (state.startList.length > 0)
|
|
614
674
|
startPass(state, clamped);
|
|
615
675
|
if (state.plainCount > 0)
|
|
616
676
|
stepPlain(state, clamped);
|
|
617
677
|
if (state.ruledCount > 0)
|
|
618
678
|
stepRuled(state, clamped);
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
679
|
+
// Each change's landing its own: a callback that throws leaves the others to land (#977).
|
|
680
|
+
if (state.animations.size > 0) {
|
|
681
|
+
for (const animation of state.animations) {
|
|
682
|
+
try {
|
|
683
|
+
checkLanding(animation);
|
|
684
|
+
}
|
|
685
|
+
catch (defect) {
|
|
686
|
+
report(state, "wardic.batch: a change's landing failed", defect);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
flushed(state);
|
|
691
|
+
try {
|
|
692
|
+
state.onFrame();
|
|
693
|
+
if (state.onFrameReported)
|
|
694
|
+
state.onFrameReported = false;
|
|
695
|
+
}
|
|
696
|
+
catch (defect) {
|
|
697
|
+
if (!state.onFrameReported) {
|
|
698
|
+
state.onFrameReported = true;
|
|
699
|
+
report(state, "wardic.batch: an onFrame failed", defect);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
// A path that stepped clean is reported again at its next throw (#977).
|
|
703
|
+
if (!state.writeThrewInStep)
|
|
704
|
+
state.writeReported = false;
|
|
705
|
+
if (!state.startThrewInStep)
|
|
706
|
+
state.startReported = false;
|
|
623
707
|
// Counted after `onFrame`: a change it makes keeps the run going.
|
|
624
708
|
if (state.plainCount + state.ruledCount > 0)
|
|
625
709
|
return false;
|
|
@@ -642,9 +726,14 @@ export const draw = (self) => {
|
|
|
642
726
|
if ((flags[slot] & LIVE) === 0)
|
|
643
727
|
continue;
|
|
644
728
|
flags[slot] = flags[slot] & ~DUE;
|
|
645
|
-
|
|
729
|
+
try {
|
|
730
|
+
write(subjects[slot], positions, slot * stride);
|
|
731
|
+
}
|
|
732
|
+
catch (defect) {
|
|
733
|
+
writeFailed(state, slot, defect);
|
|
734
|
+
}
|
|
646
735
|
}
|
|
647
|
-
state
|
|
736
|
+
flushed(state);
|
|
648
737
|
};
|
|
649
738
|
/**
|
|
650
739
|
* At rest, every transition but the Batch's own is forgotten: no member moves, so no rule is read
|
|
@@ -736,8 +825,14 @@ const stepPlain = (state, clamped) => {
|
|
|
736
825
|
elapsed[at] = time;
|
|
737
826
|
}
|
|
738
827
|
// One a delay holds still isn't written: an unchanged write is a style write all the same.
|
|
739
|
-
if (moved)
|
|
740
|
-
|
|
828
|
+
if (moved) {
|
|
829
|
+
try {
|
|
830
|
+
write(subjects[slot], positions, base);
|
|
831
|
+
}
|
|
832
|
+
catch (defect) {
|
|
833
|
+
writeFailed(state, slot, defect);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
741
836
|
// At rest: still its member's, in neither list.
|
|
742
837
|
if (still) {
|
|
743
838
|
flags[slot] = LIVE;
|
|
@@ -876,8 +971,14 @@ const stepRuled = (state, clamped) => {
|
|
|
876
971
|
positions[at] = position;
|
|
877
972
|
velocities[at] = speed;
|
|
878
973
|
}
|
|
879
|
-
if (moved)
|
|
880
|
-
|
|
974
|
+
if (moved) {
|
|
975
|
+
try {
|
|
976
|
+
write(subjects[slot], positions, base);
|
|
977
|
+
}
|
|
978
|
+
catch (defect) {
|
|
979
|
+
writeFailed(state, slot, defect);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
881
982
|
// At rest: still its member's, in neither list (a member is in one at most).
|
|
882
983
|
if (still) {
|
|
883
984
|
flags[slot] = LIVE;
|
|
@@ -988,8 +1089,14 @@ const stepRuledDriven = (state) => {
|
|
|
988
1089
|
positions[at] = position;
|
|
989
1090
|
velocities[at] = speed;
|
|
990
1091
|
}
|
|
991
|
-
if (moved)
|
|
992
|
-
|
|
1092
|
+
if (moved) {
|
|
1093
|
+
try {
|
|
1094
|
+
write(subjects[slot], positions, base);
|
|
1095
|
+
}
|
|
1096
|
+
catch (defect) {
|
|
1097
|
+
writeFailed(state, slot, defect);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
993
1100
|
// At rest: still its member's, in neither list (a member is in one at most).
|
|
994
1101
|
if (still) {
|
|
995
1102
|
flags[slot] = LIVE;
|
|
@@ -1140,7 +1247,14 @@ const startedPartway = (state, slot, dt) => {
|
|
|
1140
1247
|
const { stride, elapsed, rules, positions, velocities, targets, originVelocities, startAts } = state;
|
|
1141
1248
|
const startAt = UndefinedOr.getOrThrow(startAts[slot]);
|
|
1142
1249
|
startAts[slot] = undefined;
|
|
1143
|
-
|
|
1250
|
+
// A start that throws is its member's: it starts from its start, as `NaN` gives (#977).
|
|
1251
|
+
let time = Number.NaN;
|
|
1252
|
+
try {
|
|
1253
|
+
time = startAt(slot);
|
|
1254
|
+
}
|
|
1255
|
+
catch (defect) {
|
|
1256
|
+
startFailed(state, slot, defect);
|
|
1257
|
+
}
|
|
1144
1258
|
const base = slot * stride;
|
|
1145
1259
|
const started = !Number.isNaN(time);
|
|
1146
1260
|
for (let k = 0; k < stride; k++) {
|
|
@@ -1164,7 +1278,12 @@ const startedPartway = (state, slot, dt) => {
|
|
|
1164
1278
|
}
|
|
1165
1279
|
if (started) {
|
|
1166
1280
|
state.flags[slot] = state.flags[slot] & ~DUE;
|
|
1167
|
-
|
|
1281
|
+
try {
|
|
1282
|
+
state.write(state.subjects[slot], positions, base);
|
|
1283
|
+
}
|
|
1284
|
+
catch (defect) {
|
|
1285
|
+
writeFailed(state, slot, defect);
|
|
1286
|
+
}
|
|
1168
1287
|
}
|
|
1169
1288
|
return started;
|
|
1170
1289
|
};
|
|
@@ -1251,7 +1370,15 @@ const tellIdle = (animation) => {
|
|
|
1251
1370
|
const tell = animation.options.onMemberLanded;
|
|
1252
1371
|
if (Predicate.isUndefined(tell))
|
|
1253
1372
|
return;
|
|
1254
|
-
|
|
1373
|
+
// Each member's own: a landing that throws leaves the others told (#977).
|
|
1374
|
+
Arr.forEach(animation.idle, (slot) => {
|
|
1375
|
+
try {
|
|
1376
|
+
tell(slot);
|
|
1377
|
+
}
|
|
1378
|
+
catch (defect) {
|
|
1379
|
+
report(animation.state, "wardic.batch: a member's landing failed", defect, slot);
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1255
1382
|
};
|
|
1256
1383
|
/**
|
|
1257
1384
|
* Each member `animation` moves told, once, as every key of it it still moves has landed (`onMemberLanded`):
|
|
@@ -1278,7 +1405,13 @@ const tellMembers = (animation, tell) => {
|
|
|
1278
1405
|
if (!kept || !atRest)
|
|
1279
1406
|
continue;
|
|
1280
1407
|
told[r] = 1;
|
|
1281
|
-
|
|
1408
|
+
const slot = slotAt(state, ats[firsts[r]]);
|
|
1409
|
+
try {
|
|
1410
|
+
tell(slot);
|
|
1411
|
+
}
|
|
1412
|
+
catch (defect) {
|
|
1413
|
+
report(state, "wardic.batch: a member's landing failed", defect, slot);
|
|
1414
|
+
}
|
|
1282
1415
|
}
|
|
1283
1416
|
};
|
|
1284
1417
|
/**
|
|
@@ -1906,23 +2039,36 @@ const machineOf = (self, id) => {
|
|
|
1906
2039
|
/**
|
|
1907
2040
|
* Runs `self` on the Frame loop while any member moves, from the next tick: each tick steps every
|
|
1908
2041
|
* moving member and writes it. It succeeds once nothing moves. While one runs, another does nothing,
|
|
1909
|
-
* so a binding calls it after each change.
|
|
2042
|
+
* so a binding calls it after each change. A member's failure is reported on the services it runs with,
|
|
2043
|
+
* the Environment's Logger and ErrorReporters, and the run goes on.
|
|
1910
2044
|
*
|
|
1911
2045
|
* @example
|
|
1912
2046
|
* Batch.retarget(grid, slots, targetOf)
|
|
1913
2047
|
* runtime.runFork(Batch.run(grid))
|
|
1914
2048
|
*/
|
|
2049
|
+
/** A Batch run's options (#1026): on the frame timeline while members take their Appear animations over, or not. */
|
|
2050
|
+
const TAKING_OVER = { onFrameTimeline: true };
|
|
2051
|
+
const ON_ITS_OWN = {};
|
|
1915
2052
|
// One run, not a fiber per member (ADR-0069, decision 10). Its span is `wardic.batch`.
|
|
1916
|
-
export const run = (self) => Effect.
|
|
2053
|
+
export const run = (self) => Effect.contextWith((services) => {
|
|
1917
2054
|
const state = stateOf(self);
|
|
1918
2055
|
if (state.running !== 0)
|
|
1919
2056
|
return Effect.void;
|
|
2057
|
+
// Its failures are reported on what it runs on, the Environment's Logger and ErrorReporters, kept
|
|
2058
|
+
// for a draw or a play between runs; a second run while one runs swaps nothing (#977).
|
|
2059
|
+
state.services = services;
|
|
1920
2060
|
if (state.plainCount + state.ruledCount === 0)
|
|
1921
2061
|
return Effect.void;
|
|
1922
2062
|
const id = state.runs + 1;
|
|
1923
2063
|
state.runs = id;
|
|
1924
2064
|
state.running = id;
|
|
1925
|
-
|
|
2065
|
+
// A run that starts with members taking their Appear animations over keeps the frame timeline's time,
|
|
2066
|
+
// where those animations' `currentTime` is (#1026); one that doesn't takes no long task's time from
|
|
2067
|
+
// before it was on the page.
|
|
2068
|
+
let options = ON_ITS_OWN;
|
|
2069
|
+
if (state.startList.length > 0)
|
|
2070
|
+
options = TAKING_OVER;
|
|
2071
|
+
return Effect.ensuring(Effect.asVoid(Machine.run(machineOf(self, id), ignore, options)), Effect.sync(() => {
|
|
1926
2072
|
if (state.running === id)
|
|
1927
2073
|
state.running = 0;
|
|
1928
2074
|
}));
|