@pixerate/editor-react 0.96.0 → 0.98.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 (48) hide show
  1. package/README.md +2 -2
  2. package/dist/animation-editor/index.cjs +24 -6
  3. package/dist/animation-editor/index.js +2 -2
  4. package/dist/canvas/index.cjs +24 -6
  5. package/dist/canvas/index.js +2 -2
  6. package/dist/chart/index.cjs +2 -2
  7. package/dist/chart/index.js +1 -1
  8. package/dist/{chunk-7I73DW4V.js → chunk-NEQI2ZIU.js} +1 -1
  9. package/dist/chunk-Q7LAFHGP.js +655 -0
  10. package/dist/{chunk-GECXTPSH.js → chunk-S6C2W5JW.js} +1 -1
  11. package/dist/{chunk-IPVWWVSF.js → chunk-SI2V7XPZ.js} +2 -2
  12. package/dist/{chunk-IY6YOY5B.js → chunk-TFEKLNC7.js} +3083 -3031
  13. package/dist/effects/EffectAuthoringEditor.d.cts +22 -0
  14. package/dist/effects/EffectAuthoringEditor.d.ts +22 -0
  15. package/dist/effects/EffectParameters.d.cts +5 -1
  16. package/dist/effects/EffectParameters.d.ts +5 -1
  17. package/dist/effects/index.cjs +456 -4
  18. package/dist/effects/index.d.cts +2 -0
  19. package/dist/effects/index.d.ts +2 -0
  20. package/dist/effects/index.js +5 -1
  21. package/dist/effects/useEffectAuthoring.d.cts +6 -0
  22. package/dist/effects/useEffectAuthoring.d.ts +6 -0
  23. package/dist/image-editor/ImageEditor.d.cts +3 -1
  24. package/dist/image-editor/ImageEditor.d.ts +3 -1
  25. package/dist/image-editor/ImageEditorCanvas.d.cts +77 -0
  26. package/dist/image-editor/ImageEditorCanvas.d.ts +77 -0
  27. package/dist/image-editor/ImageEffectControls.d.cts +12 -0
  28. package/dist/image-editor/ImageEffectControls.d.ts +12 -0
  29. package/dist/image-editor/index.cjs +4709 -4644
  30. package/dist/image-editor/index.d.cts +2 -0
  31. package/dist/image-editor/index.d.ts +2 -0
  32. package/dist/image-editor/index.js +7 -3
  33. package/dist/index.cjs +5125 -5060
  34. package/dist/index.js +9 -5
  35. package/dist/paint-editor/index.cjs +24 -6
  36. package/dist/paint-editor/index.js +2 -2
  37. package/dist/parameters/index.cjs +2 -2
  38. package/dist/parameters/index.js +2 -2
  39. package/dist/playback/PresenceLayer.d.cts +3 -1
  40. package/dist/playback/PresenceLayer.d.ts +3 -1
  41. package/dist/spreadsheet/index.cjs +2 -2
  42. package/dist/spreadsheet/index.js +2 -2
  43. package/dist/vector/index.cjs +24 -6
  44. package/dist/vector/index.js +2 -2
  45. package/dist/video-editor/index.cjs +24 -6
  46. package/dist/video-editor/index.js +2 -2
  47. package/package.json +3 -3
  48. package/dist/chunk-GLSOQNQR.js +0 -205
package/README.md CHANGED
@@ -96,7 +96,7 @@ useAgentToolProvider(registry, provider);
96
96
  | :--- | :--- |
97
97
  | `@pixerate/editor-react` | `usePromptEditor`, `useEditor`, `EditorContent`, `BubbleMenu`, `TemplateRenderer`, `useHistory`, `useHistoryDirty`, `useHistoryShortcuts`, `useNavigationGuard`, `useDismissGuard`, `EditorSlotsProvider` / `useEditorSlots`, `SpreadsheetEditor` / `useSpreadsheetEditor`, `FormulaHints`, `DirtyTracker` |
