sketchmark 2.1.5 → 2.1.7

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.
@@ -1,11 +1,14 @@
1
- export function editorHtml(
2
- title: string,
3
- options?: {
4
- apiBase?: string;
1
+ export function editorHtml(
2
+ title: string,
3
+ options?: {
4
+ apiBase?: string;
5
5
  mp4MuxerUrl?: string;
6
6
  mp4MuxerSource?: string | false;
7
7
  serverExportFallback?: boolean;
8
+ canvasStageRender?: boolean;
9
+ localDocumentControls?: boolean;
10
+ bootstrapScript?: string;
8
11
  }
9
12
  ): string;
10
-
11
- export function editorMp4MuxerSource(value?: string | false): string;
13
+
14
+ export function editorMp4MuxerSource(value?: string | false): string;
@@ -0,0 +1,4 @@
1
+ import type { VisualCanvas, VisualDocument } from "../types";
2
+ import type { ApplyAuthoringOptions, AuthoringInput, CreatedVisualDocument, CreateDocumentOptions } from "./types";
3
+ export declare function createDocument(canvas: VisualCanvas, fragments?: AuthoringInput, options?: CreateDocumentOptions): CreatedVisualDocument;
4
+ export declare function apply(document: VisualDocument, input: AuthoringInput, options?: ApplyAuthoringOptions): VisualDocument;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDocument = createDocument;
4
+ exports.apply = apply;
5
+ const keyframes_1 = require("../keyframes");
6
+ const utils_1 = require("../utils");
7
+ const validate_1 = require("../validate");
8
+ const compose_1 = require("../presets/compose");
9
+ function createDocument(canvas, fragments, options = {}) {
10
+ const document = {
11
+ version: 1,
12
+ canvas: (0, utils_1.clone)(canvas),
13
+ elements: []
14
+ };
15
+ return fragments ? apply(document, fragments, options) : validateDocument(document, options.validate);
16
+ }
17
+ function apply(document, input, options = {}) {
18
+ const items = Array.isArray(input) ? input : [input];
19
+ const fragments = [];
20
+ const states = [];
21
+ for (const item of items) {
22
+ if (isKeyframeState(item))
23
+ states.push(item);
24
+ else
25
+ fragments.push(item);
26
+ }
27
+ let next = fragments.length ? (0, compose_1.applyPresetFragments)(document, fragments, { validate: options.validate }) : (0, utils_1.clone)(document);
28
+ if (states.length) {
29
+ next = (0, keyframes_1.compileKeyframeStates)(next, states, options);
30
+ validateDocument(next, options.validate);
31
+ }
32
+ else {
33
+ validateDocument(next, options.validate);
34
+ }
35
+ return next;
36
+ }
37
+ function isKeyframeState(item) {
38
+ return typeof item.time === "number";
39
+ }
40
+ function validateDocument(document, validate = true) {
41
+ if (validate === false)
42
+ return document;
43
+ const result = (0, validate_1.validateVisualDocument)(document);
44
+ if (!result.ok) {
45
+ const first = result.issues[0];
46
+ throw new Error(first ? `${first.path}: ${first.message}` : "Authoring output is not a valid Sketchmark kernel document.");
47
+ }
48
+ return document;
49
+ }
@@ -0,0 +1,7 @@
1
+ export type { ApplyAuthoringOptions, AuthoringFragment, AuthoringInput, AuthoringStep, CreatedVisualDocument, CreateDocumentOptions } from "./types";
2
+ export { apply, createDocument } from "./compose";
3
+ export { curves } from "../presets/helpers";
4
+ export * as states from "./states";
5
+ export * as layout from "./layout";
6
+ export * as motion from "./motion";
7
+ export * as pose from "./pose";
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.pose = exports.motion = exports.layout = exports.states = exports.curves = exports.createDocument = exports.apply = void 0;
37
+ var compose_1 = require("./compose");
38
+ Object.defineProperty(exports, "apply", { enumerable: true, get: function () { return compose_1.apply; } });
39
+ Object.defineProperty(exports, "createDocument", { enumerable: true, get: function () { return compose_1.createDocument; } });
40
+ var helpers_1 = require("../presets/helpers");
41
+ Object.defineProperty(exports, "curves", { enumerable: true, get: function () { return helpers_1.curves; } });
42
+ exports.states = __importStar(require("./states"));
43
+ exports.layout = __importStar(require("./layout"));
44
+ exports.motion = __importStar(require("./motion"));
45
+ exports.pose = __importStar(require("./pose"));
@@ -0,0 +1,43 @@
1
+ import type { Point2 } from "../types";
2
+ export type LayoutDirection = "horizontal" | "vertical";
3
+ export type LayoutAlign = "start" | "center" | "end" | "stretch";
4
+ export type HorizontalAlign = "left" | "center" | "right";
5
+ export type VerticalAlign = "top" | "middle" | "bottom";
6
+ export interface LayoutBox {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ export interface LayoutSize {
13
+ width: number;
14
+ height: number;
15
+ }
16
+ export interface InsetValue {
17
+ top?: number;
18
+ right?: number;
19
+ bottom?: number;
20
+ left?: number;
21
+ x?: number;
22
+ y?: number;
23
+ }
24
+ export interface StackOptions {
25
+ direction?: LayoutDirection;
26
+ gap?: number;
27
+ align?: LayoutAlign;
28
+ start?: number;
29
+ }
30
+ export interface GridOptions {
31
+ columns: number;
32
+ rows?: number;
33
+ gap?: number;
34
+ columnGap?: number;
35
+ rowGap?: number;
36
+ }
37
+ export declare function box(x: number, y: number, width: number, height: number): LayoutBox;
38
+ export declare function inset(area: LayoutBox, value: number | InsetValue): LayoutBox;
39
+ export declare function center(area: LayoutBox): Point2;
40
+ export declare function center(area: LayoutBox, size: LayoutSize): LayoutBox;
41
+ export declare function align(area: LayoutBox, size: LayoutSize, horizontal?: HorizontalAlign, vertical?: VerticalAlign, offset?: Point2): LayoutBox;
42
+ export declare function stack(area: LayoutBox, sizes: LayoutSize[], options?: StackOptions): LayoutBox[];
43
+ export declare function grid(area: LayoutBox, options: GridOptions): LayoutBox[];
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.box = box;
4
+ exports.inset = inset;
5
+ exports.center = center;
6
+ exports.align = align;
7
+ exports.stack = stack;
8
+ exports.grid = grid;
9
+ function box(x, y, width, height) {
10
+ return { x, y, width, height };
11
+ }
12
+ function inset(area, value) {
13
+ const top = typeof value === "number" ? value : value.top ?? value.y ?? 0;
14
+ const right = typeof value === "number" ? value : value.right ?? value.x ?? 0;
15
+ const bottom = typeof value === "number" ? value : value.bottom ?? value.y ?? 0;
16
+ const left = typeof value === "number" ? value : value.left ?? value.x ?? 0;
17
+ return {
18
+ x: area.x + left,
19
+ y: area.y + top,
20
+ width: Math.max(0, area.width - left - right),
21
+ height: Math.max(0, area.height - top - bottom)
22
+ };
23
+ }
24
+ function center(area, size) {
25
+ if (!size)
26
+ return [area.x + area.width / 2, area.y + area.height / 2];
27
+ return align(area, size, "center", "middle");
28
+ }
29
+ function align(area, size, horizontal = "center", vertical = "middle", offset = [0, 0]) {
30
+ const x = horizontal === "left" ? area.x : horizontal === "right" ? area.x + area.width - size.width : area.x + (area.width - size.width) / 2;
31
+ const y = vertical === "top" ? area.y : vertical === "bottom" ? area.y + area.height - size.height : area.y + (area.height - size.height) / 2;
32
+ return { x: x + offset[0], y: y + offset[1], width: size.width, height: size.height };
33
+ }
34
+ function stack(area, sizes, options = {}) {
35
+ const direction = options.direction ?? "vertical";
36
+ const gap = options.gap ?? 0;
37
+ const alignMode = options.align ?? "start";
38
+ const cursorStart = options.start ?? (direction === "vertical" ? area.y : area.x);
39
+ let cursor = cursorStart;
40
+ return sizes.map((size) => {
41
+ const item = direction === "vertical"
42
+ ? {
43
+ x: alignedCrossAxis(area.x, area.width, size.width, alignMode),
44
+ y: cursor,
45
+ width: alignMode === "stretch" ? area.width : size.width,
46
+ height: size.height
47
+ }
48
+ : {
49
+ x: cursor,
50
+ y: alignedCrossAxis(area.y, area.height, size.height, alignMode),
51
+ width: size.width,
52
+ height: alignMode === "stretch" ? area.height : size.height
53
+ };
54
+ cursor += (direction === "vertical" ? item.height : item.width) + gap;
55
+ return item;
56
+ });
57
+ }
58
+ function grid(area, options) {
59
+ const columns = Math.max(1, Math.floor(options.columns));
60
+ const rows = Math.max(1, Math.floor(options.rows ?? 1));
61
+ const columnGap = options.columnGap ?? options.gap ?? 0;
62
+ const rowGap = options.rowGap ?? options.gap ?? 0;
63
+ const cellWidth = Math.max(0, (area.width - columnGap * (columns - 1)) / columns);
64
+ const cellHeight = Math.max(0, (area.height - rowGap * (rows - 1)) / rows);
65
+ const cells = [];
66
+ for (let row = 0; row < rows; row += 1) {
67
+ for (let column = 0; column < columns; column += 1) {
68
+ cells.push({
69
+ x: area.x + column * (cellWidth + columnGap),
70
+ y: area.y + row * (cellHeight + rowGap),
71
+ width: cellWidth,
72
+ height: cellHeight
73
+ });
74
+ }
75
+ }
76
+ return cells;
77
+ }
78
+ function alignedCrossAxis(start, available, size, alignMode) {
79
+ switch (alignMode) {
80
+ case "center":
81
+ return start + (available - size) / 2;
82
+ case "end":
83
+ return start + available - size;
84
+ case "stretch":
85
+ case "start":
86
+ default:
87
+ return start;
88
+ }
89
+ }
@@ -0,0 +1,53 @@
1
+ import type { MotionValue, Point2, TimelineCurve } from "../types";
2
+ import type { PresetFragment } from "../presets/types";
3
+ export interface TargetOptions {
4
+ id: string;
5
+ start?: number;
6
+ duration?: number;
7
+ curve?: TimelineCurve;
8
+ }
9
+ export interface MoveOptions extends TargetOptions {
10
+ from: Point2;
11
+ to: Point2;
12
+ }
13
+ export interface EntranceOptions extends TargetOptions {
14
+ kind?: "fade" | "rise" | "slide" | "scale";
15
+ from?: Point2;
16
+ to?: Point2;
17
+ distance?: number;
18
+ }
19
+ export interface ExitOptions extends TargetOptions {
20
+ kind?: "fade" | "fall" | "slide" | "scale";
21
+ from?: Point2;
22
+ to?: Point2;
23
+ distance?: number;
24
+ }
25
+ export interface SettleOptions extends TargetOptions {
26
+ from?: number;
27
+ overshoot?: number;
28
+ to?: number;
29
+ }
30
+ export interface StaggerOptions {
31
+ ids: string[];
32
+ start?: number;
33
+ each?: number;
34
+ duration?: number;
35
+ curve?: TimelineCurve;
36
+ kind?: EntranceOptions["kind"];
37
+ recipe?: (id: string, start: number, index: number) => PresetFragment;
38
+ }
39
+ export interface LoopOptions {
40
+ id: string;
41
+ property: string;
42
+ values: MotionValue[];
43
+ start?: number;
44
+ duration?: number;
45
+ curve?: TimelineCurve;
46
+ close?: boolean;
47
+ }
48
+ export declare function move(options: MoveOptions): PresetFragment;
49
+ export declare function entrance(options: EntranceOptions): PresetFragment;
50
+ export declare function exit(options: ExitOptions): PresetFragment;
51
+ export declare function settle(options: SettleOptions): PresetFragment;
52
+ export declare function stagger(options: StaggerOptions): PresetFragment;
53
+ export declare function loop(options: LoopOptions): PresetFragment;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.move = move;
4
+ exports.entrance = entrance;
5
+ exports.exit = exit;
6
+ exports.settle = settle;
7
+ exports.stagger = stagger;
8
+ exports.loop = loop;
9
+ const presets_1 = require("../presets");
10
+ const helpers_1 = require("../presets/helpers");
11
+ function move(options) {
12
+ const start = options.start ?? 0;
13
+ const duration = options.duration ?? 0.5;
14
+ return (0, helpers_1.timelineFragment)(options.id, {
15
+ position: (0, helpers_1.track)([[start, options.from], [start + duration, options.to]], options.curve ?? helpers_1.curves.easeInOut)
16
+ });
17
+ }
18
+ function entrance(options) {
19
+ const kind = options.kind ?? "rise";
20
+ if (kind === "fade")
21
+ return presets_1.motions.fadeIn(options);
22
+ if (kind === "scale")
23
+ return presets_1.motions.scaleIn(options);
24
+ if (kind === "slide") {
25
+ return presets_1.motions.slideIn({
26
+ ...options,
27
+ to: options.to ?? [0, 0],
28
+ from: options.from,
29
+ distance: options.distance
30
+ });
31
+ }
32
+ return presets_1.motions.riseIn({
33
+ ...options,
34
+ to: options.to ?? [0, 0],
35
+ from: options.from,
36
+ distance: options.distance
37
+ });
38
+ }
39
+ function exit(options) {
40
+ const start = options.start ?? 0;
41
+ const duration = options.duration ?? 0.4;
42
+ const curve = options.curve ?? helpers_1.curves.easeIn;
43
+ const fade = presets_1.motions.fadeOut({ id: options.id, start, duration, curve });
44
+ if (options.kind === "scale") {
45
+ return (0, helpers_1.mergeFragments)(fade, (0, helpers_1.timelineFragment)(options.id, { scale: (0, helpers_1.track)([[start, 1], [start + duration, 0.92]], curve) }));
46
+ }
47
+ if (options.kind === "slide" || options.kind === "fall") {
48
+ const from = options.from ?? options.to ?? [0, 0];
49
+ const distance = options.distance ?? 36;
50
+ const to = options.to ?? (options.kind === "fall" ? [from[0], from[1] + distance] : [from[0] + distance, from[1]]);
51
+ return (0, helpers_1.mergeFragments)(fade, move({ id: options.id, from, to, start, duration, curve }));
52
+ }
53
+ return fade;
54
+ }
55
+ function settle(options) {
56
+ const start = options.start ?? 0;
57
+ const duration = options.duration ?? 0.55;
58
+ const from = options.from ?? 0.96;
59
+ const overshoot = options.overshoot ?? 1.04;
60
+ const to = options.to ?? 1;
61
+ return (0, helpers_1.timelineFragment)(options.id, {
62
+ scale: (0, helpers_1.track)([
63
+ [start, from],
64
+ [start + duration * 0.68, overshoot],
65
+ [start + duration, to]
66
+ ], options.curve ?? helpers_1.curves.easeOut)
67
+ });
68
+ }
69
+ function stagger(options) {
70
+ const start = options.start ?? 0;
71
+ const each = options.each ?? 0.08;
72
+ const duration = options.duration ?? 0.4;
73
+ return (0, helpers_1.mergeFragments)(...options.ids.map((id, index) => {
74
+ const itemStart = start + index * each;
75
+ return options.recipe
76
+ ? options.recipe(id, itemStart, index)
77
+ : entrance({ id, start: itemStart, duration, curve: options.curve, kind: options.kind ?? "fade" });
78
+ }));
79
+ }
80
+ function loop(options) {
81
+ if (!options.values.length)
82
+ throw new Error("Loop motion requires at least one value.");
83
+ const start = options.start ?? 0;
84
+ const duration = options.duration ?? 1;
85
+ const close = options.close !== false;
86
+ const values = close && JSON.stringify(options.values[0]) !== JSON.stringify(options.values[options.values.length - 1])
87
+ ? [...options.values, options.values[0]]
88
+ : options.values.slice();
89
+ const denominator = Math.max(1, values.length - 1);
90
+ return (0, helpers_1.timelineFragment)(options.id, {
91
+ [options.property]: (0, helpers_1.track)(values.map((value, index) => [start + (duration * index) / denominator, value]), options.curve ?? helpers_1.curves.linear)
92
+ });
93
+ }
@@ -0,0 +1,20 @@
1
+ import type { CompileKeyframeStateOptions, KeyframeElementState, KeyframeOffsetMap, KeyframeState } from "../keyframes";
2
+ import type { TimelineCurve, VisualDocument } from "../types";
3
+ export type PoseSet = Record<string, KeyframeElementState>;
4
+ export type PoseMap = Record<string, PoseSet>;
5
+ export interface PoseDefinition {
6
+ name: string;
7
+ set: PoseSet;
8
+ }
9
+ export interface PoseStep {
10
+ time: number;
11
+ pose: string;
12
+ curve?: TimelineCurve;
13
+ offsets?: KeyframeOffsetMap;
14
+ }
15
+ export interface PoseSequenceOptions {
16
+ curve?: TimelineCurve;
17
+ }
18
+ export declare function define(name: string, set: PoseSet): PoseDefinition;
19
+ export declare function sequence(poses: PoseMap | PoseDefinition[], steps: PoseStep[], options?: PoseSequenceOptions): KeyframeState[];
20
+ export declare function compile(document: VisualDocument, poses: PoseMap | PoseDefinition[], steps: PoseStep[], options?: CompileKeyframeStateOptions & PoseSequenceOptions): VisualDocument;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.define = define;
37
+ exports.sequence = sequence;
38
+ exports.compile = compile;
39
+ const utils_1 = require("../utils");
40
+ const states = __importStar(require("./states"));
41
+ function define(name, set) {
42
+ const cleanName = name.trim();
43
+ if (!cleanName)
44
+ throw new Error("Pose name must be a non-empty string.");
45
+ return { name: cleanName, set: (0, utils_1.clone)(set) };
46
+ }
47
+ function sequence(poses, steps, options = {}) {
48
+ const map = normalizePoseMap(poses);
49
+ return steps.map((step) => {
50
+ const set = map[step.pose];
51
+ if (!set)
52
+ throw new Error(`Unknown pose '${step.pose}'.`);
53
+ return states.at(step.time, set, {
54
+ ...(step.curve ?? options.curve ? { curve: step.curve ?? options.curve } : {}),
55
+ ...(step.offsets ? { offsets: step.offsets } : {})
56
+ });
57
+ });
58
+ }
59
+ function compile(document, poses, steps, options = {}) {
60
+ const keyStates = sequence(poses, steps, { curve: options.curve });
61
+ return states.compile(document, keyStates, options);
62
+ }
63
+ function normalizePoseMap(poses) {
64
+ if (!Array.isArray(poses))
65
+ return (0, utils_1.clone)(poses);
66
+ const map = {};
67
+ for (const pose of poses) {
68
+ if (map[pose.name])
69
+ throw new Error(`Duplicate pose '${pose.name}'.`);
70
+ map[pose.name] = (0, utils_1.clone)(pose.set);
71
+ }
72
+ return map;
73
+ }
@@ -0,0 +1,17 @@
1
+ import type { CompileKeyframeStateOptions, KeyframeElementState, KeyframeOffsetMap, KeyframePropertySpec, KeyframeState } from "../keyframes";
2
+ import type { MotionValue, TimelineCurve, VisualDocument } from "../types";
3
+ export interface StateAtOptions {
4
+ curve?: TimelineCurve;
5
+ offsets?: KeyframeOffsetMap;
6
+ }
7
+ export interface StateSpecOptions {
8
+ curve?: TimelineCurve;
9
+ offset?: number;
10
+ in?: TimelineCurve;
11
+ out?: TimelineCurve;
12
+ interpolation?: TimelineCurve;
13
+ }
14
+ export type StateSet = Record<string, KeyframeElementState>;
15
+ export declare function at(time: number, set: StateSet, options?: StateAtOptions): KeyframeState;
16
+ export declare function spec(value: MotionValue, options?: StateSpecOptions): KeyframePropertySpec;
17
+ export declare function compile(document: VisualDocument, steps: KeyframeState[], options?: CompileKeyframeStateOptions): VisualDocument;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.at = at;
4
+ exports.spec = spec;
5
+ exports.compile = compile;
6
+ const keyframes_1 = require("../keyframes");
7
+ const utils_1 = require("../utils");
8
+ function at(time, set, options = {}) {
9
+ return {
10
+ time,
11
+ set: (0, utils_1.clone)(set),
12
+ ...(options.curve ? { curve: (0, utils_1.clone)(options.curve) } : {}),
13
+ ...(options.offsets ? { offsets: (0, utils_1.clone)(options.offsets) } : {})
14
+ };
15
+ }
16
+ function spec(value, options = {}) {
17
+ return {
18
+ value: (0, utils_1.clone)(value),
19
+ ...(options.curve ? { curve: (0, utils_1.clone)(options.curve) } : {}),
20
+ ...(options.offset !== undefined ? { offset: options.offset } : {}),
21
+ ...(options.in ? { in: (0, utils_1.clone)(options.in) } : {}),
22
+ ...(options.out ? { out: (0, utils_1.clone)(options.out) } : {}),
23
+ ...(options.interpolation ? { interpolation: (0, utils_1.clone)(options.interpolation) } : {})
24
+ };
25
+ }
26
+ function compile(document, steps, options = {}) {
27
+ return (0, keyframes_1.compileKeyframeStates)(document, steps, options);
28
+ }
@@ -0,0 +1,14 @@
1
+ import type { CompileKeyframeStateOptions, KeyframeState } from "../keyframes";
2
+ import type { VisualCanvas, VisualDocument } from "../types";
3
+ import type { ApplyPresetOptions, PresetFragment } from "../presets/types";
4
+ export type AuthoringFragment = PresetFragment;
5
+ export type AuthoringStep = PresetFragment | KeyframeState;
6
+ export type AuthoringInput = AuthoringStep | AuthoringStep[];
7
+ export interface CreateDocumentOptions extends ApplyPresetOptions {
8
+ }
9
+ export interface ApplyAuthoringOptions extends ApplyPresetOptions, CompileKeyframeStateOptions {
10
+ }
11
+ export interface CreatedVisualDocument extends VisualDocument {
12
+ version: 1;
13
+ canvas: VisualCanvas;
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import type { VisualDocument } from "./types";
2
+ export interface BrowserEditorOptions {
3
+ document: VisualDocument;
4
+ title?: string;
5
+ autoSaveDelay?: number | false;
6
+ onChange?: (document: VisualDocument) => void;
7
+ onSave?: (document: VisualDocument) => void | Promise<void>;
8
+ }
9
+ export interface BrowserEditorInstance {
10
+ getDocument(): VisualDocument;
11
+ setDocument(document: VisualDocument): void;
12
+ save(): Promise<void>;
13
+ destroy(): void;
14
+ }
15
+ export declare function createSketchmarkBrowserEditor(root: HTMLElement, options: BrowserEditorOptions): BrowserEditorInstance;