@pixerate/editor-react 0.153.0 → 0.154.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 (35) hide show
  1. package/dist/animation-editor/index.cjs +3 -3
  2. package/dist/animation-editor/index.js +1 -1
  3. package/dist/canvas/index.cjs +3 -3
  4. package/dist/canvas/index.js +1 -1
  5. package/dist/chart/index.cjs +3 -3
  6. package/dist/chart/index.js +1 -1
  7. package/dist/{chunk-V2YC5T4R.js → chunk-6CJEJTQB.js} +1 -1
  8. package/dist/{chunk-VZ7HBWKL.js → chunk-EQ7Q5CBV.js} +1 -1
  9. package/dist/{chunk-GNO54NFG.js → chunk-W5CMGX3I.js} +4 -4
  10. package/dist/{chunk-M75ZC7DI.js → chunk-W7455SH4.js} +16 -7
  11. package/dist/image-editor/BrushOptionsBar.d.cts +2 -0
  12. package/dist/image-editor/BrushOptionsBar.d.ts +2 -0
  13. package/dist/image-editor/ImageEditorCanvas.d.cts +9 -4
  14. package/dist/image-editor/ImageEditorCanvas.d.ts +9 -4
  15. package/dist/image-editor/SelectionOptionsBar.d.cts +2 -0
  16. package/dist/image-editor/SelectionOptionsBar.d.ts +2 -0
  17. package/dist/image-editor/ShapeOptionsBar.d.cts +2 -0
  18. package/dist/image-editor/ShapeOptionsBar.d.ts +2 -0
  19. package/dist/image-editor/index.cjs +18 -9
  20. package/dist/image-editor/index.js +2 -2
  21. package/dist/index.cjs +18 -9
  22. package/dist/index.js +4 -4
  23. package/dist/paint-editor/index.cjs +3 -3
  24. package/dist/paint-editor/index.js +1 -1
  25. package/dist/parameters/index.cjs +3 -3
  26. package/dist/parameters/index.js +2 -2
  27. package/dist/playback/PresenceLayer.d.cts +7 -2
  28. package/dist/playback/PresenceLayer.d.ts +7 -2
  29. package/dist/spreadsheet/index.cjs +3 -3
  30. package/dist/spreadsheet/index.js +2 -2
  31. package/dist/vector/index.cjs +3 -3
  32. package/dist/vector/index.js +1 -1
  33. package/dist/video-editor/index.cjs +3 -3
  34. package/dist/video-editor/index.js +1 -1
  35. package/package.json +3 -3
@@ -276,7 +276,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
276
276
  // src/playback/PresenceLayer.tsx
277
277
  var import_react5 = __toESM(require("react"), 1);
278
278
  var import_jsx_runtime4 = require("react/jsx-runtime");
279
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
279
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
280
280
  const { actors } = (0, import_react5.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
281
281
  if (!actors.length) return null;
282
282
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -302,13 +302,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
302
302
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
303
303
  }
304
304
  ),
305
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
305
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
306
306
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
307
307
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
308
308
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
309
309
  a.message && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
310
310
  ] })
311
- ] })
311
+ ] }) })
312
312
  ] }, a.id);
313
313
  })
314
314
  }
@@ -11,7 +11,7 @@ import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
13
13
  usePlaybackSurface
14
- } from "../chunk-GNO54NFG.js";
14
+ } from "../chunk-W5CMGX3I.js";
15
15
 
16
16
  // src/animation-editor/useAnimationEditor.ts
17
17
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -478,7 +478,7 @@ function AgentPresenceLayer({ presences, className = "" }) {
478
478
  // src/playback/PresenceLayer.tsx
479
479
  var import_react = __toESM(require("react"), 1);
480
480
  var import_jsx_runtime2 = require("react/jsx-runtime");
481
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
481
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
482
482
  const { actors } = (0, import_react.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
483
483
  if (!actors.length) return null;
484
484
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -504,13 +504,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
504
504
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
505
505
  }
506
506
  ),
507
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
507
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
508
508
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
509
509
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
510
510
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
511
511
  a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
512
512
  ] })
513
- ] })
513
+ ] }) })
514
514
  ] }, a.id);
515
515
  })
516
516
  }
@@ -9,7 +9,7 @@ import "../chunk-3I7FOSLF.js";
9
9
  import {
10
10
  PresenceLayer,
11
11
  usePlaybackSurface
12
- } from "../chunk-GNO54NFG.js";
12
+ } from "../chunk-W5CMGX3I.js";
13
13
 
14
14
  // src/canvas/AgentPresenceLayer.tsx
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1084,7 +1084,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1084
1084
  // src/playback/PresenceLayer.tsx
1085
1085
  var import_react7 = __toESM(require("react"), 1);
1086
1086
  var import_jsx_runtime5 = require("react/jsx-runtime");
1087
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1087
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1088
1088
  const { actors } = (0, import_react7.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1089
1089
  if (!actors.length) return null;
1090
1090
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -1110,13 +1110,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1110
1110
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1111
1111
  }
1112
1112
  ),
