@glissade/core 0.11.0 → 0.12.0-pre.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/clips.d.ts +114 -0
- package/dist/clips.js +230 -0
- package/dist/cmap.js +112 -0
- package/dist/font-ingest.d.ts +154 -0
- package/dist/font-ingest.js +282 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -112
- package/dist/sidecar.d.ts +5 -470
- package/dist/sidecar.js +2 -967
- package/dist/studioHost.d.ts +4 -1
- package/dist/studioHost.js +2 -1
- package/dist/targetRef.d.ts +33 -0
- package/dist/targetRef.js +992 -0
- package/dist/timeline.d.ts +138 -0
- package/dist/track.d.ts +329 -0
- package/package.json +12 -1
package/dist/sidecar.d.ts
CHANGED
|
@@ -1,473 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* `extrapolates` declares whether a type's lerp accepts easedT outside [0,1]
|
|
5
|
-
* (spring overshoot); non-extrapolating types clamp.
|
|
6
|
-
*/
|
|
7
|
-
type Vec2 = readonly [number, number];
|
|
8
|
-
/** One bezier contour in Lottie's vertex form: anchor points + RELATIVE in/out tangents. */
|
|
9
|
-
interface PathContour {
|
|
10
|
-
closed: boolean;
|
|
11
|
-
v: Vec2[];
|
|
12
|
-
in: Vec2[];
|
|
13
|
-
out: Vec2[];
|
|
14
|
-
}
|
|
15
|
-
/** The 'path' document value (§2.2): plain JSON, serializes with no new hooks. */
|
|
16
|
-
type PathValue = PathContour[];
|
|
17
|
-
/** Transition handoff policies (v2 addendum §A.4/§B.1); 'crossfade' reserved. */
|
|
18
|
-
type HandoffKind = 'cut' | 'decay' | 'spring' | 'blend-from-frozen';
|
|
19
|
-
interface ValueType<T> {
|
|
20
|
-
id: string;
|
|
21
|
-
lerp(a: T, b: T, t: number): T;
|
|
22
|
-
/** Accepts easedT outside [0,1] (spring overshoot)? Otherwise clamped. */
|
|
23
|
-
extrapolates: boolean;
|
|
24
|
-
equals(a: T, b: T): boolean;
|
|
25
|
-
/** Optional linear-space operators (offset decay + reserved additive blending, §B.6). */
|
|
26
|
-
add?(a: T, b: T): T;
|
|
27
|
-
sub?(a: T, b: T): T;
|
|
28
|
-
scale?(a: T, k: number): T;
|
|
29
|
-
/** Type-class handoff default (§B.1): spring for kinetic, cut for hold-only. */
|
|
30
|
-
defaultHandoff?: HandoffKind;
|
|
31
|
-
/** Document (de)serialization; default identity for JSON-native types (§2.2). */
|
|
32
|
-
serialize?(value: T): unknown;
|
|
33
|
-
deserialize?(raw: unknown): T;
|
|
34
|
-
}
|
|
35
|
-
type ValueTypeId = 'number' | 'vec2' | 'color' | 'string' | 'boolean' | (string & {});
|
|
36
|
-
declare function registerValueType<T>(vt: ValueType<T>): void;
|
|
37
|
-
declare class UnknownValueTypeError extends Error {
|
|
38
|
-
constructor(id: string);
|
|
39
|
-
}
|
|
40
|
-
declare function getValueType<T = unknown>(id: ValueTypeId): ValueType<T>;
|
|
41
|
-
declare const numberType: ValueType<number>;
|
|
42
|
-
declare const vec2Equals: (a: Vec2, b: Vec2) => boolean;
|
|
43
|
-
declare const vec2Type: ValueType<Vec2>;
|
|
44
|
-
/** vec2 swept along a circular arc: polar lerp of radius + shortest-path angle (§2.2). */
|
|
45
|
-
declare const vec2ArcType: ValueType<Vec2>;
|
|
46
|
-
declare const colorType: ValueType<string>;
|
|
47
|
-
declare const stringType: ValueType<string>;
|
|
48
|
-
declare const booleanType: ValueType<boolean>;
|
|
49
|
-
/**
|
|
50
|
-
* Path morphing (§2.2): pairwise lerp of anchors and tangents — exactly how
|
|
51
|
-
* lottie-web morphs, so imported animations are pixel-faithful. Mismatched
|
|
52
|
-
* topology snaps (hold a, then b at t ≥ 1) with a one-time dev warning; the
|
|
53
|
-
* de Casteljau normalization fallback for arbitrary native morphs is tracked
|
|
54
|
-
* future work. Lerp-only: offsets are not well-defined under mismatched
|
|
55
|
-
* topology, so no add/sub/scale — handoffs blend from the frozen value.
|
|
56
|
-
*/
|
|
57
|
-
declare const pathType: ValueType<PathValue>;
|
|
58
|
-
/** A gradient color stop: `offset` 0..1 along the gradient, `color` a CSS string. */
|
|
59
|
-
interface ColorStop {
|
|
60
|
-
offset: number;
|
|
61
|
-
color: string;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* How a gradient blends BETWEEN its stops: `linear` (the canvas-native ramp,
|
|
65
|
-
* the default — byte-identical to no mode), `smooth` (a smoothstep S-curve, no
|
|
66
|
-
* Mach-banding at stops), or `gaussian` (a soft gaussian shoulder — melts like
|
|
67
|
-
* a wide blur with 2-3 stops). `smooth`/`gaussian` densify + oklab-interpolate
|
|
68
|
-
* the stops at raster, so a soft-light fill reads as smooth as a blur, no filter.
|
|
69
|
-
*/
|
|
70
|
-
type GradientInterpolation = 'linear' | 'smooth' | 'gaussian';
|
|
71
|
-
/**
|
|
72
|
-
* A fill/stroke paint (§2.2 animatable document value): a solid color, or a
|
|
73
|
-
* `linear`/`radial` gradient. Geometry (`from`/`to`, `center`/`radius`) is in
|
|
74
|
-
* the shape's LOCAL space; omit it to default to the filled path's bounds.
|
|
75
|
-
* Plain JSON — serializes with no hooks; animatable via `paintType`.
|
|
76
|
-
*/
|
|
77
|
-
type Paint = {
|
|
78
|
-
kind: 'color';
|
|
79
|
-
color: string;
|
|
80
|
-
} | {
|
|
81
|
-
kind: 'linear';
|
|
82
|
-
stops: ColorStop[];
|
|
83
|
-
from?: [number, number];
|
|
84
|
-
to?: [number, number];
|
|
85
|
-
interpolation?: GradientInterpolation;
|
|
86
|
-
} | {
|
|
87
|
-
kind: 'radial';
|
|
88
|
-
stops: ColorStop[];
|
|
89
|
-
center?: [number, number];
|
|
90
|
-
radius?: number;
|
|
91
|
-
interpolation?: GradientInterpolation;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Gradient paint morphing (§2.2): a solid color lifts to a uniform gradient to
|
|
95
|
-
* meet the other side, then matched-kind/matched-stop-count gradients lerp their
|
|
96
|
-
* stops (offset + oklab color) and geometry pairwise; a mismatched kind or stop
|
|
97
|
-
* count snaps (hold a, then b at t ≥ 1) with a one-time dev warning. Lerp-only —
|
|
98
|
-
* no offsets under mismatch — so handoffs blend from the frozen value.
|
|
99
|
-
*/
|
|
100
|
-
declare const paintType: ValueType<Paint>;
|
|
101
|
-
declare class ValueTypeInferenceError extends Error {
|
|
102
|
-
constructor(value: unknown);
|
|
103
|
-
}
|
|
104
|
-
/** Infer a registered type id from a sample value (builder + bake authoring surfaces). */
|
|
105
|
-
declare function inferValueType(value: unknown): ValueTypeId;
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region src/easing.d.ts
|
|
108
|
-
/**
|
|
109
|
-
* Easing registry + cubic bézier (DESIGN.md §2.2). All functions map [0,1]→ℝ
|
|
110
|
-
* with f(0)=0 and f(1)=1; back/elastic intentionally leave [0,1].
|
|
111
|
-
*/
|
|
112
|
-
type EasingFn = (t: number) => number;
|
|
113
|
-
type EaseSpec = string | {
|
|
114
|
-
kind: 'cubicBezier';
|
|
115
|
-
pts: [number, number, number, number];
|
|
116
|
-
} | {
|
|
117
|
-
kind: 'spring';
|
|
118
|
-
stiffness: number;
|
|
119
|
-
damping: number;
|
|
120
|
-
mass: number;
|
|
121
|
-
};
|
|
122
|
-
declare const easings: Record<string, EasingFn>;
|
|
123
|
-
/**
|
|
124
|
-
* Analytic derivatives d(u) of every named ease (§B.6) — closed-form, used
|
|
125
|
-
* for reading velocity off in-flight curves at interruption time. Property-
|
|
126
|
-
* tested against central differences at interior points.
|
|
127
|
-
*/
|
|
128
|
-
declare const easingDerivatives: Record<string, EasingFn>;
|
|
129
|
-
/** Default property-tween ease (Motion Canvas precedent). */
|
|
130
|
-
declare const DEFAULT_EASE = "easeInOutCubic";
|
|
131
|
-
/**
|
|
132
|
-
* CSS-style cubic bézier where x is time and y is progress. Newton's method
|
|
133
|
-
* with a bisection fallback for the flat-derivative regions.
|
|
134
|
-
*/
|
|
135
|
-
declare function cubicBezier(p1x: number, p1y: number, p2x: number, p2y: number): EasingFn;
|
|
136
|
-
/** Analytic dy/dx of a cubic bézier ease: y'(s)/x'(s) at the solved parameter (§B.6). */
|
|
137
|
-
declare function cubicBezierDerivative(p1x: number, p1y: number, p2x: number, p2y: number): EasingFn;
|
|
138
|
-
declare class UnknownEasingError extends Error {
|
|
139
|
-
constructor(name: string);
|
|
140
|
-
}
|
|
141
|
-
declare function namedEasing(name: string): EasingFn;
|
|
142
|
-
//#endregion
|
|
143
|
-
//#region src/spring.d.ts
|
|
144
|
-
interface SpringConfig {
|
|
145
|
-
stiffness: number;
|
|
146
|
-
damping: number;
|
|
147
|
-
mass?: number;
|
|
148
|
-
}
|
|
149
|
-
interface SpringEase {
|
|
150
|
-
kind: 'spring';
|
|
151
|
-
stiffness: number;
|
|
152
|
-
damping: number;
|
|
153
|
-
mass: number;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Settle duration: the earliest time after which |x - 1| stays within
|
|
157
|
-
* settleTolerance. Closed-form via the decay envelope for the underdamped
|
|
158
|
-
* case; bisection on the monotone tail otherwise. Deterministic.
|
|
159
|
-
*/
|
|
160
|
-
declare function duration(cfg: SpringConfig, opts?: {
|
|
161
|
-
settleTolerance?: number;
|
|
162
|
-
}): number;
|
|
163
|
-
/**
|
|
164
|
-
* Spring progress at local time t, affinely rescaled so value(duration) = 1
|
|
165
|
-
* exactly — the raw form only approaches 1, and an unscaled curve would snap
|
|
166
|
-
* at the key (§2.7 "endpoint continuity"). May exceed 1 (overshoot).
|
|
167
|
-
*/
|
|
168
|
-
declare function value(cfg: SpringConfig, t: number, opts?: {
|
|
169
|
-
settleTolerance?: number;
|
|
170
|
-
}): number;
|
|
171
|
-
/**
|
|
172
|
-
* Velocity-matched retarget oscillator (v2 addendum §B.3): the same damped
|
|
173
|
-
* harmonic oscillator on an OFFSET in value units with nonzero initial
|
|
174
|
-
* velocity — y(0)=x0, y'(0)=v0, decaying to 0. No affine rescale (the target
|
|
175
|
-
* is exactly 0). Pure closed forms; seek-safe at any τ.
|
|
176
|
-
*/
|
|
177
|
-
interface RetargetSpring {
|
|
178
|
-
value(tau: number): number;
|
|
179
|
-
velocity(tau: number): number;
|
|
180
|
-
/** Earliest τ after which |value| stays within tol (default 0.005·|x0|+1e-6 floor). */
|
|
181
|
-
settleTime(tol?: number): number;
|
|
182
|
-
}
|
|
183
|
-
declare function retarget(cfg: SpringConfig, x0: number, v0: number): RetargetSpring;
|
|
184
|
-
interface SpringFactory {
|
|
185
|
-
(cfg: SpringConfig): SpringEase;
|
|
186
|
-
duration: typeof duration;
|
|
187
|
-
value: typeof value;
|
|
188
|
-
retarget: typeof retarget;
|
|
189
|
-
}
|
|
190
|
-
declare const spring: SpringFactory;
|
|
191
|
-
/**
|
|
192
|
-
* Named spring feels (react-spring conventions, mass 1) — a vocabulary instead
|
|
193
|
-
* of hand-tuned stiffness/damping. Use `spring(springPresets.wobbly)` or
|
|
194
|
-
* `springTo(t, a, b, springPresets.gentle)`.
|
|
195
|
-
*/
|
|
196
|
-
declare const springPresets: {
|
|
197
|
-
readonly default: {
|
|
198
|
-
readonly stiffness: 170;
|
|
199
|
-
readonly damping: 26;
|
|
200
|
-
};
|
|
201
|
-
readonly gentle: {
|
|
202
|
-
readonly stiffness: 120;
|
|
203
|
-
readonly damping: 14;
|
|
204
|
-
};
|
|
205
|
-
readonly wobbly: {
|
|
206
|
-
readonly stiffness: 180;
|
|
207
|
-
readonly damping: 12;
|
|
208
|
-
};
|
|
209
|
-
readonly stiff: {
|
|
210
|
-
readonly stiffness: 210;
|
|
211
|
-
readonly damping: 20;
|
|
212
|
-
};
|
|
213
|
-
readonly slow: {
|
|
214
|
-
readonly stiffness: 280;
|
|
215
|
-
readonly damping: 60;
|
|
216
|
-
};
|
|
217
|
-
readonly molasses: {
|
|
218
|
-
readonly stiffness: 280;
|
|
219
|
-
readonly damping: 120;
|
|
220
|
-
};
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* The spring as a normalized easing over a segment whose length must equal
|
|
224
|
-
* spring.duration(cfg) (validated at the document layer, §2.7).
|
|
225
|
-
*/
|
|
226
|
-
declare function springEasing(cfg: SpringConfig): EasingFn;
|
|
227
|
-
/**
|
|
228
|
-
* Analytic d/dp of springEasing (§B.6): oscillator derivative × the affine
|
|
229
|
-
* rescale factor × duration (chain rule p → t = p·D). Flat past p=1,
|
|
230
|
-
* matching value()'s clamp (right-derivative convention).
|
|
231
|
-
*/
|
|
232
|
-
declare function springEasingDerivative(cfg: SpringConfig): EasingFn;
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/track.d.ts
|
|
235
|
-
interface Key<T = unknown> {
|
|
236
|
-
t: number;
|
|
237
|
-
value: T;
|
|
238
|
-
/** Shape of the segment ARRIVING at this key (from the previous key). */
|
|
239
|
-
ease?: EaseSpec;
|
|
240
|
-
interp?: 'default' | 'hold';
|
|
241
|
-
/** Stable key id (studio-assigned); optional in code-authored documents. */
|
|
242
|
-
id?: string;
|
|
243
|
-
/** Builder-resolved implicit from-value; re-resolved on merge (§2.6, §6.2). */
|
|
244
|
-
derived?: boolean;
|
|
245
|
-
/** Reserved (§4.7): a v2 synthesized-transition leading key reads the live value. v1 accepts but ignores it. */
|
|
246
|
-
from?: 'live';
|
|
247
|
-
}
|
|
248
|
-
interface Track<T = unknown> {
|
|
249
|
-
/** Canonical path: '<nodeId>/<prop.path>', e.g. 'circle/position.x'. */
|
|
250
|
-
target: string;
|
|
251
|
-
type: ValueTypeId;
|
|
252
|
-
/** Sorted by t; enforced by validateTrack(). */
|
|
253
|
-
keys: Key<T>[];
|
|
254
|
-
/** Studio may own this track's keys via sidecar (§6.2). */
|
|
255
|
-
editable?: boolean;
|
|
256
|
-
/** Reserved (§2.2/§B.6): v2 additive blending. v1 accepts but ignores it (coalesce stays last-wins). */
|
|
257
|
-
additive?: boolean;
|
|
258
|
-
}
|
|
259
|
-
declare class TrackValidationError extends Error {
|
|
260
|
-
constructor(target: string, message: string);
|
|
261
|
-
}
|
|
262
|
-
declare function validateTrack(track: Track): void;
|
|
263
|
-
type KeyOpts<T> = Partial<Omit<Key<T>, 't' | 'value'>>;
|
|
264
|
-
declare function key<T>(t: number, value: T, easeOrOpts?: EaseSpec | KeyOpts<T>): Key<T>;
|
|
265
|
-
/**
|
|
266
|
-
* The settle-ON-the-beat helper: a spring key must sit at prev.t +
|
|
267
|
-
* spring.duration(cfg) (§2.7), so beat-anchored authoring otherwise means
|
|
268
|
-
* hand-computing the launch time. springTo returns the [launch, settle] key
|
|
269
|
-
* pair with the arithmetic done — spread it into a raw track():
|
|
270
|
-
* track('x/width', 'number', [...springTo(beats.start('drop'), 0, 320, cfg)])
|
|
271
|
-
*/
|
|
272
|
-
declare function springTo<T>(endT: number, from: T, to: T, cfg: SpringConfig): [Key<T>, Key<T>];
|
|
273
|
-
/**
|
|
274
|
-
* Cascade a set of tracks by shifting each one's key times — the classic
|
|
275
|
-
* stagger for animating a list of nodes with a delay between them. `delay` is
|
|
276
|
-
* the per-index gap in seconds, or a function of the index for non-linear
|
|
277
|
-
* cascades. Pure: returns new tracks, leaving the inputs untouched.
|
|
278
|
-
*
|
|
279
|
-
* stagger(items.map((it, i) => track(`${it.id}/opacity`, 'number',
|
|
280
|
-
* [key(0, 0), key(0.3, 1, 'easeOutCubic')])), 0.08)
|
|
281
|
-
*/
|
|
282
|
-
declare function stagger<T>(tracks: readonly Track<T>[], delay: number | ((index: number) => number)): Track<T>[];
|
|
283
|
-
declare function track<T>(target: string, type: ValueTypeId, keys: Key<T>[], opts?: {
|
|
284
|
-
editable?: boolean;
|
|
285
|
-
}): Track<T>;
|
|
286
|
-
declare function resolveEase(spec: EaseSpec | undefined): EasingFn;
|
|
287
|
-
/**
|
|
288
|
-
* Analytic d(u) for an ease spec (§B.6). Custom-registered eases without a
|
|
289
|
-
* derivative fall back to a symmetric difference with a one-time dev warning.
|
|
290
|
-
*/
|
|
291
|
-
declare function resolveEaseDerivative(spec: EaseSpec | undefined): EasingFn;
|
|
292
|
-
/**
|
|
293
|
-
* Analytic track derivative at time t, in value-units per second of local
|
|
294
|
-
* track time (v2 addendum §B.3/§B.6 conventions, pinned):
|
|
295
|
-
* (a) at a key boundary, velocity is the RIGHT derivative;
|
|
296
|
-
* (b) hold segments and the clamped regions outside the keys have v = 0;
|
|
297
|
-
* (c) types without sub/scale operators return null (no kinetic velocity).
|
|
298
|
-
*/
|
|
299
|
-
declare function velocityAt<T>(tr: Track<T>, t: number): T | null;
|
|
300
|
-
/** Pure sample of a track at time t (§2.4). */
|
|
301
|
-
declare function sampleTrack<T>(tr: Track<T>, t: number): T;
|
|
302
|
-
//#endregion
|
|
303
|
-
//#region src/devWarning.d.ts
|
|
304
|
-
/** The configurable dev-warning channel (no DOM lib in core; console may not exist). */
|
|
305
|
-
type DevWarning = (message: string) => void;
|
|
306
|
-
declare function setDevWarning(fn: DevWarning): void;
|
|
307
|
-
/** Internal: emit through the configurable channel. */
|
|
308
|
-
declare function emitDevWarning(message: string): void;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/timeline.d.ts
|
|
311
|
-
type Json = null | boolean | number | string | Json[] | {
|
|
312
|
-
[k: string]: Json;
|
|
313
|
-
};
|
|
314
|
-
interface Marker {
|
|
315
|
-
t: number;
|
|
316
|
-
name: string;
|
|
317
|
-
data?: Json;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* One concrete font face within a family — a (weight, style) variant at a URL.
|
|
321
|
-
* `weight`/`style` default to 400/'normal' (the CSS regular face). Lives on
|
|
322
|
-
* AssetRef.faces; a bare `{ kind: 'font', url }` is exactly the 400/normal face
|
|
323
|
-
* with no extra variants (so existing documents stay byte-identical, §3.6).
|
|
324
|
-
*/
|
|
325
|
-
interface FontFaceRef {
|
|
326
|
-
url: string;
|
|
327
|
-
weight?: number | undefined;
|
|
328
|
-
style?: 'normal' | 'italic' | undefined;
|
|
329
|
-
}
|
|
330
|
-
interface AssetRef {
|
|
331
|
-
kind: 'font' | 'image' | 'audio' | 'video' | 'timeline';
|
|
332
|
-
url: string;
|
|
333
|
-
/**
|
|
334
|
-
* Font only (§3.6): the explicit face set for this family. When present, the
|
|
335
|
-
* loaders register EVERY face (not the single `url`); the family-level `url`
|
|
336
|
-
* is the implicit 400/normal face. Omitted = the bare single-face form.
|
|
337
|
-
*/
|
|
338
|
-
faces?: FontFaceRef[] | undefined;
|
|
339
|
-
/**
|
|
340
|
-
* Font only (§3.6): the explicit fallback family chain, in order. The
|
|
341
|
-
* registry resolves `[family, ...fallback]` for glyph coverage. Omitted = no
|
|
342
|
-
* declared fallback (system fallback still applies in the rasterizer).
|
|
343
|
-
*/
|
|
344
|
-
fallback?: string[] | undefined;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* A gain envelope: keys of linear gain multipliers on the clip's local time
|
|
348
|
-
* axis. A full Track satisfies it structurally, but its target/type carry no
|
|
349
|
-
* meaning here — `{ keys: [...] }` is all a clip needs.
|
|
350
|
-
*/
|
|
351
|
-
interface GainEnvelope {
|
|
352
|
-
keys: Key[];
|
|
353
|
-
}
|
|
354
|
-
/** Audio is timeline metadata, never a render product (§5.3). */
|
|
355
|
-
interface AudioClip {
|
|
356
|
-
asset: AssetRef;
|
|
357
|
-
/** timeline seconds (frame-quantized at export via sample-position arithmetic) */
|
|
358
|
-
at: number;
|
|
359
|
-
/** seconds within the source asset */
|
|
360
|
-
trim?: {
|
|
361
|
-
start: number;
|
|
362
|
-
end: number;
|
|
363
|
-
};
|
|
364
|
-
gain?: GainEnvelope;
|
|
365
|
-
playbackRate?: number;
|
|
366
|
-
}
|
|
367
|
-
interface ChildEntry {
|
|
368
|
-
timeline: Timeline;
|
|
369
|
-
/** Offset on the parent time axis. */
|
|
370
|
-
at: number;
|
|
371
|
-
/**
|
|
372
|
-
* 'add': flattened at compile time into the parent's track space.
|
|
373
|
-
* 'sync': opaque sub-timeline with its own clock (parent t maps through
|
|
374
|
-
* at/timeScale); never coalesced against parent tracks.
|
|
375
|
-
*/
|
|
376
|
-
mode: 'add' | 'sync';
|
|
377
|
-
/** sync-mode only: child plays at this rate. */
|
|
378
|
-
timeScale?: number;
|
|
379
|
-
}
|
|
380
|
-
interface Timeline {
|
|
381
|
-
version: 1;
|
|
382
|
-
duration?: number;
|
|
383
|
-
/**
|
|
384
|
-
* Studio opt-in (§6.2 rule 4): the timeline duration is code-owned and
|
|
385
|
-
* read-only in the editor UNLESS this flag is set (via `editableDuration()`
|
|
386
|
-
* on the builder, or directly). Mirrors `track.editable` for tracks.
|
|
387
|
-
*/
|
|
388
|
-
editableDuration?: boolean;
|
|
389
|
-
fps?: number;
|
|
390
|
-
posterTime?: number;
|
|
391
|
-
tracks: Track[];
|
|
392
|
-
labels?: Record<string, number>;
|
|
393
|
-
markers?: Marker[];
|
|
394
|
-
children?: ChildEntry[];
|
|
395
|
-
audio?: AudioClip[];
|
|
396
|
-
assets?: Record<string, AssetRef>;
|
|
397
|
-
}
|
|
398
|
-
interface TimelineInit {
|
|
399
|
-
tracks?: Track[];
|
|
400
|
-
duration?: number;
|
|
401
|
-
/** Studio opt-in: expose the duration to editor editing (§6.2 rule 4). */
|
|
402
|
-
editableDuration?: boolean;
|
|
403
|
-
fps?: number;
|
|
404
|
-
posterTime?: number;
|
|
405
|
-
labels?: Record<string, number>;
|
|
406
|
-
markers?: Marker[];
|
|
407
|
-
children?: ChildEntry[];
|
|
408
|
-
audio?: AudioClip[];
|
|
409
|
-
assets?: Record<string, AssetRef>;
|
|
410
|
-
}
|
|
411
|
-
declare class TimelineValidationError extends Error {
|
|
412
|
-
constructor(message: string);
|
|
413
|
-
}
|
|
414
|
-
interface CompiledTimeline {
|
|
415
|
-
duration: number;
|
|
416
|
-
labels: Record<string, number>;
|
|
417
|
-
markers: Marker[];
|
|
418
|
-
/** One track per target (§2.2), keys rebased to the root time axis. */
|
|
419
|
-
tracks: Map<string, Track>;
|
|
420
|
-
/** Audio clips rebased to the root time axis (§5.3); sync timeScale scales playbackRate. */
|
|
421
|
-
audio: AudioClip[];
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Sample-indexed clip offset — the single A/V-sync source of truth (§5.3),
|
|
425
|
-
* `round(at * sampleRate)`. Both the CLI (FFmpeg) and the browser
|
|
426
|
-
* (OfflineAudioContext) mixers derive their delay from this, so A/V offsets
|
|
427
|
-
* agree across paths by construction rather than one rounding to milliseconds
|
|
428
|
-
* and the other to raw float seconds. Default rate is the canonical mix grid.
|
|
429
|
-
*/
|
|
430
|
-
declare function audioOffsetSamples(at: number, sampleRate?: number): number;
|
|
431
|
-
/**
|
|
432
|
-
* Studio reader (§6.2 rule 4): is this timeline's duration opted into editor
|
|
433
|
-
* editing? Code-owned and read-only by default; `editableDuration()` flips it.
|
|
434
|
-
*/
|
|
435
|
-
declare function isDurationEditable(doc: Timeline): boolean;
|
|
436
|
-
declare function compileTimeline(doc: Timeline): CompiledTimeline;
|
|
437
|
-
//#endregion
|
|
438
|
-
//#region src/targetRef.d.ts
|
|
439
|
-
/**
|
|
440
|
-
* Target references (DESIGN.md §2.6): the builder accepts either a canonical
|
|
441
|
-
* target string ('circle/opacity') or a property signal that carries its own
|
|
442
|
-
* path — attached by the scene package at node construction via TARGET_PATH.
|
|
443
|
-
*/
|
|
444
|
-
declare const TARGET_PATH: unique symbol;
|
|
445
|
-
interface TargetCarrier {
|
|
446
|
-
[TARGET_PATH]?: string;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* A target string, or any object carrying TARGET_PATH (property signals of
|
|
450
|
-
* id-bearing nodes). Typed as `object` because signals are callables and the
|
|
451
|
-
* symbol prop is attached dynamically; resolution is checked at build time.
|
|
452
|
-
*/
|
|
453
|
-
type TweenTarget = string | object;
|
|
454
|
-
declare class UnresolvableTargetError extends Error {
|
|
455
|
-
constructor(message?: string);
|
|
456
|
-
}
|
|
457
|
-
/** The node-id portion of a canonical `nodeId/prop.path` target. */
|
|
458
|
-
declare function targetNodeId(target: string): string;
|
|
459
|
-
/**
|
|
460
|
-
* The single editable-host rule (§6.4 sub-decision, the 0.9 locked predicate):
|
|
461
|
-
* only a node with an EXPLICIT, non-structural id can host an editable or
|
|
462
|
-
* editor-created track. Structural fallback ids (`~Type.ordinal`, §6.5) are
|
|
463
|
-
* inspection-only and reorder-fragile, so they are never editable nor valid
|
|
464
|
-
* track targets. Lives here (the addressing module) so the builder guard, the
|
|
465
|
-
* scene, and the studio host all share ONE definition.
|
|
466
|
-
*/
|
|
467
|
-
declare function isEditableNodeId(id: string | undefined | null): id is string;
|
|
468
|
-
declare function resolveTweenTarget(target: TweenTarget): string;
|
|
469
|
-
//#endregion
|
|
1
|
+
import { T as ValueTypeId, r as Track, t as Key } from "./track.js";
|
|
2
|
+
import { l as Timeline } from "./timeline.js";
|
|
3
|
+
|
|
470
4
|
//#region src/sidecar.d.ts
|
|
5
|
+
|
|
471
6
|
type OrphanReason = 'node-missing' | 'prop-missing' | 'type-changed';
|
|
472
7
|
interface SidecarTrackEntry {
|
|
473
8
|
/** value type, so an editor-created track binds without a code baseline. */
|
|
@@ -550,4 +85,4 @@ declare function mergeSidecar(code: Timeline, sidecar: SidecarDoc | SidecarDocV1
|
|
|
550
85
|
*/
|
|
551
86
|
declare function normalizeEditedKeys(keys: Key[]): Key[];
|
|
552
87
|
//#endregion
|
|
553
|
-
export {
|
|
88
|
+
export { setSidecarTrack as _, SidecarOrphan as a, SidecarVersionError as c, emptySidecar as d, hashKeys as f, normalizeEditedKeys as g, migrateSidecar as h, SidecarDocV1 as i, assignKeyIds as l, mergeSidecarDetailed as m, OrphanReason as n, SidecarTimelineEntry as o, mergeSidecar as p, SidecarDoc as r, SidecarTrackEntry as s, MergeResult as t, deleteSidecarTrack as u };
|