@pixerate/editor-react 0.91.1 → 0.93.1

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 (63) hide show
  1. package/dist/animation-editor/AnimationEditor.d.cts +11 -1
  2. package/dist/animation-editor/AnimationEditor.d.ts +11 -1
  3. package/dist/animation-editor/index.cjs +494 -366
  4. package/dist/animation-editor/index.js +48 -4
  5. package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
  6. package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
  7. package/dist/canvas/index.cjs +1033 -893
  8. package/dist/canvas/index.d.cts +2 -0
  9. package/dist/canvas/index.d.ts +2 -0
  10. package/dist/canvas/index.js +125 -74
  11. package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
  12. package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
  13. package/dist/chart/ChartEditor.d.cts +12 -1
  14. package/dist/chart/ChartEditor.d.ts +12 -1
  15. package/dist/chart/index.cjs +187 -29
  16. package/dist/chart/index.js +74 -10
  17. package/dist/{chunk-SMMO7CZB.js → chunk-6YRSQW2V.js} +84 -2
  18. package/dist/chunk-7I73DW4V.js +43 -0
  19. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  20. package/dist/chunk-IPVWWVSF.js +96 -0
  21. package/dist/hooks/useAgentToolProvider.d.cts +6 -2
  22. package/dist/hooks/useAgentToolProvider.d.ts +6 -2
  23. package/dist/image-editor/ImageEditor.d.cts +10 -0
  24. package/dist/image-editor/ImageEditor.d.ts +10 -0
  25. package/dist/image-editor/index.cjs +1028 -864
  26. package/dist/image-editor/index.js +2 -1
  27. package/dist/index.cjs +2070 -1812
  28. package/dist/index.d.cts +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +21 -3
  31. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  32. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  33. package/dist/paint-editor/index.cjs +319 -164
  34. package/dist/paint-editor/index.js +84 -11
  35. package/dist/parameters/ParametersPanel.d.cts +11 -1
  36. package/dist/parameters/ParametersPanel.d.ts +11 -1
  37. package/dist/parameters/index.cjs +190 -41
  38. package/dist/parameters/index.js +23 -4
  39. package/dist/playback/AgentPlaybackContext.d.cts +9 -0
  40. package/dist/playback/AgentPlaybackContext.d.ts +9 -0
  41. package/dist/playback/PresenceLayer.d.cts +28 -0
  42. package/dist/playback/PresenceLayer.d.ts +28 -0
  43. package/dist/playback/index.d.cts +4 -0
  44. package/dist/playback/index.d.ts +4 -0
  45. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  46. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  47. package/dist/playback/usePlaybackSurface.d.cts +11 -0
  48. package/dist/playback/usePlaybackSurface.d.ts +11 -0
  49. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  50. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  51. package/dist/spreadsheet/index.cjs +443 -313
  52. package/dist/spreadsheet/index.js +2 -1
  53. package/dist/vector/VectorCanvas.d.cts +11 -1
  54. package/dist/vector/VectorCanvas.d.ts +11 -1
  55. package/dist/vector/index.cjs +946 -826
  56. package/dist/vector/index.js +42 -3
  57. package/dist/video-editor/VideoEditor.d.cts +6 -1
  58. package/dist/video-editor/VideoEditor.d.ts +6 -1
  59. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  60. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  61. package/dist/video-editor/index.cjs +463 -332
  62. package/dist/video-editor/index.js +53 -5
  63. package/package.json +3 -3
@@ -5,6 +5,11 @@ import {
5
5
  useEffects
6
6
  } from "../chunk-5R67YSSD.js";
7
7
  import "../chunk-OTGJEYHV.js";
8
+ import {
9
+ PresenceLayer,
10
+ useAgentPlayback,
11
+ usePlaybackSurface
12
+ } from "../chunk-IPVWWVSF.js";
8
13
 
9
14
  // src/vector/useVectorEditor.ts
10
15
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -94,7 +99,8 @@ import {
94
99
  isVectorTextTarget,
95
100
  toVectorKeyInput,
96
101
  toVectorPointerInput,
97
- vectorDiamondPath
102
+ vectorDiamondPath,
103
+ createVectorPlaybackLocator
98
104
  } from "@pixerate/editor/vector";
99
105
 
100
106
  // src/vector/VectorWidthPointEditor.tsx
