@motion-script/core 0.2.0 → 0.2.4

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 (41) hide show
  1. package/dist/assets/manager.test.js +1 -1
  2. package/dist/attributes/layout/padding.test.js +1 -1
  3. package/dist/attributes/layout/vector2.test.js +1 -1
  4. package/dist/attributes/properties/decorator.test.js +1 -1
  5. package/dist/attributes/shape/corners/border-radius.test.js +1 -1
  6. package/dist/attributes/shape/effects/chain.test.js +1 -1
  7. package/dist/attributes/shape/fill/blend.test.js +1 -1
  8. package/dist/attributes/shape/fill/chain.test.js +1 -1
  9. package/dist/attributes/shape/fill/color/parser.test.js +1 -1
  10. package/dist/attributes/shape/fill/lerp.test.js +1 -1
  11. package/dist/attributes/shape/filters/chain.test.js +1 -1
  12. package/dist/attributes/shape/filters/registry.test.d.ts +4 -4
  13. package/dist/attributes/shape/filters/registry.test.js +5 -5
  14. package/dist/attributes/shape/path/bezier.test.js +1 -1
  15. package/dist/attributes/shape/path/dash.test.js +1 -1
  16. package/dist/attributes/shape/path/length.test.js +1 -1
  17. package/dist/attributes/shape/path/subpath.test.js +1 -1
  18. package/dist/attributes/text/lerp.test.js +1 -1
  19. package/dist/layout/flex.test.js +1 -1
  20. package/dist/layout/padding.test.js +1 -1
  21. package/dist/layout/size-resolver.test.js +1 -1
  22. package/dist/layout/tweens.test.js +1 -1
  23. package/dist/project/config.test.js +1 -1
  24. package/dist/render/descriptors/path.test.js +1 -1
  25. package/dist/runtime/playback-controller.test.js +1 -1
  26. package/dist/runtime/precompisition.test.js +1 -1
  27. package/dist/runtime/runtime.fixtures.d.ts +11 -11
  28. package/dist/runtime/runtime.fixtures.js +3 -3
  29. package/dist/runtime/state-evaluator.test.js +1 -1
  30. package/dist/signals/create.test.js +2 -2
  31. package/dist/signals/signal.test.js +3 -3
  32. package/dist/tween/eases.test.js +1 -1
  33. package/dist/tween/lerp.test.js +1 -1
  34. package/dist/tween/prepare.test.js +1 -1
  35. package/dist/tween/sequence.test.js +4 -4
  36. package/dist/tween/tween.test.js +1 -1
  37. package/dist/tween/wait.test.js +1 -1
  38. package/dist/util/clamp.test.js +1 -1
  39. package/dist/util/random.test.js +1 -1
  40. package/dist/util/reference.test.js +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { AssetManager } from '../assets/manager';
2
+ import { AssetManager } from '@/assets/manager';
3
3
  import { FakeStorageAdapter, FakeAudioDevice, asStorage, makePrecompResult, makeScenePrecomp, makeAssetTrack, makeImageRecord, makeAudioRequest, } from '../runtime/runtime.fixtures';
4
4
  const flush = () => new Promise((r) => setTimeout(r, 0));
