@pixerate/editor-react 0.98.0 → 0.99.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 (40) hide show
  1. package/dist/animation-editor/index.cjs +11 -7
  2. package/dist/animation-editor/index.js +7 -7
  3. package/dist/canvas/index.cjs +20 -11
  4. package/dist/canvas/index.js +14 -9
  5. package/dist/canvas/useCanvasPlaybackSurface.d.cts +8 -2
  6. package/dist/canvas/useCanvasPlaybackSurface.d.ts +8 -2
  7. package/dist/chart/index.cjs +8 -4
  8. package/dist/chart/index.js +2 -2
  9. package/dist/{chunk-TFEKLNC7.js → chunk-EFF4YWJK.js} +390 -358
  10. package/dist/{chunk-S6C2W5JW.js → chunk-EP6MSQN4.js} +1 -1
  11. package/dist/{chunk-AILJ4JOW.js → chunk-GDPWLGPD.js} +3 -3
  12. package/dist/{chunk-SI2V7XPZ.js → chunk-GNO54NFG.js} +5 -1
  13. package/dist/{chunk-NEQI2ZIU.js → chunk-V2YC5T4R.js} +14 -8
  14. package/dist/image-editor/AdjustmentLayersPanel.d.cts +2 -0
  15. package/dist/image-editor/AdjustmentLayersPanel.d.ts +2 -0
  16. package/dist/image-editor/ControlSlider.d.cts +2 -0
  17. package/dist/image-editor/ControlSlider.d.ts +2 -0
  18. package/dist/image-editor/CurvesEditor.d.cts +2 -0
  19. package/dist/image-editor/CurvesEditor.d.ts +2 -0
  20. package/dist/image-editor/ImageEffectControls.d.cts +3 -1
  21. package/dist/image-editor/ImageEffectControls.d.ts +3 -1
  22. package/dist/image-editor/index.cjs +397 -361
  23. package/dist/image-editor/index.js +2 -2
  24. package/dist/image-editor/styles.d.cts +51 -0
  25. package/dist/image-editor/styles.d.ts +51 -0
  26. package/dist/index.cjs +437 -395
  27. package/dist/index.js +5 -5
  28. package/dist/paint-editor/index.cjs +8 -4
  29. package/dist/paint-editor/index.js +4 -4
  30. package/dist/parameters/index.cjs +18 -8
  31. package/dist/parameters/index.js +2 -2
  32. package/dist/playback/useElementPlaybackSurface.d.cts +5 -4
  33. package/dist/playback/useElementPlaybackSurface.d.ts +5 -4
  34. package/dist/spreadsheet/index.cjs +5 -1
  35. package/dist/spreadsheet/index.js +2 -2
  36. package/dist/vector/index.cjs +5 -1
  37. package/dist/vector/index.js +1 -1
  38. package/dist/video-editor/index.cjs +11 -7
  39. package/dist/video-editor/index.js +7 -7
  40. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useElementPlaybackSurface
3
- } from "./chunk-NEQI2ZIU.js";
3
+ } from "./chunk-V2YC5T4R.js";
4
4
  import {
5
5
  ChartCanvas,
6
6
  ChartDataGrid,
7
7
  ChartInspector,
8
8
  chartButtonClass
9
- } from "./chunk-AILJ4JOW.js";
9
+ } from "./chunk-GDPWLGPD.js";
10
10
  import {
11
11
  FormulaHints,
12
12
  NameManager,
@@ -21,7 +21,7 @@ import {
21
21
  useSpreadsheetClipboard,
22
22
  useSpreadsheetEditor,
23
23
  useSpreadsheetViewport
24
- } from "./chunk-S6C2W5JW.js";
24
+ } from "./chunk-EP6MSQN4.js";
25
25
  import {
26
26
  AdjustmentLayersPanel,
27
27
  BrushOptionsBar,
@@ -44,7 +44,7 @@ import {
44
44
  useImageEditor,
45
45
  useImageEffectsTools,
46
46
  useImageHistogram
47
- } from "./chunk-TFEKLNC7.js";
47
+ } from "./chunk-EFF4YWJK.js";
48
48
  import "./chunk-AJCWF6SN.js";
