@msb235/blits 0.14.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.
Files changed (173) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/README.md +3 -3
  3. package/dist/ahead.d.ts +26 -0
  4. package/dist/ahead.js +264 -0
  5. package/dist/around.d.ts +11 -0
  6. package/dist/around.js +32 -0
  7. package/dist/bare.js +15 -7
  8. package/dist/blank.d.ts +10 -0
  9. package/dist/blank.js +26 -0
  10. package/dist/blend.d.ts +2 -1
  11. package/dist/blend.js +1 -6
  12. package/dist/bound.d.ts +70 -0
  13. package/dist/bound.js +351 -0
  14. package/dist/chain.d.ts +2 -1
  15. package/dist/chain.js +7 -5
  16. package/dist/changes.d.ts +24 -0
  17. package/dist/changes.js +189 -0
  18. package/dist/channels.d.ts +39 -13
  19. package/dist/channels.js +14 -5
  20. package/dist/color.d.ts +12 -10
  21. package/dist/color.js +25 -25
  22. package/dist/columns.js +7 -3
  23. package/dist/contribution.d.ts +30 -0
  24. package/dist/contribution.js +374 -0
  25. package/dist/copyout.d.ts +10 -0
  26. package/dist/copyout.js +69 -24
  27. package/dist/crowd.d.ts +8 -2
  28. package/dist/crowd.js +4 -5
  29. package/dist/cue.d.ts +8 -1
  30. package/dist/cue.js +39 -13
  31. package/dist/cut.d.ts +8 -0
  32. package/dist/cut.js +4 -0
  33. package/dist/drop.d.ts +9 -0
  34. package/dist/drop.js +84 -0
  35. package/dist/due.d.ts +24 -5
  36. package/dist/due.js +113 -33
  37. package/dist/easing.d.ts +4 -4
  38. package/dist/easing.js +3 -3
  39. package/dist/everyone.d.ts +3 -2
  40. package/dist/everyone.js +3 -3
  41. package/dist/fade.d.ts +2 -1
  42. package/dist/fade.js +2 -1
  43. package/dist/fill.d.ts +3 -2
  44. package/dist/fill.js +51 -19
  45. package/dist/fit.d.ts +44 -26
  46. package/dist/fit.js +10 -9
  47. package/dist/fold.d.ts +4 -37
  48. package/dist/fold.js +5 -513
  49. package/dist/gather.d.ts +12 -7
  50. package/dist/gather.js +179 -44
  51. package/dist/gone.js +2 -2
  52. package/dist/grid.d.ts +47 -0
  53. package/dist/grid.js +247 -0
  54. package/dist/handle.d.ts +2 -0
  55. package/dist/handle.js +14 -8
  56. package/dist/held.d.ts +2 -1
  57. package/dist/history.d.ts +6 -5
  58. package/dist/history.js +7 -9
  59. package/dist/hosts.js +9 -15
  60. package/dist/index.d.ts +5 -4
  61. package/dist/keyfill.d.ts +1 -1
  62. package/dist/keyfill.js +5 -3
  63. package/dist/keyrows.d.ts +12 -0
  64. package/dist/keyrows.js +99 -12
  65. package/dist/lane.d.ts +36 -6
  66. package/dist/lane.js +32 -1
  67. package/dist/lanes.d.ts +23 -8
  68. package/dist/lanes.js +29 -8
  69. package/dist/leavings.d.ts +2 -2
  70. package/dist/leavings.js +1 -1
  71. package/dist/lives.d.ts +47 -0
  72. package/dist/lives.js +180 -0
  73. package/dist/meet.d.ts +2 -2
  74. package/dist/meet.js +90 -4
  75. package/dist/mixer.d.ts +54 -36
  76. package/dist/mixer.js +53 -171
  77. package/dist/motion.d.ts +14 -118
  78. package/dist/motion.js +16 -8
  79. package/dist/motions.d.ts +62 -155
  80. package/dist/motions.js +56 -370
  81. package/dist/moved.d.ts +1 -1
  82. package/dist/moved.js +16 -7
  83. package/dist/named.d.ts +0 -1
  84. package/dist/named.js +20 -2
  85. package/dist/numbers.d.ts +2 -0
  86. package/dist/numbers.js +4 -0
  87. package/dist/owed.d.ts +2 -0
  88. package/dist/owed.js +4 -0
  89. package/dist/pack.d.ts +2 -1
  90. package/dist/pack.js +2 -3
  91. package/dist/patch.d.ts +7 -3
  92. package/dist/patch.js +6 -2
  93. package/dist/places.d.ts +53 -0
  94. package/dist/places.js +171 -0
  95. package/dist/plot.d.ts +12 -0
  96. package/dist/plot.js +52 -0
  97. package/dist/project.d.ts +4 -4
  98. package/dist/project.js +9 -212
  99. package/dist/pull.js +11 -8
  100. package/dist/qualify.js +84 -21
  101. package/dist/reading.d.ts +6 -0
  102. package/dist/reading.js +5 -0
  103. package/dist/record.d.ts +5 -1
  104. package/dist/record.js +3 -2
  105. package/dist/relink.d.ts +1 -1
  106. package/dist/restored.d.ts +2 -2
  107. package/dist/restored.js +1 -1
  108. package/dist/rests.d.ts +9 -0
  109. package/dist/rests.js +76 -0
  110. package/dist/revive.d.ts +3 -2
  111. package/dist/revive.js +2 -2
  112. package/dist/{locus.d.ts → role.d.ts} +10 -9
  113. package/dist/{locus.js → role.js} +3 -3
  114. package/dist/roles.d.ts +10 -0
  115. package/dist/roles.js +158 -0
  116. package/dist/roster.js +3 -3
  117. package/dist/rotation.d.ts +1 -1
  118. package/dist/rotation.js +1 -1
  119. package/dist/rows.js +1 -1
  120. package/dist/sample.d.ts +2 -2
  121. package/dist/sample.js +33 -7
  122. package/dist/seek.js +5 -5
  123. package/dist/setting.d.ts +27 -0
  124. package/dist/setting.js +55 -0
  125. package/dist/shared.d.ts +1 -1
  126. package/dist/shared.js +1 -1
  127. package/dist/signals.d.ts +64 -32
  128. package/dist/signals.js +20 -18
  129. package/dist/stack.d.ts +5 -5
  130. package/dist/stack.js +5 -5
  131. package/dist/standing.d.ts +2 -1
  132. package/dist/standing.js +3 -2
  133. package/dist/store.d.ts +9 -0
  134. package/dist/store.js +24 -0
  135. package/dist/strays.d.ts +2 -1
  136. package/dist/strays.js +20 -13
  137. package/dist/stretch.d.ts +112 -0
  138. package/dist/stretch.js +9 -0
  139. package/dist/subject.d.ts +142 -0
  140. package/dist/subject.js +1 -0
  141. package/dist/tape.d.ts +9 -5
  142. package/dist/tape.js +5 -1
  143. package/dist/then.d.ts +9 -0
  144. package/dist/then.js +57 -0
  145. package/dist/ticker.d.ts +4 -4
  146. package/dist/transport.d.ts +0 -8
  147. package/dist/transport.js +0 -4
  148. package/dist/turns.d.ts +4 -3
  149. package/dist/turns.js +4 -3
  150. package/dist/types/arc.d.ts +12 -11
  151. package/dist/types/channel.d.ts +12 -8
  152. package/dist/types/history.d.ts +35 -19
  153. package/dist/types/mix.d.ts +222 -163
  154. package/dist/types/motion.d.ts +151 -0
  155. package/dist/types/motion.js +1 -0
  156. package/dist/types/patch.d.ts +67 -34
  157. package/dist/types/place.d.ts +51 -36
  158. package/dist/types/transport.d.ts +20 -18
  159. package/dist/types/voice.d.ts +136 -70
  160. package/dist/types/watch.d.ts +88 -40
  161. package/dist/types.d.ts +1 -0
  162. package/dist/voice.d.ts +7 -143
  163. package/dist/voice.js +28 -79
  164. package/dist/warn.d.ts +2 -0
  165. package/dist/warn.js +1 -1
  166. package/dist/watch.d.ts +2 -2
  167. package/dist/watch.js +5 -3
  168. package/dist/wave.d.ts +4 -3
  169. package/dist/wave.js +3 -2
  170. package/dist/weigh.d.ts +7 -1
  171. package/dist/weigh.js +27 -0
  172. package/docs/schema.html +212 -34
  173. package/package.json +2 -2
