@wardic/core 1.3.2 → 1.4.1
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/Arc.d.ts +2 -2
- package/dist/Arc.js +1 -1
- package/dist/BaseValue.d.ts +11 -10
- package/dist/BaseValue.d.ts.map +1 -1
- package/dist/BaseValue.js +12 -15
- package/dist/BaseValue.js.map +1 -1
- package/dist/Batch.d.ts +15 -5
- package/dist/Batch.d.ts.map +1 -1
- package/dist/Batch.js +218 -20
- package/dist/Batch.js.map +1 -1
- package/dist/Clock.d.ts +7 -7
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +17 -16
- package/dist/Clock.js.map +1 -1
- package/dist/DefaultTransition.d.ts +3 -2
- package/dist/DefaultTransition.d.ts.map +1 -1
- package/dist/DefaultTransition.js +5 -3
- package/dist/DefaultTransition.js.map +1 -1
- package/dist/Drag.d.ts +24 -9
- package/dist/Drag.d.ts.map +1 -1
- package/dist/Drag.js +10 -10
- package/dist/Drag.js.map +1 -1
- package/dist/DragActivity.js +3 -3
- package/dist/DragRecognizer.d.ts +5 -4
- package/dist/DragRecognizer.d.ts.map +1 -1
- package/dist/DragRecognizer.js +37 -14
- package/dist/DragRecognizer.js.map +1 -1
- package/dist/Easing.d.ts +1 -1
- package/dist/Easing.js +1 -1
- package/dist/Frame.d.ts.map +1 -1
- package/dist/Frame.js +5 -3
- package/dist/Frame.js.map +1 -1
- package/dist/InputFeed.d.ts +1 -1
- package/dist/InputFeed.js +2 -2
- package/dist/InputSource.d.ts +3 -3
- package/dist/InputSource.js +2 -2
- package/dist/Interpolator.d.ts +2 -2
- package/dist/Interpolator.js +2 -2
- package/dist/InterpolatorRegistry.d.ts +29 -15
- package/dist/InterpolatorRegistry.d.ts.map +1 -1
- package/dist/InterpolatorRegistry.js +17 -8
- package/dist/InterpolatorRegistry.js.map +1 -1
- package/dist/LiveValue.d.ts +7 -6
- package/dist/LiveValue.d.ts.map +1 -1
- package/dist/LiveValue.js +45 -14
- package/dist/LiveValue.js.map +1 -1
- package/dist/Machine.d.ts +7 -4
- package/dist/Machine.d.ts.map +1 -1
- package/dist/Machine.js +146 -45
- package/dist/Machine.js.map +1 -1
- package/dist/Playback.d.ts.map +1 -1
- package/dist/Playback.js +6 -1
- package/dist/Playback.js.map +1 -1
- package/dist/Projection.d.ts +9 -9
- package/dist/Projection.js +2 -2
- package/dist/Recognizer.d.ts +4 -3
- package/dist/Recognizer.d.ts.map +1 -1
- package/dist/Recognizer.js +49 -20
- package/dist/Recognizer.js.map +1 -1
- package/dist/ReducedMotion.d.ts +4 -4
- package/dist/ReducedMotion.js +6 -6
- package/dist/Renderer.d.ts +5 -5
- package/dist/Renderer.js +6 -6
- package/dist/Renderer.js.map +1 -1
- package/dist/Reorder.d.ts +1 -1
- package/dist/Reorder.d.ts.map +1 -1
- package/dist/Reorder.js +2 -1
- package/dist/Reorder.js.map +1 -1
- package/dist/ScrollSource.d.ts +1 -1
- package/dist/ScrollSource.d.ts.map +1 -1
- package/dist/Sequence.d.ts +1 -1
- package/dist/SharedSource.d.ts +3 -3
- package/dist/SharedSource.js +5 -5
- package/dist/SharedSource.js.map +1 -1
- package/dist/Spring.d.ts.map +1 -1
- package/dist/Spring.js +2 -1
- package/dist/Spring.js.map +1 -1
- package/dist/Values.d.ts +2 -2
- package/dist/Values.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/carried.d.ts +13 -0
- package/dist/internal/carried.d.ts.map +1 -0
- package/dist/internal/carried.js +23 -0
- package/dist/internal/carried.js.map +1 -0
- package/dist/internal/firstSteps.d.ts +66 -0
- package/dist/internal/firstSteps.d.ts.map +1 -0
- package/dist/internal/firstSteps.js +107 -0
- package/dist/internal/firstSteps.js.map +1 -0
- package/dist/internal/frameLoop.d.ts +1 -1
- package/dist/internal/frameLoop.d.ts.map +1 -1
- package/dist/internal/frameLoop.js +102 -81
- package/dist/internal/frameLoop.js.map +1 -1
- package/dist/internal/lerpsNumbers.d.ts +11 -0
- package/dist/internal/lerpsNumbers.d.ts.map +1 -0
- package/dist/internal/lerpsNumbers.js +38 -0
- package/dist/internal/lerpsNumbers.js.map +1 -0
- package/dist/internal/options.d.ts +7 -7
- package/dist/internal/options.d.ts.map +1 -1
- package/dist/internal/options.js +10 -10
- package/dist/internal/options.js.map +1 -1
- package/dist/internal/stepper.d.ts +13 -2
- package/dist/internal/stepper.d.ts.map +1 -1
- package/dist/internal/stepper.js +16 -1
- package/dist/internal/stepper.js.map +1 -1
- package/dist/internal/tracing.d.ts +1 -1
- package/dist/internal/tracing.js +1 -1
- package/dist/unstable/AnimationControls.d.ts +37 -38
- package/dist/unstable/AnimationControls.d.ts.map +1 -1
- package/dist/unstable/AnimationControls.js +39 -36
- package/dist/unstable/AnimationControls.js.map +1 -1
- package/dist/unstable/AppearHandoff.d.ts +5 -5
- package/dist/unstable/AppearHandoff.d.ts.map +1 -1
- package/dist/unstable/BatchCalls.d.ts +2 -2
- package/dist/unstable/BatchCalls.js +5 -5
- package/dist/unstable/Config.d.ts +19 -19
- package/dist/unstable/Config.d.ts.map +1 -1
- package/dist/unstable/FirstSteps.d.ts +25 -0
- package/dist/unstable/FirstSteps.d.ts.map +1 -0
- package/dist/unstable/FirstSteps.js +2 -0
- package/dist/unstable/FirstSteps.js.map +1 -0
- package/dist/unstable/FlushGate.d.ts +53 -51
- package/dist/unstable/FlushGate.d.ts.map +1 -1
- package/dist/unstable/FlushGate.js +56 -49
- package/dist/unstable/FlushGate.js.map +1 -1
- package/dist/unstable/FrameEffects.d.ts +2 -2
- package/dist/unstable/FrameEffects.js +2 -2
- package/dist/unstable/FrameTime.d.ts +1 -1
- package/dist/unstable/FrameTime.js +1 -1
- package/dist/unstable/Imperative.d.ts +29 -9
- package/dist/unstable/Imperative.d.ts.map +1 -1
- package/dist/unstable/Imperative.js +79 -47
- package/dist/unstable/Imperative.js.map +1 -1
- package/dist/unstable/OwnValues.js +1 -1
- package/dist/unstable/PresenceRecord.d.ts +26 -26
- package/dist/unstable/PresenceRecord.d.ts.map +1 -1
- package/dist/unstable/PresenceRecord.js +8 -8
- package/dist/unstable/PresenceRecord.js.map +1 -1
- package/dist/unstable/Projector.d.ts +34 -0
- package/dist/unstable/Projector.d.ts.map +1 -0
- package/dist/unstable/Projector.js +9 -0
- package/dist/unstable/Projector.js.map +1 -0
- package/dist/unstable/Report.d.ts +1 -1
- package/dist/unstable/Report.js +1 -1
- package/dist/unstable/RetargetLegs.d.ts +1 -1
- package/dist/unstable/RetargetLegs.d.ts.map +1 -1
- package/dist/unstable/RetargetLegs.js +9 -8
- package/dist/unstable/RetargetLegs.js.map +1 -1
- package/dist/unstable/Spine.d.ts +81 -72
- package/dist/unstable/Spine.d.ts.map +1 -1
- package/dist/unstable/Spine.js +152 -150
- package/dist/unstable/Spine.js.map +1 -1
- package/dist/unstable/Stops.d.ts +3 -3
- package/dist/unstable/Stops.js +4 -4
- package/dist/unstable/Subject.d.ts +2 -2
- package/dist/unstable/Subject.js +2 -2
- package/dist/unstable/Timelines.d.ts +11 -11
- package/dist/unstable/Timelines.d.ts.map +1 -1
- package/dist/unstable/Timelines.js +3 -3
- package/dist/unstable/VariantTarget.d.ts +7 -7
- package/dist/unstable/VariantTarget.d.ts.map +1 -1
- package/dist/unstable/VariantTarget.js +11 -11
- package/dist/unstable/VariantTarget.js.map +1 -1
- package/dist/unstable/VariantTree.d.ts +36 -36
- package/dist/unstable/VariantTree.d.ts.map +1 -1
- package/dist/unstable/VariantTree.js +33 -33
- package/dist/unstable/VariantTree.js.map +1 -1
- package/dist/unstable/WardicConfigValue.d.ts +13 -13
- package/dist/unstable/WardicConfigValue.d.ts.map +1 -1
- package/dist/unstable/WardicConfigValue.js +4 -4
- package/dist/unstable/WardicConfigValue.js.map +1 -1
- package/package.json +1 -1
- package/src/Arc.ts +3 -3
- package/src/BaseValue.ts +18 -21
- package/src/Batch.ts +236 -22
- package/src/Clock.ts +18 -17
- package/src/DefaultTransition.ts +5 -3
- package/src/Drag.ts +32 -14
- package/src/DragActivity.ts +3 -3
- package/src/DragRecognizer.ts +41 -16
- package/src/Easing.ts +1 -1
- package/src/Frame.ts +5 -3
- package/src/InputFeed.ts +2 -2
- package/src/InputSource.ts +5 -5
- package/src/Interpolator.ts +3 -3
- package/src/InterpolatorRegistry.ts +22 -13
- package/src/LiveValue.ts +47 -17
- package/src/Machine.ts +199 -61
- package/src/Playback.ts +5 -1
- package/src/Projection.ts +9 -9
- package/src/Recognizer.ts +69 -38
- package/src/ReducedMotion.ts +6 -6
- package/src/Renderer.ts +6 -6
- package/src/Reorder.ts +3 -2
- package/src/ScrollSource.ts +1 -1
- package/src/Sequence.ts +1 -1
- package/src/SharedSource.ts +5 -5
- package/src/Spring.ts +2 -1
- package/src/Values.ts +2 -2
- package/src/index.ts +1 -1
- package/src/internal/carried.ts +22 -0
- package/src/internal/firstSteps.ts +139 -0
- package/src/internal/frameLoop.ts +103 -87
- package/src/internal/lerpsNumbers.ts +53 -0
- package/src/internal/options.ts +10 -10
- package/src/internal/stepper.ts +20 -2
- package/src/internal/tracing.ts +1 -1
- package/src/unstable/AnimationControls.ts +59 -56
- package/src/unstable/AppearHandoff.ts +6 -6
- package/src/unstable/BatchCalls.ts +5 -5
- package/src/unstable/Config.ts +19 -19
- package/src/unstable/FirstSteps.ts +26 -0
- package/src/unstable/FlushGate.ts +92 -82
- package/src/unstable/FrameEffects.ts +2 -2
- package/src/unstable/FrameTime.ts +1 -1
- package/src/unstable/Imperative.ts +126 -56
- package/src/unstable/OwnValues.ts +1 -1
- package/src/unstable/PresenceRecord.ts +29 -29
- package/src/unstable/Projector.ts +45 -0
- package/src/unstable/Report.ts +1 -1
- package/src/unstable/RetargetLegs.ts +10 -9
- package/src/unstable/Spine.ts +190 -188
- package/src/unstable/Stops.ts +6 -6
- package/src/unstable/Subject.ts +2 -2
- package/src/unstable/Timelines.ts +12 -12
- package/src/unstable/VariantTarget.ts +13 -13
- package/src/unstable/VariantTree.ts +42 -42
- package/src/unstable/WardicConfigValue.ts +13 -13
|
@@ -4,54 +4,55 @@
|
|
|
4
4
|
* sinks, and its Environment the edges it reads (`GateEnvironment`); the gate imports nothing from a
|
|
5
5
|
* framework.
|
|
6
6
|
*
|
|
7
|
-
* Per ADR-0006, per-frame writes never reach their
|
|
7
|
+
* Per ADR-0006, per-frame writes never reach their Subject directly. Each source
|
|
8
8
|
* `write(id, partialValues)`s into a provider-owned gate that:
|
|
9
9
|
*
|
|
10
|
-
* 1. Accumulates *value-maps* (NOT already-projected Patches) per
|
|
11
|
-
* merging partials by key — so multiple sources can feed one
|
|
10
|
+
* 1. Accumulates *value-maps* (NOT already-projected Patches) per Subject,
|
|
11
|
+
* merging partials by key — so multiple sources can feed one Subject
|
|
12
12
|
* (e.g. a drag setting `x`/`y` while a spring drives `scale`, all
|
|
13
13
|
* collapsing into one grouped `transform`). Projecting per source would
|
|
14
14
|
* clobber the grouped transform.
|
|
15
15
|
* 2. Resolves the Renderer's PURE `project` ONCE at creation and uses it to
|
|
16
|
-
* turn each dirty
|
|
17
|
-
* per
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* turn each dirty Subject's merged value-map into a `Patch` exactly once
|
|
17
|
+
* per Subject per frame; or, for a Renderer with a projector (`unstable/Projector`),
|
|
18
|
+
* the Subject's own, made when it registers, whose patch it rewrites in place.
|
|
19
|
+
* 3. Commits each resulting Patch onto its Subject with the Renderer's `commit`, a plain
|
|
20
|
+
* call (ADR-0034) — one pass over the Subjects per frame, shared by every Subject: at the end of the
|
|
20
21
|
* Frame loop's tick, in the Refresh frame that computed the values (ADR-0033). No
|
|
21
|
-
* framework runs per frame: a binding's render carries
|
|
22
|
+
* framework runs per frame: a binding's render carries a Subject's style only until its
|
|
22
23
|
* first commit (ADR-0021, decision 6), and after it only the keys the gate doesn't hold.
|
|
23
24
|
*
|
|
24
25
|
* Three locked design decisions (this session's grills):
|
|
25
26
|
* - FLUSHED at the end of the Frame loop's tick (ADR-0033): the gate registers a hook on
|
|
26
27
|
* the Environment's loop (`afterTick`), so everything a tick writes is applied at the end
|
|
27
|
-
* of that tick, inside the Clock's callback, and
|
|
28
|
+
* of that tick, inside the Clock's callback, and drawn in that Refresh frame. A write
|
|
28
29
|
* made outside a tick (a drag's move, a `release` from a task, an effect a sink's hook ran,
|
|
29
30
|
* a Tier 2 `Stream` on `Clock.ticks` subscribed after the loop) still requests a
|
|
30
31
|
* Refresh frame, only if one is not already pending, and the hook withdraws that request
|
|
31
32
|
* when it flushes first. `flush` does NOT auto-reschedule, so an idle accumulator
|
|
32
33
|
* requests no frames — the next `write` does. The frames come from the Environment's
|
|
33
34
|
* `RefreshFrameSource` (ADR-0031): `@wardic/dom`'s is its runtime's frame callback. No binding
|
|
34
|
-
* asks its runtime for frames itself. A Tier 2 `Stream` that writes here
|
|
35
|
+
* asks its runtime for frames itself. A Tier 2 `Stream` that writes here is drawn in
|
|
35
36
|
* the loop's frame or the next one, by its subscription order (ADR-0033): run it on the
|
|
36
|
-
* loop (`Machine.run`) to
|
|
37
|
-
* - ONE flush per frame: all dirty
|
|
37
|
+
* loop (`Machine.run`) to be drawn with it.
|
|
38
|
+
* - ONE flush per frame: all dirty Subjects flush together. The one exception
|
|
38
39
|
* is `flushPass` (ADR-0018): a projection Measure pass's own writes are applied
|
|
39
|
-
* at the end of its task, so a new layout never
|
|
40
|
-
* - ONE sink shape (ADR-0034): a sink is the
|
|
41
|
-
* also removes a key its last patch had and this one doesn't (a dragged
|
|
42
|
-
* once it's dropped, ADR-0016 *Amendment (Reorder)*), restoring the
|
|
40
|
+
* at the end of its task, so a new layout is never drawn without its projection.
|
|
41
|
+
* - ONE sink shape (ADR-0034): a sink is the Subject its patch is committed onto. The gate
|
|
42
|
+
* also removes a key its last patch had and this one doesn't (a dragged Subject's raise
|
|
43
|
+
* once it's dropped, ADR-0016 *Amendment (Reorder)*), restoring the Subject's own
|
|
43
44
|
* value, saved before the gate first wrote the key. Two hooks reach the binding,
|
|
44
45
|
* outside the commits, each in the binding's `batch` (ADR-0034, *Amendment (#209)*): the
|
|
45
|
-
* Starting-style switch before
|
|
46
|
-
* the gate holds on the
|
|
46
|
+
* Starting-style switch before a Subject's first commit (`beforeFirstCommit`), and the keys
|
|
47
|
+
* the gate holds on the Subject whenever they change (`onHeld`), so the binding's `style`
|
|
47
48
|
* leaves them to Wardic.
|
|
48
49
|
*
|
|
49
50
|
* Observability (CONTEXT.md convention): the hot path (`write`/`flush`) is the
|
|
50
51
|
* per-frame work, so — exactly like core's per-frame writes and the Clock's
|
|
51
|
-
* `tick` — it stays quiet (no span, no per-call log, no metric). A throw in one
|
|
52
|
-
* binding's hook, the read of its own value, its Timeline values, its commit) is that
|
|
52
|
+
* `tick` — it stays quiet (no span, no per-call log, no metric). A throw in one Subject's step (its
|
|
53
|
+
* binding's hook, the read of its own value, its Timeline values, its commit) is that Subject's: it
|
|
53
54
|
* commits nothing that frame, a run of them is reported once (`Report.failure`) until it commits again,
|
|
54
|
-
* and every other
|
|
55
|
+
* and every other Subject still commits. Anything else a flush throws is reported and the gate
|
|
55
56
|
* goes on, so it can't fail the Frame loop's tick it runs in (ADR-0033).
|
|
56
57
|
*
|
|
57
58
|
* Unstable, for Wardic's own packages: public, with no semver promise.
|
|
@@ -60,15 +61,17 @@
|
|
|
60
61
|
*/
|
|
61
62
|
// Unstable: ADR-0071, decision 5. #672: dom's `internal/gate.ts`, moved for the spine to write through
|
|
62
63
|
// it in core; dom's `FlushGate` builds it with the DOM's edges (`DOM_GATE`) and gives it as a Layer.
|
|
63
|
-
// #969 (ADR-0033, *Amendment (#969)*): one
|
|
64
|
+
// #969 (ADR-0033, *Amendment (#969)*): one Subject's failure in a flush is its own.
|
|
64
65
|
import * as FrameLoop from "../FrameLoop.ts"
|
|
65
66
|
import * as RefreshFrameSource from "../RefreshFrameSource.ts"
|
|
66
67
|
import * as Renderer from "../Renderer.ts"
|
|
68
|
+
import * as Projector from "./Projector.ts"
|
|
67
69
|
import * as Cause from "effect/Cause"
|
|
68
70
|
import * as Atom from "effect/reactivity/Atom"
|
|
69
71
|
import * as AtomRegistry from "effect/reactivity/AtomRegistry"
|
|
70
72
|
import * as Effect from "effect/Effect"
|
|
71
73
|
import * as Exit from "effect/Exit"
|
|
74
|
+
import * as Option from "effect/Option"
|
|
72
75
|
import type * as Fiber from "effect/Fiber"
|
|
73
76
|
import * as Predicate from "effect/Predicate"
|
|
74
77
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
@@ -80,33 +83,33 @@ import * as Report from "./Report.ts"
|
|
|
80
83
|
* at flush time.
|
|
81
84
|
*/
|
|
82
85
|
export interface FlushSink {
|
|
83
|
-
/** The
|
|
86
|
+
/** The Subject the patch is committed onto. */
|
|
84
87
|
readonly target: unknown
|
|
85
88
|
/**
|
|
86
|
-
* Called once, just before the
|
|
87
|
-
* pass's `flushPass`), inside the binding's `batch` with every other
|
|
89
|
+
* Called once, just before the Subject's first commit in a frame flush (not a Measure
|
|
90
|
+
* pass's `flushPass`), inside the binding's `batch` with every other Subject's switch that
|
|
88
91
|
* flush: a binding drops its Starting style from its `style` here,
|
|
89
92
|
* so its framework removes those keys and the commit writes the first frame in the same
|
|
90
|
-
* Refresh frame, with
|
|
93
|
+
* Refresh frame, with nothing drawn in between.
|
|
91
94
|
*/
|
|
92
95
|
readonly beforeFirstCommit?: (() => void) | undefined
|
|
93
96
|
/**
|
|
94
|
-
* Called with every key the gate now holds on the
|
|
97
|
+
* Called with every key the gate now holds on the Subject, each time that set changes: after the
|
|
95
98
|
* gate restores a key it dropped, and before the commit that first
|
|
96
|
-
* writes a key. A binding whose `style` reaches the
|
|
99
|
+
* writes a key. A binding whose `style` reaches the Subject leaves these keys out of it,
|
|
97
100
|
* so its framework never writes over Wardic's value (`style` is a key's fallback). Called in
|
|
98
|
-
* the binding's `batch`, with every other
|
|
99
|
-
* binding changes reaches the
|
|
101
|
+
* the binding's `batch`, with every other Subject's whose keys changed that flush, so what the
|
|
102
|
+
* binding changes reaches the Subject before the commit, a framework that applies an update later
|
|
100
103
|
* (Solid 2) included.
|
|
101
104
|
*/
|
|
102
105
|
// ADR-0034, *Amendment (#209)*.
|
|
103
106
|
readonly onHeld?: ((keys: ReadonlyArray<string>) => void) | undefined
|
|
104
107
|
/**
|
|
105
|
-
* Called once per frame in which the
|
|
108
|
+
* Called once per frame in which the Subject's values were committed, after every commit of that
|
|
106
109
|
* frame (Motion's `onUpdate`), with its values before
|
|
107
|
-
* projection (`x` as a number). The object is the
|
|
110
|
+
* projection (`x` as a number). The object is the Subject's own, reused each call: valid during
|
|
108
111
|
* the call, copied to keep. A Measure pass's commits are told at the frame flush after them, so
|
|
109
|
-
* a frame tells each
|
|
112
|
+
* a frame tells each Subject once. A write it makes is the next frame's. A throw is reported,
|
|
110
113
|
* and the others are still told.
|
|
111
114
|
*/
|
|
112
115
|
readonly onCommit?: ((values: Readonly<Record<string, unknown>>) => void) | undefined
|
|
@@ -136,18 +139,21 @@ const clear = (list: EntryList): void => {
|
|
|
136
139
|
list.count = 0
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
/** Accumulated pre-`project` state for one registered
|
|
142
|
+
/** Accumulated pre-`project` state for one registered Subject. */
|
|
140
143
|
interface Entry {
|
|
141
144
|
/** Its gate id: what a failure of its own is reported with (#969). */
|
|
142
145
|
readonly id: string
|
|
146
|
+
/** What projects its values: its Renderer's projector, made for it, or else the Renderer's `project`. */
|
|
147
|
+
// #1030: its own, so a moving Subject's frames make no patch.
|
|
148
|
+
readonly projector: Projector.Projector
|
|
143
149
|
/** Merged value-map (partials `Object.assign`ed in by key). */
|
|
144
150
|
readonly values: Record<string, unknown>
|
|
145
|
-
/** Where this
|
|
151
|
+
/** Where this Subject's projected Patch goes. */
|
|
146
152
|
readonly sink: FlushSink
|
|
147
153
|
/** Whether a `write` has landed since the last flush. */
|
|
148
154
|
dirty: boolean
|
|
149
155
|
/**
|
|
150
|
-
* The keys the gate holds on the
|
|
156
|
+
* The keys the gate holds on the Subject: its last patch's, each with the Subject's own
|
|
151
157
|
* value from before the gate first wrote it (`""` for none), to restore when the
|
|
152
158
|
* key drops out.
|
|
153
159
|
*/
|
|
@@ -191,7 +197,7 @@ export interface GateTimeline {
|
|
|
191
197
|
/**
|
|
192
198
|
* What the gate reads of its Environment's targets, and what it keeps from a sink: a target's value
|
|
193
199
|
* for a key before the gate first writes it there (`""` for none), which it gives back at the key's
|
|
194
|
-
* release, and the key its Renderer reserves for
|
|
200
|
+
* release, and the key its Renderer reserves for a Subject's Transform template, which `onCommit`
|
|
195
201
|
* never sees.
|
|
196
202
|
*/
|
|
197
203
|
// #672 (PR2-Q1): the gate's two edges of its Environment, given by `FlushGate.make`, its only builder,
|
|
@@ -201,7 +207,7 @@ export interface GateEnvironment {
|
|
|
201
207
|
readonly templateKey: string
|
|
202
208
|
}
|
|
203
209
|
|
|
204
|
-
/** A step of one
|
|
210
|
+
/** A step of one Subject's flush, as its failure is reported (#969): `prepare`'s report as its commit. */
|
|
205
211
|
type Step = "a commit" | "a beforeFirstCommit" | "an onHeld" | "a Timeline sync"
|
|
206
212
|
|
|
207
213
|
/** Each of `values` cancelled (#240). Per flush: a plain loop. */
|
|
@@ -209,18 +215,18 @@ const cancelEach = (values: Iterable<GateTimeline>): void => {
|
|
|
209
215
|
for (const value of values) value.cancel()
|
|
210
216
|
}
|
|
211
217
|
|
|
212
|
-
/** A Flush gate: what a binding registers its
|
|
218
|
+
/** A Flush gate: what a binding registers its Subjects with and writes their values into, one per provider. */
|
|
213
219
|
export interface FlushGate {
|
|
214
220
|
/**
|
|
215
|
-
* Register
|
|
216
|
-
* that removes the
|
|
221
|
+
* Register a Subject under `id` with its `sink`. Returns an unregister fn
|
|
222
|
+
* that removes the Subject from the accumulator (a subsequent `write` is a
|
|
217
223
|
* no-op). `values` start its value-map, unflushed: drawn with its first `write`, so they never
|
|
218
224
|
* commit alone.
|
|
219
225
|
*/
|
|
220
226
|
// #443: its Transform template, which mustn't take its Starting style off early.
|
|
221
227
|
readonly register: (id: string, sink: FlushSink, values?: Readonly<Record<string, unknown>>) => () => void
|
|
222
228
|
/**
|
|
223
|
-
* Merge `partial` into the
|
|
229
|
+
* Merge `partial` into the Subject's value-map by key, mark it dirty, and
|
|
224
230
|
* schedule a flush: the end of the Frame loop's tick, for a write made in one, or else the
|
|
225
231
|
* next Refresh frame. A `write` for an unregistered (or unregistered-since) id
|
|
226
232
|
* is a no-op.
|
|
@@ -232,13 +238,13 @@ export interface FlushGate {
|
|
|
232
238
|
* `pass()` runs are recorded; each recorded entry is `project`ed and committed once, and
|
|
233
239
|
* marked clean. Everything else stays dirty for its flush. A write made by an effect a sink's
|
|
234
240
|
* hook runs (a Solid effect) takes the ordinary path. The Projection system calls it at the
|
|
235
|
-
* end of a task, so a new layout never
|
|
241
|
+
* end of a task, so a new layout is never drawn without its projection.
|
|
236
242
|
*/
|
|
237
243
|
readonly flushPass: (pass: () => void) => void
|
|
238
244
|
/**
|
|
239
|
-
* Hand `keys` back to the
|
|
245
|
+
* Hand `keys` back to the Subject's own style: drop each from the Subject's
|
|
240
246
|
* value-map and schedule a flush, which writes `restore[key]` (its Environment's text form) for a key it had
|
|
241
|
-
* written, or else the
|
|
247
|
+
* written, or else the Subject's own value it overwrote, and tells the sink (`onHeld`). A key the
|
|
242
248
|
* entry doesn't hold, or an unknown id, is a no-op. A binding releases a key back at its `style`
|
|
243
249
|
* value, so a later `style` change shows at rest. A later `write` brings the key back. A property in
|
|
244
250
|
* `keep` (`transform` for its keys) is left as it's drawn when it drops out: another writer draws it next.
|
|
@@ -246,28 +252,28 @@ export interface FlushGate {
|
|
|
246
252
|
// `keep`: #665's PR 4, a Batch member's group handed back to its Batch, whose writer draws it from then on.
|
|
247
253
|
readonly release: (id: string, keys: ReadonlyArray<string>, restore?: Readonly<Record<string, string>>, keep?: ReadonlyArray<string>) => void
|
|
248
254
|
/**
|
|
249
|
-
* The
|
|
255
|
+
* The Subject's value for `id`'s `key`, live: an `Atom` set as each write that
|
|
250
256
|
* changes it lands, so it's the value the next commit draws, before the Renderer projects it
|
|
251
257
|
* (`x` as a number, not a `transform`). Set at the write, not the commit, so a value derived
|
|
252
258
|
* from it (another key following it through a binding) is written in the same frame and
|
|
253
259
|
* commits with it. `undefined` before the key's first write, and once it's released or the
|
|
254
|
-
*
|
|
260
|
+
* Subject unregisters. One Atom for an id and a key, made on first ask, so per frame only the
|
|
255
261
|
* keys asked for cost anything.
|
|
256
262
|
*/
|
|
257
263
|
readonly valueOf: (id: string, key: string) => Atom.Atom<unknown>
|
|
258
264
|
/**
|
|
259
|
-
* Run `key`'s Timeline value on `id`'s
|
|
265
|
+
* Run `key`'s Timeline value on `id`'s Subject (#240), or stop it (`undefined`): a binding sets one
|
|
260
266
|
* while the key shows its Live value, and clears it when an entry of the Override stack takes the
|
|
261
|
-
* key. The gate goes on writing the key: at each flush that commits the
|
|
267
|
+
* key. The gate goes on writing the key: at each flush that commits the Subject, before the commit,
|
|
262
268
|
* it starts the value's animation over it, or cancels it while something else adds to its property
|
|
263
269
|
* (a projection, a Transform template, another transform key off its identity), so a frame shows one
|
|
264
270
|
* or the other. A cleared or replaced one is cancelled at the next flush; a released key's, an
|
|
265
|
-
* unregistered
|
|
271
|
+
* unregistered Subject's and a disposed gate's, at once. Setting one schedules a flush.
|
|
266
272
|
*/
|
|
267
273
|
readonly timeline: (id: string, key: string, timeline: GateTimeline | undefined) => void
|
|
268
274
|
/**
|
|
269
275
|
* Call `fn` once, after the gate's next flush: the end of the Frame loop's tick, for a call
|
|
270
|
-
* made in one, else the next Refresh frame's, so what was written before it is on the
|
|
276
|
+
* made in one, else the next Refresh frame's, so what was written before it is on the Subjects.
|
|
271
277
|
* It schedules that flush if none is pending. A binding tells an animation's end here, as Motion's
|
|
272
278
|
* `onAnimationComplete` comes with the final value set. One that throws is reported, and the rest
|
|
273
279
|
* still run.
|
|
@@ -282,7 +288,7 @@ export interface FlushGate {
|
|
|
282
288
|
// #672: named here, as dom's `FlushGate` names it, so the spine reads the gate's own types in core.
|
|
283
289
|
export type Shape = Omit<FlushGate, "dispose">
|
|
284
290
|
|
|
285
|
-
/**
|
|
291
|
+
/** A Subject's commit target and hooks, given to `register`. */
|
|
286
292
|
export type Sink = FlushSink
|
|
287
293
|
|
|
288
294
|
/** What a flush gate needs from its Environment: the `Renderer`, the Frame loop it flushes at the end of each tick of, and the `RefreshFrameSource`. */
|
|
@@ -304,11 +310,11 @@ export interface FlushGateRuntime {
|
|
|
304
310
|
export interface FlushGateOptions {
|
|
305
311
|
/**
|
|
306
312
|
* Runs a flush's hooks together: calls `apply`, and returns once every update inside it has reached
|
|
307
|
-
* the
|
|
313
|
+
* the Subjects, before the gate commits. Solid 1 passes its `batch`, Solid 2 runs `apply` then
|
|
308
314
|
* `flush()`, and React would pass `flushSync`, untried; a binding with nothing to batch passes
|
|
309
315
|
* `(apply) => apply()`. Called at most twice a flush: once for the starting-style switches
|
|
310
|
-
* (`beforeFirstCommit`) of the
|
|
311
|
-
*
|
|
316
|
+
* (`beforeFirstCommit`) of the Subjects committing for the first time, before anything is read off the
|
|
317
|
+
* Subjects; and once for the held keys (`onHeld`) of the Subjects whose held keys changed.
|
|
312
318
|
*/
|
|
313
319
|
// ADR-0031, decision 3, ADR-0034; *Amendment (#209)*.
|
|
314
320
|
readonly batch: (apply: () => void) => void
|
|
@@ -319,7 +325,8 @@ export interface FlushGateOptions {
|
|
|
319
325
|
* switches through the binding's `batch`.
|
|
320
326
|
*
|
|
321
327
|
* Resolves both ONCE here: `project` is pure and `commit` a plain call (both called directly at
|
|
322
|
-
* flush, ADR-0034),
|
|
328
|
+
* flush, ADR-0034), and a Renderer's projector maker makes each Subject's projector as it registers;
|
|
329
|
+
* `requestFrame` /
|
|
323
330
|
* `cancelFrame` schedule and cancel the flush of a write made outside a tick, and the Frame
|
|
324
331
|
* loop's `afterTick` takes the gate's hook for its lifetime. All come from whichever env the
|
|
325
332
|
* provider was given (`DomLive` / `TestLive`), so the gate inherits that environment's
|
|
@@ -332,14 +339,16 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
332
339
|
// `requestFrame` and `cancelFrame` are called detached, never as `frames.requestFrame(cb)`: a
|
|
333
340
|
// browser throws "Illegal invocation" when `requestAnimationFrame` runs with `this` bound to
|
|
334
341
|
// anything but the window (ADR-0031, decision 7).
|
|
335
|
-
const { commit, project, requestFrame, cancelFrame, afterTick } = runtime.runSync(
|
|
342
|
+
const { commit, project, maker, requestFrame, cancelFrame, afterTick } = runtime.runSync(
|
|
336
343
|
Effect.gen(function* () {
|
|
337
|
-
const
|
|
344
|
+
const renderer = yield* Renderer.Renderer
|
|
338
345
|
const { requestFrame, cancelFrame } = yield* RefreshFrameSource.RefreshFrameSource
|
|
339
346
|
const { afterTick } = yield* FrameLoop.FrameLoop
|
|
340
|
-
return { commit, project, requestFrame, cancelFrame, afterTick }
|
|
347
|
+
return { commit: renderer.commit, project: renderer.project, maker: Projector.makerOf(renderer), requestFrame, cancelFrame, afterTick }
|
|
341
348
|
}),
|
|
342
349
|
)
|
|
350
|
+
// What makes a new Subject's projector, at its register: its Renderer's maker, or the Renderer's `project` for all.
|
|
351
|
+
const projectorOf: Projector.Make = Option.getOrElse(maker, () => () => project)
|
|
343
352
|
|
|
344
353
|
const accumulator = new Map<string, Entry>()
|
|
345
354
|
// Every live output asked for (`valueOf`), by id: an entry registered later picks its map up.
|
|
@@ -356,8 +365,8 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
356
365
|
let recording: Set<string> | undefined
|
|
357
366
|
// The entries committed since the last frame flush whose sink has an `onCommit` (#233).
|
|
358
367
|
const committedSince = new Set<Entry>()
|
|
359
|
-
// Each
|
|
360
|
-
// its next: only the
|
|
368
|
+
// Each Subject's Timeline values by key (#240), and those let go of since its last flush, cancelled at
|
|
369
|
+
// its next: only the Subjects that have one, so the per-frame path checks their sizes alone.
|
|
361
370
|
const timelines = new Map<Entry, Map<string, GateTimeline>>()
|
|
362
371
|
const endings = new Map<Entry, Array<GateTimeline>>()
|
|
363
372
|
// A frame flush's entries, in order, prepared and waiting for their commit; and those whose
|
|
@@ -366,13 +375,13 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
366
375
|
const heldChanged = entryListOf()
|
|
367
376
|
|
|
368
377
|
/**
|
|
369
|
-
* Project one dirty entry's patch and restore the keys it dropped (once per
|
|
378
|
+
* Project one dirty entry's patch and restore the keys it dropped (once per Subject per flush),
|
|
370
379
|
* marking it clean: into `into`, and into `held` when the keys it holds change and its sink
|
|
371
380
|
* hears them. Its commit waits for the binding's `batch` of those (ADR-0034, *Amendment
|
|
372
381
|
* (#209)*). Plain calls only: this is the per-frame path.
|
|
373
382
|
*/
|
|
374
383
|
const prepare = (entry: Entry, into: EntryList, held: EntryList): void => {
|
|
375
|
-
const patch =
|
|
384
|
+
const patch = entry.projector(entry.values)
|
|
376
385
|
entry.dirty = false
|
|
377
386
|
entry.patch = patch
|
|
378
387
|
addTo(into, entry)
|
|
@@ -390,7 +399,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
390
399
|
committed.set(key, valueBeforeOf(target, key))
|
|
391
400
|
added = true
|
|
392
401
|
}
|
|
393
|
-
// A key the last patch wrote and this one doesn't: the
|
|
402
|
+
// A key the last patch wrote and this one doesn't: the Subject gets its own value
|
|
394
403
|
// back. Only looked for when one dropped out (the usual frame keeps every key).
|
|
395
404
|
let restore: Renderer.Patch | undefined
|
|
396
405
|
if (kept < before) {
|
|
@@ -411,10 +420,10 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
411
420
|
}
|
|
412
421
|
|
|
413
422
|
/**
|
|
414
|
-
* Before a flush's commits (#240): cancel the Timeline values each
|
|
423
|
+
* Before a flush's commits (#240): cancel the Timeline values each Subject committing now let go of,
|
|
415
424
|
* and sync the rest with its values, so each starts or stops as nothing else adds to its property.
|
|
416
425
|
* An entry is committing while it holds a prepared patch. Kept beside the entries, not on them, so an
|
|
417
|
-
*
|
|
426
|
+
* Subject with none pays nothing per frame: the flush checks two sizes. Per flush: plain loops.
|
|
418
427
|
*/
|
|
419
428
|
const syncTimelines = (): void => {
|
|
420
429
|
for (const [entry, ended] of endings) {
|
|
@@ -439,7 +448,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
439
448
|
}
|
|
440
449
|
}
|
|
441
450
|
|
|
442
|
-
/** Every Timeline value of `entry`, cancelled at once: its
|
|
451
|
+
/** Every Timeline value of `entry`, cancelled at once: its Subject is gone, or the gate is. */
|
|
443
452
|
const cancelTimelines = (entry: Entry): void => {
|
|
444
453
|
const ended = endings.get(entry)
|
|
445
454
|
endings.delete(entry)
|
|
@@ -449,7 +458,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
449
458
|
if (Predicate.isNotUndefined(byKey)) cancelEach(byKey.values())
|
|
450
459
|
}
|
|
451
460
|
|
|
452
|
-
/** Commit a prepared entry's patch onto its
|
|
461
|
+
/** Commit a prepared entry's patch onto its Subject. */
|
|
453
462
|
const commitPrepared = (entry: Entry): void => {
|
|
454
463
|
const patch = entry.patch
|
|
455
464
|
if (Predicate.isUndefined(patch)) return
|
|
@@ -461,13 +470,13 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
461
470
|
|
|
462
471
|
/**
|
|
463
472
|
* One of `entry`'s steps threw this flush (#969): its later steps skipped this frame, its patch with
|
|
464
|
-
* them, and the other
|
|
473
|
+
* them, and the other Subjects' going on. A run of them is reported at its first, `step` naming it.
|
|
465
474
|
*/
|
|
466
475
|
// A failure's path, never the frame's: one place each loop's catch calls.
|
|
467
476
|
const failedAt = (entry: Entry, step: Step, defect: unknown): void => {
|
|
468
477
|
entry.patch = undefined
|
|
469
478
|
// Tried again at the gate's next flush, which it doesn't ask for itself: a Subject frozen for good would
|
|
470
|
-
// keep the host's frames running. A later write, its own or another
|
|
479
|
+
// keep the host's frames running. A later write, its own or another Subject's, brings that flush.
|
|
471
480
|
entry.dirty = true
|
|
472
481
|
// Its sink's `onCommit` hears nothing of a frame it didn't commit in.
|
|
473
482
|
committedSince.delete(entry)
|
|
@@ -482,7 +491,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
482
491
|
*/
|
|
483
492
|
const commitAll = (entries: EntryList, held: EntryList): void => {
|
|
484
493
|
if (held.count > 0) batch(() => tellHeld(held))
|
|
485
|
-
// A try for each
|
|
494
|
+
// A try for each Subject, its call direct (#969): a shared helper taking the step measured +20% a frame.
|
|
486
495
|
for (let i = 0; i < entries.count; i++) {
|
|
487
496
|
const entry = entries.entries[i] as Entry
|
|
488
497
|
try {
|
|
@@ -495,7 +504,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
495
504
|
clear(held)
|
|
496
505
|
}
|
|
497
506
|
|
|
498
|
-
/** Each entry's `onHeld`, with every key the gate holds on its
|
|
507
|
+
/** Each entry's `onHeld`, with every key the gate holds on its Subject now. */
|
|
499
508
|
const tellHeld = (held: EntryList): void => {
|
|
500
509
|
for (let i = 0; i < held.count; i++) {
|
|
501
510
|
const entry = held.entries[i] as Entry
|
|
@@ -549,7 +558,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
549
558
|
*/
|
|
550
559
|
// #979, group D (ADR-0074): an output's dependent that throws (an app's Atom over a ward's `read(key)`)
|
|
551
560
|
// is its own. The registry has set the output and told its other listeners before the throw comes back,
|
|
552
|
-
// so the write goes on, the
|
|
561
|
+
// so the write goes on, the Subject's other outputs with it: before, it came out of the ward's own leg.
|
|
553
562
|
const setOutputs = (entry: Entry): void => {
|
|
554
563
|
const outputs = entry.outputs
|
|
555
564
|
if (Predicate.isUndefined(outputs)) return
|
|
@@ -563,7 +572,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
563
572
|
|
|
564
573
|
/** `output` set to `value`, its dependent's throw its own: reported once a run of throws, until a clean set. */
|
|
565
574
|
// The try is here, out of the loops that call it (`setOutputs`', `endOutputs`'): in the body of
|
|
566
|
-
// `setOutputs`' loop over the
|
|
575
|
+
// `setOutputs`' loop over the Subject's outputs Map, it measured +5–8% on Node's write.
|
|
567
576
|
const setOutput = (id: string, key: string, output: Output, value: unknown): void => {
|
|
568
577
|
try {
|
|
569
578
|
registry.set(output.atom, value)
|
|
@@ -598,9 +607,9 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
598
607
|
const flush = (): void => {
|
|
599
608
|
scheduled = false
|
|
600
609
|
try {
|
|
601
|
-
// The switches first:
|
|
610
|
+
// The switches first: a Subject's own values are read once its Starting style is gone.
|
|
602
611
|
if (firstCommits.size > 0) batch(runFirstCommits)
|
|
603
|
-
// Every dirty
|
|
612
|
+
// Every dirty Subject, once. No auto-reschedule — the next write() does. A write()
|
|
604
613
|
// from an effect a sink's hook runs requests the next frame (it isn't stranded).
|
|
605
614
|
for (const entry of accumulator.values()) {
|
|
606
615
|
if (!entry.dirty) continue
|
|
@@ -666,6 +675,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
666
675
|
committed: new Map(),
|
|
667
676
|
outputs: outputsById.get(id),
|
|
668
677
|
id,
|
|
678
|
+
projector: projectorOf(),
|
|
669
679
|
latest: undefined,
|
|
670
680
|
onCommitFailing: false,
|
|
671
681
|
stepFailing: false,
|
|
@@ -686,8 +696,8 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
686
696
|
}
|
|
687
697
|
}
|
|
688
698
|
|
|
689
|
-
/** `id`'s live outputs, each set to `undefined` and forgotten: its
|
|
690
|
-
// #979, row 42 (ADR-0074): set through `setOutput`, so a dependent that throws as its
|
|
699
|
+
/** `id`'s live outputs, each set to `undefined` and forgotten: its Subject is gone. */
|
|
700
|
+
// #979, row 42 (ADR-0074): set through `setOutput`, so a dependent that throws as its Subject leaves is
|
|
691
701
|
// reported, and every output still ends: before, its throw came out of the unregister, a binding's
|
|
692
702
|
// cleanup, and left that output and the later ones mounted.
|
|
693
703
|
const endOutputs = (id: string): void => {
|
|
@@ -717,7 +727,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
717
727
|
}
|
|
718
728
|
const known = outputs.get(key)
|
|
719
729
|
if (Predicate.isNotUndefined(known)) return known.atom
|
|
720
|
-
// Made `undefined` and mounted until its
|
|
730
|
+
// Made `undefined` and mounted until its Subject unregisters, not kept alive: a kept-alive
|
|
721
731
|
// Atom's node never leaves the registry, and one left behind reads `undefined` afresh.
|
|
722
732
|
const atom = Atom.make<unknown>(undefined)
|
|
723
733
|
const output: Output = { atom, last: undefined, unmount: registry.mount(atom), failing: false }
|
|
@@ -751,7 +761,7 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
751
761
|
if (written.size === 0) return
|
|
752
762
|
// No `beforeFirstCommit` here: a Measure pass may write only a node's projection, and
|
|
753
763
|
// dropping the Starting style then would leave its animated keys unset until the frame
|
|
754
|
-
// flush (a frame later for
|
|
764
|
+
// flush (a frame later for a Subject mounted inside a frame). The frame flush switches.
|
|
755
765
|
// A commit here is told at the frame flush (#233): the write that made it scheduled that flush.
|
|
756
766
|
// Its own lists: a pass may run from a hook the frame flush's `batch` runs.
|
|
757
767
|
const entries = entryListOf()
|
|
@@ -791,13 +801,13 @@ export const makeFlushGate = (runtime: FlushGateRuntime, options: FlushGateOptio
|
|
|
791
801
|
}
|
|
792
802
|
byKey.set(key, value)
|
|
793
803
|
}
|
|
794
|
-
//
|
|
804
|
+
// A Subject left with none leaves the map, so the flush skips it.
|
|
795
805
|
if (Predicate.isNotUndefined(byKey) && byKey.size === 0) timelines.delete(entry)
|
|
796
806
|
entry.dirty = true
|
|
797
807
|
scheduleFlush()
|
|
798
808
|
}
|
|
799
809
|
|
|
800
|
-
/** `entry`'s Timeline values for `keys`, cancelled at once: those keys go back to the
|
|
810
|
+
/** `entry`'s Timeline values for `keys`, cancelled at once: those keys go back to the Subject's own style. */
|
|
801
811
|
const releaseTimelines = (entry: Entry, keys: ReadonlyArray<string>): void => {
|
|
802
812
|
const byKey = timelines.get(entry)
|
|
803
813
|
if (Predicate.isUndefined(byKey)) return
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* An Environment's **Frame effects** (CONTEXT.md): an app's own code, run at the end of each frame the
|
|
3
3
|
* Environment draws, after Wardic's writes for it, in the order the effects were added. A scene runs
|
|
4
|
-
* them in its Host loop before it renders;
|
|
4
|
+
* them in its Host loop before it renders; `@wardic/dom`, before its frame is drawn. The Environment calls {@link
|
|
5
5
|
* FrameEffects.run} at its frame's end, and gives `make` its way to ask for a frame, so an effect whose
|
|
6
6
|
* inputs changed is run on a frame nothing else asked for.
|
|
7
7
|
*
|
|
@@ -136,7 +136,7 @@ export const make = (options: FrameEffectsOptions): FrameEffects => {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* Frame effects for an Environment on core's Frame loop and Refresh frames,
|
|
139
|
+
* Frame effects for an Environment on core's Frame loop and Refresh frames, as `@wardic/dom` is: run at the end
|
|
140
140
|
* of each tick, after the tick's hooks added before them (the Flush gate's flush, so after Wardic's
|
|
141
141
|
* writes for the frame), and, on a frame with no tick, on a Refresh frame of their own that `request()`
|
|
142
142
|
* asks for, which a tick withdraws. For as long as the Scope is open.
|
|
@@ -36,7 +36,7 @@ export const frameNow: () => number = Clock.syncNow(() => performance.now())
|
|
|
36
36
|
const clockNows = new WeakMap<WardicServices.Runner<WardicServices.WardicServices>, () => number>()
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* The time a provider's
|
|
39
|
+
* The time a provider's Subjects read their velocities against (#460, Q7): its Environment's Clock's
|
|
40
40
|
* `now` (#464's sync time, `@wardic/dom`'s or a test Environment's own), kept per runtime.
|
|
41
41
|
*/
|
|
42
42
|
export const clockNowOf = (runtime: WardicServices.Runner<WardicServices.WardicServices>): (() => number) => {
|