@glissade/core 0.18.0-pre.3 → 0.18.0-pre.5
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 +1 -1
- package/dist/clips.js +45 -12
- package/dist/index.d.ts +24 -12
- package/dist/index.js +32 -16
- package/dist/sidecar.js +27 -7
- package/dist/studioHost.d.ts +1 -1
- package/dist/targetRef.js +11 -1
- package/dist/timeline.d.ts +12 -0
- package/dist/track.d.ts +9 -1
- package/package.json +1 -1
package/dist/clips.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as Vec2, T as ValueTypeId,
|
|
1
|
+
import { D as Vec2, T as ValueTypeId, X as EaseSpec, r as Track, t as Key } from "./track.js";
|
|
2
2
|
import { r as TweenTarget } from "./targetRef.js";
|
|
3
3
|
|
|
4
4
|
//#region src/clip.d.ts
|
package/dist/clips.js
CHANGED
|
@@ -501,6 +501,50 @@ function partitionOpacity(tracks, opacityTarget) {
|
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
503
|
/**
|
|
504
|
+
* The same stable-sort + coincident-`t` later-wins dedup the opacity guard uses,
|
|
505
|
+
* factored out so the NON-opacity channels reconcile identically. Given keys
|
|
506
|
+
* already in merge order (earlier-emitted first), sort by `t` keeping that order
|
|
507
|
+
* at ties, then collapse a coincident-`t` run to its LAST key. Pure.
|
|
508
|
+
*/
|
|
509
|
+
function reconcileKeys(keys) {
|
|
510
|
+
const sorted = stableSortByT(keys);
|
|
511
|
+
const deduped = [];
|
|
512
|
+
for (const k of sorted) {
|
|
513
|
+
const last = deduped[deduped.length - 1];
|
|
514
|
+
if (last && last.t === k.t) deduped[deduped.length - 1] = k;
|
|
515
|
+
else deduped.push(k);
|
|
516
|
+
}
|
|
517
|
+
return deduped;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Reconcile the enter's then the exit's NON-opacity tracks per target. When enter
|
|
521
|
+
* AND exit animate the SAME non-opacity channel (e.g. both slide `position` — a
|
|
522
|
+
* slide-in-hold-slide-out), emit ONE track per target whose keys are the enter's
|
|
523
|
+
* then the exit's, fused with the SAME stable-sort + later-wins dedup as opacity:
|
|
524
|
+
* at a coincident `t` (the enter's settle vs the exit's start) the exit wins, so
|
|
525
|
+
* the merged ramp is continuous and no key is silently dropped by
|
|
526
|
+
* `compileTimeline`'s `coalesce()`. Disjoint targets pass straight through.
|
|
527
|
+
* Output order is stable: first appearance across [enterRest, exitRest].
|
|
528
|
+
*/
|
|
529
|
+
function reconcileNonOpacity(enterRest, exitRest) {
|
|
530
|
+
const order = [];
|
|
531
|
+
const byTarget = /* @__PURE__ */ new Map();
|
|
532
|
+
for (const tr of [...enterRest, ...exitRest]) {
|
|
533
|
+
const bucket = byTarget.get(tr.target);
|
|
534
|
+
if (bucket) bucket.push(tr);
|
|
535
|
+
else {
|
|
536
|
+
byTarget.set(tr.target, [tr]);
|
|
537
|
+
order.push(tr.target);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return order.map((target) => {
|
|
541
|
+
const group = byTarget.get(target);
|
|
542
|
+
if (group.length === 1) return group[0];
|
|
543
|
+
const merged = group.flatMap((tr) => tr.keys);
|
|
544
|
+
return track(target, group[0].type, reconcileKeys(merged));
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
504
548
|
* Schedule a node's enter/exit presence. Emits keyed `Track[]` only.
|
|
505
549
|
*
|
|
506
550
|
* presence('card', { show: 1, hide: 5 }) // fade in at 1, fade out to land on 5
|
|
@@ -538,19 +582,8 @@ function presence(nodeId, opts) {
|
|
|
538
582
|
else overlay.push(key(show, 0), key(enterEnd, 1));
|
|
539
583
|
if (exitOpacity.length > 0) for (const k of exitOpacity) overlay.push(k);
|
|
540
584
|
else overlay.push(key(exitStart, 1), key(hide, 0));
|
|
541
|
-
const sorted = stableSortByT([...bareGuard, ...overlay]);
|
|
542
|
-
const deduped = [];
|
|
543
|
-
for (const k of sorted) {
|
|
544
|
-
const last = deduped[deduped.length - 1];
|
|
545
|
-
if (last && last.t === k.t) deduped[deduped.length - 1] = k;
|
|
546
|
-
else deduped.push(k);
|
|
547
|
-
}
|
|
548
585
|
return {
|
|
549
|
-
tracks: [
|
|
550
|
-
track(opacityTarget, "number", deduped),
|
|
551
|
-
...enterRest,
|
|
552
|
-
...exitRest
|
|
553
|
-
],
|
|
586
|
+
tracks: [track(opacityTarget, "number", reconcileKeys([...bareGuard, ...overlay])), ...reconcileNonOpacity(enterRest, exitRest)],
|
|
554
587
|
end: hide,
|
|
555
588
|
shownAt: show,
|
|
556
589
|
hiddenAt: hide
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as cubicBezier, A as getValueType, B as vec2Equals, C as UnknownValueTypeError, D as Vec2, E as ValueTypeInferenceError, F as pathType, G as spring, H as RetargetSpring, I as registerValueType, J as springPresets, K as springEasing, L as reprOf, M as listValueTypes, N as numberType, O as booleanType, P as paintType, Q as UnknownEasingError, R as stringType, S as PathValue, T as ValueTypeId, U as SpringConfig, V as vec2Type, W as SpringEase, X as EaseSpec, Y as DEFAULT_EASE, Z as EasingFn, _ as MeshInterpolation, a as key, b as Paint, c as sampleTrack, d as track, et as cubicBezierDerivative, f as validateTrack, g as HandoffKind, h as GradientInterpolation, i as TrackValidationError, j as inferValueType, k as colorType, l as springTo, m as ColorStop, n as KeyOpts, nt as easings, o as resolveEase, p as velocityAt, q as springEasingDerivative, r as Track, rt as namedEasing, s as resolveEaseDerivative, t as Key, tt as easingDerivatives, u as stagger, v as MeshPaint, w as ValueType, x as PathContour, y as MeshPoint, z as vec2ArcType } from "./track.js";
|
|
2
2
|
import { a as isEditableNodeId, i as UnresolvableTargetError, n as TargetCarrier, o as resolveTweenTarget, r as TweenTarget, s as targetNodeId, t as TARGET_PATH } from "./targetRef.js";
|
|
3
3
|
import { _ as setDevWarning, a as FontFaceRef, c as Marker, d as TimelineValidationError, f as audioOffsetSamples, g as emitDevWarning, h as DevWarning, i as CompiledTimeline, l as Timeline, m as isDurationEditable, n as AudioClip, o as GainEnvelope, p as compileTimeline, r as ChildEntry, s as Json, t as AssetRef, u as TimelineInit } from "./timeline.js";
|
|
4
4
|
import { _ as setSidecarTrack, a as SidecarOrphan, c as SidecarVersionError, d as emptySidecar, f as hashKeys, g as normalizeEditedKeys, h as migrateSidecar, i as SidecarDocV1, l as assignKeyIds, m as mergeSidecarDetailed, n as OrphanReason, o as SidecarTimelineEntry, p as mergeSidecar, r as SidecarDoc, s as SidecarTrackEntry, t as MergeResult, u as deleteSidecarTrack } from "./sidecar.js";
|
|
@@ -249,13 +249,22 @@ interface StaggerSpec<T = unknown> {
|
|
|
249
249
|
ease?: EaseSpec;
|
|
250
250
|
}
|
|
251
251
|
/**
|
|
252
|
-
* Stagger placement.
|
|
253
|
-
*
|
|
254
|
-
*
|
|
252
|
+
* Stagger placement.
|
|
253
|
+
*
|
|
254
|
+
* `each` is the per-target delay. A number gives the uniform cascade
|
|
255
|
+
* `d_i = rank_i * each` (the common case). A function `(rank, count) => seconds`
|
|
256
|
+
* maps each target's rank (and the group size) to its own delay, so accelerating
|
|
257
|
+
* / decelerating / eased cascades are author-controlled (GSAP parity). The
|
|
258
|
+
* function must return a finite number for every target.
|
|
259
|
+
*
|
|
260
|
+
* `anchor` picks the placement the cascade ranks outward from — note this is the
|
|
261
|
+
* placement axis, distinct from `StaggerSpec.from` (the start VALUE that routes a
|
|
262
|
+
* target through `fromTo`). `at` places the whole group's base position
|
|
263
|
+
* (defaults to the chain end).
|
|
255
264
|
*/
|
|
256
265
|
interface StaggerOpts {
|
|
257
|
-
each: number;
|
|
258
|
-
|
|
266
|
+
each: number | ((rank: number, count: number) => number);
|
|
267
|
+
anchor?: 'start' | 'end' | 'center' | 'edges' | number;
|
|
259
268
|
at?: Position;
|
|
260
269
|
}
|
|
261
270
|
interface TimelineBuilder {
|
|
@@ -264,12 +273,15 @@ interface TimelineBuilder {
|
|
|
264
273
|
/**
|
|
265
274
|
* Build-time sugar: loop the shipped `to`/`fromTo` emission over `targets`,
|
|
266
275
|
* cascading each by a per-rank delay. Emits keys byte-identical to N
|
|
267
|
-
* hand-authored offset tweens. The `
|
|
268
|
-
*
|
|
276
|
+
* hand-authored offset tweens. The `anchor` ranks targets over their array
|
|
277
|
+
* index i (n = targets.length, c = (n-1)/2): `'start'` → i; `'end'` →
|
|
269
278
|
* (n-1)-i; `'center'` → round(|i-c|); `'edges'` → round(c-|i-c|); numeric k →
|
|
270
|
-
* round(|i-k|).
|
|
271
|
-
* `
|
|
272
|
-
*
|
|
279
|
+
* round(|i-k|). The delay is `d_i = rank_i * each` for a numeric `each`, or
|
|
280
|
+
* `d_i = each(rank_i, n)` for a function `each` (accel/decel/eased cascades).
|
|
281
|
+
* Each target is inserted at `base + d_i` where `base = resolvePosition(opts.at)`.
|
|
282
|
+
* The group reads as one block to a following `'<'`/`'>'`/`'+='` step (its
|
|
283
|
+
* bounds are the true min/max delay, so a backward/non-uniform spread reports
|
|
284
|
+
* honestly to the cursor).
|
|
273
285
|
*/
|
|
274
286
|
stagger<T>(targets: TweenTarget[], spec: StaggerSpec<T>, opts: StaggerOpts): TimelineBuilder;
|
|
275
287
|
/** Hold key: the value snaps at the resolved position (§2.6). */
|
|
@@ -439,4 +451,4 @@ interface CheckpointedSim {
|
|
|
439
451
|
}
|
|
440
452
|
declare function bakeCheckpointed<W, S = W>(cfg: CheckpointedBakeConfig<W, S>): CheckpointedSim;
|
|
441
453
|
//#endregion
|
|
442
|
-
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindTarget, BindTypeMismatchError, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type ColorStop, type CompiledTimeline, type CoverageReport, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type FontFaceRef, type FontMode, type FontRegistry, type FontUsage, FontValidationError, type GainEnvelope, type GradientInterpolation, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type MergeResult, type MeshInterpolation, type MeshPaint, type MeshPoint, type MissingGlyphs, type OkLab, type OrphanReason, type Paint, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type ResolvedFace, type RetargetSpring, type Rgba, type Rng, type Scheduler, type SidecarDoc, type SidecarDocV1, type SidecarOrphan, type SidecarTimelineEntry, type SidecarTrackEntry, SidecarVersionError, type Signal, type SignalOptions, type SpringConfig, type SpringEase, type StaggerOpts, type StaggerSpec, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValidateFontsOptions, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Component, type Vec2Signal, WriteDuringEvaluationError, assignKeyIds, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, deleteSidecarTrack, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, hashKeys, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, mergeSidecar, mergeSidecarDetailed, migrateSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, setSidecarTrack, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
454
|
+
export { type AssetRef, type AudioClip, type BakeConfig, BakeError, type BindTarget, BindTypeMismatchError, type BindableSignal, type BoundTimeline, type CheckpointedBakeConfig, type CheckpointedSim, type ChildEntry, CircularDependencyError, ColorParseError, type ColorStop, type CompiledTimeline, type CoverageReport, type CurveSampler, DEFAULT_EASE, type DevWarning, type EaseSpec, type EasingFn, type Equals, type FontFaceRef, type FontMode, type FontRegistry, type FontUsage, FontValidationError, type GainEnvelope, type GradientInterpolation, type HandoffKind, type Json, type Key, type KeyOpts, type Marker, type MergeResult, type MeshInterpolation, type MeshPaint, type MeshPoint, type MissingGlyphs, type OkLab, type OrphanReason, type Paint, type PathContour, type PathValue, type Playhead, type Position, PositionError, type ReadonlySignal, type ResolvedFace, type RetargetSpring, type Rgba, type Rng, type Scheduler, type SidecarDoc, type SidecarDocV1, type SidecarOrphan, type SidecarTimelineEntry, type SidecarTrackEntry, SidecarVersionError, type Signal, type SignalOptions, type SpringConfig, type SpringEase, type StaggerOpts, type StaggerSpec, TARGET_PATH, type TargetCarrier, type Timeline, type TimelineBuilder, type TimelineInit, TimelineValidationError, type Track, TrackValidationError, type TweenOpts, type TweenTarget, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, type ValidateFontsOptions, type ValueType, type ValueTypeId, ValueTypeInferenceError, type Vec2, type Vec2Component, type Vec2Signal, WriteDuringEvaluationError, assignKeyIds, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, deleteSidecarTrack, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, hashKeys, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, mergeSidecar, mergeSidecarDetailed, migrateSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, setSidecarTrack, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as vec2Equals, B as spring, C as numberType, D as reprOf, E as registerValueType, F as oklabToRgba, G as UnknownEasingError, H as springEasingDerivative, I as parseColor, J as easingDerivatives, K as cubicBezier, L as rgbaToOklab, M as ColorParseError, N as formatColor, O as stringType, P as lerpColor, R as emitDevWarning, S as listValueTypes, T as pathType, U as springPresets, V as springEasing, W as DEFAULT_EASE, X as namedEasing, Y as easings, _ as ValueTypeInferenceError, a as targetNodeId, b as getValueType, c as resolveEase, d as springTo, f as stagger, g as UnknownValueTypeError, h as velocityAt, i as resolveTweenTarget, j as vec2Type, k as vec2ArcType, l as resolveEaseDerivative, m as validateTrack, n as UnresolvableTargetError, o as TrackValidationError, p as track, q as cubicBezierDerivative, r as isEditableNodeId, s as key, t as TARGET_PATH, u as sampleTrack, v as booleanType, w as paintType, x as inferValueType, y as colorType, z as setDevWarning } from "./targetRef.js";
|
|
2
2
|
import { t as parseCmap } from "./cmap.js";
|
|
3
|
-
import { a as hashKeys, c as migrateSidecar, d as TimelineValidationError, f as audioOffsetSamples, h as
|
|
3
|
+
import { _ as timeline$1, a as hashKeys, c as migrateSidecar, d as TimelineValidationError, f as audioOffsetSamples, g as namespaceCallName, h as isDurationEditable, i as emptySidecar, l as normalizeEditedKeys, m as compileTimeline, n as assignKeyIds, o as mergeSidecar, p as callMarkerPrefix, r as deleteSidecarTrack, s as mergeSidecarDetailed, t as SidecarVersionError, u as setSidecarTrack } from "./sidecar.js";
|
|
4
4
|
//#region src/ticker.ts
|
|
5
5
|
/** The default scheduler: flush synchronously, preserving pre-ticker timing. */
|
|
6
6
|
const synchronousScheduler = (flush) => flush();
|
|
@@ -647,30 +647,44 @@ function buildTimeline(build, init = {}) {
|
|
|
647
647
|
const n = targets.length;
|
|
648
648
|
const base = resolvePosition(opts.at);
|
|
649
649
|
const c = (n - 1) / 2;
|
|
650
|
+
const { anchor = "start", each } = opts;
|
|
651
|
+
const finite = (v) => {
|
|
652
|
+
if (!Number.isFinite(v)) throw new TimelineValidationError(`stagger: non-finite each/anchor (${String(v)})`);
|
|
653
|
+
return v;
|
|
654
|
+
};
|
|
655
|
+
if (typeof anchor === "number") finite(anchor);
|
|
656
|
+
if (typeof each === "number") finite(each);
|
|
650
657
|
const rankOf = (i) => {
|
|
651
|
-
|
|
652
|
-
if (
|
|
653
|
-
if (
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
return Math.round(Math.abs(i - f));
|
|
658
|
+
if (anchor === "start") return i;
|
|
659
|
+
if (anchor === "end") return n - 1 - i;
|
|
660
|
+
if (anchor === "center") return Math.round(Math.abs(i - c));
|
|
661
|
+
if (anchor === "edges") return Math.round(c - Math.abs(i - c));
|
|
662
|
+
return Math.round(Math.abs(i - anchor));
|
|
657
663
|
};
|
|
658
|
-
const
|
|
659
|
-
|
|
664
|
+
const delayOf = (rank) => finite(typeof each === "function" ? each(rank, n) : rank * each);
|
|
665
|
+
const ease = spec.ease;
|
|
666
|
+
const effDur = typeof ease === "object" && ease !== null && ease.kind === "spring" ? spring.duration(ease) : spec.duration ?? 1;
|
|
660
667
|
const tweenOpts = (d) => ({
|
|
661
668
|
at: base + d,
|
|
662
669
|
...spec.duration !== void 0 ? { duration: spec.duration } : {},
|
|
663
670
|
...spec.ease !== void 0 ? { ease: spec.ease } : {}
|
|
664
671
|
});
|
|
672
|
+
let minDelay = 0;
|
|
673
|
+
let maxDelay = 0;
|
|
665
674
|
for (let i = 0; i < n; i++) {
|
|
666
|
-
const d = rankOf(i)
|
|
667
|
-
if (d
|
|
675
|
+
const d = delayOf(rankOf(i));
|
|
676
|
+
if (i === 0 || d < minDelay) minDelay = d;
|
|
677
|
+
if (i === 0 || d > maxDelay) maxDelay = d;
|
|
678
|
+
const start = base + d;
|
|
679
|
+
if (start < 0) throw new TimelineValidationError(`stagger: target would land at t=${start} (< 0); shift opts.at`);
|
|
668
680
|
const t = targets[i];
|
|
669
681
|
if (spec.from !== void 0) builder.fromTo(t, spec.from, spec.to, tweenOpts(d));
|
|
670
682
|
else builder.to(t, spec.to, tweenOpts(d));
|
|
671
683
|
}
|
|
672
|
-
|
|
673
|
-
|
|
684
|
+
if (n > 0) {
|
|
685
|
+
prevStart = base + minDelay;
|
|
686
|
+
prevEnd = base + maxDelay + effDur;
|
|
687
|
+
}
|
|
674
688
|
return builder;
|
|
675
689
|
},
|
|
676
690
|
set(target, value, opts = {}) {
|
|
@@ -704,8 +718,10 @@ function buildTimeline(build, init = {}) {
|
|
|
704
718
|
_pos: at
|
|
705
719
|
};
|
|
706
720
|
if (opts.timeScale !== void 0) entry.timeScale = opts.timeScale;
|
|
721
|
+
const childIndex = children.length;
|
|
707
722
|
children.push(entry);
|
|
708
|
-
|
|
723
|
+
const prefix = callMarkerPrefix(childIndex);
|
|
724
|
+
for (const [name, fn] of getTimelineCallbacks(child)) callbacks.set(namespaceCallName(name, prefix), fn);
|
|
709
725
|
const scale = mode === "sync" ? opts.timeScale ?? 1 : 1;
|
|
710
726
|
prevStart = start;
|
|
711
727
|
prevEnd = start + compileTimeline(child).duration / scale;
|
|
@@ -1047,4 +1063,4 @@ function bakeCheckpointed(cfg) {
|
|
|
1047
1063
|
};
|
|
1048
1064
|
}
|
|
1049
1065
|
//#endregion
|
|
1050
|
-
export { BakeError, BindTypeMismatchError, CircularDependencyError, ColorParseError, DEFAULT_EASE, FontValidationError, PositionError, SidecarVersionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, assignKeyIds, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, deleteSidecarTrack, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, hashKeys, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, mergeSidecar, mergeSidecarDetailed, migrateSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, setSidecarTrack, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
|
1066
|
+
export { BakeError, BindTypeMismatchError, CircularDependencyError, ColorParseError, DEFAULT_EASE, FontValidationError, PositionError, SidecarVersionError, TARGET_PATH, TimelineValidationError, TrackValidationError, UnboundTargetError, UnknownEasingError, UnknownValueTypeError, UnresolvableTargetError, ValueTypeInferenceError, WriteDuringEvaluationError, assignKeyIds, audioOffsetSamples, bake, bakeCheckpointed, batch, beginReadPhase, bindTimeline, booleanType, buildFontRegistry, buildTimeline, colorType, compileTimeline, computed, createPlayhead, cubicBezier, cubicBezierDerivative, deleteSidecarTrack, easingDerivatives, easings, emitDevWarning, emptySidecar, endReadPhase, evaluateAt, formatColor, getTimelineCallbacks, getValueType, hashKeys, inReadPhase, inferValueType, isDurationEditable, isEditableNodeId, isExemptFamily, key, lerpColor, listValueTypes, mergeSidecar, mergeSidecarDetailed, migrateSidecar, namedEasing, normalizeEditedKeys, numberType, oklabToRgba, paintType, parseCmap, parseColor, pathType, random, registerValueType, reprOf, resolveEase, resolveEaseDerivative, resolveTweenTarget, rgbaToOklab, sampleTrack, setDevWarning, setScheduler, setSidecarTrack, signal, spring, springEasing, springEasingDerivative, springPresets, springTo, stagger, stringType, synchronousScheduler, targetNodeId, timeline, track, untracked, validateFonts, validateTrack, vec2ArcType, vec2Equals, vec2Signal, vec2Type, velocityAt };
|
package/dist/sidecar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as spring, R as emitDevWarning, a as targetNodeId, m as validateTrack, o as TrackValidationError, r as isEditableNodeId } from "./targetRef.js";
|
|
2
2
|
//#region src/timeline.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Timeline document (DESIGN.md §2.3) — the serializable animation source
|
|
@@ -53,6 +53,24 @@ function rebaseKeys(keys, at, timeScale) {
|
|
|
53
53
|
t: at + k.t / timeScale
|
|
54
54
|
}));
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* `.call()` markers carry an auto-assigned `call:N` name whose counter resets
|
|
58
|
+
* per document, so two sibling sub-timelines that each define a `.call()` would
|
|
59
|
+
* collide on `call:0` when rebased into one parent (one callback dropped, the
|
|
60
|
+
* other double-firing). We namespace a child's `call:*` markers by the child's
|
|
61
|
+
* position PATH in the parent (`c<index>/…`), and the builder's `add()` applies
|
|
62
|
+
* the EXACT same prefix when forwarding the child's name→fn map — so the rebased
|
|
63
|
+
* marker name and the registered callback key agree by construction. Only
|
|
64
|
+
* `call:*` names are rewritten; author-named cues keep their names. Both surfaces
|
|
65
|
+
* call these so the convention lives in one place.
|
|
66
|
+
*/
|
|
67
|
+
function callMarkerPrefix(childIndex) {
|
|
68
|
+
return `c${childIndex}/`;
|
|
69
|
+
}
|
|
70
|
+
const CALL = /(^|\/)call:\d+$/;
|
|
71
|
+
function namespaceCallName(name, prefix) {
|
|
72
|
+
return prefix !== "" && CALL.test(name) ? prefix + name : name;
|
|
73
|
+
}
|
|
56
74
|
function flatten(doc, at, timeScale, unit, out, counter) {
|
|
57
75
|
for (const tr of doc.tracks) {
|
|
58
76
|
validateTrack(tr);
|
|
@@ -136,13 +154,15 @@ function compileTimeline(doc) {
|
|
|
136
154
|
const labels = { ...doc.labels };
|
|
137
155
|
const markers = [...doc.markers ?? []];
|
|
138
156
|
const audio = [...doc.audio ?? []];
|
|
139
|
-
const visitChildren = (children, at, scale) => {
|
|
140
|
-
|
|
157
|
+
const visitChildren = (children, at, scale, prefix) => {
|
|
158
|
+
(children ?? []).forEach((child, index) => {
|
|
141
159
|
const base = at + child.at / scale;
|
|
142
160
|
const childScale = scale * (child.mode === "sync" ? child.timeScale ?? 1 : 1);
|
|
161
|
+
const childPrefix = prefix + callMarkerPrefix(index);
|
|
143
162
|
for (const [name, t] of Object.entries(child.timeline.labels ?? {})) if (!(name in labels)) labels[name] = base + t / childScale;
|
|
144
163
|
for (const m of child.timeline.markers ?? []) markers.push({
|
|
145
164
|
...m,
|
|
165
|
+
name: namespaceCallName(m.name, childPrefix),
|
|
146
166
|
t: base + m.t / childScale
|
|
147
167
|
});
|
|
148
168
|
for (const clip of child.timeline.audio ?? []) audio.push({
|
|
@@ -150,10 +170,10 @@ function compileTimeline(doc) {
|
|
|
150
170
|
at: base + clip.at / childScale,
|
|
151
171
|
...childScale !== 1 ? { playbackRate: (clip.playbackRate ?? 1) * childScale } : {}
|
|
152
172
|
});
|
|
153
|
-
visitChildren(child.timeline.children, base, childScale);
|
|
154
|
-
}
|
|
173
|
+
visitChildren(child.timeline.children, base, childScale, childPrefix);
|
|
174
|
+
});
|
|
155
175
|
};
|
|
156
|
-
visitChildren(doc.children, 0, 1);
|
|
176
|
+
visitChildren(doc.children, 0, 1, "");
|
|
157
177
|
markers.sort((a, b) => a.t - b.t);
|
|
158
178
|
audio.sort((a, b) => a.at - b.at);
|
|
159
179
|
return {
|
|
@@ -391,4 +411,4 @@ function normalizeEditedKeys(keys) {
|
|
|
391
411
|
return out;
|
|
392
412
|
}
|
|
393
413
|
//#endregion
|
|
394
|
-
export { hashKeys as a, migrateSidecar as c, TimelineValidationError as d, audioOffsetSamples as f,
|
|
414
|
+
export { timeline as _, hashKeys as a, migrateSidecar as c, TimelineValidationError as d, audioOffsetSamples as f, namespaceCallName as g, isDurationEditable as h, emptySidecar as i, normalizeEditedKeys as l, compileTimeline as m, assignKeyIds as n, mergeSidecar as o, callMarkerPrefix as p, deleteSidecarTrack as r, mergeSidecarDetailed as s, SidecarVersionError as t, setSidecarTrack as u };
|
package/dist/studioHost.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as ValueTypeId,
|
|
1
|
+
import { T as ValueTypeId, X as EaseSpec, t as Key } from "./track.js";
|
|
2
2
|
import { a as isEditableNodeId, s as targetNodeId } from "./targetRef.js";
|
|
3
3
|
import { l as Timeline } from "./timeline.js";
|
|
4
4
|
import { a as SidecarOrphan, r as SidecarDoc } from "./sidecar.js";
|
package/dist/targetRef.js
CHANGED
|
@@ -491,6 +491,16 @@ function getValueType(id) {
|
|
|
491
491
|
return vt;
|
|
492
492
|
}
|
|
493
493
|
/**
|
|
494
|
+
* The ids of every currently-registered value type, in registration order
|
|
495
|
+
* (the built-ins first, then any custom `registerValueType` additions). The
|
|
496
|
+
* introspection seam `describe()` reads to list `valueTypes` from the REAL
|
|
497
|
+
* registry — so the manifest can't drift from what `evaluate()` can actually
|
|
498
|
+
* interpolate. Pure read; never touched by evaluate().
|
|
499
|
+
*/
|
|
500
|
+
function listValueTypes() {
|
|
501
|
+
return [...registry.keys()];
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
494
504
|
* Resolve a value-type id to its REPRESENTATION (the bind guard's compatibility
|
|
495
505
|
* key, §2.2): a type's `repr` (the built-in it's representationally compatible
|
|
496
506
|
* with), else the id itself. SINGLE-HOP — `repr` is never chained, so a custom
|
|
@@ -1030,4 +1040,4 @@ function resolveTweenTarget(target) {
|
|
|
1030
1040
|
return path;
|
|
1031
1041
|
}
|
|
1032
1042
|
//#endregion
|
|
1033
|
-
export {
|
|
1043
|
+
export { vec2Equals as A, spring as B, numberType as C, reprOf as D, registerValueType as E, oklabToRgba as F, UnknownEasingError as G, springEasingDerivative as H, parseColor as I, easingDerivatives as J, cubicBezier as K, rgbaToOklab as L, ColorParseError as M, formatColor as N, stringType as O, lerpColor as P, emitDevWarning as R, listValueTypes as S, pathType as T, springPresets as U, springEasing as V, DEFAULT_EASE as W, namedEasing as X, easings as Y, ValueTypeInferenceError as _, targetNodeId as a, getValueType as b, resolveEase as c, springTo as d, stagger as f, UnknownValueTypeError as g, velocityAt as h, resolveTweenTarget as i, vec2Type as j, vec2ArcType as k, resolveEaseDerivative as l, validateTrack as m, UnresolvableTargetError as n, TrackValidationError as o, track as p, cubicBezierDerivative as q, isEditableNodeId as r, key as s, TARGET_PATH as t, sampleTrack as u, booleanType as v, paintType as w, inferValueType as x, colorType as y, setDevWarning as z };
|
package/dist/timeline.d.ts
CHANGED
|
@@ -128,6 +128,18 @@ interface CompiledTimeline {
|
|
|
128
128
|
* and the other to raw float seconds. Default rate is the canonical mix grid.
|
|
129
129
|
*/
|
|
130
130
|
declare function audioOffsetSamples(at: number, sampleRate?: number): number;
|
|
131
|
+
/**
|
|
132
|
+
* `.call()` markers carry an auto-assigned `call:N` name whose counter resets
|
|
133
|
+
* per document, so two sibling sub-timelines that each define a `.call()` would
|
|
134
|
+
* collide on `call:0` when rebased into one parent (one callback dropped, the
|
|
135
|
+
* other double-firing). We namespace a child's `call:*` markers by the child's
|
|
136
|
+
* position PATH in the parent (`c<index>/…`), and the builder's `add()` applies
|
|
137
|
+
* the EXACT same prefix when forwarding the child's name→fn map — so the rebased
|
|
138
|
+
* marker name and the registered callback key agree by construction. Only
|
|
139
|
+
* `call:*` names are rewritten; author-named cues keep their names. Both surfaces
|
|
140
|
+
* call these so the convention lives in one place.
|
|
141
|
+
*/
|
|
142
|
+
|
|
131
143
|
/**
|
|
132
144
|
* Studio reader (§6.2 rule 4): is this timeline's duration opted into editor
|
|
133
145
|
* editing? Code-owned and read-only by default; `editableDuration()` flips it.
|
package/dist/track.d.ts
CHANGED
|
@@ -175,6 +175,14 @@ declare class UnknownValueTypeError extends Error {
|
|
|
175
175
|
constructor(id: string);
|
|
176
176
|
}
|
|
177
177
|
declare function getValueType<T = unknown>(id: ValueTypeId): ValueType<T>;
|
|
178
|
+
/**
|
|
179
|
+
* The ids of every currently-registered value type, in registration order
|
|
180
|
+
* (the built-ins first, then any custom `registerValueType` additions). The
|
|
181
|
+
* introspection seam `describe()` reads to list `valueTypes` from the REAL
|
|
182
|
+
* registry — so the manifest can't drift from what `evaluate()` can actually
|
|
183
|
+
* interpolate. Pure read; never touched by evaluate().
|
|
184
|
+
*/
|
|
185
|
+
declare function listValueTypes(): string[];
|
|
178
186
|
/**
|
|
179
187
|
* Resolve a value-type id to its REPRESENTATION (the bind guard's compatibility
|
|
180
188
|
* key, §2.2): a type's `repr` (the built-in it's representationally compatible
|
|
@@ -344,4 +352,4 @@ declare function velocityAt<T>(tr: Track<T>, t: number): T | null;
|
|
|
344
352
|
/** Pure sample of a track at time t (§2.4). */
|
|
345
353
|
declare function sampleTrack<T>(tr: Track<T>, t: number): T;
|
|
346
354
|
//#endregion
|
|
347
|
-
export {
|
|
355
|
+
export { cubicBezier as $, getValueType as A, vec2Equals as B, UnknownValueTypeError as C, Vec2 as D, ValueTypeInferenceError as E, pathType as F, spring as G, RetargetSpring as H, registerValueType as I, springPresets as J, springEasing as K, reprOf as L, listValueTypes as M, numberType as N, booleanType as O, paintType as P, UnknownEasingError as Q, stringType as R, PathValue as S, ValueTypeId as T, SpringConfig as U, vec2Type as V, SpringEase as W, EaseSpec as X, DEFAULT_EASE as Y, EasingFn as Z, MeshInterpolation as _, key as a, Paint as b, sampleTrack as c, track as d, cubicBezierDerivative as et, validateTrack as f, HandoffKind as g, GradientInterpolation as h, TrackValidationError as i, inferValueType as j, colorType as k, springTo as l, ColorStop as m, KeyOpts as n, easings as nt, resolveEase as o, velocityAt as p, springEasingDerivative as q, Track as r, namedEasing as rt, resolveEaseDerivative as s, Key as t, easingDerivatives as tt, stagger as u, MeshPaint as v, ValueType as w, PathContour as x, MeshPoint as y, vec2ArcType as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/core",
|
|
3
|
-
"version": "0.18.0-pre.
|
|
3
|
+
"version": "0.18.0-pre.5",
|
|
4
4
|
"description": "glissade core: signals, tracks, timeline document, evaluation, easing, springs, seeded RNG. Zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|