@pixerate/editor 0.55.0 → 0.57.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/agent/index.cjs +18 -17
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +3 -2
- package/dist/agent/index.js.map +1 -1
- package/dist/animation-editor/index.cjs +25 -7
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +21 -5
- package/dist/animation-editor/index.d.ts +21 -5
- package/dist/animation-editor/index.js +25 -7
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/canvas/index.cjs +2105 -172
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +319 -23
- package/dist/canvas/index.d.ts +319 -23
- package/dist/canvas/index.js +2081 -148
- package/dist/canvas/index.js.map +1 -1
- package/dist/chart/index.cjs +32 -30
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +4 -2
- package/dist/chart/index.d.ts +4 -2
- package/dist/chart/index.js +20 -18
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-C3JHII3M.cjs → chunk-3I6V7PI4.cjs} +45 -45
- package/dist/{chunk-C3JHII3M.cjs.map → chunk-3I6V7PI4.cjs.map} +1 -1
- package/dist/{chunk-P43HUQRX.cjs → chunk-AHCENCU4.cjs} +12 -10
- package/dist/chunk-AHCENCU4.cjs.map +1 -0
- package/dist/chunk-II77MLHN.cjs +11106 -0
- package/dist/chunk-II77MLHN.cjs.map +1 -0
- package/dist/{chunk-OIKYP7XC.js → chunk-LMUDHBWR.js} +2 -2
- package/dist/{chunk-VODBAO32.js → chunk-OEFCLWZ3.js} +4 -1425
- package/dist/chunk-OEFCLWZ3.js.map +1 -0
- package/dist/{chunk-NK3WL5TJ.cjs → chunk-P2CTDJNF.cjs} +27 -1448
- package/dist/chunk-P2CTDJNF.cjs.map +1 -0
- package/dist/chunk-TKPPIVW7.cjs +1443 -0
- package/dist/chunk-TKPPIVW7.cjs.map +1 -0
- package/dist/chunk-WJSCGBJ2.js +11106 -0
- package/dist/chunk-WJSCGBJ2.js.map +1 -0
- package/dist/{chunk-RIXTW3C4.js → chunk-WLVZ235X.js} +5 -3
- package/dist/{chunk-RIXTW3C4.js.map → chunk-WLVZ235X.js.map} +1 -1
- package/dist/chunk-ZOH6X3VR.js +1443 -0
- package/dist/chunk-ZOH6X3VR.js.map +1 -0
- package/dist/{controller-DscWQbjO.d.ts → controller-D2rj5umx.d.ts} +2 -362
- package/dist/{controller-CX0QfSv0.d.cts → controller-R2biKk_E.d.cts} +2 -362
- package/dist/diagram/index.cjs +1457 -47
- package/dist/diagram/index.cjs.map +1 -1
- package/dist/diagram/index.d.cts +1734 -15
- package/dist/diagram/index.d.ts +1734 -15
- package/dist/diagram/index.js +1436 -26
- package/dist/diagram/index.js.map +1 -1
- package/dist/extensions/index.cjs +5 -4
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +4 -3
- package/dist/extensions/index.d.ts +4 -3
- package/dist/extensions/index.js +4 -3
- package/dist/{index-DIWB6xMf.d.cts → index-BcHyG0Wq.d.cts} +2 -1
- package/dist/{index-CALDD35B.d.ts → index-CTCc3m3C.d.ts} +2 -1
- package/dist/index.cjs +10 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/types-BRp-6zkY.d.cts +362 -0
- package/dist/types-BRp-6zkY.d.ts +362 -0
- package/dist/{types-BULrFyuQ.d.cts → types-DYkjhzdz.d.cts} +1 -1
- package/dist/{types-BULrFyuQ.d.ts → types-DYkjhzdz.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-H5K77C7Y.cjs +0 -3848
- package/dist/chunk-H5K77C7Y.cjs.map +0 -1
- package/dist/chunk-NK3WL5TJ.cjs.map +0 -1
- package/dist/chunk-P43HUQRX.cjs.map +0 -1
- package/dist/chunk-VODBAO32.js.map +0 -1
- package/dist/chunk-WWJNC7SX.js +0 -3848
- package/dist/chunk-WWJNC7SX.js.map +0 -1
- /package/dist/{chunk-OIKYP7XC.js.map → chunk-LMUDHBWR.js.map} +0 -0
|
@@ -42,6 +42,7 @@ var _chunkA6PHCAGXcjs = require('../chunk-A6PHCAGX.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
|
|
45
46
|
var _chunkXZ4L3R4Kcjs = require('../chunk-XZ4L3R4K.cjs');
|
|
46
47
|
|
|
47
48
|
// src/animation-editor/types.ts
|
|
@@ -1231,6 +1232,14 @@ function flairEaseFor(ease) {
|
|
|
1231
1232
|
}
|
|
1232
1233
|
return void 0;
|
|
1233
1234
|
}
|
|
1235
|
+
function flairCurveFor(ease, curves = true) {
|
|
1236
|
+
const name = flairEaseFor(ease);
|
|
1237
|
+
if (name || !curves) return name;
|
|
1238
|
+
const resolved = _chunkXZ4L3R4Kcjs.resolveEasing.call(void 0, ease);
|
|
1239
|
+
if (resolved === "hold" || resolved.type !== "cubic-bezier") return void 0;
|
|
1240
|
+
return [resolved.x1, resolved.y1, resolved.x2, resolved.y2];
|
|
1241
|
+
}
|
|
1242
|
+
var overshoots = (ease) => typeof ease !== "string" && (ease[1] < 0 || ease[1] > 1 || ease[3] < 0 || ease[3] > 1);
|
|
1234
1243
|
var TRANSFORM_PROPS2 = ["x", "y", "rotation", "scaleX", "scaleY", "follow"];
|
|
1235
1244
|
var LINEAR_TRANSFORM = /* @__PURE__ */ new Set(["x", "y", "rotation", "scaleX", "scaleY"]);
|
|
1236
1245
|
function hex6(color) {
|
|
@@ -1240,6 +1249,7 @@ function hex6(color) {
|
|
|
1240
1249
|
function toFlairSvgMotion(scene, options = {}) {
|
|
1241
1250
|
const fps = _nullishCoalesce(_nullishCoalesce(options.fps, () => ( scene.fps)), () => ( 30));
|
|
1242
1251
|
const precision = _nullishCoalesce(options.precision, () => ( 3));
|
|
1252
|
+
const curves = _nullishCoalesce(options.curves, () => ( true));
|
|
1243
1253
|
const round2 = (n) => Math.round(n * 10 ** precision) / 10 ** precision;
|
|
1244
1254
|
const f = (n) => String(round2(n));
|
|
1245
1255
|
const timeline = compileMotionScene(scene);
|
|
@@ -1269,6 +1279,7 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1269
1279
|
attr: "transform",
|
|
1270
1280
|
segments: transformSegments,
|
|
1271
1281
|
exact: (s) => LINEAR_TRANSFORM.has(s.property) && !s.wave,
|
|
1282
|
+
overshoot: true,
|
|
1272
1283
|
value: (t) => {
|
|
1273
1284
|
const o = motionNodeOffset(entry, timeline, t, nodes);
|
|
1274
1285
|
return `translate(${f(o.dx)} ${f(o.dy)}) rotate(${f(o.rotation)} ${f(c.x)} ${f(c.y)}) translate(${f(c.x)} ${f(c.y)}) scale(${f(o.scaleX)} ${f(o.scaleY)}) translate(${f(-c.x)} ${f(-c.y)})${base}`;
|
|
@@ -1316,12 +1327,12 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1316
1327
|
}
|
|
1317
1328
|
}
|
|
1318
1329
|
const camera = track("", "camera");
|
|
1319
|
-
if (camera.length) channels.push({ id: "", kind: "view", segments: [...camera], exact: () => true, value: (t) => trackValue(camera, t).map(round2) });
|
|
1330
|
+
if (camera.length) channels.push({ id: "", kind: "view", segments: [...camera], exact: () => true, overshoot: true, value: (t) => trackValue(camera, t).map(round2) });
|
|
1320
1331
|
const animate = [];
|
|
1321
1332
|
let sampled = 0;
|
|
1322
1333
|
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
1323
1334
|
const emit = (channel, delay, ms, from, to, ease) => {
|
|
1324
|
-
const base = { ...channel.id ? { id: channel.id } : {}, ...delay > 0 ? { delay: round2(delay) } : {}, ms: round2(ms), ease };
|
|
1335
|
+
const base = { ...channel.id ? { id: channel.id } : {}, ...delay > 0 ? { delay: round2(delay) } : {}, ms: round2(ms), ease: typeof ease === "string" ? ease : ease.map(round2) };
|
|
1325
1336
|
if (channel.kind === "view") animate.push({ ...base, view: to });
|
|
1326
1337
|
else if (channel.kind === "draw") animate.push({ ...base, draw: [from, to] });
|
|
1327
1338
|
else animate.push({ ...base, attrs: { [channel.attr]: [from, to] } });
|
|
@@ -1337,7 +1348,8 @@ function toFlairSvgMotion(scene, options = {}) {
|
|
|
1337
1348
|
if (!active.length) continue;
|
|
1338
1349
|
const first = active[0];
|
|
1339
1350
|
const together = active.every((x) => x.start === a && x.end === b && channel.exact(x) && JSON.stringify(x.ease) === JSON.stringify(first.ease));
|
|
1340
|
-
const
|
|
1351
|
+
const curve = together ? flairCurveFor(first.ease, curves) : void 0;
|
|
1352
|
+
const ease = curve && (!overshoots(curve) || channel.overshoot) ? curve : void 0;
|
|
1341
1353
|
if (ease) {
|
|
1342
1354
|
const from = channel.value(a);
|
|
1343
1355
|
const to = channel.value(b);
|
|
@@ -1914,13 +1926,17 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
1914
1926
|
return { time: t, svg };
|
|
1915
1927
|
}
|
|
1916
1928
|
};
|
|
1929
|
+
const CURVES_DESCRIPTION = "Write cubic-bezier easings (ease, ease-in, ease-out, ease-in-out, back eases, custom curves) as one change with ease: [x1, y1, x2, y2] (default true). Needs Flair 0.36 or later; false samples them into linear steps for older Flair.";
|
|
1917
1930
|
const exportFlairMotion = {
|
|
1918
1931
|
name: "export_flair_motion",
|
|
1919
1932
|
title: "Export as Flair vector motion",
|
|
1920
1933
|
description: "Returns the animation as a Flair SvgMotion ({ svg, animate }) that Flair's SvgPlayer plays, plus its hold, how many changes were sampled into linear steps, and notes on anything not carried over.",
|
|
1921
|
-
inputSchema: object({
|
|
1934
|
+
inputSchema: object({
|
|
1935
|
+
fps: { type: "number", minimum: 1, maximum: 120, description: "Sampling rate for changes Flair cannot express exactly (default: the scene's fps, else 30)." },
|
|
1936
|
+
curves: { type: "boolean", description: CURVES_DESCRIPTION }
|
|
1937
|
+
}),
|
|
1922
1938
|
annotations: { title: "Export as Flair vector motion", ...READ },
|
|
1923
|
-
handler: ({ fps }) => controller.toFlairMotion(fps ? { fps } : {})
|
|
1939
|
+
handler: ({ fps, curves }) => controller.toFlairMotion({ ...fps ? { fps } : {}, ...curves === void 0 ? {} : { curves } })
|
|
1924
1940
|
};
|
|
1925
1941
|
const exportFlairEffect = {
|
|
1926
1942
|
name: "export_flair_effect",
|
|
@@ -1931,7 +1947,8 @@ function createAnimationEditorToolProvider(controller, options = {}) {
|
|
|
1931
1947
|
name: { type: "string", minLength: 1, description: "Display name (default: the scene's name)." },
|
|
1932
1948
|
description: { type: "string", description: "One sentence (default: the scene's description)." },
|
|
1933
1949
|
category: { type: "string", minLength: 1, description: "Flair catalog category, e.g. icon, loader, ui, data, text, morph (default icon)." },
|
|
1934
|
-
tags: { type: "array", items: { type: "string" }, description: "Search tags (default none)." }
|
|
1950
|
+
tags: { type: "array", items: { type: "string" }, description: "Search tags (default none)." },
|
|
1951
|
+
curves: { type: "boolean", description: CURVES_DESCRIPTION }
|
|
1935
1952
|
}),
|
|
1936
1953
|
annotations: { title: "Export as a Flair effect", ...READ },
|
|
1937
1954
|
handler: (args) => controller.toFlairEffect(args)
|
|
@@ -2217,5 +2234,6 @@ Keep motion purposeful: one thing moving at a time reads best, ease-out for arri
|
|
|
2217
2234
|
|
|
2218
2235
|
|
|
2219
2236
|
|
|
2220
|
-
|
|
2237
|
+
|
|
2238
|
+
exports.ANIMATION_EDITOR_AGENT_INSTRUCTIONS = ANIMATION_EDITOR_AGENT_INSTRUCTIONS; exports.AnimationEditorController = AnimationEditorController; exports.FLAIR_EASES = FLAIR_EASES; exports.MOTION_CAMERA_MS = MOTION_CAMERA_MS; exports.MOTION_COMMAND_SCHEMA = MOTION_COMMAND_SCHEMA; exports.MOTION_COMMAND_TYPES = MOTION_COMMAND_TYPES; exports.MOTION_DEFAULT_DURATIONS = MOTION_DEFAULT_DURATIONS; exports.MOTION_DEFAULT_HOLD = MOTION_DEFAULT_HOLD; exports.MOTION_DIRECTIONS = MOTION_DIRECTIONS; exports.MOTION_DRAW_EFFECT_ID = MOTION_DRAW_EFFECT_ID; exports.MOTION_DRAW_MS_PER_UNIT = MOTION_DRAW_MS_PER_UNIT; exports.MOTION_DRAW_RANGE = MOTION_DRAW_RANGE; exports.MOTION_EASE_IN_OUT = MOTION_EASE_IN_OUT; exports.MOTION_EASE_OUT = MOTION_EASE_OUT; exports.MOTION_EDIT_OPS = MOTION_EDIT_OPS; exports.MOTION_ENTER_STYLES = MOTION_ENTER_STYLES; exports.MOTION_EXIT_STYLES = MOTION_EXIT_STYLES; exports.MOTION_ISSUE_CODES = MOTION_ISSUE_CODES; exports.MOTION_MIN_CHANGE_MS = MOTION_MIN_CHANGE_MS; exports.MotionSceneFormatError = MotionSceneFormatError; exports.activeSegment = activeSegment; exports.applyMotionControlValues = applyMotionControlValues; exports.applyMotionEdits = applyMotionEdits; exports.checkMotionScene = checkMotionScene; exports.commandShapeProblems = commandShapeProblems; exports.compileMotionScene = compileMotionScene; exports.createAnimationEditorToolProvider = createAnimationEditorToolProvider; exports.createMotionScene = createMotionScene; exports.describeMotionElements = describeMotionElements; exports.describeMotionShots = describeMotionShots; exports.fitMotionRect = fitMotionRect; exports.flairCurveFor = flairCurveFor; exports.flairEaseFor = flairEaseFor; exports.freshShotId = freshShotId; exports.indexMotionNodes = indexMotionNodes; exports.interpolateMotionValue = interpolateMotionValue; exports.isMotionCommand = isMotionCommand; exports.isMotionShot = isMotionShot; exports.motionCommandDuration = motionCommandDuration; exports.motionFrameAt = motionFrameAt; exports.motionFrameToSvg = motionFrameToSvg; exports.motionIssue = motionIssue; exports.motionIssueKey = motionIssueKey; exports.motionIssueLine = motionIssueLine; exports.motionNodeOffset = motionNodeOffset; exports.motionPathLength = motionPathLength; exports.motionRestValue = motionRestValue; exports.motionSceneShapeProblems = motionSceneShapeProblems; exports.motionSceneToJson = motionSceneToJson; exports.motionShotAt = motionShotAt; exports.motionTrackKey = motionTrackKey; exports.namedWithSuggestion = namedWithSuggestion; exports.parseMotionScene = parseMotionScene; exports.resolveMotionCamera = resolveMotionCamera; exports.segmentProgress = segmentProgress; exports.segmentValue = segmentValue; exports.shotShapeProblems = shotShapeProblems; exports.suggestName = suggestName; exports.toFlairEffectDocument = toFlairEffectDocument; exports.toFlairSvgMotion = toFlairSvgMotion; exports.toFlairVectorEffect = toFlairVectorEffect; exports.trackValue = trackValue; exports.withViewBox = withViewBox;
|
|
2221
2239
|
//# sourceMappingURL=index.cjs.map
|