1113
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
1113
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1114
1114
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
1115
1115
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1116
1116
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1117
1117
  a.message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
1118
1118
  ] })
1119
- ] })
1119
+ ] }) })
1120
1120
  ] }, a.id);
1121
1121
  })
1122
1122
  }
@@ -27,7 +27,7 @@ import {
27
27
  PresenceLayer,
28
28
  useAgentPlayback,
29
29
  usePlaybackSurface
30
- } from "../chunk-GNO54NFG.js";
30
+ } from "../chunk-W5CMGX3I.js";
31
31
 
32
32
  // src/chart/ChartEditor.tsx
33
33
  import { useRef, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePlaybackSurface
3
- } from "./chunk-GNO54NFG.js";
3
+ } from "./chunk-W5CMGX3I.js";
4
4
 
5
5
  // src/playback/useElementPlaybackSurface.ts
6
6
  import { useRef } from "react";
@@ -2,7 +2,7 @@ import {
2
2
  PresenceLayer,
3
3
  useAgentPlayback,
4
4
  usePlaybackSurface
5
- } from "./chunk-GNO54NFG.js";
5
+ } from "./chunk-W5CMGX3I.js";
6
6
 
7
7
  // src/spreadsheet/useSpreadsheetEditor.ts
8
8
  import { useState, useRef, useCallback, useMemo, useEffect } from "react";
@@ -1,7 +1,7 @@
1
1
  // src/playback/PresenceLayer.tsx
2
2
  import React, { useSyncExternalStore } from "react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
5
5
  const { actors } = useSyncExternalStore(presence.subscribe, presence.getState, presence.getState);
6
6
  if (!actors.length) return null;
7
7
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -27,13 +27,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
27
27
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
28
28
  }
29
29
  ),
30
- /* @__PURE__ */ jsxs("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
30
+ /* @__PURE__ */ jsx("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ jsxs(Fragment, { children: [
31
31
  /* @__PURE__ */ jsx("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ jsx("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
32
32
  /* @__PURE__ */ jsxs("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
33
33
  /* @__PURE__ */ jsx("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
34
34
  a.message && /* @__PURE__ */ jsx("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
35
35
  ] })
36
- ] })
36
+ ] }) })
37
37
  ] }, a.id);
38
38
  })
39
39
  }
@@ -15,7 +15,7 @@ import {
15
15
  PresenceLayer,
16
16
  useAgentPlayback,
17
17
  usePlaybackSurface
18
- } from "./chunk-GNO54NFG.js";
18
+ } from "./chunk-W5CMGX3I.js";
19
19
 
20
20
  // src/image-editor/useImageEditor.ts
21
21
  import { useRef, useState, useEffect, useCallback, useMemo } from "react";
@@ -257,6 +257,8 @@ var ImageEditorCanvas = ({
257
257
  locate,
258
258
  locateElement,
259
259
  open,
260
+ onSample,
261
+ renderPresenceCursor,
260
262
  className = "",
261
263
  style
262
264
  }) => {
@@ -660,6 +662,12 @@ var ImageEditorCanvas = ({
660
662
  const canvas = canvasRef.current;
661
663
  if (!canvas || transformTool.active) return;
662
664
  const canvasPt = getCanvasEventPoint(e);
665
+ if (mode === "sample") {
666
+ const imgPt = canvasToImagePoint(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
667
+ const color = controller.sampleColor(imgPt, { setForeground: true });
668
+ if (color) onSample?.(color);
669
+ return;
670
+ }
663
671
  if (mode === "select") {
664
672
  const gesture = selectionGestureRef.current;
665
673
  const imgPt = canvasToImagePoint(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
@@ -1041,7 +1049,7 @@ var ImageEditorCanvas = ({
1041
1049
  }
1042
1050
  )
1043
1051
  ] }),
1044
- playing && /* @__PURE__ */ jsx(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false })
1052
+ playing && /* @__PURE__ */ jsx(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false, renderCursor: renderPresenceCursor })
1045
1053
  ] });
1046
1054
  };
1047
1055
 