49
49
  import "./chunk-Q7LAFHGP.js";
50
50
  import "./chunk-5LFQ2UQZ.js";
@@ -55,7 +55,7 @@ import {
55
55
  PresenceLayer,
56
56
  useAgentPlayback,
57
57
  usePlaybackSurface
58
- } from "./chunk-SI2V7XPZ.js";
58
+ } from "./chunk-GNO54NFG.js";
59
59
  import {
60
60
  CommandPalette,
61
61
  useCommandPalette,
@@ -1369,7 +1369,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1369
1369
  beginGesture: (key) => o().beginGesture?.(key),
1370
1370
  endGesture: () => o().endGesture?.(),
1371
1371
  reveal: () => o().reveal?.(),
1372
- open: (ref) => o().open?.(ref),
1372
+ // Only a surface whose options can open things has `open`, so playback skips `open` steps
1373
+ // (and their wait) everywhere else. Read per step, like the other options.
1374
+ get open() {
1375
+ return o().open ? (ref) => o().open?.(ref) : void 0;
1376
+ },
1373
1377
  get defaultKind() {
1374
1378
  return o().defaultKind;
1375
1379
  }
@@ -3054,11 +3058,11 @@ function usePaintEffectsProvider(controller) {
3054
3058
  return provider;
3055
3059
  }
3056
3060
  function usePaintEffectsTools(registry, controller, options = {}) {
3057
- const { id, namespace, readOnly } = options;
3061
+ const { id, namespace, readOnly, playbackSurface } = options;
3058
3062
  (0, import_react22.useEffect)(() => {
3059
3063
  if (!registry) return;
3060
- return registry.register((0, import_paint_editor13.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly }));
3061
- }, [registry, controller, id, namespace, readOnly]);
3064
+ return registry.register((0, import_paint_editor13.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
3065
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
3062
3066
  }
3063
3067
  function Controls({ provider, effect, name, values, apply }) {
3064
3068
  const { description, error } = useEffectDescription(provider, effect);
@@ -13,7 +13,7 @@ import {
13
13
  PresenceLayer,
14
14
  useAgentPlayback,
15
15
  usePlaybackSurface
16
- } from "../chunk-SI2V7XPZ.js";
16
+ } from "../chunk-GNO54NFG.js";
17
17
 
18
18
  // src/paint-editor/usePaintEditor.ts
19
19
  import { useMemo, useState, useSyncExternalStore } from "react";
@@ -1238,11 +1238,11 @@ function usePaintEffectsProvider(controller) {
1238
1238
  return provider;
1239
1239
  }
1240
1240
  function usePaintEffectsTools(registry, controller, options = {}) {
1241
- const { id, namespace, readOnly } = options;
1241
+ const { id, namespace, readOnly, playbackSurface } = options;
1242
1242
  useEffect3(() => {
1243
1243
  if (!registry) return;
1244
- return registry.register(createPaintEffectsToolProvider(controller, { id, namespace, readOnly }));
1245
- }, [registry, controller, id, namespace, readOnly]);
1244
+ return registry.register(createPaintEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
1245
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
1246
1246
  }
1247
1247
  function Controls({ provider, effect, name, values, apply }) {
1248
1248
  const { description, error } = useEffectDescription(provider, effect);
@@ -1547,6 +1547,7 @@ function useAgentPlayback() {
1547
1547
 
1548
1548
  // src/playback/useElementPlaybackSurface.ts
1549
1549
  var import_react8 = require("react");
1550
+ var import_tools2 = require("@pixerate/editor/tools");
1550
1551
 
1551
1552
  // src/playback/usePlaybackSurface.ts
1552
1553
  var import_react7 = require("react");
@@ -1571,7 +1572,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
1571
1572
  beginGesture: (key) => o().beginGesture?.(key),
1572
1573
  endGesture: () => o().endGesture?.(),
1573
1574
  reveal: () => o().reveal?.(),
1574
- open: (ref) => o().open?.(ref),
1575
+ // Only a surface whose options can open things has `open`, so playback skips `open` steps
1576
+ // (and their wait) everywhere else. Read per step, like the other options.
1577
+ get open() {
1578
+ return o().open ? (ref) => o().open?.(ref) : void 0;
1579
+ },
1575
1580
  get defaultKind() {
1576
1581
  return o().defaultKind;
1577
1582
  }
@@ -1590,15 +1595,20 @@ function useElementPlaybackSurface(playback, id, element, options) {
1590
1595
  const latest = (0, import_react8.useRef)(options);
1591
1596
  latest.current = options;
1592
1597
  const box = () => element.current?.getBoundingClientRect() ?? null;
1598
+ const fromViewport = (p) => {
1599
+ const r = box();
1600
+ return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1601
+ };
1593
1602
  return usePlaybackSurface(playback, id, {
1594
1603
  get defaultKind() {
1595
1604
  return latest.current.defaultKind;
1596
1605
  },
1597
1606
  locate: (ref) => {
1598
- const selector = latest.current.selectors[ref.kind]?.(ref.id);
1607
+ const selector = latest.current.selectors?.[ref.kind]?.(ref.id);
1599
1608
  const b = box();
1600
1609
  const r = selector ? element.current?.querySelector(selector)?.getBoundingClientRect() : null;
1601
- return b && r && r.width > 0 ? { x: r.left - b.left, y: r.top - b.top, width: r.width, height: r.height } : null;
1610
+ if (b && r && r.width > 0) return { x: r.left - b.left, y: r.top - b.top, width: r.width, height: r.height };
1611
+ return (0, import_tools2.locatePlaybackChrome)(ref, latest.current, fromViewport);
1602
1612
  },
1603
1613
  bounds: () => {
1604
1614
  const r = box();
@@ -1612,11 +1622,11 @@ function useElementPlaybackSurface(playback, id, element, options) {
1612
1622
  const r = box();
1613
1623
  return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
1614
1624
  },
1615
- fromViewport: (p) => {
1616
- const r = box();
1617
- return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
1618
- },
1619
- reveal: () => latest.current.reveal?.()
1625
+ fromViewport,
1626
+ reveal: () => latest.current.reveal?.(),
1627
+ get open() {
1628
+ return latest.current.open ? (ref) => latest.current.open?.(ref) : void 0;
1629
+ }
1620
1630
  });
1621
1631
  }
1622
1632
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useElementPlaybackSurface
3
- } from "../chunk-NEQI2ZIU.js";
3
+ } from "../chunk-V2YC5T4R.js";
4
4
  import {
5
5
  KeyframeDiamond,
6
6
  ParameterColor,
@@ -21,7 +21,7 @@ import "../chunk-3I7FOSLF.js";
21
21
  import {
22
22
  PresenceLayer,
23
23
  useAgentPlayback
24
- } from "../chunk-SI2V7XPZ.js";
24
+ } from "../chunk-GNO54NFG.js";
25
25
 
26
26
  // src/parameters/useParameters.ts
27
27
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -1,13 +1,14 @@
1
1
  import { type RefObject } from "react";
2
- import type { AgentPlayback, PresenceStore } from "@pixerate/editor/tools";
3
- export interface ElementPlaybackSurfaceOptions {
2
+ import { type AgentPlayback, type PlaybackChromeOptions, type PresenceStore } from "@pixerate/editor/tools";
3
+ export interface ElementPlaybackSurfaceOptions extends PlaybackChromeOptions {
4
4
  /** The kind of a bare `id` / `ids` argument (e.g. `parameter`). */
5
5
  defaultKind?: string;
6
6
  /**
7
7
  * A CSS selector for each ref kind the surface can find inside the element, e.g.
8
- * `{ parameter: (id) => \`[data-parameter-id="${CSS.escape(id)}"]\` }`.
8
+ * `{ parameter: (id) => \`[data-parameter-id="${CSS.escape(id)}"]\` }`. Refs they miss go to
9
+ * `locate`, then `locateElement` (which may return an element outside this one).
9
10
  */
10
- selectors: Record<string, (id: string) => string>;
11
+ selectors?: Record<string, (id: string) => string>;
11
12
  /** Bring the element on screen (switch to its tab) before the agent acts. */
12
13
  reveal?: () => void | Promise<void>;
13
14
  }
@@ -1,13 +1,14 @@
1
1
  import { type RefObject } from "react";
2
- import type { AgentPlayback, PresenceStore } from "@pixerate/editor/tools";
3
- export interface ElementPlaybackSurfaceOptions {
2
+ import { type AgentPlayback, type PlaybackChromeOptions, type PresenceStore } from "@pixerate/editor/tools";
3
+ export interface ElementPlaybackSurfaceOptions extends PlaybackChromeOptions {
4
4
  /** The kind of a bare `id` / `ids` argument (e.g. `parameter`). */
5
5
  defaultKind?: string;
6
6
  /**
7
7
  * A CSS selector for each ref kind the surface can find inside the element, e.g.
8
- * `{ parameter: (id) => \`[data-parameter-id="${CSS.escape(id)}"]\` }`.
8
+ * `{ parameter: (id) => \`[data-parameter-id="${CSS.escape(id)}"]\` }`. Refs they miss go to
9
+ * `locate`, then `locateElement` (which may return an element outside this one).
9
10
  */
10
- selectors: Record<string, (id: string) => string>;
11
+ selectors?: Record<string, (id: string) => string>;
11
12
  /** Bring the element on screen (switch to its tab) before the agent acts. */
12
13
  reveal?: () => void | Promise<void>;
13
14
  }
@@ -317,7 +317,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
317
317
  beginGesture: (key) => o().beginGesture?.(key),
318
318
  endGesture: () => o().endGesture?.(),
319
319
  reveal: () => o().reveal?.(),
320
- open: (ref) => o().open?.(ref),
320
+ // Only a surface whose options can open things has `open`, so playback skips `open` steps
321
+ // (and their wait) everywhere else. Read per step, like the other options.
322
+ get open() {
323
+ return o().open ? (ref) => o().open?.(ref) : void 0;
324
+ },
321
325
  get defaultKind() {
322
326
  return o().defaultKind;
323
327
  }
@@ -12,8 +12,8 @@ import {
12
12
  useSpreadsheetClipboard,
13
13
  useSpreadsheetEditor,
14
14
  useSpreadsheetViewport
15
- } from "../chunk-S6C2W5JW.js";
16
- import "../chunk-SI2V7XPZ.js";
15
+ } from "../chunk-EP6MSQN4.js";
16
+ import "../chunk-GNO54NFG.js";
17
17
  export {
18
18
  FormulaHints,
19
19
  NameManager,
@@ -177,7 +177,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
177
177
  beginGesture: (key) => o().beginGesture?.(key),
178
178
  endGesture: () => o().endGesture?.(),
179
179
  reveal: () => o().reveal?.(),
180
- open: (ref) => o().open?.(ref),
180
+ // Only a surface whose options can open things has `open`, so playback skips `open` steps
181
+ // (and their wait) everywhere else. Read per step, like the other options.
182
+ get open() {
183
+ return o().open ? (ref) => o().open?.(ref) : void 0;
184
+ },
181
185
  get defaultKind() {
182
186
  return o().defaultKind;
183
187
  }
@@ -11,7 +11,7 @@ import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
13
13
  usePlaybackSurface
14
- } from "../chunk-SI2V7XPZ.js";
14
+ } from "../chunk-GNO54NFG.js";
15
15
 
16
16
  // src/vector/useVectorEditor.ts
17
17
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -88,18 +88,18 @@ function useVideoEditor(controllerOrOptions = {}) {
88
88
  return { controller, state, ...actions };
89
89
  }
90
90
  function useVideoEditorTools(registry, controller, options = {}) {
91
- const { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout } = options;
91
+ const { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface } = options;
92
92
  (0, import_react.useEffect)(() => {
93
93
  if (!registry) return;
94
- return registry.register((0, import_video_editor.createVideoEditorToolProvider)(controller, { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout }));
95
- }, [registry, controller, id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout]);
94
+ return registry.register((0, import_video_editor.createVideoEditorToolProvider)(controller, { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface }));
95
+ }, [registry, controller, id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface]);
96
96
  }
97
97
  function useVideoEffectsTools(registry, controller, options = {}) {
98
- const { id, namespace, readOnly } = options;
98
+ const { id, namespace, readOnly, playbackSurface } = options;
99
99
  (0, import_react.useEffect)(() => {
100
100
  if (!registry) return;
101
- return registry.register((0, import_video_editor.createVideoEffectsToolProvider)(controller, { id, namespace, readOnly }));
102
- }, [registry, controller, id, namespace, readOnly]);
101
+ return registry.register((0, import_video_editor.createVideoEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
102
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
103
103
  }
104
104
 
105
105
  // src/video-editor/VideoPreview.tsx
@@ -284,7 +284,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
284
284
  beginGesture: (key) => o().beginGesture?.(key),
285
285
  endGesture: () => o().endGesture?.(),
286
286
  reveal: () => o().reveal?.(),
287
- open: (ref) => o().open?.(ref),
287
+ // Only a surface whose options can open things has `open`, so playback skips `open` steps
288
+ // (and their wait) everywhere else. Read per step, like the other options.
289
+ get open() {
290
+ return o().open ? (ref) => o().open?.(ref) : void 0;
291
+ },
288
292
  get defaultKind() {
289
293
  return o().defaultKind;
290
294
  }
@@ -11,7 +11,7 @@ import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
13
13
  usePlaybackSurface
14
- } from "../chunk-SI2V7XPZ.js";
14
+ } from "../chunk-GNO54NFG.js";
15
15
 
16
16
  // src/video-editor/useVideoEditor.ts
17
17
  import { useEffect, useMemo, useRef, useSyncExternalStore } from "react";
@@ -57,18 +57,18 @@ function useVideoEditor(controllerOrOptions = {}) {
57
57
  return { controller, state, ...actions };
58
58
  }
59
59
  function useVideoEditorTools(registry, controller, options = {}) {
60
- const { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout } = options;
60
+ const { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface } = options;
61
61
  useEffect(() => {
62
62
  if (!registry) return;
63
- return registry.register(createVideoEditorToolProvider(controller, { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout }));
64
- }, [registry, controller, id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout]);
63
+ return registry.register(createVideoEditorToolProvider(controller, { id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface }));
64
+ }, [registry, controller, id, namespace, readOnly, rasterize, framePixels, framePixelsTimeout, playbackSurface]);
65
65
  }
