@motion-script/core 0.2.3 → 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.
- package/dist/assets/manager.test.js +1 -1
- package/dist/attributes/layout/padding.test.js +1 -1
- package/dist/attributes/layout/vector2.test.js +1 -1
- package/dist/attributes/properties/decorator.test.js +1 -1
- package/dist/attributes/shape/corners/border-radius.test.js +1 -1
- package/dist/attributes/shape/effects/chain.test.js +1 -1
- package/dist/attributes/shape/fill/blend.test.js +1 -1
- package/dist/attributes/shape/fill/chain.test.js +1 -1
- package/dist/attributes/shape/fill/color/parser.test.js +1 -1
- package/dist/attributes/shape/fill/lerp.test.js +1 -1
- package/dist/attributes/shape/filters/chain.test.js +1 -1
- package/dist/attributes/shape/filters/registry.test.d.ts +4 -4
- package/dist/attributes/shape/filters/registry.test.js +5 -5
- package/dist/attributes/shape/path/bezier.test.js +1 -1
- package/dist/attributes/shape/path/dash.test.js +1 -1
- package/dist/attributes/shape/path/length.test.js +1 -1
- package/dist/attributes/shape/path/subpath.test.js +1 -1
- package/dist/attributes/text/lerp.test.js +1 -1
- package/dist/layout/flex.test.js +1 -1
- package/dist/layout/padding.test.js +1 -1
- package/dist/layout/size-resolver.test.js +1 -1
- package/dist/layout/tweens.test.js +1 -1
- package/dist/project/config.test.js +1 -1
- package/dist/render/descriptors/path.test.js +1 -1
- package/dist/runtime/playback-controller.test.js +1 -1
- package/dist/runtime/precompisition.test.js +1 -1
- package/dist/runtime/runtime.fixtures.d.ts +11 -11
- package/dist/runtime/runtime.fixtures.js +3 -3
- package/dist/runtime/state-evaluator.test.js +1 -1
- package/dist/signals/create.test.js +2 -2
- package/dist/signals/signal.test.js +3 -3
- package/dist/tween/eases.test.js +1 -1
- package/dist/tween/lerp.test.js +1 -1
- package/dist/tween/prepare.test.js +1 -1
- package/dist/tween/sequence.test.js +4 -4
- package/dist/tween/tween.test.js +1 -1
- package/dist/tween/wait.test.js +1 -1
- package/dist/util/clamp.test.js +1 -1
- package/dist/util/random.test.js +1 -1
- package/dist/util/reference.test.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { AssetManager } from '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
import '
|
|
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 '
|
|
2
|
+
import { FilterRegistry } from '@/attributes/shape/filters/registry';
|
|
3
3
|
// Importing the implementations registers them via module side effects.
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
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 '
|
|
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 { calculatePathLength } from '
|
|
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 { lerpText } from '
|
|
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');
|
package/dist/layout/flex.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { layoutFlex, measureFlex, } from '
|
|
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 { resolveSize, isAutoSize } from '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 "
|
|
12
|
-
import { MasterClock } from "
|
|
13
|
-
import { MeasureScope } from "
|
|
14
|
-
import { AssetTracker } from "
|
|
15
|
-
import { AssetCatalog } from "
|
|
16
|
-
import { Scene } from "
|
|
17
|
-
import { StorageAdapter } from "
|
|
18
|
-
import { RenderContext } from "
|
|
19
|
-
import { AudioRequest } from "
|
|
20
|
-
import { AssetRecord } from "
|
|
21
|
-
import { PrecompResult, AssetTrack, ScenePrecomp } from "
|
|
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 "
|
|
12
|
-
import { MasterClock } from "
|
|
13
|
-
import { MeasureScope } from "
|
|
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 '
|
|
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 '
|
|
3
|
-
import { linear } from '
|
|
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 '
|
|
3
|
-
import { Signal } from '
|
|
4
|
-
import { linear } from '
|
|
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();
|
package/dist/tween/eases.test.js
CHANGED
|
@@ -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 '
|
|
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);
|
package/dist/tween/lerp.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { prepareNumericTween } from '
|
|
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 '
|
|
3
|
-
import { tween } from '
|
|
4
|
-
import { wait } from '
|
|
5
|
-
import { parallel } from '
|
|
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();
|
package/dist/tween/tween.test.js
CHANGED
package/dist/tween/wait.test.js
CHANGED
package/dist/util/clamp.test.js
CHANGED
package/dist/util/random.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { SeedGenerator } from '
|
|
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);
|
package/package.json
CHANGED