@@ -2637,7 +2645,7 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ jsx14(PaintGradientEditorVi
2637
2645
 
2638
2646
  // src/image-editor/BrushOptionsBar.tsx
2639
2647
  import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2640
- var BrushOptionsBar = ({ controller, className }) => {
2648
+ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
2641
2649
  const [, setTick] = useState11(0);
2642
2650
  useEffect8(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
2643
2651
  const [error, setError] = useState11(null);
@@ -2653,7 +2661,7 @@ var BrushOptionsBar = ({ controller, className }) => {
2653
2661
  }
2654
2662
  };
2655
2663
  return /* @__PURE__ */ jsxs13("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
2656
- /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx15(
2664
+ showTools && /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: PAINT_TOOLS.map((t) => /* @__PURE__ */ jsx15(
2657
2665
  "button",
2658
2666
  {
2659
2667
  type: "button",
@@ -3436,6 +3444,7 @@ var SelectionOptionsBar = ({
3436
3444
  selection,
3437
3445
  quickMask,
3438
3446
  selectionDisplay,
3447
+ showTools = true,
3439
3448
  className = ""
3440
3449
  }) => {
3441
3450
  const [radius, setRadius] = useState16(2);
@@ -3552,7 +3561,7 @@ var SelectionOptionsBar = ({
3552
3561
  }
3553
3562
  };
3554
3563
  return /* @__PURE__ */ jsxs18("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
3555
- /* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3564
+ showTools && /* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
3556
3565
  /* @__PURE__ */ jsx20("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
3557
3566
  options.tool === "wand" && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
3558
3567
  /* @__PURE__ */ jsxs18("label", { className: "flex flex-col gap-1", children: [
@@ -4725,7 +4734,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
4725
4734
  import { useEffect as useEffect15, useState as useState24 } from "react";
4726
4735
  import { LIVE_SHAPE_KINDS, SHAPE_KIND_LABELS, applyShapeOptions } from "@pixerate/editor/image-editor";
4727
4736
  import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
4728
- var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4737
+ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
4729
4738
  const [, setTick] = useState24(0);
4730
4739
  useEffect15(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4731
4740
  const [error, setError] = useState24(null);
@@ -4743,7 +4752,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
4743
4752
  };
4744
4753
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
4745
4754
  return /* @__PURE__ */ jsxs26("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
4746
- /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4755
+ showTools && /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ jsx28("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: SHAPE_KIND_LABELS[k] }, k)) }),
4747
4756
  /* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-3", children: [
4748
4757
  /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-1", children: [
4749
4758
  /* @__PURE__ */ jsx28(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import type { ImageEditorController } from '@pixerate/editor/image-editor';
3
3
  export interface BrushOptionsBarProps {
4
4
  controller: ImageEditorController;
5
+ /** The row of paint tool buttons (default true); hide it when the host has its own toolbar. */
6
+ showTools?: boolean;
5
7
  className?: string;
6
8
  }
7
9
  /**
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import type { ImageEditorController } from '@pixerate/editor/image-editor';
3
3
  export interface BrushOptionsBarProps {
4
4
  controller: ImageEditorController;
5
+ /** The row of paint tool buttons (default true); hide it when the host has its own toolbar. */
6
+ showTools?: boolean;
5
7
  className?: string;
6
8
  }
7
9
  /**
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import type { AgentPlayback, PlaybackRect, PlaybackRef } from '@pixerate/editor/tools';
2
+ import type { AgentPlayback, PlaybackRect, PlaybackRef, PresenceActor } from '@pixerate/editor/tools';
3
3
  import type { ImageEditorFit } from '@pixerate/editor/image-editor';
4
4
  import { FreeTransformTool, type SelectionToolOptions, type ShapeToolOptions, type TextEditSession, type TypeToolOptions } from '@pixerate/editor/image-editor';
5
5
  import type { UseImageEditorReturn } from './useImageEditor.cjs';
6
6
  /** What pointer gestures on the canvas do (and whether the crop overlay shows). */
7
- export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'none';
7
+ export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'sample' | 'none';
8
8
  /** Which gesture an `onError` report comes from. */
9
9
  export type ImageEditorCanvasErrorSource = 'paint' | 'select' | 'shape' | 'type' | 'path';
10
10
  export interface ImageEditorCanvasProps {
@@ -13,10 +13,15 @@ export interface ImageEditorCanvasProps {
13
13
  /**
14
14
  * What pointer gestures do: `crop` (crop box and its overlay, in the crop margin), `select`
15
15
  * (the selection tools), `paint` (brush, eraser, move and their shortcuts), `annotate`
16
- * (annotations, shape and type layers, by the active tool) or `none` (view only). Free
17
- * Transform works in every mode. Default `none`.
16
+ * (annotations, shape and type layers, by the active tool), `sample` (the Eyedropper: a click
17
+ * picks the composite's colour as the paint foreground) or `none` (view only). Free Transform
18
+ * works in every mode. Default `none`.
18
19
  */
19
20
  mode?: ImageEditorCanvasMode;
21
+ /** The Eyedropper picked a colour (`sample` mode); it is already the paint foreground. */
22
+ onSample?: (color: string) => void;
23
+ /** Draws each agent cursor during playback in place of the default arrow and name tag. */
24
+ renderPresenceCursor?: (actor: PresenceActor) => React.ReactNode;
20
25
  /** How the image fits the canvas (default: the renderer's). */
21
26
  fit?: ImageEditorFit;
22
27
  /** Options of the selection tools (magic wand tolerance, feather, …). */
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import type { AgentPlayback, PlaybackRect, PlaybackRef } from '@pixerate/editor/tools';
2
+ import type { AgentPlayback, PlaybackRect, PlaybackRef, PresenceActor } from '@pixerate/editor/tools';
3
3
  import type { ImageEditorFit } from '@pixerate/editor/image-editor';
4
4
  import { FreeTransformTool, type SelectionToolOptions, type ShapeToolOptions, type TextEditSession, type TypeToolOptions } from '@pixerate/editor/image-editor';
5
5
  import type { UseImageEditorReturn } from './useImageEditor.js';
6
6
  /** What pointer gestures on the canvas do (and whether the crop overlay shows). */
7
- export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'none';
7
+ export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'sample' | 'none';
8
8
  /** Which gesture an `onError` report comes from. */
9
9
  export type ImageEditorCanvasErrorSource = 'paint' | 'select' | 'shape' | 'type' | 'path';
10
10
  export interface ImageEditorCanvasProps {
@@ -13,10 +13,15 @@ export interface ImageEditorCanvasProps {
13
13
  /**
14
14
  * What pointer gestures do: `crop` (crop box and its overlay, in the crop margin), `select`
15
15
  * (the selection tools), `paint` (brush, eraser, move and their shortcuts), `annotate`
16
- * (annotations, shape and type layers, by the active tool) or `none` (view only). Free
17
- * Transform works in every mode. Default `none`.
16
+ * (annotations, shape and type layers, by the active tool), `sample` (the Eyedropper: a click
17
+ * picks the composite's colour as the paint foreground) or `none` (view only). Free Transform
18
+ * works in every mode. Default `none`.
18
19
  */
19
20
  mode?: ImageEditorCanvasMode;
21
+ /** The Eyedropper picked a colour (`sample` mode); it is already the paint foreground. */
22
+ onSample?: (color: string) => void;
23
+ /** Draws each agent cursor during playback in place of the default arrow and name tag. */
24
+ renderPresenceCursor?: (actor: PresenceActor) => React.ReactNode;
20
25
  /** How the image fits the canvas (default: the renderer's). */
21
26
  fit?: ImageEditorFit;
22
27
  /** Options of the selection tools (magic wand tolerance, feather, …). */
@@ -10,6 +10,8 @@ export interface SelectionOptionsBarProps {
10
10
  quickMask?: boolean;
11
11
  /** How the canvas shows the selection (`state.selectionDisplay`); wins over `quickMask`. */
12
12
  selectionDisplay?: SelectionDisplay;
13
+ /** The tool picker row (default true); hide it when the host's toolbar offers the same choice. */
14
+ showTools?: boolean;
13
15
  className?: string;
14
16
  }
15
17
  /**
@@ -10,6 +10,8 @@ export interface SelectionOptionsBarProps {
10
10
  quickMask?: boolean;
11
11
  /** How the canvas shows the selection (`state.selectionDisplay`); wins over `quickMask`. */
12
12
  selectionDisplay?: SelectionDisplay;
13
+ /** The tool picker row (default true); hide it when the host's toolbar offers the same choice. */
14
+ showTools?: boolean;
13
15
  className?: string;
14
16
  }
15
17
  /**
@@ -4,6 +4,8 @@ export interface ShapeOptionsBarProps {
4
4
  controller: ImageEditorController;
5
5
  options: ShapeToolOptions;
6
6
  onChange: (options: ShapeToolOptions) => void;
7
+ /** The tool picker row (default true); hide it when the host's toolbar offers the same choice. */
8
+ showTools?: boolean;
7
9
  className?: string;
8
10
  }
9
11
  /**
@@ -4,6 +4,8 @@ export interface ShapeOptionsBarProps {
4
4
  controller: ImageEditorController;
5
5
  options: ShapeToolOptions;
6
6
  onChange: (options: ShapeToolOptions) => void;
7
+ /** The tool picker row (default true); hide it when the host's toolbar offers the same choice. */
8
+ showTools?: boolean;
7
9
  className?: string;
8
10
  }
9
11
  /**
@@ -302,7 +302,7 @@ var import_tools2 = require("@pixerate/editor/tools");
302
302
  // src/playback/PresenceLayer.tsx
303
303
  var import_react4 = __toESM(require("react"), 1);
304
304
  var import_jsx_runtime2 = require("react/jsx-runtime");
305
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
305
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
306
306
  const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
307
307
  if (!actors.length) return null;
308
308
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -328,13 +328,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
328
328
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
329
329
  }
330
330
  ),
331
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
331
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
332
332
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
333
333
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
334
334
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
335
335
  a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
336
336
  ] })
337
- ] })
337
+ ] }) })
338
338
  ] }, a.id);
339
339
  })
340
340
  }
@@ -364,6 +364,8 @@ var ImageEditorCanvas = ({
364
364
  locate,
365
365
  locateElement,
366
366
  open,
367
+ onSample,
368
+ renderPresenceCursor,
367
369
  className = "",
368
370
  style
369
371
  }) => {
@@ -767,6 +769,12 @@ var ImageEditorCanvas = ({
767
769
  const canvas = canvasRef.current;
768
770
  if (!canvas || transformTool.active) return;
769
771
  const canvasPt = getCanvasEventPoint(e);
772
+ if (mode === "sample") {
773
+ const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
774
+ const color = controller.sampleColor(imgPt, { setForeground: true });
775
+ if (color) onSample?.(color);
776
+ return;
777
+ }
770
778
  if (mode === "select") {
771
779
  const gesture = selectionGestureRef.current;
772
780
  const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
@@ -1148,7 +1156,7 @@ var ImageEditorCanvas = ({
1148
1156
  }
1149
1157
  )
1150
1158
  ] }),
1151
- playing && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false })
1159
+ playing && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false, renderCursor: renderPresenceCursor })
1152
1160
  ] });
1153
1161
  };
1154
1162
 
@@ -4582,7 +4590,7 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime24.js
4582
4590
 
4583
4591
  // src/image-editor/BrushOptionsBar.tsx
4584
4592
  var import_jsx_runtime25 = require("react/jsx-runtime");
4585
- var BrushOptionsBar = ({ controller, className }) => {
4593
+ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
4586
4594
  const [, setTick] = (0, import_react25.useState)(0);
4587
4595
  (0, import_react25.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
4588
4596
  const [error, setError] = (0, import_react25.useState)(null);
@@ -4598,7 +4606,7 @@ var BrushOptionsBar = ({ controller, className }) => {
4598
4606
  }
4599
4607
  };
4600
4608
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
4601
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4609
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4602
4610
  "button",
4603
4611
  {
4604
4612
  type: "button",
@@ -5374,6 +5382,7 @@ var SelectionOptionsBar = ({
5374
5382
  selection,
5375
5383
  quickMask,
5376
5384
  selectionDisplay,
5385
+ showTools = true,
5377
5386
  className = ""
5378
5387
  }) => {
5379
5388
  const [radius, setRadius] = (0, import_react30.useState)(2);
@@ -5490,7 +5499,7 @@ var SelectionOptionsBar = ({
5490
5499
  }
5491
5500
  };
5492
5501
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
5493
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
5502
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
5494
5503
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor17.SELECTION_MODE_LABELS[m] }, m)) }),
5495
5504
  options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
5496
5505
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex flex-col gap-1", children: [
@@ -6657,7 +6666,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
6657
6666
  var import_react38 = require("react");
6658
6667
  var import_image_editor23 = require("@pixerate/editor/image-editor");
6659
6668
  var import_jsx_runtime38 = require("react/jsx-runtime");
6660
- var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6669
+ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
6661
6670
  const [, setTick] = (0, import_react38.useState)(0);
6662
6671
  (0, import_react38.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
6663
6672
  const [error, setError] = (0, import_react38.useState)(null);
@@ -6675,7 +6684,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
6675
6684
  };
6676
6685
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
6677
6686
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
6678
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor23.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor23.SHAPE_KIND_LABELS[k] }, k)) }),
6687
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor23.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor23.SHAPE_KIND_LABELS[k] }, k)) }),
6679
6688
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
6680
6689
  /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
6681
6690
  /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
@@ -36,13 +36,13 @@ import {
36
36
  useImageEditorControls,
37
37
  useImageEffectsTools,
38
38
  useImageHistogram
39
- } from "../chunk-M75ZC7DI.js";
39
+ } from "../chunk-W7455SH4.js";
40
40
  import "../chunk-AJCWF6SN.js";
41
41
  import "../chunk-IDUWADYT.js";
42
42
  import "../chunk-5RPB4WGT.js";
43
43
  import "../chunk-KIRIU53A.js";
44
44
  import "../chunk-3I7FOSLF.js";
45
- import "../chunk-GNO54NFG.js";
45
+ import "../chunk-W5CMGX3I.js";
46
46
  export {
47
47
  AdjustmentLayersPanel,
48
48
  BrushOptionsBar,
package/dist/index.cjs CHANGED
@@ -784,7 +784,7 @@ function useRichTextEditorDocument(editor) {
784
784
  // src/playback/PresenceLayer.tsx
785
785
  var import_react13 = __toESM(require("react"), 1);
786
786
  var import_jsx_runtime2 = require("react/jsx-runtime");
787
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
787
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
788
788
  const { actors } = (0, import_react13.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
789
789
  if (!actors.length) return null;
790
790
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -810,13 +810,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
810
810
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
811
811
  }
812
812
  ),
813
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
813
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
814
814
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
815
815
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
816
816
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
817
817
  a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
818
818
  ] })
819
- ] })
819
+ ] }) })
820
820
  ] }, a.id);
821
821
  })
822
822
  }
@@ -4078,6 +4078,8 @@ var ImageEditorCanvas = ({
4078
4078
  locate,
4079
4079
  locateElement,
4080
4080
  open,
4081
+ onSample,
4082
+ renderPresenceCursor,
4081
4083
  className = "",
4082
4084
  style
4083
4085
  }) => {
@@ -4481,6 +4483,12 @@ var ImageEditorCanvas = ({
4481
4483
  const canvas = canvasRef.current;
4482
4484
  if (!canvas || transformTool.active) return;
4483
4485
  const canvasPt = getCanvasEventPoint(e);
4486
+ if (mode === "sample") {
4487
+ const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
4488
+ const color = controller.sampleColor(imgPt, { setForeground: true });
4489
+ if (color) onSample?.(color);
4490
+ return;
4491
+ }
4484
4492
  if (mode === "select") {
4485
4493
  const gesture = selectionGestureRef.current;
4486
4494
  const imgPt = (0, import_image_editor2.canvasToImagePoint)(canvasPt, state, viewRef.current.width, viewRef.current.height, false);
@@ -4862,7 +4870,7 @@ var ImageEditorCanvas = ({
4862
4870
  }
4863
4871
  )
4864
4872
  ] }),
4865
- playing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false })
4873
+ playing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PresenceLayer, { presence: agentPresence, viewport: docToRoot, clip: false, renderCursor: renderPresenceCursor })
4866
4874
  ] });
4867
4875
  };
4868
4876
 
@@ -8296,7 +8304,7 @@ var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime40.js
8296
8304
 
8297
8305
  // src/image-editor/BrushOptionsBar.tsx
8298
8306
  var import_jsx_runtime41 = require("react/jsx-runtime");
8299
- var BrushOptionsBar = ({ controller, className }) => {
8307
+ var BrushOptionsBar = ({ controller, showTools = true, className }) => {
8300
8308
  const [, setTick] = (0, import_react61.useState)(0);
8301
8309
  (0, import_react61.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
8302
8310
  const [error, setError] = (0, import_react61.useState)(null);
@@ -8312,7 +8320,7 @@ var BrushOptionsBar = ({ controller, className }) => {
8312
8320
  }
8313
8321
  };
8314
8322
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
8315
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8323
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8316
8324
  "button",
8317
8325
  {
8318
8326
  type: "button",
@@ -9088,6 +9096,7 @@ var SelectionOptionsBar = ({
9088
9096
  selection,
9089
9097
  quickMask,
9090
9098
  selectionDisplay,
9099
+ showTools = true,
9091
9100
  className = ""
9092
9101
  }) => {
9093
9102
  const [radius, setRadius] = (0, import_react66.useState)(2);
@@ -9204,7 +9213,7 @@ var SelectionOptionsBar = ({
9204
9213
  }
9205
9214
  };
9206
9215
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
9207
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
9216
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
9208
9217
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor17.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor17.SELECTION_MODE_LABELS[m] }, m)) }),
9209
9218
  options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-2", children: [
9210
9219
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex flex-col gap-1", children: [
@@ -10371,7 +10380,7 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
10371
10380
  var import_react74 = require("react");
10372
10381
  var import_image_editor23 = require("@pixerate/editor/image-editor");
10373
10382
  var import_jsx_runtime54 = require("react/jsx-runtime");
10374
- var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10383
+ var ShapeOptionsBar = ({ controller, options, onChange, showTools = true, className }) => {
10375
10384
  const [, setTick] = (0, import_react74.useState)(0);
10376
10385
  (0, import_react74.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
10377
10386
  const [error, setError] = (0, import_react74.useState)(null);
@@ -10389,7 +10398,7 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
10389
10398
  };
10390
10399
  const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
10391
10400
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
10392
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor23.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor23.SHAPE_KIND_LABELS[k] }, k)) }),
10401
+ showTools && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor23.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor23.SHAPE_KIND_LABELS[k] }, k)) }),
10393
10402
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
10394
10403
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-1", children: [
10395
10404
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useElementPlaybackSurface
3
- } from "./chunk-V2YC5T4R.js";
3
+ } from "./chunk-6CJEJTQB.js";
4
4
  import {
5
5
  ChartCanvas,
6
6
  ChartDataGrid,
@@ -21,7 +21,7 @@ import {
21
21
  useSpreadsheetClipboard,
22
22
  useSpreadsheetEditor,
23
23
  useSpreadsheetViewport
24
- } from "./chunk-VZ7HBWKL.js";
24
+ } from "./chunk-EQ7Q5CBV.js";
25
25
  import {
26
26
  AdjustmentLayersPanel,
27
27
  BrushOptionsBar,
@@ -60,7 +60,7 @@ import {
60
60
  useImageEditorControls,
61
61
  useImageEffectsTools,
62
62
  useImageHistogram
63
- } from "./chunk-M75ZC7DI.js";
63
+ } from "./chunk-W7455SH4.js";
64
64
  import "./chunk-AJCWF6SN.js";
65
65
  import "./chunk-IDUWADYT.js";
66
66
  import "./chunk-5RPB4WGT.js";
@@ -71,7 +71,7 @@ import {
71
71
  PresenceLayer,
72
72
  useAgentPlayback,
73
73
  usePlaybackSurface
74
- } from "./chunk-GNO54NFG.js";
74
+ } from "./chunk-W5CMGX3I.js";
75
75
  import {
76
76
  CommandPalette,
77
77
  useCommandPalette,
@@ -1394,7 +1394,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1394
1394
  // src/playback/PresenceLayer.tsx
1395
1395
  var import_react13 = __toESM(require("react"), 1);
1396
1396
  var import_jsx_runtime13 = require("react/jsx-runtime");
1397
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1397
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1398
1398
  const { actors } = (0, import_react13.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1399
1399
  if (!actors.length) return null;
1400
1400
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -1420,13 +1420,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1420
1420
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1421
1421
  }
1422
1422
  ),
1423
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
1423
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1424
1424
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
1425
1425
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1426
1426
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1427
1427
  a.message && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
1428
1428
  ] })
1429
- ] })
1429
+ ] }) })
1430
1430
  ] }, a.id);
1431
1431
  })
1432
1432
  }
@@ -13,7 +13,7 @@ import {
13
13
  PresenceLayer,
14
14
  useAgentPlayback,
15
15
  usePlaybackSurface
16
- } from "../chunk-GNO54NFG.js";
16
+ } from "../chunk-W5CMGX3I.js";
17
17
 
18
18
  // src/paint-editor/usePaintEditor.ts
19
19
  import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
@@ -1771,7 +1771,7 @@ function useElementPlaybackSurface(playback, id, element, options) {
1771
1771
  // src/playback/PresenceLayer.tsx
1772
1772
  var import_react10 = __toESM(require("react"), 1);
1773
1773
  var import_jsx_runtime6 = require("react/jsx-runtime");
1774
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1774
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
1775
1775
  const { actors } = (0, import_react10.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
1776
1776
  if (!actors.length) return null;
1777
1777
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -1797,13 +1797,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
1797
1797
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
1798
1798
  }
1799
1799
  ),
1800
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
1800
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1801
1801
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
1802
1802
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
1803
1803
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
1804
1804
  a.message && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
1805
1805
  ] })
1806
- ] })
1806
+ ] }) })
1807
1807
  ] }, a.id);
1808
1808
  })
1809
1809
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useElementPlaybackSurface
3
- } from "../chunk-V2YC5T4R.js";
3
+ } from "../chunk-6CJEJTQB.js";
4
4
  import {
5
5
  KeyframeDiamond,
6
6
  ParameterColor,
@@ -28,7 +28,7 @@ import "../chunk-3I7FOSLF.js";
28
28
  import {
29
29
  PresenceLayer,
30
30
  useAgentPlayback
31
- } from "../chunk-GNO54NFG.js";
31
+ } from "../chunk-W5CMGX3I.js";
32
32
 
33
33
  // src/parameters/useParameters.ts
34
34
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { PresenceStore } from "@pixerate/editor/tools";
2
+ import type { PresenceActor, PresenceStore } from "@pixerate/editor/tools";
3
3
  export interface PresenceLayerProps {
4
4
  /** The cursors to draw, e.g. from `usePlaybackSurface` or a director. */
5
5
  presence: PresenceStore;
@@ -20,6 +20,11 @@ export interface PresenceLayerProps {
20
20
  });
21
21
  /** Clip the cursors to the layer's box (default true). `false` lets a cursor visit chrome outside it. */
22
22
  clip?: boolean;
23
+ /**
24
+ * Draws an actor's cursor in place of the default arrow, name tag and note (a host's own
25
+ * presence cursor). It is placed at the actor's point; the focus ring is still drawn.
26
+ */
27
+ renderCursor?: (actor: PresenceActor) => React.ReactNode;
23
28
  className?: string;
24
29
  }
25
30
  /**
@@ -27,4 +32,4 @@ export interface PresenceLayerProps {
27
32
  * in a `position: relative` box over the surface. It has the `pixerate-presence` class, so
28
33
  * snapshots and exports leave it out.
29
34
  */
30
- export declare function PresenceLayer({ presence, viewport, clip, className }: PresenceLayerProps): React.JSX.Element | null;
35
+ export declare function PresenceLayer({ presence, viewport, clip, renderCursor, className }: PresenceLayerProps): React.JSX.Element | null;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { PresenceStore } from "@pixerate/editor/tools";
2
+ import type { PresenceActor, PresenceStore } from "@pixerate/editor/tools";
3
3
  export interface PresenceLayerProps {
4
4
  /** The cursors to draw, e.g. from `usePlaybackSurface` or a director. */
5
5
  presence: PresenceStore;
@@ -20,6 +20,11 @@ export interface PresenceLayerProps {
20
20
  });
21
21
  /** Clip the cursors to the layer's box (default true). `false` lets a cursor visit chrome outside it. */
22
22
  clip?: boolean;
23
+ /**
24
+ * Draws an actor's cursor in place of the default arrow, name tag and note (a host's own
25
+ * presence cursor). It is placed at the actor's point; the focus ring is still drawn.
26
+ */
27
+ renderCursor?: (actor: PresenceActor) => React.ReactNode;
23
28
  className?: string;
24
29
  }
25
30
  /**
@@ -27,4 +32,4 @@ export interface PresenceLayerProps {
27
32
  * in a `position: relative` box over the surface. It has the `pixerate-presence` class, so
28
33
  * snapshots and exports leave it out.
29
34
  */
30
- export declare function PresenceLayer({ presence, viewport, clip, className }: PresenceLayerProps): React.JSX.Element | null;
35
+ export declare function PresenceLayer({ presence, viewport, clip, renderCursor, className }: PresenceLayerProps): React.JSX.Element | null;
@@ -342,7 +342,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
342
342
  // src/playback/PresenceLayer.tsx
343
343
  var import_react4 = __toESM(require("react"), 1);
344
344
  var import_jsx_runtime2 = require("react/jsx-runtime");
345
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
345
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
346
346
  const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
347
347
  if (!actors.length) return null;
348
348
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -368,13 +368,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
368
368
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
369
369
  }
370
370
  ),
371
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
371
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
372
372
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
373
373
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
374
374
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
375
375
  a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
376
376
  ] })
377
- ] })
377
+ ] }) })
378
378
  ] }, a.id);
