@pixerate/editor 0.241.0 → 0.242.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.
Files changed (41) hide show
  1. package/dist/animation-editor/controller.d.cts +10 -0
  2. package/dist/animation-editor/controller.d.ts +10 -0
  3. package/dist/animation-editor/effects.d.cts +1 -1
  4. package/dist/animation-editor/effects.d.ts +1 -1
  5. package/dist/animation-editor/index.cjs +137 -88
  6. package/dist/animation-editor/index.js +60 -11
  7. package/dist/canvas/index.cjs +7 -7
  8. package/dist/canvas/index.js +1 -1
  9. package/dist/{chunk-A7PQNIBX.cjs → chunk-7V7QMFTI.cjs} +14 -14
  10. package/dist/{chunk-JAOSL334.cjs → chunk-GHCSC2WP.cjs} +38 -16
  11. package/dist/{chunk-JWCKJNDR.cjs → chunk-K5DS2JTA.cjs} +6 -6
  12. package/dist/{chunk-WDDUPWVG.js → chunk-L3JFOTBQ.js} +1 -1
  13. package/dist/{chunk-SIK3LT6M.js → chunk-OFH6Q67U.js} +28 -6
  14. package/dist/{chunk-G3RUKJ5C.js → chunk-RXZL4NG5.js} +1 -1
  15. package/dist/{chunk-TEFQISBY.js → chunk-X3ZINLIP.js} +1 -1
  16. package/dist/{chunk-ZQIWBJGH.cjs → chunk-XNZFVYC2.cjs} +7 -7
  17. package/dist/effects/fake.d.cts +4 -0
  18. package/dist/effects/fake.d.ts +4 -0
  19. package/dist/effects/helpers.d.cts +6 -0
  20. package/dist/effects/helpers.d.ts +6 -0
  21. package/dist/effects/index.cjs +222 -94
  22. package/dist/effects/index.js +131 -3
  23. package/dist/effects/types.d.cts +31 -0
  24. package/dist/effects/types.d.ts +31 -0
  25. package/dist/image-editor/index.cjs +13 -13
  26. package/dist/image-editor/index.js +1 -1
  27. package/dist/paint-editor/index.cjs +7 -7
  28. package/dist/paint-editor/index.js +2 -2
  29. package/dist/vector/index.cjs +6 -6
  30. package/dist/vector/index.js +1 -1
  31. package/dist/video-editor/controller.d.cts +49 -1
  32. package/dist/video-editor/controller.d.ts +49 -1
  33. package/dist/video-editor/effect-path.d.cts +66 -0
  34. package/dist/video-editor/effect-path.d.ts +66 -0
  35. package/dist/video-editor/index.cjs +616 -427
  36. package/dist/video-editor/index.d.cts +1 -0
  37. package/dist/video-editor/index.d.ts +1 -0
  38. package/dist/video-editor/index.js +193 -4
  39. package/package.json +1 -1
  40. package/skills/pixerate-animation-editor/SKILL.md +1 -1
  41. package/skills/pixerate-video-editor/SKILL.md +9 -2
@@ -15,7 +15,7 @@ import { type VideoSvgOptions } from './render.cjs';
15
15
  import type { VideoCameraFraming, VideoClipCamera, VideoClipEffect, VideoEffectValues, VideoPlacementMode, VideoProject } from './types.cjs';
16
16
  import { EffectsSlot } from '../effects/helpers.cjs';
17
17
  import { type VideoCameraBake } from './camera.cjs';
18
- import type { CameraMoveRole, CameraMoveSpec, EffectDescription, EffectProvider, EffectSummary, EffectValue } from '../effects/types.cjs';
18
+ import type { CameraMoveRole, CameraMoveSpec, EffectDescription, EffectPathValue, EffectProvider, EffectSummary, EffectValue } from '../effects/types.cjs';
19
19
  import { VideoEffectsEngine, type VideoEffectPlace } from './effects.cjs';
20
20
  import { type VideoAnimatable, type VideoKey } from './keyframes.cjs';
21
21
  import { type VideoEditPlan, type VideoEditPlanInput } from './plan.cjs';
@@ -80,6 +80,26 @@ export type VideoCameraMoveResult = {
80
80
  ok: false;
81
81
  error: string;
82
82
  };