@@ -372,7 +378,10 @@ function VectorCanvas({
372
378
  guideColor = THEME2.guide,
373
379
  className,
374
380
  style,
375
- "aria-label": ariaLabel = "Vector canvas"
381
+ "aria-label": ariaLabel = "Vector canvas",
382
+ playback,
383
+ playbackId = "vector",
384
+ onPlaybackReveal
376
385
  }) {
377
386
  const state = useVectorEditorState(controller);
378
387
  const svgRef = useRef3(null);
@@ -426,6 +435,34 @@ function VectorCanvas({
426
435
  el.addEventListener("wheel", onWheel, { passive: false });
427
436
  return () => el.removeEventListener("wheel", onWheel);
428
437
  }, [controller]);
438
+ const ambientPlayback = useAgentPlayback();
439
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
440
+ const [locate] = useState2(() => createVectorPlaybackLocator(controller));
441
+ const svgBox = () => svgRef.current?.getBoundingClientRect() ?? null;
442
+ const presence = usePlaybackSurface(playing, playbackId, {
443
+ defaultKind: "vector",
444
+ locate,
445
+ bounds: () => {
446
+ const r = svgBox();
447
+ const v = controller.getState().viewport;
448
+ return r && r.width > 0 ? { x: -v.x / v.zoom, y: -v.y / v.zoom, width: r.width / v.zoom, height: r.height / v.zoom } : null;
449
+ },
450
+ visible: () => {
451
+ const r = svgBox();
452
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
453
+ },
454
+ toViewport: (p) => {
455
+ const r = svgBox();
456
+ const v = controller.getState().viewport;
457
+ return { x: (r?.left ?? 0) + p.x * v.zoom + v.x, y: (r?.top ?? 0) + p.y * v.zoom + v.y };
458
+ },
459
+ fromViewport: (p) => {
460
+ const r = svgBox();
461
+ const v = controller.getState().viewport;
462
+ return { x: (p.x - (r?.left ?? 0) - v.x) / v.zoom, y: (p.y - (r?.top ?? 0) - v.y) / v.zoom };
463
+ },
464
+ reveal: () => onPlaybackReveal?.()
465
+ });
429
466
  const local = (e) => {
430
467
  const rect = svgRef.current?.getBoundingClientRect();
431
468
  return { x: e.clientX - (rect?.left ?? 0), y: e.clientY - (rect?.top ?? 0) };
@@ -814,7 +851,9 @@ function VectorCanvas({
814
851
  }
815
852
  ) }),
816
853
  edit && editAt && // Width Point Edit (double-click with the width tool), beside the point.
817
- /* @__PURE__ */ jsx2("foreignObject", { "data-vector-width-point-edit": "", x: editAt.x + 12, y: editAt.y + 12, width: 180, height: 140, style: { overflow: "visible" }, children: /* @__PURE__ */ jsx2(VectorWidthPointEditor, { controller, edit, accentColor }, `${edit.nodeId}:${edit.index}:${edit.t}`) })
854
+ /* @__PURE__ */ jsx2("foreignObject", { "data-vector-width-point-edit": "", x: editAt.x + 12, y: editAt.y + 12, width: 180, height: 140, style: { overflow: "visible" }, children: /* @__PURE__ */ jsx2(VectorWidthPointEditor, { controller, edit, accentColor }, `${edit.nodeId}:${edit.index}:${edit.t}`) }),
855
+ playing && // The agent's cursor (agent playback), over everything and never in the way.
856
+ /* @__PURE__ */ jsx2("foreignObject", { "data-vector-presence": "", x: 0, y: 0, width: "100%", height: "100%", pointerEvents: "none", style: { overflow: "visible", pointerEvents: "none" }, children: /* @__PURE__ */ jsx2("div", { style: { position: "relative", width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx2(PresenceLayer, { presence, viewport: state.viewport }) }) })
818
857
  ]
819
858
  }
820
859
  );
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { VideoEditorController, VideoEditorOptions } from '@pixerate/editor/video-editor';
3
3
  import type { EffectProvider } from '@pixerate/editor/effects';