379
379
  })
380
380
  }
@@ -12,8 +12,8 @@ import {
12
12
  useSpreadsheetClipboard,
13
13
  useSpreadsheetEditor,
14
14
  useSpreadsheetViewport
15
- } from "../chunk-VZ7HBWKL.js";
16
- import "../chunk-GNO54NFG.js";
15
+ } from "../chunk-EQ7Q5CBV.js";
16
+ import "../chunk-W5CMGX3I.js";
17
17
  export {
18
18
  FormulaHints,
19
19
  NameManager,
@@ -200,7 +200,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
200
200
  // src/playback/PresenceLayer.tsx
201
201
  var import_react4 = __toESM(require("react"), 1);
202
202
  var import_jsx_runtime2 = require("react/jsx-runtime");
203
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
203
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
204
204
  const { actors } = (0, import_react4.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
205
205
  if (!actors.length) return null;
206
206
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -226,13 +226,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
226
226
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
227
227
  }
228
228
  ),
229
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
229
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
230
230
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
231
231
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
232
232
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
233
233
  a.message && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
234
234
  ] })
235
- ] })
235
+ ] }) })
236
236
  ] }, a.id);
237
237
  })
238
238
  }
@@ -11,7 +11,7 @@ import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
13
13
  usePlaybackSurface