98
98
  | `@pixerate/editor-react/spreadsheet` | `SpreadsheetEditor` (virtualised for large sheets, `virtualize` prop), `useSpreadsheetEditor`, `useSpreadsheetViewport`, `useSpreadsheetTableInteractions`, `FormulaHints`, `SpreadsheetContextMenu`, `SpreadsheetGroupRow`, `SheetTabs`, `NameManager` (also re-exported from the root entry) |
99
- | `@pixerate/editor-react/image-editor` | `ImageEditor`, `useImageEditor`: crop, rotate/flip, adjustments, annotations, depth masks, Select & Mask (`SelectionOptionsBar`, `RefineEdgePanel`: magic wand, marquees, lasso, Refine Edge, layer masks), and `onInpaint` / `onRemoveBackground` AI hooks |
99
+ | `@pixerate/editor-react/image-editor` | `ImageEditor`, `useImageEditor`, `ImageEditorCanvas` (the canvas alone, for your own chrome; see `docs/image-editor-canvas.md`), `ImageEffectControls`: crop, rotate/flip, adjustments, annotations, depth masks, Select & Mask (`SelectionOptionsBar`, `RefineEdgePanel`: magic wand, marquees, lasso, Refine Edge, layer masks), and `onInpaint` / `onRemoveBackground` AI hooks |
100
100
  | `@pixerate/editor-react/paint-editor` | `PaintEditor`, `usePaintEditor`: natural-media painting with `PaintCanvas` (pen pressure, tilt and twist, coalesced and predicted events, palm rejection, view rotation and mirroring), `PaintToolbar` (tools, symmetry, perspective, tracing and reference images, save / open, PNG / JPEG / PSD), `BrushPanel` (library with thumbnails), `PaperPanel`, `ColorPanel` (wheel, harmonies, swatches, mixing pad) and `PaintLayersPanel` |
101
101
  | `@pixerate/editor-react/commands` | `CommandPalette`, `useCommandPalette` (`hotkey: "Mod+K"`), `useCommandShortcuts`, `useRegisterCommands` over a `CommandRegistry` from `@pixerate/editor/commands` (also re-exported from the root entry) |