4
+ import type { AgentPlayback } from '@pixerate/editor/tools';
4
5
  export interface VideoEditorProps {
5
6
  /** The controller to edit. Without it one is created from `options` for the component's lifetime. */
6
7
  controller?: VideoEditorController;
@@ -32,10 +33,14 @@ export interface VideoEditorProps {
32
33
  /** Show the effects panel (default: when a provider is given or the project has effects). */
33
34
  showEffects?: boolean;
34
35
  className?: string;
36
+ /** Agent playback on the timeline (see `<VideoTimeline playback>`; default: the nearest `AgentPlaybackProvider`). */
37
+ playback?: AgentPlayback | null;
38
+ /** Bring the editor on screen (switch to its tab) before the agent acts. */
39
+ onPlaybackReveal?: () => void | Promise<void>;
35
40
  }
36
41
  /**
37
42
  * A whole non-linear video editor for a `VideoEditorController`: the media bin, the preview, the
38
43
  * transport, the timeline and the clip inspector, with the project's issues listed under the
39
44
  * timeline. Every edit is one undo step; the controller's agent tools edit the same project.
40
45
  */
41
- export declare function VideoEditor({ controller: given, options, editable, pxPerSecond, onPxPerSecondChange, resolution, showIssues, showTranscript, showScopes, effects, showEffects, className }: VideoEditorProps): React.JSX.Element;
46
+ export declare function VideoEditor({ controller: given, options, editable, pxPerSecond, onPxPerSecondChange, resolution, showIssues, showTranscript, showScopes, effects, showEffects, className, playback, onPlaybackReveal }: VideoEditorProps): React.JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { VideoEditorController, VideoEditorOptions } from '@pixerate/editor/video-editor';
3
3
  import type { EffectProvider } from '@pixerate/editor/effects';
4
+ import type { AgentPlayback } from '@pixerate/editor/tools';
4
5
  export interface VideoEditorProps {
5
6
  /** The controller to edit. Without it one is created from `options` for the component's lifetime. */
6
7
  controller?: VideoEditorController;
@@ -32,10 +33,14 @@ export interface VideoEditorProps {
32
33
  /** Show the effects panel (default: when a provider is given or the project has effects). */
33
34
  showEffects?: boolean;
34
35
  className?: string;
36
+ /** Agent playback on the timeline (see `<VideoTimeline playback>`; default: the nearest `AgentPlaybackProvider`). */
37
+ playback?: AgentPlayback | null;
38
+ /** Bring the editor on screen (switch to its tab) before the agent acts. */
39
+ onPlaybackReveal?: () => void | Promise<void>;
35
40
  }
36
41
  /**
37
42
  * A whole non-linear video editor for a `VideoEditorController`: the media bin, the preview, the
38
43
  * transport, the timeline and the clip inspector, with the project's issues listed under the
39
44
  * timeline. Every edit is one undo step; the controller's agent tools edit the same project.
40
45
  */
41
- export declare function VideoEditor({ controller: given, options, editable, pxPerSecond, onPxPerSecondChange, resolution, showIssues, showTranscript, showScopes, effects, showEffects, className }: VideoEditorProps): React.JSX.Element;
46
+ export declare function VideoEditor({ controller: given, options, editable, pxPerSecond, onPxPerSecondChange, resolution, showIssues, showTranscript, showScopes, effects, showEffects, className, playback, onPlaybackReveal }: VideoEditorProps): React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type VideoEditorController, type VideoWaveformMode } from '@pixerate/editor/video-editor';
3
+ import type { AgentPlayback } from '@pixerate/editor/tools';
3
4
  export interface VideoTimelineProps {
4
5
  controller: VideoEditorController;
5
6
  /** Zoom: pixels per second of timeline. With `onPxPerSecondChange` the host owns it; otherwise it is the starting zoom (default 100). */
@@ -11,5 +12,14 @@ export interface VideoTimelineProps {
11
12
  /** Draw waveforms in audio clips (default), in every clip with sound (`all`), or not at all. Sound is decoded once per asset through `controller.audioPeaks`. */
12
13
  waveforms?: VideoWaveformMode;
13
14
  className?: string;
15
+ /**
16
+ * Agent playback: act out the video tools' calls here with the agent's cursor (default: the
17
+ * nearest `AgentPlaybackProvider`; `null` turns it off).
18
+ */
19
+ playback?: AgentPlayback | null;
20
+ /** The playback surface id (default `video`, where the video tool providers play). */
21
+ playbackId?: string;
22
+ /** Bring the timeline on screen (switch to its tab) before the agent acts. */
23
+ onPlaybackReveal?: () => void | Promise<void>;
14
24
  }
15
- export declare function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable, waveforms, className }: VideoTimelineProps): React.JSX.Element;
25
+ export declare function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable, waveforms, className, playback, playbackId, onPlaybackReveal }: VideoTimelineProps): React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type VideoEditorController, type VideoWaveformMode } from '@pixerate/editor/video-editor';
3
+ import type { AgentPlayback } from '@pixerate/editor/tools';
3
4
  export interface VideoTimelineProps {
4
5
  controller: VideoEditorController;
5
6
  /** Zoom: pixels per second of timeline. With `onPxPerSecondChange` the host owns it; otherwise it is the starting zoom (default 100). */
@@ -11,5 +12,14 @@ export interface VideoTimelineProps {
11
12
  /** Draw waveforms in audio clips (default), in every clip with sound (`all`), or not at all. Sound is decoded once per asset through `controller.audioPeaks`. */
12
13
  waveforms?: VideoWaveformMode;
13
14
  className?: string;
15
+ /**
16
+ * Agent playback: act out the video tools' calls here with the agent's cursor (default: the
17
+ * nearest `AgentPlaybackProvider`; `null` turns it off).
18
+ */
19
+ playback?: AgentPlayback | null;
20
+ /** The playback surface id (default `video`, where the video tool providers play). */
21
+ playbackId?: string;
22
+ /** Bring the timeline on screen (switch to its tab) before the agent acts. */
23
+ onPlaybackReveal?: () => void | Promise<void>;
14
24
  }
15
- export declare function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable, waveforms, className }: VideoTimelineProps): React.JSX.Element;
25
+ export declare function VideoTimeline({ controller, pxPerSecond, onPxPerSecondChange, editable, waveforms, className, playback, playbackId, onPlaybackReveal }: VideoTimelineProps): React.JSX.Element;