14
- } from "../chunk-GNO54NFG.js";
14
+ } from "../chunk-W5CMGX3I.js";
15
15
 
16
16
  // src/vector/useVectorEditor.ts
17
17
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -345,7 +345,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
345
345
  // src/playback/PresenceLayer.tsx
346
346
  var import_react6 = __toESM(require("react"), 1);
347
347
  var import_jsx_runtime5 = require("react/jsx-runtime");
348
- function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
348
+ function PresenceLayer({ presence, viewport, clip = true, renderCursor, className = "" }) {
349
349
  const { actors } = (0, import_react6.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
350
350
  if (!actors.length) return null;
351
351
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -371,13 +371,13 @@ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
371
371
  style: { position: "absolute", ...ring, borderRadius: 8, border: `2px solid ${a.color}`, background: `${a.color}14`, transition: "all 160ms ease-out" }
372
372
  }
373
373
  ),
374
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: [
374
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "data-actor": a.id, style: { position: "absolute", left: 0, top: 0, transform: `translate(${at.x}px, ${at.y}px)` }, children: renderCursor ? renderCursor(a) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
375
375
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "18", height: "20", viewBox: "0 0 12 18", style: { display: "block", transform: a.pressed ? "scale(0.85)" : void 0, transformOrigin: "0 0", filter: "drop-shadow(0 1px 2px rgba(0,0,0,.35))" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 } }) }),
376
376
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { position: "absolute", left: 14, top: 16, display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 4 }, children: [
377
377
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { whiteSpace: "nowrap", borderRadius: 999, padding: "1px 7px", fontSize: 11, fontWeight: 600, color: "#ffffff", background: a.color }, children: a.name }),
378
378
  a.message && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-actor-message": a.id, style: { width: "max-content", maxWidth: 240, borderRadius: 8, borderTopLeftRadius: 0, padding: "4px 8px", fontSize: 12, color: "#1e293b", background: "#ffffff", boxShadow: "0 4px 12px rgba(15,23,42,.18)" }, children: a.message })
