@pixerate/editor-react 0.92.0 → 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 (45) 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/index.cjs +3 -2
  6. package/dist/canvas/index.js +4 -4
  7. package/dist/chart/ChartEditor.d.cts +12 -1
  8. package/dist/chart/ChartEditor.d.ts +12 -1
  9. package/dist/chart/index.cjs +187 -29
  10. package/dist/chart/index.js +74 -10
  11. package/dist/{chunk-6MDTFAPY.js → chunk-6YRSQW2V.js} +5 -5
  12. package/dist/chunk-7I73DW4V.js +43 -0
  13. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  14. package/dist/{chunk-ECBC4HD7.js → chunk-IPVWWVSF.js} +3 -2
  15. package/dist/image-editor/index.cjs +3 -2
  16. package/dist/image-editor/index.js +2 -2
  17. package/dist/index.cjs +609 -527
  18. package/dist/index.js +10 -6
  19. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  20. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  21. package/dist/paint-editor/index.cjs +319 -164
  22. package/dist/paint-editor/index.js +84 -11
  23. package/dist/parameters/ParametersPanel.d.cts +11 -1
  24. package/dist/parameters/ParametersPanel.d.ts +11 -1
  25. package/dist/parameters/index.cjs +190 -41
  26. package/dist/parameters/index.js +23 -4
  27. package/dist/playback/index.d.cts +1 -0
  28. package/dist/playback/index.d.ts +1 -0
  29. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  30. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  31. package/dist/playback/usePlaybackSurface.d.cts +3 -1
  32. package/dist/playback/usePlaybackSurface.d.ts +3 -1
  33. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  34. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  35. package/dist/spreadsheet/index.cjs +443 -313
  36. package/dist/spreadsheet/index.js +2 -1
  37. package/dist/vector/index.cjs +3 -2
  38. package/dist/vector/index.js +5 -5
  39. package/dist/video-editor/VideoEditor.d.cts +6 -1
  40. package/dist/video-editor/VideoEditor.d.ts +6 -1
  41. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  42. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  43. package/dist/video-editor/index.cjs +463 -332
  44. package/dist/video-editor/index.js +53 -5
  45. package/package.json +3 -3
@@ -1,3 +1,9 @@
1
+ import {
2
+ PresenceLayer,
3
+ useAgentPlayback,
4
+ usePlaybackSurface
5
+ } from "./chunk-IPVWWVSF.js";
6
+
1
7
  // src/spreadsheet/useSpreadsheetEditor.ts
2
8
  import { useState, useRef, useCallback, useMemo } from "react";