package/dist/fit.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  /**
2
- * How hard a claim on time holds when it meets another: the weaker gives way.
2
+ * How hard a claim on time holds when it meets another. The weaker gives way.
3
3
  *
4
4
  * @category score
5
5
  */
6
6
  export type Strength = 'weak' | 'strong' | 'required';
7
7
  /**
8
- * How a span lays its children out: each after the one before has ended, partway through it, or
9
- * all at once.
8
+ * How a span lays its children out. Each after the one before has ended, partway through it, or all
9
+ * at once.
10
10
  *
11
11
  * @category score
12
12
  */
13
13
  export type Order = 'queue' | 'stagger' | 'together';
14
14
  /**
15
- * One child of a span as a fit sees it: what is left of it, and the ways it may give way.
15
+ * One child of a span as a fit sees it. What is left of it, and the ways it may give way.
16
16
  *
17
17
  * @category score
18
18
  */
@@ -25,13 +25,16 @@ export interface Claim {
25
25
  faster: number;
26
26
  /** How many times slower it may play; 1 for no slower. */
27
27
  slower: number;
28
- /** Whether it may run alongside the one before it where the span's order would not have it. */
28
+ /**
29
+ * Whether it may run alongside the one before it. It may where the span's order would not have
30
+ * it.
31
+ */
29
32
  overlap: boolean;
30
33
  /** Whether it may jump to its end instead of playing. */
31
34
  ballast: boolean;
32
35
  priority: Strength;
33
36
  /**
34
- * Span ms from now before which it may not start, from its `earliest`; absent for none. Below 0
37
+ * Span ms from now before which it may not start. From its `earliest`; absent for none. Below 0
35
38
  * where it has passed, which places the child there.
36
39
  */
37
40
  floor?: number;
@@ -52,9 +55,9 @@ export interface SpanClaim {
52
55
  share: number;
53
56
  }
54
57
  /**
55
- * What a fit decides, per child in the order given: a rate over its own, and whether it is
56
- * skipped. `share` is how far through the one before a child that may overlap starts, and `allow`
57
- * the span ms the span may run past its budget.
58
+ * What a fit decides for each child. A rate over its own, and whether it is skipped, per child in
59
+ * the order given. `share` is how far through the one before a child that may overlap starts, and
60
+ * `allow` the span ms the span may run past its budget.
58
61
  *
59
62
  * @category score
60
63
  */
@@ -65,7 +68,8 @@ export interface FitPlan {
65
68
  allow: number;
66
69
  }
67
70
  /**
68
- * A strategy for fitting a span's children into its budget: from the plan so far to a new one.
71
+ * A strategy for fitting a span's children into its budget. It goes from the plan so far to a new
72
+ * one.
69
73
  *
70
74
  * @category score
71
75
  */
@@ -73,23 +77,31 @@ export type Fit = (span: SpanClaim, kids: readonly Claim[], plan: FitPlan) => Fi
73
77
  /** How far through the one before a child starts under each order, before any fit. */
74
78
  export declare function shareOf(order: Order, stagger: number): number;
75
79
  /**
76
- * The plan before any fit: every child at its own rate, played, in the span's order.
80
+ * The plan before any fit. Every child at its own rate, played, in the span's order.
77
81
  *
78
82
  * @category score
79
83
  */
80
84
  export declare function plain(span: SpanClaim, kids: readonly Claim[]): FitPlan;
81
85
  /**
82
- * Where a plan puts each child, span ms from now, and how long they take together. A playing child
83
- * is where it is, at 0; each pending one starts its share through the one before it, or at its
84
- * floor where that is later. A floor already past places a child before now, so it starts partway
85
- * through; one without a floor starts no sooner than now.
86
+ * Where `layout` puts a span's children.
86
87
  *
87
88
  * @category score
88
89
  */
89
- export declare function layout(span: SpanClaim, kids: readonly Claim[], plan: FitPlan): {
90
+ export interface Layout {
91
+ /** Where each child starts, span ms from now, in the order given. */
90
92
  at: number[];
93
+ /** How long they take together, span ms from now. */
91
94
  length: number;
92
- };
95
+ }
96
+ /**
97
+ * Where a plan puts each child, and how long they take together. Times are span ms from now. A
98
+ * playing child is where it is, at 0; each pending one starts its share through the one before it,
99
+ * or at its floor where that is later. A floor already past places a child before now, so it starts
100
+ * partway through; one without a floor starts no sooner than now.
101
+ *
102
+ * @category score
103
+ */
104
+ export declare function layout(span: SpanClaim, kids: readonly Claim[], plan: FitPlan): Layout;
93
105
  /**
94
106
  * Moves every child's rate by one factor toward the budget, before the span's fit: faster where
95
107
  * they run past it, each no faster than its `faster` allows, and slower where they leave room in
@@ -97,8 +109,8 @@ export declare function layout(span: SpanClaim, kids: readonly Claim[], plan: Fi
97
109
  */
98
110
  export declare function rescale(span: SpanClaim, kids: readonly Claim[], plan: FitPlan): FitPlan;
99
111
  /**
100
- * Starts children that may overlap sooner after the one before, toward all at once, until they
101
- * fit.
112
+ * Starts children that may overlap sooner, until they fit. Each moves closer after the one before,
113
+ * toward all at once.
102
114
  *
103
115
  * @category score
104
116
  */
@@ -116,13 +128,20 @@ export declare function shed(): Fit;
116
128
  */
117
129
  export declare function conclude(): Fit;
118
130
  /**
119
- * Lets the span run past its budget: up to `cap` times it, or without limit.
131
+ * What `overrun` and `lax` take.
120
132
  *
121
133
  * @category score
122
134
  */
123
- export declare function overrun(opts?: {
135
+ export interface OverrunOptions {
136
+ /** The most the span may run, as a multiple of its budget. Default: no limit. */
124
137
  cap?: number;
125
- }): Fit;
138
+ }
139
+ /**
140
+ * Lets the span run past its budget. Up to `cap` times it, or without limit.
141
+ *
142
+ * @category score
143
+ */
144
+ export declare function overrun(opts?: OverrunOptions): Fit;
126
145
  /**
127
146
  * Tries each fit in turn, handing the plan on, and stops once the children fit.
128
147
  *
@@ -130,13 +149,12 @@ export declare function overrun(opts?: {
130
149
  */
131
150
  export declare function pipe(...fits_: readonly Fit[]): Fit;
132
151
  /**
133
- * Every way of giving way after the span's retiming, overrunning only once the rest are spent.
152
+ * Every way of giving way, overrunning only once the rest are spent. It applies after the span's
153
+ * retiming.
134
154
  *
135
155
  * @category score
136
156
  */
137
- export declare function lax(opts?: {
138
- cap?: number;
139
- }): Fit;
157
+ export declare function lax(opts?: OverrunOptions): Fit;
140
158
  /** The fit a span takes without one of its own. */
141
159
  export declare const defaultFit: Fit;
142
160
  /**
package/dist/fit.js CHANGED
@@ -3,7 +3,7 @@ export function shareOf(order, stagger) {
3
3
  return order === 'queue' ? 1 : order === 'together' ? 0 : stagger;
4
4
  }
5
5
  /**
6
- * The plan before any fit: every child at its own rate, played, in the span's order.
6
+ * The plan before any fit. Every child at its own rate, played, in the span's order.
7
7
  *
8
8
  * @category score
9
9
  */
@@ -16,10 +16,10 @@ export function plain(span, kids) {
16
16
  };
17
17
  }