379
379
  ] })
380
- ] })
380
+ ] }) })
381
381
  ] }, a.id);
382
382
  })
383
383
  }
@@ -12,7 +12,7 @@ import {
12
12
  PresenceLayer,
13
13
  useAgentPlayback,
14
14
  usePlaybackSurface
15
- } from "../chunk-GNO54NFG.js";
15
+ } from "../chunk-W5CMGX3I.js";
16
16
 
17
17
  // src/video-editor/useVideoEditor.ts
18
18
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.153.0",
3
+ "version": "0.154.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -254,7 +254,7 @@
254
254
  "dependencies": {},
255
255
  "peerDependencies": {
256
256
  "@dagrejs/dagre": "^1.1.8",
257
- "@pixerate/editor": ">=0.228.0 <1.0.0-0",
257
+ "@pixerate/editor": ">=0.229.0 <1.0.0-0",
258
258
  "@tiptap/core": "^2.27.3",
259
259
  "@tiptap/extension-bubble-menu": "^2.27.3",
260
260
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -305,7 +305,7 @@
305
305
  "tsup": "^9.0.0",
306
306
  "typescript": "^5.7.3",
307
307
  "vitest": "^5.0.5",
308
- "@pixerate/editor": "0.228.0"
308
+ "@pixerate/editor": "0.229.0"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",