@glissade/core 0.18.0-pre.0 → 0.18.0-pre.2

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/index.d.ts CHANGED
@@ -281,6 +281,24 @@ interface TimelineBuilder {
281
281
  mode?: 'add' | 'sync';
282
282
  timeScale?: number;
283
283
  }): TimelineBuilder;
284
+ /**
285
+ * Build-time sugar: chain N 0-relative sub-timelines end-to-end. Each sub is
286
+ * `add()`ed at the running chain end (`prevEnd`); a scalar `gap` inserts slack
287
+ * between consecutive subs. Because `add()` advances the cursor by each sub's
288
+ * compiled duration, changing one sub's internal duration auto-shifts the
289
+ * rest. Emits ordinary ChildEntry rows — byte-identical to a hand-written
290
+ * `add(a); add(b, '+=gap'); add(c, '+=gap')` chain. (Negative `gap` overlaps
291
+ * arithmetically; it does NOT synthesize crossfades.)
292
+ */
293
+ sequence(subs: Timeline[], opts?: {
294
+ gap?: number;
295
+ }): TimelineBuilder;
296
+ /**
297
+ * Build-time sugar: place a 0-relative sub-timeline at an absolute parent time
298
+ * — `at(time, sub)` is exactly `add(sub, time)` (a numeric Position resolves to
299
+ * itself). The `at` here is a builder method, distinct from `TweenOpts.at`.
300
+ */
301
+ at(time: number, sub: Timeline): TimelineBuilder;
284
302
  /** Compiles to a marker; the callback is Player-registered, never serialized (§4.2). */
285
303
  call(fn: () => void, at?: Position): TimelineBuilder;
286
304
  /**
package/dist/index.js CHANGED
@@ -705,11 +705,21 @@ function buildTimeline(build, init = {}) {
705
705
  };
706
706
  if (opts.timeScale !== void 0) entry.timeScale = opts.timeScale;
707
707
  children.push(entry);
708
+ for (const [name, fn] of getTimelineCallbacks(child)) if (!callbacks.has(name)) callbacks.set(name, fn);
708
709
  const scale = mode === "sync" ? opts.timeScale ?? 1 : 1;
709
710
  prevStart = start;
710
711
  prevEnd = start + compileTimeline(child).duration / scale;
711
712
  return builder;
712
713
  },
714
+ sequence(subs, opts = {}) {
715
+ const gap = opts.gap ?? 0;
716
+ const rel = gap < 0 ? `-=${-gap}` : `+=${gap}`;
717
+ for (let i = 0; i < subs.length; i++) builder.add(subs[i], i === 0 ? void 0 : rel);
718
+ return builder;
719
+ },
720
+ at(time, sub) {
721
+ return builder.add(sub, time);
722
+ },
713
723
  call(fn, at) {
714
724
  const t = at === void 0 ? prevEnd : resolvePosition(at);
715
725
  const name = `call:${callCount++}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/core",
3
- "version": "0.18.0-pre.0",
3
+ "version": "0.18.0-pre.2",
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": {