18
18
  /**
19
- * Where a plan puts each child, span ms from now, and how long they take together. A playing child
20
- * is where it is, at 0; each pending one starts its share through the one before it, or at its
21
- * floor where that is later. A floor already past places a child before now, so it starts partway
22
- * through; one without a floor starts no sooner than now.
19
+ * Where a plan puts each child, and how long they take together. Times are span ms from now. A
20
+ * playing child is where it is, at 0; each pending one starts its share through the one before it,
21
+ * or at its floor where that is later. A floor already past places a child before now, so it starts
22
+ * partway through; one without a floor starts no sooner than now.
23
23
  *
24
24
  * @category score
25
25
  */
@@ -87,8 +87,8 @@ export function rescale(span, kids, plan) {
87
87
  return fits(span, kids, at(f)) ? at(f) : at(Math.max(1, f - 1e-9));
88
88
  }
89
89
  /**
90
- * Starts children that may overlap sooner after the one before, toward all at once, until they
91
- * fit.
90
+ * Starts children that may overlap sooner, until they fit. Each moves closer after the one before,
91
+ * toward all at once.
92
92
  *
93
93
  * @category score
94
94
  */
@@ -130,7 +130,7 @@ export function conclude() {
130
130
  return (_span, kids, plan) => ({ ...plan, skip: kids.map(() => true) });
131
131
  }
