@msb235/blits 0.13.0 → 0.15.0
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/CHANGELOG.md +183 -0
- package/README.md +20 -3
- package/dist/ahead.d.ts +26 -0
- package/dist/ahead.js +264 -0
- package/dist/around.d.ts +11 -0
- package/dist/around.js +32 -0
- package/dist/bare.js +15 -7
- package/dist/blank.d.ts +10 -0
- package/dist/blank.js +26 -0
- package/dist/blend.d.ts +2 -1
- package/dist/blend.js +1 -6
- package/dist/bound.d.ts +70 -0
- package/dist/bound.js +351 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.js +7 -5
- package/dist/changes.d.ts +24 -0
- package/dist/changes.js +189 -0
- package/dist/channels.d.ts +39 -13
- package/dist/channels.js +14 -5
- package/dist/closed.d.ts +1 -0
- package/dist/closed.js +45 -1
- package/dist/color.d.ts +12 -10
- package/dist/color.js +25 -25
- package/dist/columns.js +7 -3
- package/dist/contribution.d.ts +30 -0
- package/dist/contribution.js +374 -0
- package/dist/copyout.d.ts +10 -0
- package/dist/copyout.js +69 -24
- package/dist/crowd.d.ts +8 -2
- package/dist/crowd.js +4 -5
- package/dist/cue.d.ts +8 -1
- package/dist/cue.js +47 -14
- package/dist/cut.d.ts +8 -0
- package/dist/cut.js +4 -0
- package/dist/drop.d.ts +9 -0
- package/dist/drop.js +84 -0
- package/dist/due.d.ts +24 -5
- package/dist/due.js +113 -33
- package/dist/easing.d.ts +4 -4
- package/dist/easing.js +3 -3
- package/dist/everyone.d.ts +3 -2
- package/dist/everyone.js +3 -3
- package/dist/fade.d.ts +2 -1
- package/dist/fade.js +2 -1
- package/dist/fill.d.ts +3 -2
- package/dist/fill.js +51 -19
- package/dist/fit.d.ts +44 -26
- package/dist/fit.js +10 -9
- package/dist/fling.d.ts +66 -0
- package/dist/fling.js +162 -0
- package/dist/fold.d.ts +4 -37
- package/dist/fold.js +5 -512
- package/dist/gather.d.ts +12 -7
- package/dist/gather.js +179 -44
- package/dist/gone.js +2 -2
- package/dist/grid.d.ts +47 -0
- package/dist/grid.js +247 -0
- package/dist/handle.d.ts +3 -0
- package/dist/handle.js +19 -8
- package/dist/held.d.ts +2 -1
- package/dist/history.d.ts +6 -5
- package/dist/history.js +9 -9
- package/dist/hosts.js +9 -15
- package/dist/index.d.ts +5 -4
- package/dist/keyfill.d.ts +1 -1
- package/dist/keyfill.js +5 -3
- package/dist/keyrows.d.ts +12 -0
- package/dist/keyrows.js +99 -12
- package/dist/lane.d.ts +36 -6
- package/dist/lane.js +32 -1
- package/dist/lanes.d.ts +23 -8
- package/dist/lanes.js +29 -8
- package/dist/leavings.d.ts +2 -2
- package/dist/leavings.js +1 -1
- package/dist/lives.d.ts +47 -0
- package/dist/lives.js +180 -0
- package/dist/meet.d.ts +2 -2
- package/dist/meet.js +90 -4
- package/dist/mixer.d.ts +61 -35
- package/dist/mixer.js +64 -169
- package/dist/motion.d.ts +19 -106
- package/dist/motion.js +60 -13
- package/dist/motions.d.ts +62 -150
- package/dist/motions.js +57 -369
- package/dist/move.js +24 -1
- package/dist/moved.d.ts +1 -1
- package/dist/moved.js +16 -7
- package/dist/named.d.ts +0 -1
- package/dist/named.js +20 -2
- package/dist/numbers.d.ts +2 -0
- package/dist/numbers.js +4 -0
- package/dist/owed.d.ts +2 -0
- package/dist/owed.js +4 -0
- package/dist/pack.d.ts +3 -1
- package/dist/pack.js +4 -3
- package/dist/patch.d.ts +7 -3
- package/dist/patch.js +6 -2
- package/dist/places.d.ts +53 -0
- package/dist/places.js +171 -0
- package/dist/plot.d.ts +12 -0
- package/dist/plot.js +52 -0
- package/dist/project.d.ts +4 -4
- package/dist/project.js +9 -211
- package/dist/pull.js +11 -8
- package/dist/qualify.js +84 -21
- package/dist/reading.d.ts +6 -0
- package/dist/reading.js +5 -0
- package/dist/record.d.ts +5 -1
- package/dist/record.js +4 -2
- package/dist/relink.d.ts +1 -1
- package/dist/restored.d.ts +2 -2
- package/dist/restored.js +1 -1
- package/dist/rests.d.ts +9 -0
- package/dist/rests.js +76 -0
- package/dist/revive.d.ts +3 -2
- package/dist/revive.js +2 -2
- package/dist/{locus.d.ts → role.d.ts} +10 -9
- package/dist/{locus.js → role.js} +3 -3
- package/dist/roles.d.ts +10 -0
- package/dist/roles.js +158 -0
- package/dist/roster.js +3 -3
- package/dist/rotation.d.ts +1 -1
- package/dist/rotation.js +1 -1
- package/dist/rows.js +1 -1
- package/dist/sample.d.ts +2 -2
- package/dist/sample.js +33 -7
- package/dist/seek.js +13 -5
- package/dist/setting.d.ts +27 -0
- package/dist/setting.js +55 -0
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +1 -1
- package/dist/signals.d.ts +64 -32
- package/dist/signals.js +20 -18
- package/dist/stack.d.ts +5 -5
- package/dist/stack.js +5 -5
- package/dist/standing.d.ts +2 -1
- package/dist/standing.js +3 -2
- package/dist/store.d.ts +9 -0
- package/dist/store.js +24 -0
- package/dist/strays.d.ts +2 -1
- package/dist/strays.js +21 -14
- package/dist/stretch.d.ts +112 -0
- package/dist/stretch.js +9 -0
- package/dist/subject.d.ts +142 -0
- package/dist/subject.js +1 -0
- package/dist/tape.d.ts +9 -5
- package/dist/tape.js +5 -1
- package/dist/then.d.ts +9 -0
- package/dist/then.js +57 -0
- package/dist/ticker.d.ts +4 -4
- package/dist/transport.d.ts +0 -8
- package/dist/transport.js +0 -4
- package/dist/turns.d.ts +4 -3
- package/dist/turns.js +4 -3
- package/dist/types/arc.d.ts +12 -11
- package/dist/types/channel.d.ts +12 -8
- package/dist/types/history.d.ts +35 -19
- package/dist/types/mix.d.ts +222 -161
- package/dist/types/motion.d.ts +151 -0
- package/dist/types/motion.js +1 -0
- package/dist/types/patch.d.ts +69 -34
- package/dist/types/place.d.ts +51 -36
- package/dist/types/transport.d.ts +20 -18
- package/dist/types/voice.d.ts +145 -72
- package/dist/types/watch.d.ts +88 -40
- package/dist/types.d.ts +1 -0
- package/dist/voice.d.ts +9 -141
- package/dist/voice.js +30 -79
- package/dist/warn.d.ts +2 -0
- package/dist/warn.js +1 -1
- package/dist/watch.d.ts +2 -2
- package/dist/watch.js +5 -3
- package/dist/wave.d.ts +4 -3
- package/dist/wave.js +3 -2
- package/dist/weigh.d.ts +7 -1
- package/dist/weigh.js +27 -0
- package/docs/schema.html +223 -37
- package/package.json +6 -2
package/dist/ticker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a ticker runs
|
|
2
|
+
* What a ticker runs. A mix, or anything that syncs, sleeps on `inert` and wakes by `onWake`.
|
|
3
3
|
*
|
|
4
4
|
* @category mix
|
|
5
5
|
*/
|
|
@@ -21,9 +21,9 @@ export interface TickerOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
fps?: number;
|
|
23
23
|
/**
|
|
24
|
-
* Where frames come from
|
|
25
|
-
* default animation frames where they exist, and a timer where they don't, as in a worker
|
|
26
|
-
*
|
|
24
|
+
* Where frames come from. `'frame'` is `requestAnimationFrame`, and `'timer'` is `setTimeout`. By
|
|
25
|
+
* default animation frames where they exist, and a timer where they don't, as in a worker without
|
|
26
|
+
* them or in Node.
|
|
27
27
|
*/
|
|
28
28
|
grain?: 'frame' | 'timer';
|
|
29
29
|
/**
|
package/dist/transport.d.ts
CHANGED
|
@@ -31,14 +31,6 @@ export interface Frame {
|
|
|
31
31
|
at: number;
|
|
32
32
|
u: number;
|
|
33
33
|
}
|
|
34
|
-
/** Where history is cut for a seek or read: what frame `seq` made, and before it, is kept. */
|
|
35
|
-
export interface Cut {
|
|
36
|
-
seq: number;
|
|
37
|
-
/** For a read of what a frame showed: of that frame's own changes, only those made before it was read. */
|
|
38
|
-
strict: boolean;
|
|
39
|
-
}
|
|
40
|
-
/** Whether a change made in frame `seq` falls inside `cut`; `early` for one made before the frame was read. */
|
|
41
|
-
export declare function within(cut: Cut, seq: number, early?: boolean): boolean;
|
|
42
34
|
/**
|
|
43
35
|
* The clock its mixes play on: host time less what `rebase` took out, at the rate its `pace`
|
|
44
36
|
* sets, moved by `sync` and `seek`, and the tape of calls a seek plays again. A mix made alone
|
package/dist/transport.js
CHANGED
|
@@ -11,10 +11,6 @@ import { hostAt, record, replay, tapeOf } from './tape.js';
|
|
|
11
11
|
import { gave, historyFor } from './watch.js';
|
|
12
12
|
/** How far the tape's reach moves before it is pruned again, ms of mix time. */
|
|
13
13
|
const TAPE_STEP_MS = 1000;
|
|
14
|
-
/** Whether a change made in frame `seq` falls inside `cut`; `early` for one made before the frame was read. */
|
|
15
|
-
export function within(cut, seq, early = false) {
|
|
16
|
-
return seq < cut.seq || (seq === cut.seq && (!cut.strict || early));
|
|
17
|
-
}
|
|
18
14
|
/**
|
|
19
15
|
* The clock its mixes play on: host time less what `rebase` took out, at the rate its `pace`
|
|
20
16
|
* sets, moved by `sync` and `seek`, and the tape of calls a seek plays again. A mix made alone
|
package/dist/turns.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ export declare function shortWay(d: number, turn: number): number;
|
|
|
7
7
|
* `fold`, which takes its axes as one value.
|
|
8
8
|
*/
|
|
9
9
|
export declare function turnInto(ch: Laned, values: Float64Array, base: number, value: unknown, w: number): void;
|
|
10
|
-
/** `turnInto` for a value held as numbers at `from` in `source`, as a
|
|
10
|
+
/** `turnInto` for a value held as numbers at `from` in `source`, as a role holds what it gathered. */
|
|
11
11
|
export declare function turnFrom(ch: Laned, values: Float64Array, base: number, source: Float64Array, from: number, w: number): void;
|
|
12
12
|
/**
|
|
13
|
-
* A
|
|
14
|
-
* the channel's own `lerp
|
|
13
|
+
* A role member's value for a channel not lerped straight across, lerped by `u` into what the
|
|
14
|
+
* members before it left at `base` through the channel's own `lerp`, or an angle's short way round;
|
|
15
|
+
* the first member's value as it is, where `taken` is 0.
|
|
15
16
|
*/
|
|
16
17
|
export declare function turnToward(ch: Laned, values: Float64Array, base: number, value: unknown, taken: number, u: number): void;
|
|
17
18
|
/** Sets every numbered subject's values on a lane to the channel's rest, as a fill starts from. */
|
package/dist/turns.js
CHANGED
|
@@ -28,7 +28,7 @@ export function turnInto(ch, values, base, value, w) {
|
|
|
28
28
|
for (let a = 0; a < axes; a++)
|
|
29
29
|
values[base + a] = out[a];
|
|
30
30
|
}
|
|
31
|
-
/** `turnInto` for a value held as numbers at `from` in `source`, as a
|
|
31
|
+
/** `turnInto` for a value held as numbers at `from` in `source`, as a role holds what it gathered. */
|
|
32
32
|
export function turnFrom(ch, values, base, source, from, w) {
|
|
33
33
|
if (ch.turn > 0) {
|
|
34
34
|
turnInto(ch, values, base, source[from], w);
|
|
@@ -38,8 +38,9 @@ export function turnFrom(ch, values, base, source, from, w) {
|
|
|
38
38
|
turnInto(ch, values, base, other, w);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* A
|
|
42
|
-
* the channel's own `lerp
|
|
41
|
+
* A role member's value for a channel not lerped straight across, lerped by `u` into what the
|
|
42
|
+
* members before it left at `base` through the channel's own `lerp`, or an angle's short way round;
|
|
43
|
+
* the first member's value as it is, where `taken` is 0.
|
|
43
44
|
*/
|
|
44
45
|
export function turnToward(ch, values, base, value, taken, u) {
|
|
45
46
|
if (ch.turn > 0) {
|
package/dist/types/arc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Handle, OwnerSpec, VoiceSpec } from './voice.js';
|
|
2
2
|
/**
|
|
3
|
-
* One voice of an arc's part
|
|
4
|
-
* fades it across each boundary by `blend`, and holds its first and last frames for the blend.
|
|
3
|
+
* One voice of an arc's part. It is a voice's spec, less what the arc sets for it. The arc places
|
|
4
|
+
* it, fades it across each boundary by `blend`, and holds its first and last frames for the blend.
|
|
5
5
|
*
|
|
6
6
|
* @category score
|
|
7
7
|
*/
|
|
@@ -13,15 +13,15 @@ export interface ArcVoice<I, O, H = unknown> extends Omit<VoiceSpec<I, O, H>, 'o
|
|
|
13
13
|
duration?: number;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* One part of an arc
|
|
17
|
-
* the longest.
|
|
16
|
+
* One part of an arc. It is a voice, or several layered together that play as one and last as
|
|
17
|
+
* long as the longest.
|
|
18
18
|
*
|
|
19
19
|
* @category score
|
|
20
20
|
*/
|
|
21
21
|
export type ArcPart<I, O, H = unknown> = ArcVoice<I, O, H> | readonly ArcVoice<I, O, H>[];
|
|
22
22
|
/**
|
|
23
|
-
* What `arc` takes
|
|
24
|
-
* `exit`, any of which may be left out.
|
|
23
|
+
* What `arc` takes. It is an owner over three parts that hand over in order, `enter`, `active`
|
|
24
|
+
* and `exit`, any of which may be left out.
|
|
25
25
|
*
|
|
26
26
|
* @category score
|
|
27
27
|
*/
|
|
@@ -33,22 +33,23 @@ export interface ArcSpec<I, O, H = unknown> extends Omit<OwnerSpec<I, H>, 'freez
|
|
|
33
33
|
/** What plays as it leaves. Its start is the arc's `out` mark, and its end the arc's `end`. */
|
|
34
34
|
exit?: ArcPart<I, O, H>;
|
|
35
35
|
/**
|
|
36
|
-
* How long `active` plays, ms on the arc's clock,
|
|
37
|
-
* passes;
|
|
38
|
-
* for good, and 0 with no `active`.
|
|
36
|
+
* How long `active` plays, ms on the arc's clock, or `'open'`. A number loops `active` for it
|
|
37
|
+
* unless its `loop` says how many passes; `'open'` plays it until `release`. Default: `active`'s
|
|
38
|
+
* own length, held open where it loops for good, and 0 with no `active`.
|
|
39
39
|
*/
|
|
40
40
|
hold?: number | 'open';
|
|
41
41
|
/** A crossfade across each boundary, ms, half before it and half after. Default 0. */
|
|
42
42
|
blend?: number;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* An arc's handle
|
|
45
|
+
* An arc's handle, which can release its hold. It is an owner's handle, and `release` ends the
|
|
46
|
+
* hold. `fade` takes it out with no exit.
|
|
46
47
|
*
|
|
47
48
|
* @category score
|
|
48
49
|
*/
|
|
49
50
|
export interface ArcHandle<I = unknown> extends Handle<I> {
|
|
50
51
|
/**
|
|
51
|
-
* Ends the hold now and plays the exit
|
|
52
|
+
* Ends the hold now and plays the exit. Its blend starts here; where the enter is still
|
|
52
53
|
* playing, the exit follows it. Nothing once the exit has begun or the arc is fading.
|
|
53
54
|
*/
|
|
54
55
|
release(): void;
|
package/dist/types/channel.d.ts
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export interface Channel<V> {
|
|
7
7
|
/**
|
|
8
|
-
* Names this channel's arithmetic
|
|
9
|
-
* another of the same name. Two channels of one kind must fold identically; the stock
|
|
10
|
-
* as `'sum'` or `'vec(3, sum)'`. Absent, a channel matches only itself.
|
|
8
|
+
* Names this channel's arithmetic. A patch written against one channel can then be checked
|
|
9
|
+
* against another of the same name. Two channels of one kind must fold identically; the stock
|
|
10
|
+
* ones set it, as `'sum'` or `'vec(3, sum)'`. Absent, a channel matches only itself.
|
|
11
11
|
*/
|
|
12
12
|
kind?: string;
|
|
13
13
|
/**
|
|
@@ -16,21 +16,25 @@ export interface Channel<V> {
|
|
|
16
16
|
* carries speed can push it out; overshoot stops flat at the bound.
|
|
17
17
|
*/
|
|
18
18
|
bounds?: readonly [min: number, max: number];
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The value that changes nothing when folded in, such as 0 for `sum` or 1 for `mul`. Absent means
|
|
21
|
+
* the channel has none: it replaces rather than contributes.
|
|
22
|
+
*/
|
|
20
23
|
rest?: V;
|
|
21
24
|
/** Fold two contributions into one. */
|
|
22
25
|
merge(a: V, b: V): V;
|
|
23
26
|
/** Fade toward `rest` by weight 0..1. Required when `rest` is set; absent otherwise. */
|
|
24
27
|
scale?(v: V, w: number): V;
|
|
25
|
-
/** Interpolate, for retargeting, for blending alternatives, and for folding a
|
|
28
|
+
/** Interpolate, for retargeting, for blending alternatives, and for folding a role. */
|
|
26
29
|
lerp(a: V, b: V, u: number): V;
|
|
27
30
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
31
|
+
* Folds a weighted contribution into `into` in place. Optional. It computes
|
|
32
|
+
* `merge(into, scale(v, w))`, written into `into` and returned, so a channel whose values are
|
|
33
|
+
* objects need not allocate per contribution. The mix only hands it a value it made.
|
|
30
34
|
*/
|
|
31
35
|
fold?(into: V, v: V, w: number): V;
|
|
32
36
|
/**
|
|
33
|
-
*
|
|
37
|
+
* A fresh copy of `v`. Optional. The mix makes one of `rest` for `fold` to write into. The mix
|
|
34
38
|
* copies arrays, typed arrays and plain objects itself; a channel whose `rest` is anything else,
|
|
35
39
|
* such as a class instance, and that has `fold`, needs this or `cue` refuses it.
|
|
36
40
|
*/
|
package/dist/types/history.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { VoiceSpec } from './voice.js';
|
|
2
2
|
/**
|
|
3
|
-
* What a mix or transport remembers, for `seek` and `project` to read back
|
|
3
|
+
* What a mix or transport remembers, for `seek` and `project` to read back. See
|
|
4
4
|
* `MixOptions.history`.
|
|
5
5
|
*
|
|
6
6
|
* @category mix
|
|
@@ -17,11 +17,11 @@ export interface HistoryOptions {
|
|
|
17
17
|
* the tape: the host bounds it.
|
|
18
18
|
*/
|
|
19
19
|
store?: HistoryStore;
|
|
20
|
-
/** Rebuilds a cued voice's spec from
|
|
20
|
+
/** Rebuilds a cued voice's spec from its descriptor. That lets the voice be paged out. */
|
|
21
21
|
revive?(d: Described): VoiceSpec<any, any>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* A voice as plain data
|
|
24
|
+
* A voice as plain data. `kind` names what built it, and `data` survives `structuredClone`.
|
|
25
25
|
*
|
|
26
26
|
* @category mix
|
|
27
27
|
*/
|
|
@@ -39,21 +39,23 @@ export interface HistoryStore {
|
|
|
39
39
|
/** Records leaving memory. One brought back by a seek may be paged again: keep one per key and `seq`. */
|
|
40
40
|
page(out: readonly Paged[]): void;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* the latest record at or before `t` and every record after it. Returning
|
|
42
|
+
* Loads what a restore to mix time `t` needs, for every mix. That is, from each stream, per voice
|
|
43
|
+
* and subject, the latest record at or before `t` and every record after it. Returning
|
|
44
|
+
* everything is fine.
|
|
44
45
|
*/
|
|
45
46
|
load(t: number): Promise<readonly Paged[]>;
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
* makes again.
|
|
48
|
+
* Forgets every record after frame `seq`, which a seek went back to. Every record whose `seq` is
|
|
49
|
+
* greater is from a future the tape makes again.
|
|
49
50
|
*/
|
|
50
51
|
cut(seq: number): void;
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
-
* signal's reading, a subject's record when it `left` a voice, a motion
|
|
55
|
-
* or older `stretch`, the `host` fields patches read, a whole `voice`
|
|
56
|
-
* transport's own: a `mark` announced on it, a change of its `pace`, and a
|
|
54
|
+
* Which kind of thing a history record holds. It is a voice's `controls`, a stateful record's
|
|
55
|
+
* `snap`, an `input` signal's reading, a subject's record when it `left` a voice, a motion
|
|
56
|
+
* subject's `released` run or older `stretch`, the `host` fields patches read, a whole `voice`
|
|
57
|
+
* that has left, or the transport's own: a `mark` announced on it, a change of its `pace`, and a
|
|
58
|
+
* `frame` it played.
|
|
57
59
|
*
|
|
58
60
|
* @category mix
|
|
59
61
|
*/
|
|
@@ -64,12 +66,17 @@ export type PagedStream = 'voice' | 'snap' | 'input' | 'left' | 'released' | 'st
|
|
|
64
66
|
* @category mix
|
|
65
67
|
*/
|
|
66
68
|
export interface Paged {
|
|
67
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* The mix's `name`. It is '' for a mix made alone without one, and for the transport's own
|
|
71
|
+
* records.
|
|
72
|
+
*/
|
|
68
73
|
mix: string;
|
|
69
74
|
stream: PagedStream;
|
|
70
75
|
/** The voice's id, for every stream but `host` and the transport's own. */
|
|
71
76
|
voice?: number;
|
|
72
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The subject's key, for a record of one subject. For a `mark`, the number it was announced as.
|
|
79
|
+
*/
|
|
73
80
|
subject?: string | number;
|
|
74
81
|
/** Mix time. */
|
|
75
82
|
at: number;
|
|
@@ -81,7 +88,7 @@ export interface Paged {
|
|
|
81
88
|
data: unknown;
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
84
|
-
* One host call a mix recorded on its tape
|
|
91
|
+
* One host call a mix recorded on its tape. `apply` makes it again, and `invert` does nothing,
|
|
85
92
|
* since a mix goes back by restoring what it kept rather than by undoing calls.
|
|
86
93
|
*
|
|
87
94
|
* @category mix
|
|
@@ -92,8 +99,8 @@ export interface TapeOp {
|
|
|
92
99
|
label?: string;
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
95
|
-
* One future a tape keeps at its current entry
|
|
96
|
-
* back here, before it made new ones.
|
|
102
|
+
* One future a tape keeps at its current entry. It holds the calls the host made after the mix
|
|
103
|
+
* last went back here, before it made new ones.
|
|
97
104
|
*
|
|
98
105
|
* @category mix
|
|
99
106
|
*/
|
|
@@ -126,14 +133,23 @@ export interface Tape {
|
|
|
126
133
|
switchBranch(id: number): void;
|
|
127
134
|
}
|
|
128
135
|
/**
|
|
129
|
-
* Makes a mix's tape
|
|
136
|
+
* Makes a mix's tape. weasel-history's `createHistory` is one. The mix passes the clock it stamps
|
|
130
137
|
* calls with, branching on, so a call made after going back keeps the old future as a branch, and
|
|
131
138
|
* coalescing off.
|
|
132
139
|
*
|
|
133
140
|
* @category mix
|
|
134
141
|
*/
|
|
135
|
-
export type TapeMaker = (adapter: unknown, opts:
|
|
142
|
+
export type TapeMaker = (adapter: unknown, opts: TapeOptions) => Tape;
|
|
143
|
+
/**
|
|
144
|
+
* What a mix passes its `TapeMaker` besides the adapter.
|
|
145
|
+
*
|
|
146
|
+
* @category mix
|
|
147
|
+
*/
|
|
148
|
+
export interface TapeOptions {
|
|
149
|
+
/** The clock the tape stamps calls with. */
|
|
136
150
|
now: () => number;
|
|
151
|
+
/** Always `true`, so a call made after going back keeps the old future as a branch. */
|
|
137
152
|
branching: boolean;
|
|
153
|
+
/** Always `0`, which turns coalescing off. */
|
|
138
154
|
coalesceWindowMs: number;
|
|
139
|
-
}
|
|
155
|
+
}
|