3
9
  import {
@@ -248,7 +254,8 @@ import {
248
254
  numberFormatColorToCss,
249
255
  getConditionalFormatCss as getConditionalFormatCss2,
250
256
  getConditionalFormatIcon,
251
- getDataBarCss
257
+ getDataBarCss,
258
+ parseSpreadsheetPlaybackRef
252
259
  } from "@pixerate/editor/spreadsheet";
253
260
 
254
261
  // src/spreadsheet/SpreadsheetContextMenu.tsx
@@ -1209,11 +1216,53 @@ var SpreadsheetEditor = ({
1209
1216
  onColumnHeaderClick,
1210
1217
  onColumnResize,
1211
1218
  showSheetTabs = false,
1212
- virtualize = "auto"
1219
+ virtualize = "auto",
1220
+ playback,
1221
+ playbackId = "spreadsheet",
1222
+ onPlaybackReveal
1213
1223
  }) => {
1214
1224
  const defaultState = useSpreadsheetEditor();
1215
1225
  const state = externalState || defaultState;
1216
1226
  const gridRef = useRef8(null);
1227
+ const ambientPlayback = useAgentPlayback();
1228
+ const playing = (playback === void 0 ? ambientPlayback : playback) ?? null;
1229
+ const agentPresence = usePlaybackSurface(playing, playbackId, {
1230
+ defaultKind: "cell",
1231
+ locate: (ref) => {
1232
+ const grid2 = gridRef.current;
1233
+ const range = parseSpreadsheetPlaybackRef(ref);
1234
+ if (!grid2 || !range) return null;
1235
+ const box = grid2.getBoundingClientRect();
1236
+ const inside = (v, a, b) => (a === null || v >= a) && (b === null || v <= b);
1237
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
1238
+ for (const td of grid2.querySelectorAll("td[data-row][data-col]")) {
1239
+ if (!inside(Number(td.dataset.row), range.startRow, range.endRow) || !inside(Number(td.dataset.col), range.startCol, range.endCol)) continue;
1240
+ const r = td.getBoundingClientRect();
1241
+ minX = Math.min(minX, r.left - box.left);
1242
+ minY = Math.min(minY, r.top - box.top);
1243
+ maxX = Math.max(maxX, r.right - box.left);
1244
+ maxY = Math.max(maxY, r.bottom - box.top);
1245
+ }
1246
+ return minX < maxX ? { x: minX, y: minY, width: maxX - minX, height: maxY - minY } : null;
1247
+ },
1248
+ bounds: () => {
1249
+ const r = gridRef.current?.getBoundingClientRect();
1250
+ return r && r.width > 0 ? { x: 0, y: 0, width: r.width, height: r.height } : null;
1251
+ },
1252
+ visible: () => {
1253
+ const r = gridRef.current?.getBoundingClientRect();
1254
+ return !!r && r.width > 0 && r.height > 0 && !(typeof document !== "undefined" && document.visibilityState === "hidden");
1255
+ },
1256
+ toViewport: (p) => {
1257
+ const r = gridRef.current?.getBoundingClientRect();
1258
+ return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
1259
+ },
1260
+ fromViewport: (p) => {
1261
+ const r = gridRef.current?.getBoundingClientRect();
1262
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1263
+ },
1264
+ reveal: () => onPlaybackReveal?.()
1265
+ });
1217
1266
  const scrollRef = useRef8(null);
1218
1267
  const formulaBarRef = useRef8(null);
1219
1268
  const cellInputRef = useRef8(null);
@@ -1607,7 +1656,7 @@ var SpreadsheetEditor = ({
1607
1656
  "div",
1608
1657
  {
1609
1658
  ref: gridRef,
1610
- className: "flex flex-col h-full w-full overflow-hidden border border-border bg-background select-none outline-none text-foreground font-sans text-xs",
1659
+ className: "relative flex flex-col h-full w-full overflow-hidden border border-border bg-background select-none outline-none text-foreground font-sans text-xs",
1611
1660
  tabIndex: 0,
1612
1661
  onKeyDown: handleKeyDown,
1613
1662
  role: "grid",
@@ -1944,6 +1993,7 @@ var SpreadsheetEditor = ({
1944
1993
  }
1945
1994
  ),
1946
1995
  state.validationPrompt && /* @__PURE__ */ jsx7(SpreadsheetValidationDialog, { prompt: state.validationPrompt, onResolve: resolveValidation }),
1996
+ playing && /* @__PURE__ */ jsx7(PresenceLayer, { presence: agentPresence }),
1947
1997
  /* @__PURE__ */ jsx7("style", { children: `
1948
1998
  .col-resize-handle:hover .col-resize-handle-line {
1949
1999
  background-color: var(--primary, #6366f1);
@@ -54,10 +54,11 @@ function useAgentPlayback() {
54
54
  // src/playback/usePlaybackSurface.ts
55
55
  import { useEffect, useRef, useState } from "react";
56
56
  import { PresenceStore } from "@pixerate/editor/tools";
57
- function usePlaybackSurface(playback, id, options = {}) {
57
+ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
58
58
  const ambient = useAgentPlayback();
59
59
  const target = playback === void 0 ? ambient : playback;
60
- const [presence] = useState(() => new PresenceStore());
60
+ const [ownPresence] = useState(() => new PresenceStore());
61
+ const presence = sharedPresence ?? ownPresence;
61
62
  const latest = useRef(options);
62
63
  latest.current = options;
63
64
  useEffect(() => {
@@ -231,10 +231,11 @@ function useAgentPlayback() {
231
231
  // src/playback/usePlaybackSurface.ts
232
232
  var import_react3 = require("react");
233
233
  var import_tools = require("@pixerate/editor/tools");
234
- function usePlaybackSurface(playback, id, options = {}) {
234
+ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
235
235
  const ambient = useAgentPlayback();
236
236
  const target = playback === void 0 ? ambient : playback;
237
- const [presence] = (0, import_react3.useState)(() => new import_tools.PresenceStore());
237
+ const [ownPresence] = (0, import_react3.useState)(() => new import_tools.PresenceStore());
238
+ const presence = sharedPresence ?? ownPresence;
238
239
  const latest = (0, import_react3.useRef)(options);
239
240
  latest.current = options;
240
241
  (0, import_react3.useEffect)(() => {
@@ -18,11 +18,11 @@ import {
18
18
  useImageEditor,
19
19
  useImageEffectsTools,
20
20
  useImageHistogram
21
- } from "../chunk-6MDTFAPY.js";
22
- import "../chunk-ECBC4HD7.js";
21
+ } from "../chunk-6YRSQW2V.js";
23
22
  import "../chunk-AJCWF6SN.js";
24
23
  import "../chunk-5R67YSSD.js";
25
24
  import "../chunk-OTGJEYHV.js";
25
+ import "../chunk-IPVWWVSF.js";
26
26
  export {
27
27
  AdjustmentLayersPanel,
28
28
  BrushOptionsBar,