132
132
  /**
133
- * Lets the span run past its budget: up to `cap` times it, or without limit.
133
+ * Lets the span run past its budget. Up to `cap` times it, or without limit.
134
134
  *
135
135
  * @category score
136
136
  */
@@ -158,7 +158,8 @@ export function pipe(...fits_) {
158
158
  };
159
159
  }
160
160
  /**
161
- * Every way of giving way after the span's retiming, overrunning only once the rest are spent.
161
+ * Every way of giving way, overrunning only once the rest are spent. It applies after the span's
162
+ * retiming.
162
163
  *
163
164
  * @category score
164
165
  */
package/dist/fold.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Mixer } from './mixer.js';
2
+ import type { Subject } from './subject.js';
2
3
  import type { Channel } from './types.js';
3
- import { type Subject, type Voice } from './voice.js';
4
+ import type { Voice } from './voice.js';
4
5
  export type Key<O> = keyof O & string;
5
6
  export declare function near(a: unknown, b: unknown): boolean;
6
7
  /**
@@ -10,31 +11,6 @@ export declare function near(a: unknown, b: unknown): boolean;
10
11
  */
11
12
  export declare function merged(channel: Channel<unknown>, acc: unknown, b: unknown): unknown;
12
13
  export type Values = Record<string, unknown>;
