@glissade/core 0.23.0-pre.4 → 0.23.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/dist/index.d.ts CHANGED
@@ -238,6 +238,14 @@ interface TweenOpts<T = unknown> {
238
238
  at?: Position;
239
239
  /** Explicit start value — sugar for fromTo; required ergonomics for string targets. */
240
240
  from?: T;
241
+ /**
242
+ * Explicit value type — the escape hatch for when `inferValueType(value)` can't
243
+ * tell what a value is (a structured map like `fontAxes`'s `{ wght: 700 }`, or a
244
+ * `number`-under-a-custom-id). Overrides inference for this target's whole track,
245
+ * e.g. `to('hero/fontAxes', { wght: 900 }, { type: 'fontAxes' })`. Two different
246
+ * explicit types on the same target throw (one track has one type).
247
+ */
248
+ type?: ValueTypeId;
241
249
  }
242
250
  /** The shared tween shape applied to every staggered target (§2.6 stagger sugar). */
243
251
  interface StaggerSpec<T = unknown> {
@@ -309,9 +317,11 @@ interface TimelineBuilder {
309
317
  tracks(tracks: Track[] | {
310
318
  tracks: Track[];
311
319
  }): TimelineBuilder;
312
- /** Hold key: the value snaps at the resolved position (§2.6). */
320
+ /** Hold key: the value snaps at the resolved position (§2.6). `type` is the
321
+ * value-type escape hatch (see {@link TweenOpts.type}). */
313
322
  set<T>(target: TweenTarget, value: T, opts?: {
314
323
  at?: Position;
324
+ type?: ValueTypeId;
315
325
  }): TimelineBuilder;
316
326
  label(name: string, at?: Position): TimelineBuilder;
317
327
  add(child: Timeline, at?: Position, opts?: {
package/dist/index.js CHANGED
@@ -597,9 +597,10 @@ const TO_OPTS_KEYS = [
597
597
  "duration",
598
598
  "ease",
599
599
  "at",
600
- "from"
600
+ "from",
601
+ "type"
601
602
  ];
602
- const SET_OPTS_KEYS = ["at"];
603
+ const SET_OPTS_KEYS = ["at", "type"];
603
604
  const STAGGER_SPEC_KEYS = [
604
605
  "to",
605
606
  "from",
@@ -666,6 +667,7 @@ function buildTimeline(build, init = {}) {
666
667
  start
667
668
  };
668
669
  if (opts.from !== void 0) ins.explicitFrom = opts.from;
670
+ if (opts.type !== void 0) ins.valueType = opts.type;
669
671
  insertions.push(ins);
670
672
  prevStart = start;
671
673
  prevEnd = start + duration;
@@ -729,7 +731,7 @@ function buildTimeline(build, init = {}) {
729
731
  set(target, value, opts = {}) {
730
732
  rejectUnknownOpts("set", opts, SET_OPTS_KEYS);
731
733
  const start = resolvePosition(opts.at);
732
- insertions.push({
734
+ const ins = {
733
735
  kind: "set",
734
736
  target: resolveTweenTarget(target),
735
737
  value,
@@ -739,7 +741,9 @@ function buildTimeline(build, init = {}) {
739
741
  baseValue: peekBase(target),
740
742
  editable: false,
741
743
  start
742
- });
744
+ };
745
+ if (opts.type !== void 0) ins.valueType = opts.type;
746
+ insertions.push(ins);
743
747
  prevStart = start;
744
748
  prevEnd = start;
745
749
  return builder;
@@ -879,9 +883,11 @@ function buildTimeline(build, init = {}) {
879
883
  if (last && last.t === k.t) deduped[deduped.length - 1] = k;
880
884
  else deduped.push(k);
881
885
  }
886
+ const explicitTypes = [...new Set(list.filter((i) => i.valueType !== void 0).map((i) => i.valueType))];
887
+ if (explicitTypes.length > 1) throw new TimelineValidationError(`'${target}': conflicting explicit value types [${explicitTypes.join(", ")}] on one target — a track has a single value type`);
882
888
  const tr = {
883
889
  target,
884
- type: inferValueType(list[0].value),
890
+ type: explicitTypes[0] ?? inferValueType(list[0].value),
885
891
  keys: deduped
886
892
  };
887
893
  if (editable) tr.editable = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/core",
3
- "version": "0.23.0-pre.4",
3
+ "version": "0.23.0",
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": {