83
+ /** The effect a path is drawn for on the preview: a clip, its effect instance ("generator" for an effect clip) and optionally the path control. */
84
+ export interface VideoPathDrawingTarget {
85
+ clip: string;
86
+ instance: string;
87
+ control?: string;
88
+ }
89
+ /** A path for an effect that draws along one (`setEffectPath`). */
90
+ export type VideoEffectPathInput = {
91
+ points: number[];
92
+ } | {
93
+ d: string;
94
+ } | {
95
+ mask: {
96
+ clip: string;
97
+ };
98
+ } | {
99
+ text: string;
100
+ font?: string;
101
+ align?: 'start' | 'middle' | 'end';
102
+ };
83
103
  export type VideoEffectEditResult = (VideoEditResult & {
84
104
  ok: true;
85
105
  clip: string;
@@ -116,6 +136,8 @@ export interface VideoEditorState {
116
136
  effectsProvider: EffectProvider | null;
117
137
  /** Proposed edit plans waiting for review, oldest first (see `proposePlan`). Not part of the project or its undo history. */
118
138
  plans: readonly VideoEditPlan[];
139
+ /** The effect a path is being drawn for on the preview (`startPathDrawing`), or `null`. Editor state. */
140
+ pathDrawing: VideoPathDrawingTarget | null;
119
141
  /** Bumped on every change. */
120
142
  revision: number;
121
143
  }
@@ -365,6 +387,32 @@ export declare class VideoEditorController {
365
387
  updateEffectValues(clip: string, part: 'generator' | 'transition', values: VideoEffectValues, options?: {
366
388
  merge?: string;
367
389
  }): Promise<VideoEffectEditResult>;
390
+ /**
391
+ * Gives an effect that draws along a path (see `pathControlsOf`) its path: on an effect clip
392
+ * (`instance` "generator") or a clip effect (its id). The path is frame points (`points`
393
+ * `[x0, y0, …]`, mapped into the pixels of the picture the effect renders: the project frame for
394
+ * an effect clip, the clip's own picture for a clip effect), SVG path data (`d`, which the effect
395
+ * fits as its control says; `""` clears it), the outline of a clip's mask (`mask`), or words the
396
+ * provider writes as a single-stroke path (`text`). `control` picks the path control when there
397
+ * are several. Checked before anything changes; one undo step. Returns the edit, the control and
398
+ * the value it took.
399
+ */
400
+ setEffectPath(clip: string, instance: string, path: VideoEffectPathInput, options?: {
401
+ control?: string;
402
+ }): Promise<VideoEffectEditResult & {
403
+ control?: string;
404
+ value?: EffectPathValue;
405
+ }>;
406
+ private pathDrawing;
407
+ /**
408
+ * Starts drawing a path on the preview for an effect that draws along one (the preview then
409
+ * takes the pointer; `finishPathDrawing` with the frame points applies it). Editor state.
410
+ */
411
+ startPathDrawing(target: VideoPathDrawingTarget): void;
412
+ /** Stops drawing a path without changing anything. */
413
+ cancelPathDrawing(): void;
414
+ /** Applies the drawn path (frame points) to the effect being drawn for, and stops drawing. One undo step. */
415
+ finishPathDrawing(points: number[]): Promise<VideoEffectEditResult>;
368
416
  /** Keys for one numeric control of a clip effect (clip-relative ms), or `null` to stop animating it (keeping its value at the clip's start). */
369
417
  setClipEffectKeyframes(clip: string, instance: string, control: string, keys: VideoKey[] | null): Promise<VideoEffectEditResult>;
370
418
  /** What plays at `time` (default: the playhead). */
@@ -15,7 +15,7 @@ import { type VideoSvgOptions } from './render.js';
15
15
  import type { VideoCameraFraming, VideoClipCamera, VideoClipEffect, VideoEffectValues, VideoPlacementMode, VideoProject } from './types.js';
16
16
  import { EffectsSlot } from '../effects/helpers.js';
17
17
  import { type VideoCameraBake } from './camera.js';
18
- import type { CameraMoveRole, CameraMoveSpec, EffectDescription, EffectProvider, EffectSummary, EffectValue } from '../effects/types.js';
18
+ import type { CameraMoveRole, CameraMoveSpec, EffectDescription, EffectPathValue, EffectProvider, EffectSummary, EffectValue } from '../effects/types.js';
19
19
  import { VideoEffectsEngine, type VideoEffectPlace } from './effects.js';
20
20
  import { type VideoAnimatable, type VideoKey } from './keyframes.js';
21
21
  import { type VideoEditPlan, type VideoEditPlanInput } from './plan.js';
@@ -80,6 +80,26 @@ export type VideoCameraMoveResult = {
80
80
  ok: false;
81
81
  error: string;
82
82
  };
83
+ /** The effect a path is drawn for on the preview: a clip, its effect instance ("generator" for an effect clip) and optionally the path control. */
84
+ export interface VideoPathDrawingTarget {
85
+ clip: string;
86
+ instance: string;
87
+ control?: string;
88
+ }
89
+ /** A path for an effect that draws along one (`setEffectPath`). */
90
+ export type VideoEffectPathInput = {
91
+ points: number[];
92
+ } | {
93
+ d: string;
94
+ } | {
95
+ mask: {
96
+ clip: string;
97
+ };
98
+ } | {
99
+ text: string;
100
+ font?: string;
101
+ align?: 'start' | 'middle' | 'end';
102
+ };
83
103
  export type VideoEffectEditResult = (VideoEditResult & {
84
104
  ok: true;
85
105
  clip: string;
@@ -116,6 +136,8 @@ export interface VideoEditorState {
116
136
  effectsProvider: EffectProvider | null;
117
137
  /** Proposed edit plans waiting for review, oldest first (see `proposePlan`). Not part of the project or its undo history. */
118
138
  plans: readonly VideoEditPlan[];
139
+ /** The effect a path is being drawn for on the preview (`startPathDrawing`), or `null`. Editor state. */
140
+ pathDrawing: VideoPathDrawingTarget | null;
119
141
  /** Bumped on every change. */
120
142
  revision: number;
121
143
  }
@@ -365,6 +387,32 @@ export declare class VideoEditorController {
365
387
  updateEffectValues(clip: string, part: 'generator' | 'transition', values: VideoEffectValues, options?: {
366
388
  merge?: string;
367
389
  }): Promise<VideoEffectEditResult>;
390
+ /**
391
+ * Gives an effect that draws along a path (see `pathControlsOf`) its path: on an effect clip
392
+ * (`instance` "generator") or a clip effect (its id). The path is frame points (`points`
393
+ * `[x0, y0, …]`, mapped into the pixels of the picture the effect renders: the project frame for
394
+ * an effect clip, the clip's own picture for a clip effect), SVG path data (`d`, which the effect
395
+ * fits as its control says; `""` clears it), the outline of a clip's mask (`mask`), or words the
396
+ * provider writes as a single-stroke path (`text`). `control` picks the path control when there
397
+ * are several. Checked before anything changes; one undo step. Returns the edit, the control and
398
+ * the value it took.
399
+ */
400
+ setEffectPath(clip: string, instance: string, path: VideoEffectPathInput, options?: {
401
+ control?: string;
402
+ }): Promise<VideoEffectEditResult & {
403
+ control?: string;
404
+ value?: EffectPathValue;
405
+ }>;
406
+ private pathDrawing;
407
+ /**
408
+ * Starts drawing a path on the preview for an effect that draws along one (the preview then
409
+ * takes the pointer; `finishPathDrawing` with the frame points applies it). Editor state.
410
+ */
411
+ startPathDrawing(target: VideoPathDrawingTarget): void;
412
+ /** Stops drawing a path without changing anything. */
413
+ cancelPathDrawing(): void;
414
+ /** Applies the drawn path (frame points) to the effect being drawn for, and stops drawing. One undo step. */
415
+ finishPathDrawing(points: number[]): Promise<VideoEffectEditResult>;
368
416
  /** Keys for one numeric control of a clip effect (clip-relative ms), or `null` to stop animating it (keeping its value at the clip's start). */
369
417
  setClipEffectKeyframes(clip: string, instance: string, control: string, keys: VideoKey[] | null): Promise<VideoEffectEditResult>;
370
418
  /** What plays at `time` (default: the playhead). */
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Paths for effects that draw along one (`pathControlsOf`): where a clip's picture is in the frame,
3
+ * so a path drawn on the frame can be handed to an effect in the pixels of the picture it renders.
4
+ *
5
+ * An effect clip renders at the project frame and is placed over it (filled, unless moved or
6
+ * scaled); a clip effect renders over the clip's picture as it comes from the source (a media
7
+ * clip's own size), before placement. Either way a frame point maps into the picture by undoing
8
+ * the clip's placement and rotation at its first frame.
9
+ */
10
+ import type { VideoClip, VideoProject } from './types.cjs';
11
+ /** A clip's picture: its size in pixels, where it is placed in the frame, and its rotation (degrees). */
12
+ export interface VideoClipPicture {
13
+ size: {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ rect: {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ };
23
+ rotation: number;
24
+ }
25
+ /** Where a clip's picture lies in the frame at its first frame. */
26
+ export declare function videoClipPicture(project: VideoProject, clip: VideoClip): VideoClipPicture;
27
+ /** Frame points `[x0, y0, x1, y1, …]` in the pixels of a clip's picture (rounded to 0.01 px). */
28
+ export declare function framePointsToPicture(points: readonly number[], picture: VideoClipPicture): number[];
29
+ /** A clip's mask outline as frame points `[x0, y0, …]` (its rotation applied), closed; `null` without a mask. */
30
+ export declare function videoClipMaskOutline(project: VideoProject, clip: VideoClip): number[] | null;
31
+ /**
32
+ * Collects a path drawn on the preview with a pointer, in frame pixels: `down` and `move` take the
33
+ * pointer's position over the preview element (`box`, its on-screen rect) and keep a point every
34
+ * `spacing` frame pixels. Framework-free, for the bindings.
35
+ */
36
+ export declare class VideoPathGesture {
37
+ private readonly frame;
38
+ private readonly spacing;
39
+ points: number[];
40
+ private drawing;
41
+ constructor(frame: {
42
+ width: number;
43
+ height: number;
44
+ }, spacing?: number);
45
+ private at;
46
+ down(e: {
47
+ clientX: number;
48
+ clientY: number;
49
+ }, box: {
50
+ left: number;
51
+ top: number;
52
+ width: number;
53
+ height: number;
54
+ }): void;
55
+ move(e: {
56
+ clientX: number;
57
+ clientY: number;
58
+ }, box: {
59
+ left: number;
60
+ top: number;
61
+ width: number;
62
+ height: number;
63
+ }): boolean;
64
+ /** Ends the stroke; returns its points, or `null` for a tap (fewer than two points). */
65
+ up(): number[] | null;
66
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Paths for effects that draw along one (`pathControlsOf`): where a clip's picture is in the frame,
3
+ * so a path drawn on the frame can be handed to an effect in the pixels of the picture it renders.
4
+ *
5
+ * An effect clip renders at the project frame and is placed over it (filled, unless moved or
6
+ * scaled); a clip effect renders over the clip's picture as it comes from the source (a media
7
+ * clip's own size), before placement. Either way a frame point maps into the picture by undoing
8
+ * the clip's placement and rotation at its first frame.
9
+ */
10
+ import type { VideoClip, VideoProject } from './types.js';
11
+ /** A clip's picture: its size in pixels, where it is placed in the frame, and its rotation (degrees). */
12
+ export interface VideoClipPicture {
13
+ size: {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ rect: {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ };
23
+ rotation: number;
24
+ }
25
+ /** Where a clip's picture lies in the frame at its first frame. */
26
+ export declare function videoClipPicture(project: VideoProject, clip: VideoClip): VideoClipPicture;
27
+ /** Frame points `[x0, y0, x1, y1, …]` in the pixels of a clip's picture (rounded to 0.01 px). */
28
+ export declare function framePointsToPicture(points: readonly number[], picture: VideoClipPicture): number[];
29
+ /** A clip's mask outline as frame points `[x0, y0, …]` (its rotation applied), closed; `null` without a mask. */
30
+ export declare function videoClipMaskOutline(project: VideoProject, clip: VideoClip): number[] | null;
31
+ /**
32
+ * Collects a path drawn on the preview with a pointer, in frame pixels: `down` and `move` take the
33
+ * pointer's position over the preview element (`box`, its on-screen rect) and keep a point every
34
+ * `spacing` frame pixels. Framework-free, for the bindings.
35
+ */
36
+ export declare class VideoPathGesture {
37
+ private readonly frame;
38
+ private readonly spacing;
39
+ points: number[];
40
+ private drawing;
41
+ constructor(frame: {
42
+ width: number;
43
+ height: number;
44
+ }, spacing?: number);
45
+ private at;
46
+ down(e: {
47
+ clientX: number;
48
+ clientY: number;
49
+ }, box: {
50
+ left: number;
51
+ top: number;
52
+ width: number;
53
+ height: number;
54
+ }): void;
55
+ move(e: {
56
+ clientX: number;
57
+ clientY: number;
58
+ }, box: {
59
+ left: number;
60
+ top: number;
61
+ width: number;
62
+ height: number;
63
+ }): boolean;
64
+ /** Ends the stroke; returns its points, or `null` for a tap (fewer than two points). */
65
+ up(): number[] | null;
66
+ }