102
102
  | `@pixerate/editor-react/persistence` | `useAutosave` (crash-recovery snapshots bound to a history / dirty flag, flushed on `pagehide`, with a recovery check on mount), `useEditorAutosave` (the same for any editor's `EditorDocument`, e.g. `useMermaidDiagram().editorDocument`; `restore` loads the snapshot into the editor) and `<RecoveryPrompt>` (also re-exported from the root entry) |
@@ -130,7 +130,7 @@ The components are styled with [Tailwind CSS](https://tailwindcss.com) utility c
130
130
 
131
131
  2. **Define the theme colors.** `SpreadsheetEditor`, `BubbleMenu`, `TemplateRenderer` and the slot components use [shadcn/ui](https://ui.shadcn.com)-style tokens: `background`, `foreground`, `muted`, `muted-foreground`, `border`, `input`, `primary`, `popover`, `popover-foreground` and `destructive`. Projects already using shadcn/ui have these. Otherwise, define them as colors in your Tailwind theme.
132
132
 
133
- `ImageEditor` uses a fixed dark (slate) palette and only needs step 1. Without Tailwind, the components work but render unstyled. Pass `className` to override.
133
+ `ImageEditor`, `ImageEditorCanvas` and the image panels use the same theme tokens (plus `accent`, `primary-foreground` and `accent-foreground`), so they follow your light or dark theme; their shared classes are in `image-editor/styles.ts`. Without Tailwind, the components work but render unstyled. Pass `className` to override.
134
134
 
135
135
  ## License
136
136
 
@@ -270,7 +270,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
270
270
  // src/playback/PresenceLayer.tsx
271
271
  var import_react5 = __toESM(require("react"), 1);
272
272
  var import_jsx_runtime4 = require("react/jsx-runtime");
273
- function PresenceLayer({ presence, viewport, className = "" }) {
273
+ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
274
274
  const { actors } = (0, import_react5.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
275
275
  if (!actors.length) return null;
276
276
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -280,7 +280,7 @@ function PresenceLayer({ presence, viewport, className = "" }) {
280
280
  className: `pixerate-presence ${className}`.trim(),
281
281
  "aria-hidden": "true",
282
282
  "data-testid": "presence-layer",
283
- style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
283
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: clip ? "hidden" : "visible", zIndex: 50 },
284
284
  children: actors.map((a) => {
285
285
  const at = map(a);
286
286
  const ring = a.focus && (() => {
@@ -2684,13 +2684,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
2684
2684
 
2685
2685
  // src/effects/EffectParameters.tsx
2686
2686
  var import_jsx_runtime18 = require("react/jsx-runtime");
2687
- function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
2687
+ function EffectParameters({
2688
+ description,
2689
+ values,
2690
+ onChange,
2691
+ onReset,
2692
+ keyframed,
2693
+ onPreset,
2694
+ onPresetName,
2695
+ renderControlAddon,
2696
+ disabled = false,
2697
+ className = ""
2698
+ }) {
2688
2699
  const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2689
2700
  const idBase = (0, import_react19.useId)();
2690
2701
  const gesture = import_react19.default.useRef(null);
2691
2702
  const count = import_react19.default.useRef(0);
2692
2703
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
2693
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2704
+ (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2694
2705
  "select",
2695
2706
  {
2696
2707
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -2698,8 +2709,14 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
2698
2709
  value: "",
2699
2710
  disabled,
2700
2711
  onChange: (e) => {
2701
- const preset = description.presets.find((p) => p.name === e.currentTarget.value);
2702
- if (preset) onPreset({ ...description.defaults, ...preset.values });
2712
+ const name = e.currentTarget.value;
2713
+ if (!name) return;
2714
+ if (onPresetName) {
2715
+ onPresetName(name);
2716
+ } else if (onPreset) {
2717
+ const preset = description.presets.find((p) => p.name === name);
2718
+ if (preset) onPreset({ ...description.defaults, ...preset.values });
2719
+ }
2703
2720
  },
2704
2721
  children: [
2705
2722
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("option", { value: "", children: "Presets\u2026" }),
@@ -2717,6 +2734,7 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
2717
2734
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1.5", children: [
2718
2735
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
2719
2736
  keyed && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
2737
+ renderControlAddon?.(field.id),
2720
2738
  onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
2721
2739
  ] }),
2722
2740
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
@@ -3,7 +3,7 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-GLSOQNQR.js";
6
+ } from "../chunk-Q7LAFHGP.js";
7
7
  import "../chunk-5LFQ2UQZ.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
@@ -11,7 +11,7 @@ import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
13
13
  usePlaybackSurface
14
- } from "../chunk-IPVWWVSF.js";
14
+ } from "../chunk-SI2V7XPZ.js";
15
15
 
16
16
  // src/animation-editor/useAnimationEditor.ts
17
17
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -469,7 +469,7 @@ function AgentPresenceLayer({ presences, className = "" }) {
469
469
  // src/playback/PresenceLayer.tsx
470
470
  var import_react = __toESM(require("react"), 1);
471
471
  var import_jsx_runtime2 = require("react/jsx-runtime");
472
- function PresenceLayer({ presence, viewport, className = "" }) {
472
+ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
473
473
  const { actors } = (0, import_react.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
474
474
  if (!actors.length) return null;
475
475
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -479,7 +479,7 @@ function PresenceLayer({ presence, viewport, className = "" }) {
479
479
  className: `pixerate-presence ${className}`.trim(),
480
480
  "aria-hidden": "true",
481
481
  "data-testid": "presence-layer",
482
- style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
482
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: clip ? "hidden" : "visible", zIndex: 50 },
483
483
  children: actors.map((a) => {
484
484
  const at = map(a);
485
485
  const ring = a.focus && (() => {
@@ -3396,13 +3396,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
3396
3396
 
3397
3397
  // src/effects/EffectParameters.tsx
3398
3398
  var import_jsx_runtime12 = require("react/jsx-runtime");
3399
- function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, disabled = false, className = "" }) {
3399
+ function EffectParameters({
3400
+ description,
3401
+ values,
3402
+ onChange,
3403
+ onReset,
3404
+ keyframed,
3405
+ onPreset,
3406
+ onPresetName,
3407
+ renderControlAddon,
3408
+ disabled = false,
3409
+ className = ""
3410
+ }) {
3400
3411
  const fields = (0, import_react26.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3401
3412
  const idBase = (0, import_react26.useId)();
3402
3413
  const gesture = import_react26.default.useRef(null);
3403
3414
  const count = import_react26.default.useRef(0);
3404
3415
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
3405
- onPreset && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3416
+ (onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
3406
3417
  "select",
3407
3418
  {
3408
3419
  className: "w-full rounded border border-border bg-transparent px-1 py-0.5 text-xs",
@@ -3410,8 +3421,14 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
3410
3421
  value: "",
3411
3422
  disabled,
3412
3423
  onChange: (e) => {
3413
- const preset = description.presets.find((p) => p.name === e.currentTarget.value);
3414
- if (preset) onPreset({ ...description.defaults, ...preset.values });
3424
+ const name = e.currentTarget.value;
3425
+ if (!name) return;
3426
+ if (onPresetName) {
3427
+ onPresetName(name);
3428
+ } else if (onPreset) {
3429
+ const preset = description.presets.find((p) => p.name === name);
3430
+ if (preset) onPreset({ ...description.defaults, ...preset.values });
3431
+ }
3415
3432
  },
3416
3433
  children: [
3417
3434
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("option", { value: "", children: "Presets\u2026" }),
@@ -3429,6 +3446,7 @@ function EffectParameters({ description, values, onChange, onReset, keyframed, o
3429
3446
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1.5", children: [
3430
3447
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
3431
3448
  keyed && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
3449
+ renderControlAddon?.(field.id),
3432
3450
  onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
3433
3451
  ] }),
3434
3452
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
@@ -2,14 +2,14 @@ import {
2
2
  EffectParameters,
3
3
  EffectsBrowser,
4
4
  useEffectDescription
5
- } from "../chunk-GLSOQNQR.js";
5
+ } from "../chunk-Q7LAFHGP.js";
6
6
  import "../chunk-5LFQ2UQZ.js";
7
7
  import "../chunk-KIRIU53A.js";
8
8
  import "../chunk-3I7FOSLF.js";
9
9
  import {
10
10
  PresenceLayer,
11
11
  usePlaybackSurface
12
- } from "../chunk-IPVWWVSF.js";
12
+ } from "../chunk-SI2V7XPZ.js";
13
13
 
14
14
  // src/canvas/AgentPresenceLayer.tsx
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -835,7 +835,7 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
835
835
  // src/playback/PresenceLayer.tsx
836
836
  var import_react7 = __toESM(require("react"), 1);
837
837
  var import_jsx_runtime5 = require("react/jsx-runtime");
838
- function PresenceLayer({ presence, viewport, className = "" }) {
838
+ function PresenceLayer({ presence, viewport, clip = true, className = "" }) {
839
839
  const { actors } = (0, import_react7.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
840
840
  if (!actors.length) return null;
841
841
  const map = typeof viewport === "function" ? viewport : viewport ? (p) => ({ x: p.x * viewport.zoom + viewport.x, y: p.y * viewport.zoom + viewport.y }) : (p) => p;
@@ -845,7 +845,7 @@ function PresenceLayer({ presence, viewport, className = "" }) {
845
845
  className: `pixerate-presence ${className}`.trim(),
846
846
  "aria-hidden": "true",
847
847
  "data-testid": "presence-layer",
848
- style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
848
+ style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: clip ? "hidden" : "visible", zIndex: 50 },
849
849
  children: actors.map((a) => {
850
850
  const at = map(a);
851
851
  const ring = a.focus && (() => {
@@ -25,7 +25,7 @@ import {
25
25
  PresenceLayer,
26
26
  useAgentPlayback,
27
27
  usePlaybackSurface
28
- } from "../chunk-IPVWWVSF.js";
28
+ } from "../chunk-SI2V7XPZ.js";
29
29
 
30
30
  // src/chart/ChartEditor.tsx
31
31
  import { useRef, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePlaybackSurface
3
- } from "./chunk-IPVWWVSF.js";
3
+ } from "./chunk-SI2V7XPZ.js";
4
4
 
5
5
  // src/playback/useElementPlaybackSurface.ts
6
6
  import { useRef } from "react";