13
- /**
14
- * One live voice's delta for one subject this frame, through its record for the subject, or null
15
- * when it does not reach. Its weight is left in `w`.
16
- */
17
- export declare function contribution<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, now: number, held: Subject<unknown>): Record<string, unknown> | null;
18
- /** Reads a keys voice's stops at `held.phase` into the subject's delta, through the voice's scratch. */
19
- export declare function keyed<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, held: Subject<unknown>): Record<string, unknown>;
20
- /**
21
- * Runs `step` once per whole interval between where this subject last stopped and now, on a grid
22
- * counted from when its delay ran out, and leaves the remainder for the next sample. Counting
23
- * rather than adding keeps the grid where it is however many samples it is reached through.
24
- */
25
- export declare function tick<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, held: Subject<unknown>, tick: number, to: number): void;
26
- /**
27
- * Stop 0 for a retargeting voice: the subject's pose in the frame before this voice contributes.
28
- * With no such frame on record — a voice cued before the subject was ever probed, or a host that
29
- * samples into its own object — it is this frame's pose with every other voice folded in.
30
- */
31
- export declare function baseFor<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I): Record<string, unknown>;
32
- /**
33
- * How fast each numeric channel this voice writes was moving, from the subject's last two probed
34
- * poses, in units per ms. Undefined with fewer than two on record, which starts the voice at rest.
35
- */
36
- export declare function slopeFor<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I): Record<string, unknown> | undefined;
37
- export declare function isRest<I, O>(this: Mixer<I, O>, delta: Record<string, unknown>): boolean;
38
14
  /**
39
15
  * A record's band state once its voice is skipped at weight 0: off, as `passes` would have said, so
40
16
  * a weight that comes back inside the band does not find it still on.
@@ -48,11 +24,6 @@ export declare function apply<I, O>(this: Mixer<I, O>, pose: Record<string, unkn
48
24
  export declare function clamp<I, O>(this: Mixer<I, O>, pose: Record<string, unknown>): Record<string, unknown>;
49
25
  /** A folded value held to its channel's bounds: a number clamped, an array clamped in place. */