5
5
  function setup(precomp = makePrecompResult({ scenes: [] })) {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { resolvePadding } from '../../attributes/layout/padding';
2
+ import { resolvePadding } from '@/attributes/layout/padding';
3
3
  describe('resolvePadding', () => {
4
4
  it('expands a single number to all four sides', () => {
5
5
  expect(resolvePadding(8)).toEqual({ left: 8, right: 8, top: 8, bottom: 8 });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { lerpVector2 } from '../../attributes/layout/vector2';
2
+ import { lerpVector2 } from '@/attributes/layout/vector2';
3
3
  describe('lerpVector2', () => {
4
4
  it('returns from at t=0', () => {
5
5
  expect(lerpVector2({ x: 1, y: 2 }, { x: 10, y: 20 }, 0)).toEqual({ x: 1, y: 2 });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { property, getPropertyMeta, PROPERTY_META } from '../../attributes/properties/decorator';
2
+ import { property, getPropertyMeta, PROPERTY_META } from '@/attributes/properties/decorator';
3
3
  describe('property decorator + getPropertyMeta', () => {
4
4
  it('registers a property with its default on the prototype', () => {
5
5
  class Node {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { isUniformBorderRadius, getUniformBorderRadius, isZeroBorderRadius, lerpBorderRadius, resolveBorderRadius, } from '../../../attributes/shape/corners/border-radius';
2
+ import { isUniformBorderRadius, getUniformBorderRadius, isZeroBorderRadius, lerpBorderRadius, resolveBorderRadius, } from '@/attributes/shape/corners/border-radius';
3
3
  const corners = (tl, tr, bl, br) => ({
4
4
  topLeft: tl, topRight: tr, bottomLeft: bl, bottomRight: br,
5
5
  });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { FX, resolveChainEffects } from '../../../attributes/shape/effects/chain';
2
+ import { FX, resolveChainEffects } from '@/attributes/shape/effects/chain';
3
3
  describe('FX builders', () => {
4
4
  it('blur produces a single blur effect', () => {
5
5
  expect([...FX.blur(4)]).toEqual([{ type: 'blur', radius: 4 }]);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { BLEND_MODES_LIST, getBlendModeHash } from '../../../attributes/shape/fill/blend';
2
+ import { BLEND_MODES_LIST, getBlendModeHash } from '@/attributes/shape/fill/blend';
3
3
  describe('getBlendModeHash', () => {
4
4
  it('returns the index of the mode within the list', () => {
5
5
  expect(getBlendModeHash('multiply')).toBe(0);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { Fill, resolveChainFill } from '../../../attributes/shape/fill/chain';
2
+ import { Fill, resolveChainFill } from '@/attributes/shape/fill/chain';
3
3
  describe('Fill builders', () => {
4
4
  it('color produces a single solid fill', () => {
5
5
  expect([...Fill.color('red')]).toEqual([{ type: 'color', color: 'red' }]);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, afterEach, vi } from 'vitest';
2
- import { parseColor, setTheme } from '../../../../attributes/shape/fill/color/parser';
2
+ import { parseColor, setTheme } from '@/attributes/shape/fill/color/parser';
3
3
  /** Asserts an RGBA tuple matches expected channels within float tolerance. */
4
4
  function expectColor(actual, expected, precision = 2) {
5
5
  expect(actual).toHaveLength(4);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { lerpColor } from '../../../attributes/shape/fill/lerp';
2
+ import { lerpColor } from '@/attributes/shape/fill/lerp';
3
3
  describe('lerpColor', () => {
4
4
  it('returns the from color at t=0', () => {
5
5
  expect(lerpColor([0, 0, 0, 1], [1, 1, 1, 1], 0)).toEqual([0, 0, 0, 1]);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { MX, resolveChainFilters } from '../../../attributes/shape/filters/chain';
2
+ import { MX, resolveChainFilters } from '@/attributes/shape/filters/chain';
3
3
  describe('MX builders', () => {
4
4
  it('blur stores radius under value', () => {
5
5
  expect([...MX.blur(6)]).toEqual([{ type: 'blur', value: 6 }]);
@@ -1,5 +1,5 @@
1
- import '../../../attributes/shape/filters/implementations/blur';
2
- import '../../../attributes/shape/filters/implementations/alpha';
3
- import '../../../attributes/shape/filters/implementations/grayscale';
4
- import '../../../attributes/shape/filters/implementations/curves';
1
+ import '@/attributes/shape/filters/implementations/blur';
2
+ import '@/attributes/shape/filters/implementations/alpha';
3
+ import '@/attributes/shape/filters/implementations/grayscale';
4
+ import '@/attributes/shape/filters/implementations/curves';
5
5
  //# sourceMappingURL=registry.test.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { FilterRegistry } from '../../../attributes/shape/filters/registry';
2
+ import { FilterRegistry } from '@/attributes/shape/filters/registry';
3
3
  // Importing the implementations registers them via module side effects.
4
- import '../../../attributes/shape/filters/implementations/blur';
5
- import '../../../attributes/shape/filters/implementations/alpha';
6
- import '../../../attributes/shape/filters/implementations/grayscale';
7
- import '../../../attributes/shape/filters/implementations/curves';
4
+ import '@/attributes/shape/filters/implementations/blur';
5
+ import '@/attributes/shape/filters/implementations/alpha';
6
+ import '@/attributes/shape/filters/implementations/grayscale';
7
+ import '@/attributes/shape/filters/implementations/curves';
8
8
  describe('FilterRegistry – registration', () => {
9
9
  it('reports registered built-in filters via has()', () => {
10
10
  expect(FilterRegistry.has('blur')).toBe(true);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { isSmoothCurveType, reflectControlPoint, distance, cubicAxis, quadAxis, cubicPoint, quadPoint, sampleCurveLength, } from '../../../attributes/shape/path/bezier';
2
+ import { isSmoothCurveType, reflectControlPoint, distance, cubicAxis, quadAxis, cubicPoint, quadPoint, sampleCurveLength, } from '@/attributes/shape/path/bezier';
3
3
  describe('isSmoothCurveType', () => {
4
4
  it('is true for curve commands that feed reflected control points', () => {
5
5
  for (const t of ['C', 'c', 'S', 's', 'Q', 'q', 'T', 't']) {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { applyDashPattern } from '../../../attributes/shape/path/dash';
2
+ import { applyDashPattern } from '@/attributes/shape/path/dash';
3
3
  const line = [
4
4
  { type: 'M', x: 0, y: 0 },
5
5
  { type: 'L', x: 100, y: 0 },
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { calculatePathLength } from '../../../attributes/shape/path/length';
2
+ import { calculatePathLength } from '@/attributes/shape/path/length';
3
3
  describe('calculatePathLength', () => {
4
4
  it('returns 0 for an empty path', () => {
5
5
  expect(calculatePathLength([])).toBe(0);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { extractSubpath } from '../../../attributes/shape/path/subpath';
2
+ import { extractSubpath } from '@/attributes/shape/path/subpath';
3
3
  const line = [
4
4
  { type: 'M', x: 0, y: 0 },
5
5
  { type: 'L', x: 10, y: 0 },
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { lerpText } from '../../attributes/text/lerp';
2
+ import { lerpText } from '@/attributes/text/lerp';
3
3
  describe('lerpText', () => {
4
4
  it('returns from at t<=0 and to at t>=1', () => {
5
5
  expect(lerpText('abc', 'xyz', 0)).toBe('abc');
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { layoutFlex, measureFlex, } from '../layout/flex';
2
+ import { layoutFlex, measureFlex, } from '@/layout/flex';
3
3
  // ── Helpers ─────────────────────────────────────────────────────────
4
4
  function child(widthMode, heightMode) {
5
5
  return {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { applyPadding, expandByPadding } from '../layout/padding';
2
+ import { applyPadding, expandByPadding } from '@/layout/padding';
3
3
  const pad = (l, r, t, b) => ({
4
4
  left: l, right: r, top: t, bottom: b,
5
5
  });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { resolveSize, isAutoSize } from '../layout/size-resolver';
2
+ import { resolveSize, isAutoSize } from '@/layout/size-resolver';
3
3
  describe('resolveSize', () => {
4
4
  it('returns a fixed number as-is', () => {
5
5
  expect(resolveSize(120, 500, 80)).toBe(120);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { lerpSizeInput, lerpEdgeInset } from '../layout/tweens';
2
+ import { lerpSizeInput, lerpEdgeInset } from '@/layout/tweens';
3
3
  describe('lerpSizeInput', () => {
4
4
  it('interpolates between two numbers', () => {
5
5
  expect(lerpSizeInput(0, 100, 0.5)).toBe(50);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { createProject } from '../project/config';
2
+ import { createProject } from '@/project/config';
3
3
  describe('createProject', () => {
4
4
  it('applies defaults for an empty input', () => {
5
5
  const project = createProject({ name: 'Test' });
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { toPathString } from '../../render/descriptors/path';
2
+ import { toPathString } from '@/render/descriptors/path';
3
3
  describe('toPathString', () => {
4
4
  it('passes a string path through unchanged', () => {
5
5
  expect(toPathString('M0 0 L10 10')).toBe('M0 0 L10 10');
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { PlaybackController } from '../runtime/playback-controller';
2
+ import { PlaybackController } from '@/runtime/playback-controller';
3
3
  import { FakeScene, FakeNode, FakeClock, FakeAudioDevice, FakeStorageAdapter, FakeRenderContext, FakeMeasureScope, FakeAssetCatalog, asScenes, asCatalog, asStorage, asRenderContext, } from './runtime.fixtures';
4
4
  const flush = () => new Promise((r) => setTimeout(r, 0));
5
5
  function makeController(yieldCount = 10, fps = 10) {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { Precomp } from '../runtime/precompisition';
2
+ import { Precomp } from '@/runtime/precompisition';
3
3
  import { FakeScene, FakeMeasureScope, FakeAssetCatalog, asScenes, asCatalog, makeAudioRequest, } from './runtime.fixtures';
4
4
  const VIEWPORT = { width: 200, height: 100 };
5
5
  const scope = new FakeMeasureScope();
@@ -8,17 +8,17 @@
8
8
  *
9
9
  * Excluded from the published build via `src/**\/*.fixtures.ts` in tsconfig.
10
10
  */
11
- import { AudioDevice } from "../platform/audio-device";
12
- import { MasterClock } from "../platform/master-clock";
13
- import { MeasureScope } from "../render/measure-scope";
14
- import { AssetTracker } from "../assets/tracker";
15
- import { AssetCatalog } from "../assets/catalog";
16
- import { Scene } from "../nodes/base/scene-node";
17
- import { StorageAdapter } from "../platform/storage-adapter";
18
- import { RenderContext } from "../render/render-context";
19
- import { AudioRequest } from "../attributes/audio/request";
20
- import { AssetRecord } from "../assets/record";
21
- import { PrecompResult, AssetTrack, ScenePrecomp } from "../runtime/precompisition";
11
+ import { AudioDevice } from "@/platform/audio-device";
12
+ import { MasterClock } from "@/platform/master-clock";
13
+ import { MeasureScope } from "@/render/measure-scope";
14
+ import { AssetTracker } from "@/assets/tracker";
15
+ import { AssetCatalog } from "@/assets/catalog";
16
+ import { Scene } from "@/nodes/base/scene-node";
17
+ import { StorageAdapter } from "@/platform/storage-adapter";
18
+ import { RenderContext } from "@/render/render-context";
19
+ import { AudioRequest } from "@/attributes/audio/request";
20
+ import { AssetRecord } from "@/assets/record";
21
+ import { PrecompResult, AssetTrack, ScenePrecomp } from "@/runtime/precompisition";
22
22
  /** A minimal tree node used to test getTreeState / getNodeState walking. */
23
23
  export declare class FakeNode {
24
24
  id: string;
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * Excluded from the published build via `src/**\/*.fixtures.ts` in tsconfig.
10
10
  */
11
- import { AudioDevice } from "../platform/audio-device";
12
- import { MasterClock } from "../platform/master-clock";
13
- import { MeasureScope } from "../render/measure-scope";
11
+ import { AudioDevice } from "@/platform/audio-device";
12
+ import { MasterClock } from "@/platform/master-clock";
13
+ import { MeasureScope } from "@/render/measure-scope";
14
14
  // ─── Scene graph fakes ──────────────────────────────────────────────────────
15
15
  /** A minimal tree node used to test getTreeState / getNodeState walking. */
16
16
  export class FakeNode {
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { StateEvaluator } from '../runtime/state-evaluator';
2
+ import { StateEvaluator } from '@/runtime/state-evaluator';
3
3
  import { FakeScene, FakeMeasureScope, FakeRenderContext, FakeAssetCatalog, asScenes, asCatalog, asRenderContext, } from './runtime.fixtures';
4
4
  const VIEWPORT = { width: 100, height: 50 };
5
5
  const FPS = 4; // dt = 0.25 → clean global-time arithmetic
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { createSignal } from '../signals/create';
3
- import { linear } from '../tween/ease/constants';
2
+ import { createSignal } from '@/signals/create';
3
+ import { linear } from '@/tween/ease/constants';
4
4
  describe('createSignal – read & write', () => {
5
5
  it('reads via call and via get()', () => {
6
6
  const s = createSignal(5);
@@ -1,7 +1,7 @@
1
1
  import { describe, it, expect, vi } from 'vitest';
2
- import { createSignal } from '../signals/create';
3
- import { Signal } from '../signals/signal';
4
- import { linear } from '../tween/ease/constants';
2
+ import { createSignal } from '@/signals/create';
3
+ import { Signal } from '@/signals/signal';
4
+ import { linear } from '@/tween/ease/constants';
5
5
  function drive(gen, dt = 1 / 60) {
6
6
  let frames = 0;
7
7
  let result = gen.next();
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { linear, easeInQuad, easeOutQuad, easeOutQuart, easeInOutQuad, easeOutBack, easeInBack, easeInOutBack, easeOutElastic, easeInElastic, easeInOutElastic, } from '../tween/ease/constants';
2
+ import { linear, easeInQuad, easeOutQuad, easeOutQuart, easeInOutQuad, easeOutBack, easeInBack, easeInOutBack, easeOutElastic, easeInElastic, easeInOutElastic, } from '@/tween/ease/constants';
3
3
  function endpoints(fn, atOne = 1) {
4
4
  expect(fn(0)).toBeCloseTo(0, 5);
5
5
  expect(fn(1)).toBeCloseTo(atOne, 5);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { lerpNumber } from '../tween/lerp';
2
+ import { lerpNumber } from '@/tween/lerp';
3
3
  describe('lerpNumber', () => {
4
4
  it('returns from at t=0 and to at t=1', () => {
5
5
  expect(lerpNumber(10, 20, 0)).toBe(10);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { prepareNumericTween } from '../tween/prepare';
2
+ import { prepareNumericTween } from '@/tween/prepare';
3
3
  describe('prepareNumericTween', () => {
4
4
  it('snapshots the start values and interpolates toward the target', () => {
5
5
  const target = { x: 0, y: 100 };
@@ -1,8 +1,8 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { sequence } from '../tween/sequence';
3
- import { tween } from '../tween/tween';
4
- import { wait } from '../tween/wait';
5
- import { parallel } from '../tween/parallel';
2
+ import { sequence } from '@/tween/sequence';
3
+ import { tween } from '@/tween/tween';
4
+ import { wait } from '@/tween/wait';
5
+ import { parallel } from '@/tween/parallel';
6
6
  function drive(gen, dt = 1 / 60) {
7
7
  let frames = 0;
8
8
  let result = gen.next();
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { tween } from '../tween/tween';
2
+ import { tween } from '@/tween/tween';
3
3
  /** Drive a tween generator with a fixed-size frame delta until it completes. */
4
4
  function drive(duration, dt) {
5
5
  const calls = [];
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { wait } from '../tween/wait';
2
+ import { wait } from '@/tween/wait';
3
3
  describe('wait', () => {
4
4
  it('completes immediately when duration is 0', () => {
5
5
  const gen = wait(0);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { clamp, clamp01 } from '../util/clamp';
2
+ import { clamp, clamp01 } from '@/util/clamp';
3
3
  describe('clamp', () => {
4
4
  it('returns the value when within range', () => {
5
5
  expect(clamp(5, 0, 10)).toBe(5);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { SeedGenerator } from '../util/random';
2
+ import { SeedGenerator } from '@/util/random';
3
3
  describe('SeedGenerator', () => {
4
4
  it('produces values in the [0,1) range', () => {
5
5
  const gen = new SeedGenerator(123);
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { createRef } from '../util/reference';
2
+ import { createRef } from '@/util/reference';
3
3
  describe('createRef', () => {
4
4
  it('throws when read before assignment', () => {
5
5
  const ref = createRef();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@motion-script/core",
3
- "version": "0.2.0",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Engine-agnostic animation library for Motion Script: scenes, nodes, signals, tweens, layout, and the JSX runtime.",
6
6
  "keywords": [