@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/animation-editor/useAnimationEditor.ts
10
15
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -162,7 +167,7 @@ function ShotTimeline({ controller, className = "" }) {
162
167
  }
163
168
 
164
169
  // src/animation-editor/AnimationEditor.tsx
165
- import { useMemo as useMemo7, useState as useState7 } from "react";
170
+ import { useMemo as useMemo7, useRef as useRef3, useState as useState7 } from "react";
166
171
  import { indexMotionNodes as indexMotionNodes2, motionIssueLine } from "@pixerate/editor/animation-editor";
167
172
 
168
173
  // src/animation-editor/CommandInspector.tsx
@@ -1022,8 +1027,44 @@ function AnimationEffectsPanel({ controller, node, className = "" }) {
1022
1027
  import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1023
1028
  var ONION = { before: 3, after: 1 };
1024
1029
  var btn5 = "rounded border border-border px-2 py-0.5 text-xs disabled:opacity-40";
1025
- function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "" }) {
1030
+ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssues = true, editable = true, effects, className = "", playback, playbackId = "animation", onPlaybackReveal }) {
1026
1031
  const state = useAnimationEditorState(controller);
1032
+ const rootRef = useRef3(null);
1033
+ const ambientPlayback = useAgentPlayback();
1034
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1035
+ const rectIn = (el) => {
1036
+ const box = rootRef.current?.getBoundingClientRect();
1037
+ const r = el?.getBoundingClientRect();
1038
+ return box && r && r.width > 0 ? { x: r.left - box.left, y: r.top - box.top, width: r.width, height: r.height } : null;
1039
+ };
1040
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
1041
+ defaultKind: "shot",
1042
+ locate: (ref) => {
1043
+ const root = rootRef.current;
1044
+ if (!root) return null;
1045
+ if (ref.kind === "shot") return rectIn(root.querySelector(`[data-shot="${CSS.escape(ref.id)}"]`));
1046
+ if (ref.kind === "element") return rectIn(root.querySelector(`[data-animation-stage] [id="ae-${CSS.escape(ref.id)}"]`));
1047
+ return null;
1048
+ },
1049
+ bounds: () => {
1050
+ const r = rootRef.current?.getBoundingClientRect();
1051
+ return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
1052
+ },
1053
+ visible: () => {
1054
+ const r = rootRef.current?.getBoundingClientRect();
1055
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
1056
+ },
1057
+ toViewport: (p) => {
1058
+ const r = rootRef.current?.getBoundingClientRect();
1059
+ return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
1060
+ },
1061
+ fromViewport: (p) => {
1062
+ const r = rootRef.current?.getBoundingClientRect();
1063
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1064
+ },
1065
+ reveal: () => onPlaybackReveal?.()
1066
+ });
1067
+ const presenceLayer = playing ? /* @__PURE__ */ jsx11(PresenceLayer, { presence: agentPresence }) : null;
1027
1068
  useEffects(controller, effects);
1028
1069
  const { issues, scene, selection, readOnly } = state;
1029
1070
  const [picked, setPicked] = useState7(null);
@@ -1055,7 +1096,8 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1055
1096
  );
1056
1097
  const issueList = showIssues && issues.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "space-y-0.5 text-xs", "aria-label": "Animation issues", children: issues.map((issue, i) => /* @__PURE__ */ jsx11("li", { className: issue.severity === "error" ? "text-red-500" : issue.severity === "warning" ? "text-amber-500" : "text-muted-foreground", children: motionIssueLine(issue) }, i)) });
1057
1098
  if (!editable)
1058
- return /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1099
+ return /* @__PURE__ */ jsxs9("div", { ref: rootRef, className: `relative flex flex-col gap-2 ${className}`, "data-animation-editor": "", children: [
1100
+ presenceLayer,
1059
1101
  stage,
1060
1102
  /* @__PURE__ */ jsx11(PlayheadScrubber, { controller }),
1061
1103
  issueList
@@ -1063,7 +1105,8 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1063
1105
  return /* @__PURE__ */ jsxs9(
1064
1106
  "div",
1065
1107
  {
1066
- className: `grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1108
+ ref: rootRef,
1109
+ className: `relative grid gap-3 lg:grid-cols-[minmax(0,1fr)_20rem] ${className}`,
1067
1110
  "data-animation-editor": "",
1068
1111
  onKeyDown: (e) => {
1069
1112
  const el = e.target;
@@ -1073,6 +1116,7 @@ function AnimationEditor({ controller, values, onionSkin, motionPaths, showIssue
1073
1116
  else controller.undo();
1074
1117
  },
1075
1118
  children: [
1119
+ presenceLayer,
1076
1120
  /* @__PURE__ */ jsxs9("div", { className: "flex min-w-0 flex-col gap-2", children: [
1077
1121
  stage,
1078
1122
  /* @__PURE__ */ jsx11(PlayheadScrubber, { controller }),
@@ -5,6 +5,9 @@ export interface AgentPresenceLayerProps {
5
5
  className?: string;
6
6
  }
7
7
  /**
8
+ * @deprecated Use `<PresenceLayer>` with `useCanvasPlaybackSurface` (agent playback), which
9
+ * plays every tool call; this layer only draws `AgentPresence` objects you place yourself.
10
+ *
8
11
  * Visual multiplayer and agent choreography presence layer for React Canvas.
9
12
  * Renders floating cursor indicators, agent name tags, and active status tooltips.
10
13
  */
@@ -5,6 +5,9 @@ export interface AgentPresenceLayerProps {
5
5
  className?: string;
6
6
  }
7
7
  /**
8
+ * @deprecated Use `<PresenceLayer>` with `useCanvasPlaybackSurface` (agent playback), which
9
+ * plays every tool call; this layer only draws `AgentPresence` objects you place yourself.
10
+ *
8
11
  * Visual multiplayer and agent choreography presence layer for React Canvas.
9
12
  * Renders floating cursor indicators, agent name tags, and active status tooltips.
10
13
  */