50
26
  export declare function bound(channel: Channel<unknown>, v: unknown): unknown;
51
- /**
52
- * Whether a fold's next voice is its chain's next record, `held`, and not the next voice sharing
53
- * one record, `sharers[q]`: the two lists are each in voice order, and a fold takes them as one.
54
- */
55
- export declare function chainFirst<I, O>(held: Subject<unknown> | null, sharers: readonly Voice<I, O>[], q: number): boolean;
56
27
  /**
57
28
  * After a fold read a sharing voice for the subject numbered `slot`: keeps the weight it gave and
58
29
  * what the read left on its record, and gives the fold's place in `sharers`, which moves back where
@@ -69,9 +40,9 @@ export declare function linked<I, O>(this: Mixer<I, O>, subject: I): Subject<unk
69
40
  /** The fold after a subject's chain is linked and its lanes asked whether it reads from them. */
70
41
  export declare function foldWith<I, O>(this: Mixer<I, O>, subject: I, out: O, head: Subject<unknown> | null, laned: boolean, dry: boolean, except?: number): O;
71
42
  /**
72
- * `foldWith`'s voices in a mix with a locus or a voice sharing one record in it. The chain is taken
43
+ * `foldWith`'s voices in a mix with a role or a voice sharing one record in it. The chain is taken
73
44
  * again where a voice stopped sharing since it was linked, as a patch call in this probe's fill can
74
- * make one do. With no locus, the chain's records fold in voice order, and each voice sharing one
45
+ * make one do. With no role, the chain's records fold in voice order, and each voice sharing one
75
46
  * record, which is in no chain, before the first chain record that comes after it.
76
47
  */
77
48
  export declare function foldDetour<I, O>(this: Mixer<I, O>, subject: I, pose: Record<string, unknown>, linkedHead: Subject<unknown>, laned: boolean, dry: boolean, except: number | undefined, owed: number): O;
@@ -82,7 +53,3 @@ export declare function foldDetour<I, O>(this: Mixer<I, O>, subject: I, pose: Re
82
53
  export declare function foldSharers<I, O>(this: Mixer<I, O>, pose: Record<string, unknown>, subject: I, head: Subject<unknown>, q: number, before: number, laned: boolean, dry: boolean, except: number | undefined, owed: number): number;
83
54
  /** Whether the subject numbered `owed` reads laned `voice` from the general path this fill. */
84
55
  export declare function owedBy<I, O>(this: Mixer<I, O>, owed: number, voice: Voice<I, O>): boolean;
85
- /** `foldWith`'s voices with a locus in play: each locus folds at its first member's place. */
86
- export declare function foldLoci<I, O>(this: Mixer<I, O>, subject: I, pose: Record<string, unknown>, head: Subject<unknown>, laned: boolean, dry: boolean, except: number | undefined, owed: number): O;
87
- /** `contribution`, or for a dry fold a subject already probed this frame, without advancing it. */
88
- export declare function read<I, O>(this: Mixer<I, O>, voice: Voice<I, O>, subject: I, now: number, dry: boolean, held: Subject<unknown>): Record<string, unknown> | null;