@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The **Frame loop**'s implementation (ADR-0027), behind the `FrameLoop` module's service and
|
|
3
3
|
* `layer` (ADR-0028, decision 11): one fiber per burst that steps every running
|
|
4
4
|
* Primitive's machine once per tick, in one pass, and hands each its Frame. Each animation used
|
|
5
|
-
* to be a fiber running its own `Stream`; at 1,000
|
|
5
|
+
* to be a fiber running its own `Stream`; at 1,000 Subjects that machinery was about 90% of a
|
|
6
6
|
* Primitive's per-frame cost.
|
|
7
7
|
*
|
|
8
8
|
* - **A run** is `run(machine, sink)`: an entry added, its Frames handed to `sink` from the loop's
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
* starts while the ending burst resumes its runs (#81).
|
|
25
25
|
* - **The end of a tick** calls each `afterTick` hook, with the tick's dt, after every step and sink
|
|
26
26
|
* and the continuations of the runs that settled in it, the tick that ends a burst included. The flush
|
|
27
|
-
* gate flushes there, so a value
|
|
27
|
+
* gate flushes there, so a value is drawn in the Refresh frame that computed it (ADR-0033). A run
|
|
28
28
|
* a hook starts keeps the burst: whether it ends is counted after the hooks (#209).
|
|
29
29
|
* - **The Late window** runs from a tick's first step until a microtask the tick queues at its end
|
|
30
30
|
* (ADR-0027 *Amendment (#680)*): what starts in it is drawn in that tick's Refresh frame, after the
|
|
31
31
|
* tick. A run `run` added in it, during the tick or in a microtask the tick's own code queued (Solid
|
|
32
32
|
* 2's effects, a promise it resolved), takes its **Late step** in that microtask: one step at the
|
|
33
|
-
* tick's dt, and the hooks again, so the frame
|
|
33
|
+
* tick's dt, and the hooks again, so the frame draws it, not its origin. A round whose steps or hooks
|
|
34
34
|
* add more runs is followed by another, at most `MAX_LATE_ROUNDS`; the rest step at the next tick. A
|
|
35
35
|
* `runLast` run takes none: the projection's coordinator, its one caller, would step again the nodes
|
|
36
36
|
* an after-tick Measure pass already stepped. One the tick stepped steps again at dt 0 after a round
|
|
@@ -81,6 +81,7 @@ import * as Supersede from "../Supersede.ts"
|
|
|
81
81
|
import type * as FrameLoop from "../FrameLoop.ts"
|
|
82
82
|
import type * as Machine from "../Machine.ts"
|
|
83
83
|
import * as Report from "../unstable/Report.ts"
|
|
84
|
+
import * as FirstSteps from "./firstSteps.ts"
|
|
84
85
|
import { none, SpansGiven, traced } from "./tracing.ts"
|
|
85
86
|
|
|
86
87
|
// @wardic/core compiles against ES2022 alone, which does not declare `performance` (see
|
|
@@ -155,7 +156,7 @@ export interface Shape {
|
|
|
155
156
|
* frame's tick, as a binding that renders in a frame callback of its own does (ADR-0071 decision 32).
|
|
156
157
|
* Opens the **Late window** when a burst's last tick was this frame's (`Clock.frameAt`) or no burst runs
|
|
157
158
|
* (no tick is coming this frame), so the runs added after it, in the rest of the callback and its
|
|
158
|
-
* microtasks, take their Late step and
|
|
159
|
+
* microtasks, take their Late step and are drawn in this frame, and a queued Measure pass runs as an after-tick one. With a
|
|
159
160
|
* tick still to come in the frame, nothing: that tick is their first step. Idle, the Late step's dt is
|
|
160
161
|
* the last tick's, or a nominal frame before any.
|
|
161
162
|
*/
|
|
@@ -188,15 +189,11 @@ interface Entry {
|
|
|
188
189
|
/** Its span, when traced: marked `late` at its Late step (#680). */
|
|
189
190
|
readonly span: Tracer.Span | undefined
|
|
190
191
|
/**
|
|
191
|
-
* What a long task
|
|
192
|
-
*
|
|
193
|
-
*
|
|
192
|
+
* What it owes of a long task's time (`FirstSteps`, #1026): its first step, until it's taken, then that
|
|
193
|
+
* frame's lateness, which its second step leaves out, then 0. 0 from the start for a run on
|
|
194
|
+
* the frame timeline, and on an Environment that tells no late frame.
|
|
194
195
|
*/
|
|
195
196
|
owed: number
|
|
196
|
-
/** When it was made, on the Clock's `now()` (ms), where `owed` starts `NaN`. */
|
|
197
|
-
readonly madeAt: number
|
|
198
|
-
/** Made in the Late window of a frame a long task held: what it held, in seconds, which a first step at a later tick leaves out. */
|
|
199
|
-
readonly madeLate: number
|
|
200
197
|
}
|
|
201
198
|
|
|
202
199
|
/** How many Late rounds a window runs before the rest wait for the next tick: the Measure pass's cap (#680). */
|
|
@@ -214,9 +211,6 @@ const onFrameTimeline = (options: RunOptions | undefined): boolean => {
|
|
|
214
211
|
return options.onFrameTimeline === true
|
|
215
212
|
}
|
|
216
213
|
|
|
217
|
-
/** `dt`, less `left` seconds left out of it: a nominal frame at least, and never more than `dt`. */
|
|
218
|
-
const leavingOut = (dt: number, left: number): number => Math.min(dt, Math.max(dt - left, Clock.NOMINAL_DT))
|
|
219
|
-
|
|
220
214
|
/**
|
|
221
215
|
* The Frame loop's metrics: the running animations, the runs that settled and failed, and each tick's
|
|
222
216
|
* ms. None unless an app gives them (`FrameLoop.layerMetrics`, #518), so an app that reads none ships and
|
|
@@ -380,23 +374,39 @@ export const make = Effect.fnUntraced(
|
|
|
380
374
|
// is held (#81).
|
|
381
375
|
let bursting = false
|
|
382
376
|
// The Late window (ADR-0027 *Amendment (#680)*): open from a tick's first step until the microtask
|
|
383
|
-
// queued at its end has run. `
|
|
377
|
+
// queued at its end has run. `lateWindowQueued` keeps one microtask per window, however many ticks open
|
|
384
378
|
// it before a checkpoint (a test firing frames back to back).
|
|
385
|
-
let
|
|
386
|
-
let
|
|
379
|
+
let lateWindowOpen = false
|
|
380
|
+
let lateWindowQueued = false
|
|
387
381
|
// The dt of the tick that opened the window: a Late step's. A nominal frame before any tick, for a
|
|
388
382
|
// window a hint opens while idle (#791).
|
|
389
|
-
let
|
|
383
|
+
let tickDt = Clock.NOMINAL_DT
|
|
390
384
|
// The ticks run, for `tickCount` (#991): one add a tick.
|
|
391
385
|
let ticked = 0
|
|
392
386
|
// A late frame, as the Environment tells one (#1026, `Clock.LateFrames`): the line, in ms, `NaN` for
|
|
393
387
|
// none. Telling one, each tick reads its frame's timestamp and when it ran, on the Clock's `now()`, and
|
|
394
|
-
//
|
|
388
|
+
// how late it is by its lag, in seconds (`tickLateByLag`); a hint's window while the loop idles tells nothing.
|
|
395
389
|
const lateAfter = lateAfterOf(yield* Clock.LateFrames)
|
|
396
390
|
const tellsLate = !Number.isNaN(lateAfter)
|
|
397
|
-
let
|
|
398
|
-
let windowLate = 0
|
|
391
|
+
let tickLateByLag = 0
|
|
399
392
|
let lastStamp = Number.NaN
|
|
393
|
+
// The frames' interval (`frameInterval`), once a tick, from the last five gaps between their timestamps, and
|
|
394
|
+
// how late the tick's frame is by its gap (`tickLateByGap`), in seconds (`FirstSteps.intervalOf`, `lateByGap`;
|
|
395
|
+
// #1048, #1050). The time between
|
|
396
|
+
// bursts is no frame's gap: a burst's first tick times none (`gapFrom` is `NaN` from its start), nor does a
|
|
397
|
+
// frame that repeats the one before's timestamp. A gap the loop hasn't timed is a 60 Hz frame's.
|
|
398
|
+
let gapFrom = Number.NaN
|
|
399
|
+
// The four gaps before the tick's, newest first.
|
|
400
|
+
let gapBefore1 = FirstSteps.NOMINAL_FRAME_MS
|
|
401
|
+
let gapBefore2 = FirstSteps.NOMINAL_FRAME_MS
|
|
402
|
+
let gapBefore3 = FirstSteps.NOMINAL_FRAME_MS
|
|
403
|
+
let gapBefore4 = FirstSteps.NOMINAL_FRAME_MS
|
|
404
|
+
let frameInterval = Clock.NOMINAL_DT
|
|
405
|
+
let tickLateByGap = 0
|
|
406
|
+
// Whether the tick is stepping its runs now (#1028): a step in its window after them is a Late step, the
|
|
407
|
+
// loop's own or one a run takes there itself (the projection's after-tick step), and a member made in the
|
|
408
|
+
// window owes it none of the window's frame, whose dt it takes.
|
|
409
|
+
let tickStepping = false
|
|
400
410
|
// The `run` runs added in the window, in add order: their Late step is due. The `runLast` runs added
|
|
401
411
|
// in it take none, and are marked only so the dt-0 step leaves them out: they step at the next tick.
|
|
402
412
|
const lateFirst: Array<Entry> = []
|
|
@@ -436,52 +446,57 @@ export const make = Effect.fnUntraced(
|
|
|
436
446
|
// decision 8); counted loops, statement `if`s, a `try` per entry (it costs nothing measurable).
|
|
437
447
|
|
|
438
448
|
/**
|
|
439
|
-
* The tick's frame, told late or on time (#1026): late once its callback ran past the line after
|
|
440
|
-
* timestamp, a long task
|
|
441
|
-
* an input), which the Clock times by `now()`, is on time.
|
|
449
|
+
* The tick's frame, told late or on time (#1026): late by its lag once its callback ran past the line after
|
|
450
|
+
* its timestamp, a long task delaying it (`FirstSteps.lateByLag`). A frame that repeats the one before's
|
|
451
|
+
* timestamp (a runtime's second frame after an input), which the Clock times by `now()`, is on time. Its gap
|
|
452
|
+
* from the frame before, in a burst, times the frames' interval, and tells whether a long task delayed it,
|
|
453
|
+
* however it's stamped (`FirstSteps.lateByGap`). Once a tick, where late frames are told: the rule's numbers come from
|
|
454
|
+
* `FirstSteps`, and this keeps them.
|
|
442
455
|
*/
|
|
456
|
+
// A repeated timestamp: Firefox's frame right after an input (#18; ADR-0017, amended by #2).
|
|
443
457
|
const tellLate = (): void => {
|
|
444
458
|
const stamp = clock.frameAt()
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
459
|
+
tickLateByLag = 0
|
|
460
|
+
if (stamp !== lastStamp) tickLateByLag = FirstSteps.lateByLag(clock.now() - stamp, lateAfter) / 1000
|
|
461
|
+
tickLateByGap = 0
|
|
462
|
+
const gap = stamp - gapFrom
|
|
463
|
+
if (gap > 0) {
|
|
464
|
+
const interval = FirstSteps.intervalOf(gap, gapBefore1, gapBefore2, gapBefore3, gapBefore4)
|
|
465
|
+
tickLateByGap = FirstSteps.lateByGap(gap, interval) / 1000
|
|
466
|
+
frameInterval = interval / 1000
|
|
467
|
+
gapBefore4 = gapBefore3
|
|
468
|
+
gapBefore3 = gapBefore2
|
|
469
|
+
gapBefore2 = gapBefore1
|
|
470
|
+
gapBefore1 = gap
|
|
471
|
+
}
|
|
472
|
+
gapFrom = stamp
|
|
448
473
|
lastStamp = stamp
|
|
449
|
-
|
|
450
|
-
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* The loop's ticks as the rule reads them (`FirstSteps`): its own entries' dt, and a run's that keeps the
|
|
478
|
+
* rule per member, a Batch's, carried on the service (#1028). Its reads are the loop's own fields.
|
|
479
|
+
*/
|
|
480
|
+
const reader: FirstSteps.Reader = {
|
|
481
|
+
madeOwing: () => {
|
|
482
|
+
if (!tellsLate) return 0
|
|
483
|
+
if (lateWindowOpen) return FirstSteps.madeOwing(tickLateByLag)
|
|
484
|
+
return FirstSteps.madeOwing(0)
|
|
485
|
+
},
|
|
486
|
+
owingDt: (owed, dt) => FirstSteps.owingDt(owed, dt, lateWindowOpen && !tickStepping, tickLateByGap, frameInterval),
|
|
487
|
+
owedAfter: (owed) => FirstSteps.owedAfter(owed, tickLateByLag),
|
|
451
488
|
}
|
|
452
489
|
|
|
453
490
|
/**
|
|
454
491
|
* The dt `entry` steps at (#1026): the tick's, but a run takes none of a long task's time from before it
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* frame was held of its second step; one made in that frame's Late window and first stepped at the next
|
|
458
|
-
* tick, of its first; and one that waited past the line for its first frame (Motion's
|
|
459
|
-
* `MAX_START_DELAY`, however its frame is stamped) begins there, a 60 Hz frame at most. What was
|
|
460
|
-
* running catches up, as before; a run on the frame timeline keeps the ticks' dt. Per frame: a field
|
|
461
|
-
* read, and nothing made.
|
|
492
|
+
* began (`FirstSteps`). What was running catches up, as before; a run on the frame timeline keeps the
|
|
493
|
+
* ticks' dt. Per frame: a field read, and nothing made.
|
|
462
494
|
*/
|
|
463
495
|
const dtOf = (entry: Entry, dt: number): number => {
|
|
464
496
|
const owed = entry.owed
|
|
465
497
|
if (owed === 0) return dt
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return leavingOut(dt, owed)
|
|
469
|
-
}
|
|
470
|
-
return firstDt(entry, dt, entry.madeLate)
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
/** A run's first step (`owed` `NaN`): what of its frame a long task held, owed to its second; `before` left out. */
|
|
474
|
-
const firstDt = (entry: Entry, dt: number, before: number): number => {
|
|
475
|
-
entry.owed = windowLate
|
|
476
|
-
if (windowRanAt - entry.madeAt > lateAfter) return Math.min(dt, Clock.NOMINAL_DT)
|
|
477
|
-
if (before > 0) return leavingOut(dt, before)
|
|
478
|
-
return dt
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/** A Late step's dt: its first step, in the window it was made in, with nothing of the window's left out. */
|
|
482
|
-
const lateDtOf = (entry: Entry, dt: number): number => {
|
|
483
|
-
if (entry.owed === 0) return dt
|
|
484
|
-
return firstDt(entry, dt, 0)
|
|
498
|
+
entry.owed = reader.owedAfter(owed)
|
|
499
|
+
return reader.owingDt(owed, dt)
|
|
485
500
|
}
|
|
486
501
|
|
|
487
502
|
/**
|
|
@@ -523,8 +538,8 @@ export const make = Effect.fnUntraced(
|
|
|
523
538
|
// A window this tick finds open is the last frame's, its checkpoint not yet run (back-to-back
|
|
524
539
|
// frames in a test): its runs are on the lanes, so this tick steps them.
|
|
525
540
|
if (lateFirst.length + lateLast.length > 0) dropLate()
|
|
526
|
-
|
|
527
|
-
|
|
541
|
+
lateWindowOpen = true
|
|
542
|
+
tickDt = dt
|
|
528
543
|
if (tellsLate) tellLate()
|
|
529
544
|
// The tick's start, read only for the metrics' histogram (#518).
|
|
530
545
|
let t0 = 0
|
|
@@ -533,6 +548,7 @@ export const make = Effect.fnUntraced(
|
|
|
533
548
|
// Late step at the window's end, a `runLast` run waits for the next tick (#680).
|
|
534
549
|
const count = entries.length
|
|
535
550
|
const lastCount = lastEntries.length
|
|
551
|
+
tickStepping = true
|
|
536
552
|
for (let i = 0; i < count; i++) {
|
|
537
553
|
const entry = entries[i]
|
|
538
554
|
if (entry.removed) continue
|
|
@@ -547,6 +563,7 @@ export const make = Effect.fnUntraced(
|
|
|
547
563
|
}
|
|
548
564
|
// The last lane, after every other run (ADR-0027, *Amendment (#137)*).
|
|
549
565
|
if (lastCount > 0) stepLast(lastCount, dt)
|
|
566
|
+
tickStepping = false
|
|
550
567
|
// Drop the removed entries in place, keeping order (and those added during the pass).
|
|
551
568
|
let kept = 0
|
|
552
569
|
for (let i = 0; i < entries.length; i++) {
|
|
@@ -577,8 +594,8 @@ export const make = Effect.fnUntraced(
|
|
|
577
594
|
}
|
|
578
595
|
}
|
|
579
596
|
// The window stays open to the end of this frame's microtasks, which take the Late steps (#680).
|
|
580
|
-
if (!
|
|
581
|
-
|
|
597
|
+
if (!lateWindowQueued) {
|
|
598
|
+
lateWindowQueued = true
|
|
582
599
|
queueMicrotask(endLateWindow)
|
|
583
600
|
}
|
|
584
601
|
// The burst ends with no run left, counted after the hooks: one a hook started (the flush
|
|
@@ -603,7 +620,7 @@ export const make = Effect.fnUntraced(
|
|
|
603
620
|
|
|
604
621
|
/**
|
|
605
622
|
* One step of `entry` at `at`: its Frame to its sink, its settle, or its defect, as a tick's. A Late
|
|
606
|
-
* step's dt is its first's
|
|
623
|
+
* step's dt is its first's; a dt-0 step leaves what it owes as it was.
|
|
607
624
|
*/
|
|
608
625
|
const stepOne = (entry: Entry, at: number): void => {
|
|
609
626
|
try {
|
|
@@ -620,7 +637,7 @@ export const make = Effect.fnUntraced(
|
|
|
620
637
|
entry.late = false
|
|
621
638
|
if (entry.removed) return false
|
|
622
639
|
if (Predicate.isNotUndefined(entry.span)) entry.span.attribute("late", true)
|
|
623
|
-
stepOne(entry,
|
|
640
|
+
stepOne(entry, dtOf(entry, tickDt))
|
|
624
641
|
return true
|
|
625
642
|
}
|
|
626
643
|
|
|
@@ -647,7 +664,7 @@ export const make = Effect.fnUntraced(
|
|
|
647
664
|
for (let i = 0; i < again.length; i++) {
|
|
648
665
|
const added = again[i]
|
|
649
666
|
try {
|
|
650
|
-
added.hook(
|
|
667
|
+
added.hook(tickDt)
|
|
651
668
|
if (added.failing) added.failing = false
|
|
652
669
|
} catch (defect) {
|
|
653
670
|
if (!added.failing) hookFailed(defect)
|
|
@@ -661,8 +678,8 @@ export const make = Effect.fnUntraced(
|
|
|
661
678
|
* left past the cap steps at the next tick. A hook that throws ends every run, as in a tick (Q15).
|
|
662
679
|
*/
|
|
663
680
|
const endLateWindow = (): void => {
|
|
664
|
-
|
|
665
|
-
if (!
|
|
681
|
+
lateWindowQueued = false
|
|
682
|
+
if (!lateWindowOpen) return
|
|
666
683
|
let rounds = 0
|
|
667
684
|
try {
|
|
668
685
|
while (lateFirst.length > 0 && rounds < MAX_LATE_ROUNDS) {
|
|
@@ -675,7 +692,7 @@ export const make = Effect.fnUntraced(
|
|
|
675
692
|
}
|
|
676
693
|
// Past the cap, the first lane's rest step at the next tick; the last lane's were never due.
|
|
677
694
|
if (lateFirst.length + lateLast.length > 0) dropLate()
|
|
678
|
-
|
|
695
|
+
lateWindowOpen = false
|
|
679
696
|
}
|
|
680
697
|
|
|
681
698
|
/**
|
|
@@ -697,14 +714,17 @@ export const make = Effect.fnUntraced(
|
|
|
697
714
|
|
|
698
715
|
/** A binding's hint (above): the window opened under the rule, closed by the microtask it queues. */
|
|
699
716
|
const hint = (frameTime: number): void => {
|
|
700
|
-
if (
|
|
717
|
+
if (lateWindowOpen) return
|
|
701
718
|
if (bursting && clock.frameAt() !== frameTime) return
|
|
702
|
-
|
|
703
|
-
//
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
719
|
+
lateWindowOpen = true
|
|
720
|
+
// Idle, no tick told its frame (#1026): a run made in it is told nothing late. While a burst runs, it's
|
|
721
|
+
// the frame the last tick told, which still stands (#1050).
|
|
722
|
+
if (!bursting) {
|
|
723
|
+
tickLateByLag = 0
|
|
724
|
+
tickLateByGap = 0
|
|
725
|
+
}
|
|
726
|
+
if (!lateWindowQueued) {
|
|
727
|
+
lateWindowQueued = true
|
|
708
728
|
queueMicrotask(endLateWindow)
|
|
709
729
|
}
|
|
710
730
|
}
|
|
@@ -740,7 +760,7 @@ export const make = Effect.fnUntraced(
|
|
|
740
760
|
// A burst that failed closes the window: no later call is in it (#673, TK3; #680). One that ran out
|
|
741
761
|
// of runs leaves it open, so a run started after its last tick, in its frame, takes its Late step.
|
|
742
762
|
if (failed) {
|
|
743
|
-
|
|
763
|
+
lateWindowOpen = false
|
|
744
764
|
dropLate()
|
|
745
765
|
}
|
|
746
766
|
Arr.forEach(Arr.appendAll(entries.splice(0), lastEntries.splice(0)), (entry) => {
|
|
@@ -769,6 +789,8 @@ export const make = Effect.fnUntraced(
|
|
|
769
789
|
onTrue: () => Effect.void,
|
|
770
790
|
onFalse: () => {
|
|
771
791
|
bursting = true
|
|
792
|
+
// The time since the last burst's last frame is no frame's gap (#1048).
|
|
793
|
+
gapFrom = Number.NaN
|
|
772
794
|
// Detached and started at once, as `FiberHandle.run` forks: no scheduler hop before the
|
|
773
795
|
// subscription, and no caller's fiber its parent.
|
|
774
796
|
return Effect.map(Effect.forkDetach(ticking, START_NOW), hold)
|
|
@@ -842,16 +864,10 @@ export const make = Effect.fnUntraced(
|
|
|
842
864
|
if (closed) return Effect.interrupt
|
|
843
865
|
let checkedSink: FrameLoop.Sink<F> = sink
|
|
844
866
|
if (check) checkedSink = checked(sink)
|
|
845
|
-
// What
|
|
846
|
-
// frame timeline:
|
|
867
|
+
// What it owes of its first frames' lateness (#1026), where late frames are told and it isn't on the
|
|
868
|
+
// frame timeline: its first step owed, made in a window or not.
|
|
847
869
|
let owed = 0
|
|
848
|
-
|
|
849
|
-
let madeLate = 0
|
|
850
|
-
if (tellsLate && !onFrameTimeline(options)) {
|
|
851
|
-
owed = Number.NaN
|
|
852
|
-
madeAt = clock.now()
|
|
853
|
-
if (windowOpen) madeLate = windowLate
|
|
854
|
-
}
|
|
870
|
+
if (tellsLate && !onFrameTimeline(options)) owed = reader.madeOwing()
|
|
855
871
|
const entry: Entry = {
|
|
856
872
|
name: machine.span.name,
|
|
857
873
|
step: machine.start(),
|
|
@@ -859,11 +875,9 @@ export const make = Effect.fnUntraced(
|
|
|
859
875
|
settles: machine.settles,
|
|
860
876
|
settled: Deferred.makeUnsafe<Frame.Frame<unknown> | Supersede.Superseded>(),
|
|
861
877
|
removed: false,
|
|
862
|
-
late:
|
|
878
|
+
late: lateWindowOpen,
|
|
863
879
|
span,
|
|
864
880
|
owed,
|
|
865
|
-
madeAt,
|
|
866
|
-
madeLate,
|
|
867
881
|
}
|
|
868
882
|
lane.push(entry)
|
|
869
883
|
if (entry.late) late.push(entry)
|
|
@@ -871,9 +885,11 @@ export const make = Effect.fnUntraced(
|
|
|
871
885
|
return Effect.as(startBurst, entry)
|
|
872
886
|
}
|
|
873
887
|
|
|
874
|
-
const inLateWindow = (): boolean =>
|
|
888
|
+
const inLateWindow = (): boolean => lateWindowOpen
|
|
875
889
|
|
|
876
|
-
|
|
890
|
+
const shape = { run: runIn(entries, lateFirst), runLast: runIn(lastEntries, lateLast), afterTick, inLateWindow, tickCount, hint } satisfies Shape
|
|
891
|
+
// Its `Reader`, carried beside the stable shape (#1028): a Batch keeps the rule per member by it.
|
|
892
|
+
return FirstSteps.carrying(shape, reader)
|
|
877
893
|
},
|
|
878
894
|
(self) => traced(self, "wardic.frameloop.make"),
|
|
879
895
|
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a registry blends a pair of numbers with core's `Interpolator.number`: the first of its kinds that
|
|
3
|
+
* reads both is that one itself. A blend machine asks once per leg, for a pair no Key rule takes, and computes
|
|
4
|
+
* such a pair's frames in its own loop, with no blend to call. A registry made by core's `make` carries the
|
|
5
|
+
* check; any other says no to every pair, and its pairs blend through what it resolves.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
// #1036 (ADR-0030, *Amendment (#1036)*): carried on the registry's value, as #1030's projector is on the
|
|
10
|
+
// Renderer's, so the stable `InterpolatorRegistry` keeps its shape. Internal: only core reads it, under a key
|
|
11
|
+
// no other module can name. A spread of the registry carries it too: `withKeyRules`' keeps it, and a registry an
|
|
12
|
+
// app makes from core's with a `resolve` of its own doesn't use it, since it answers for core's `resolve` alone.
|
|
13
|
+
import * as Option from "effect/Option"
|
|
14
|
+
import * as Predicate from "effect/Predicate"
|
|
15
|
+
import type * as InterpolatorRegistry from "../InterpolatorRegistry.ts"
|
|
16
|
+
import { carriedOf, carry } from "./carried.ts"
|
|
17
|
+
|
|
18
|
+
/** Whether a pair of numbers blends through core's `Interpolator.number`. */
|
|
19
|
+
export type LerpsNumbers = (from: number, to: number) => boolean
|
|
20
|
+
|
|
21
|
+
/** An `InterpolatorRegistry`'s service. */
|
|
22
|
+
type Service = InterpolatorRegistry.InterpolatorRegistry["Service"]
|
|
23
|
+
|
|
24
|
+
/** What a registry carries: its check, and the `resolve` it answers for. */
|
|
25
|
+
interface Carried {
|
|
26
|
+
readonly resolve: Service["resolve"]
|
|
27
|
+
readonly lerps: LerpsNumbers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Whether a value is what `attach` carries. Only `attach` writes `KEY`, so its fields are read as they are. */
|
|
31
|
+
const isCarried = Predicate.and(Predicate.hasProperty("resolve"), Predicate.hasProperty("lerps")) as Predicate.Refinement<unknown, Carried>
|
|
32
|
+
|
|
33
|
+
/** Where a registry's value carries it. */
|
|
34
|
+
const KEY: unique symbol = Symbol("@wardic/core/internal/lerpsNumbers")
|
|
35
|
+
|
|
36
|
+
/** The check of a registry that carries none, or one made with a `resolve` of its own: no pair. */
|
|
37
|
+
const NEVER: LerpsNumbers = () => false
|
|
38
|
+
|
|
39
|
+
/** `registry`, carrying `lerps`, which answers for its `resolve`. */
|
|
40
|
+
export const attach = (registry: Service, lerps: LerpsNumbers): Service => {
|
|
41
|
+
const carried: Carried = { resolve: registry.resolve, lerps }
|
|
42
|
+
return carry(registry, KEY, carried)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** `registry`'s check, or one that says no to every pair when it carries none for its `resolve`. */
|
|
46
|
+
export const lerpsNumbersOf = (registry: Service): LerpsNumbers => {
|
|
47
|
+
// Per leg (#460): statements.
|
|
48
|
+
const carried = carriedOf(registry, KEY, isCarried)
|
|
49
|
+
if (Option.isNone(carried)) return NEVER
|
|
50
|
+
const { resolve, lerps } = carried.value
|
|
51
|
+
if (resolve !== registry.resolve) return NEVER
|
|
52
|
+
return lerps
|
|
53
|
+
}
|
package/src/internal/options.ts
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* field takes its default; a given one is checked. Then a bag's cross-field `check`, if any, reads
|
|
13
13
|
* the filled fields.
|
|
14
14
|
*
|
|
15
|
-
* Each resolver checks once per bag: its result is cached by the bag's identity, so a
|
|
16
|
-
*
|
|
15
|
+
* Each resolver checks once per bag: its result is cached by the bag's identity, so a Ward's
|
|
16
|
+
* Subject's `transition`, the same object across its Retargets, is checked once. A bag is read
|
|
17
17
|
* once and never again: one changed after its first check keeps the first result (the bags are
|
|
18
18
|
* `readonly` in their types). None of this is on the per-frame path: a resolver runs when an
|
|
19
19
|
* animation is built or started.
|
|
@@ -183,25 +183,25 @@ export const union = <const Cs extends ReadonlyArray<Check<any>>>(members: Cs):
|
|
|
183
183
|
|
|
184
184
|
const NOT_ARRAY = expected("array")
|
|
185
185
|
|
|
186
|
-
/**
|
|
186
|
+
/** The item check's failure for the value at index `i`, under it, or `None`. */
|
|
187
187
|
const elementFailure = (element: Check<unknown>, value: unknown, i: number): Option.Option<string> => {
|
|
188
188
|
const checked = element(value)
|
|
189
189
|
if (checked === true) return Option.none()
|
|
190
190
|
return Option.some(under(`[${i}]`, checked))
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
/** The first of `values`
|
|
193
|
+
/** The first of `values` the item check rejects, its failure under its index, or `true`. */
|
|
194
194
|
const elementsOf = (element: Check<unknown>, values: ReadonlyArray<unknown>): true | string =>
|
|
195
195
|
Option.getOrElse(Arr.findFirst(values, (value, i) => elementFailure(element, value, i)), (): true => true)
|
|
196
196
|
|
|
197
|
-
/** An array, each
|
|
197
|
+
/** An array, each item passing the item check. */
|
|
198
198
|
export const array = <A>(element: Check<A>): Check<ReadonlyArray<A>> =>
|
|
199
199
|
make("array", Arr.isArray, (value) => {
|
|
200
200
|
if (!Arr.isArray(value)) return NOT_ARRAY
|
|
201
201
|
return elementsOf(element, value)
|
|
202
202
|
})
|
|
203
203
|
|
|
204
|
-
/** An array of one
|
|
204
|
+
/** An array of one item or more, each passing the item check: an empty one is missing its first. */
|
|
205
205
|
export const nonEmptyArray = <A>(element: Check<A>): Check<Arr.NonEmptyReadonlyArray<A>> =>
|
|
206
206
|
make("array", Arr.isArray, (value) => {
|
|
207
207
|
if (!Arr.isArray(value)) return NOT_ARRAY
|
|
@@ -209,13 +209,13 @@ export const nonEmptyArray = <A>(element: Check<A>): Check<Arr.NonEmptyReadonlyA
|
|
|
209
209
|
return elementsOf(element, value)
|
|
210
210
|
})
|
|
211
211
|
|
|
212
|
-
/** The tuple
|
|
212
|
+
/** The tuple's failure at index `i` of `values`: missing, or its item check's. */
|
|
213
213
|
const tupleElementFailure = (values: ReadonlyArray<unknown>) => (element: Check<unknown>, i: number): Option.Option<string> => {
|
|
214
214
|
if (i >= values.length) return Option.some(under(`[${i}]`, MISSING))
|
|
215
215
|
return elementFailure(element, values[i], i)
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
/** An array of exactly
|
|
218
|
+
/** An array of exactly the tuple's length, each item passing its own check: a missing one, then one past the end, fail. */
|
|
219
219
|
export const tuple = <const Cs extends ReadonlyArray<Check<any>>>(elements: Cs): Check<{ readonly [K in keyof Cs]: TypeOf<Cs[K]> }> =>
|
|
220
220
|
make("array", Arr.isArray, (value) => {
|
|
221
221
|
if (!Arr.isArray(value)) return NOT_ARRAY
|
|
@@ -226,8 +226,8 @@ export const tuple = <const Cs extends ReadonlyArray<Check<any>>>(elements: Cs):
|
|
|
226
226
|
})
|
|
227
227
|
|
|
228
228
|
/**
|
|
229
|
-
* A cubic Bézier's four numbers, `[x1, y1, x2, y2]`: its x's from 0 to 1,
|
|
230
|
-
*
|
|
229
|
+
* A cubic Bézier's four numbers, `[x1, y1, x2, y2]`: its x's from 0 to 1, so the curve is a
|
|
230
|
+
* function of time, its y's any finite number, so a curve may overshoot.
|
|
231
231
|
*/
|
|
232
232
|
// #618 (decision 9): any four finite numbers passed, and an x outside 0-1 threw bezier-easing's own
|
|
233
233
|
// Error as the curve was made.
|
package/src/internal/stepper.ts
CHANGED
|
@@ -47,12 +47,29 @@ export interface TweenState {
|
|
|
47
47
|
elapsed: number
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/** A run's own Frame, rewritten in place each tick (#895): a
|
|
50
|
+
/** A run's own Frame, rewritten in place each tick (#895): a blend's and the keyframes step's, a tween's as a {@link TweenFrame}. */
|
|
51
51
|
export interface WritableFrame<A> {
|
|
52
52
|
value: A
|
|
53
53
|
done: boolean
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A tween's own Frame, rewritten in place each tick: a class of its own, so no Frame whose `value` is a
|
|
58
|
+
* record shares its hidden class, and V8 keeps its `value` a number field it rewrites where it is. Its
|
|
59
|
+
* fields are assigned in the constructor, not declared with values: a field declared that way starts as
|
|
60
|
+
* `undefined`, and V8 would keep it able to hold anything, boxing each number stored in it.
|
|
61
|
+
*/
|
|
62
|
+
// #1031 (ADR-0030, *Amendment (#1031)*): as a `{ value, done }` literal it shared `blendedBy`'s Frame's hidden
|
|
63
|
+
// class, whose `value` is a record, so each frame's number was boxed into it, 16 B a Subject.
|
|
64
|
+
export class TweenFrame implements WritableFrame<number> {
|
|
65
|
+
declare value: number
|
|
66
|
+
declare done: boolean
|
|
67
|
+
constructor(value: number) {
|
|
68
|
+
this.value = value
|
|
69
|
+
this.done = false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
/** A tween's options with every default filled in. */
|
|
57
74
|
export interface ResolvedTween {
|
|
58
75
|
/** Seconds before it moves. */
|
|
@@ -169,13 +186,14 @@ export interface Pass {
|
|
|
169
186
|
}
|
|
170
187
|
|
|
171
188
|
/**
|
|
172
|
-
* Where a run is `t` seconds in, by Motion's `JSAnimation` iteration math
|
|
189
|
+
* Where a run is `t` seconds in, by Motion's `JSAnimation` iteration math: every
|
|
173
190
|
* pass and every gap is a stretch of one time, so a pass starts the moment the one before it ends,
|
|
174
191
|
* wherever that falls in a tick (#226). A gap holds where its pass ended. Every other pass is
|
|
175
192
|
* turned by its `repeatType`, and `flip` (`reverse`) reads every pass's stops from last to first,
|
|
176
193
|
* Motion's mirrored generator (#429). Written into `pass`; whether the run has ended. Per frame
|
|
177
194
|
* (ADR-0025): arithmetic and statement `if`s.
|
|
178
195
|
*/
|
|
196
|
+
// `motion-dom` 13.3.0's `JSAnimation`.
|
|
179
197
|
export const passAt = (t: number, run: ResolvedRun, flip: boolean, pass: Pass): boolean => {
|
|
180
198
|
const cycle = run.cycle
|
|
181
199
|
const total = run.total
|
package/src/internal/tracing.ts
CHANGED
|
@@ -97,7 +97,7 @@ export const tracedScoped = <A, E, R>(
|
|
|
97
97
|
/**
|
|
98
98
|
* `self` under the span `name` when the fiber running it is traced and the app gives spans; as it is
|
|
99
99
|
* otherwise. Decided once, when the stream is run, and the pull handed on is `self`'s own: a
|
|
100
|
-
* `Stream.unwrap` here suspended every pull, per
|
|
100
|
+
* `Stream.unwrap` here suspended every pull, per stream per frame for a Stream consumer (+4–6% on
|
|
101
101
|
* Bun's `ticksOnly`). `Shape.tracedStream` hands `self` back untraced, which is how it's told.
|
|
102
102
|
*/
|
|
103
103
|
export const tracedStream = <A, E, R>(self: Stream.Stream<A, E, R>, name: string, options: Spans.Options = {}): Stream.Stream<A, E, R> => {
|