66
66
  function useVideoEffectsTools(registry, controller, options = {}) {
67
- const { id, namespace, readOnly } = options;
67
+ const { id, namespace, readOnly, playbackSurface } = options;
68
68
  useEffect(() => {
69
69
  if (!registry) return;
70
- return registry.register(createVideoEffectsToolProvider(controller, { id, namespace, readOnly }));
71
- }, [registry, controller, id, namespace, readOnly]);
70
+ return registry.register(createVideoEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
71
+ }, [registry, controller, id, namespace, readOnly, playbackSurface]);
72
72
  }
73
73
 
74
74
  // src/video-editor/VideoPreview.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.98.0",
3
+ "version": "0.99.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -245,7 +245,7 @@
245
245
  },
246
246
  "peerDependencies": {
247
247
  "@dagrejs/dagre": "^1.1.8",
248
- "@pixerate/editor": ">=0.148.0 <1.0.0-0",
248
+ "@pixerate/editor": ">=0.149.0 <1.0.0-0",
249
249
  "@tiptap/core": "^2.27.3",
250
250
  "@tiptap/pm": "^2.27.3",
251
251
  "@tiptap/react": "^2.27.3",
@@ -272,7 +272,7 @@
272
272
  "tsup": "^9.0.0",
273
273
  "typescript": "^5.7.3",
274
274
  "vitest": "^5.0.5",
275
- "@pixerate/editor": "0.148.0"
275
+ "@pixerate/editor": "0.149.0"
276
276
  },
277
277
  "scripts": {
278
278
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",