@pixerate/editor-react 0.91.1 → 0.93.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/animation-editor/AnimationEditor.d.cts +11 -1
  2. package/dist/animation-editor/AnimationEditor.d.ts +11 -1
  3. package/dist/animation-editor/index.cjs +494 -366
  4. package/dist/animation-editor/index.js +48 -4
  5. package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
  6. package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
  7. package/dist/canvas/index.cjs +1033 -893
  8. package/dist/canvas/index.d.cts +2 -0
  9. package/dist/canvas/index.d.ts +2 -0
  10. package/dist/canvas/index.js +125 -74
  11. package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
  12. package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
  13. package/dist/chart/ChartEditor.d.cts +12 -1
  14. package/dist/chart/ChartEditor.d.ts +12 -1
  15. package/dist/chart/index.cjs +187 -29
  16. package/dist/chart/index.js +74 -10
  17. package/dist/{chunk-SMMO7CZB.js → chunk-6YRSQW2V.js} +84 -2
  18. package/dist/chunk-7I73DW4V.js +43 -0
  19. package/dist/{chunk-GML6BYCN.js → chunk-GECXTPSH.js} +53 -3
  20. package/dist/chunk-IPVWWVSF.js +96 -0
  21. package/dist/hooks/useAgentToolProvider.d.cts +6 -2
  22. package/dist/hooks/useAgentToolProvider.d.ts +6 -2
  23. package/dist/image-editor/ImageEditor.d.cts +10 -0
  24. package/dist/image-editor/ImageEditor.d.ts +10 -0
  25. package/dist/image-editor/index.cjs +1028 -864
  26. package/dist/image-editor/index.js +2 -1
  27. package/dist/index.cjs +2070 -1812
  28. package/dist/index.d.cts +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +21 -3
  31. package/dist/paint-editor/PaintEditor.d.cts +12 -1
  32. package/dist/paint-editor/PaintEditor.d.ts +12 -1
  33. package/dist/paint-editor/index.cjs +319 -164
  34. package/dist/paint-editor/index.js +84 -11
  35. package/dist/parameters/ParametersPanel.d.cts +11 -1
  36. package/dist/parameters/ParametersPanel.d.ts +11 -1
  37. package/dist/parameters/index.cjs +190 -41
  38. package/dist/parameters/index.js +23 -4
  39. package/dist/playback/AgentPlaybackContext.d.cts +9 -0
  40. package/dist/playback/AgentPlaybackContext.d.ts +9 -0
  41. package/dist/playback/PresenceLayer.d.cts +28 -0
  42. package/dist/playback/PresenceLayer.d.ts +28 -0
  43. package/dist/playback/index.d.cts +4 -0
  44. package/dist/playback/index.d.ts +4 -0
  45. package/dist/playback/useElementPlaybackSurface.d.cts +19 -0
  46. package/dist/playback/useElementPlaybackSurface.d.ts +19 -0
  47. package/dist/playback/usePlaybackSurface.d.cts +11 -0
  48. package/dist/playback/usePlaybackSurface.d.ts +11 -0
  49. package/dist/spreadsheet/SpreadsheetEditor.d.cts +10 -0
  50. package/dist/spreadsheet/SpreadsheetEditor.d.ts +10 -0
  51. package/dist/spreadsheet/index.cjs +443 -313
  52. package/dist/spreadsheet/index.js +2 -1
  53. package/dist/vector/VectorCanvas.d.cts +11 -1
  54. package/dist/vector/VectorCanvas.d.ts +11 -1
  55. package/dist/vector/index.cjs +946 -826
  56. package/dist/vector/index.js +42 -3
  57. package/dist/video-editor/VideoEditor.d.cts +6 -1
  58. package/dist/video-editor/VideoEditor.d.ts +6 -1
  59. package/dist/video-editor/VideoTimeline.d.cts +11 -1
  60. package/dist/video-editor/VideoTimeline.d.ts +11 -1
  61. package/dist/video-editor/index.cjs +463 -332
  62. package/dist/video-editor/index.js +53 -5
  63. package/package.json +3 -3
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import type { PresenceStore } from "@pixerate/editor/tools";
3
+ export interface PresenceLayerProps {
4
+ /** The cursors to draw, e.g. from `usePlaybackSurface` or a director. */
5
+ presence: PresenceStore;
6
+ /**
7
+ * How surface coordinates map to this layer's pixels: a canvas viewport
8
+ * (`x * zoom + viewport.x`), or a function. Default: one to one.
9
+ */
10
+ viewport?: {
11
+ x: number;
12
+ y: number;
13
+ zoom: number;
14
+ } | ((point: {
15
+ x: number;
16
+ y: number;
17
+ }) => {
18
+ x: number;
19
+ y: number;
20
+ });
21
+ className?: string;
22
+ }
23
+ /**
24
+ * Agent cursors with their name tag or note, and a ring around what each one works on. Place it
25
+ * in a `position: relative` box over the surface. It has the `pixerate-presence` class, so
26
+ * snapshots and exports leave it out.
27
+ */
28
+ export declare function PresenceLayer({ presence, viewport, className }: PresenceLayerProps): React.JSX.Element | null;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import type { PresenceStore } from "@pixerate/editor/tools";
3
+ export interface PresenceLayerProps {
4
+ /** The cursors to draw, e.g. from `usePlaybackSurface` or a director. */
5
+ presence: PresenceStore;
6
+ /**
7
+ * How surface coordinates map to this layer's pixels: a canvas viewport
8
+ * (`x * zoom + viewport.x`), or a function. Default: one to one.
9
+ */
10
+ viewport?: {
11
+ x: number;
12
+ y: number;
13
+ zoom: number;
14
+ } | ((point: {
15
+ x: number;
16
+ y: number;
17
+ }) => {
18
+ x: number;
19
+ y: number;
20
+ });
21
+ className?: string;
22
+ }
23
+ /**
24
+ * Agent cursors with their name tag or note, and a ring around what each one works on. Place it
25
+ * in a `position: relative` box over the surface. It has the `pixerate-presence` class, so
26
+ * snapshots and exports leave it out.
27
+ */
28
+ export declare function PresenceLayer({ presence, viewport, className }: PresenceLayerProps): React.JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ export { PresenceLayer, type PresenceLayerProps } from "./PresenceLayer.cjs";
2
+ export { AgentPlaybackProvider, useAgentPlayback } from "./AgentPlaybackContext.cjs";
3
+ export { usePlaybackSurface, type PlaybackSurfaceOptions } from "./usePlaybackSurface.cjs";
4
+ export { useElementPlaybackSurface, type ElementPlaybackSurfaceOptions } from "./useElementPlaybackSurface.cjs";
@@ -0,0 +1,4 @@
1
+ export { PresenceLayer, type PresenceLayerProps } from "./PresenceLayer.js";
2
+ export { AgentPlaybackProvider, useAgentPlayback } from "./AgentPlaybackContext.js";
3
+ export { usePlaybackSurface, type PlaybackSurfaceOptions } from "./usePlaybackSurface.js";
4
+ export { useElementPlaybackSurface, type ElementPlaybackSurfaceOptions } from "./useElementPlaybackSurface.js";
@@ -0,0 +1,19 @@
1
+ import { type RefObject } from "react";
2
+ import type { AgentPlayback, PresenceStore } from "@pixerate/editor/tools";
3
+ export interface ElementPlaybackSurfaceOptions {
4
+ /** The kind of a bare `id` / `ids` argument (e.g. `parameter`). */
5
+ defaultKind?: string;
6
+ /**
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)}"]\` }`.
9
+ */
10
+ selectors: Record<string, (id: string) => string>;
11
+ /** Bring the element on screen (switch to its tab) before the agent acts. */
12
+ reveal?: () => void | Promise<void>;
13
+ }
14
+ /**
15
+ * A playback surface for a plain DOM component: coordinates are pixels of `element`'s box, and
16
+ * refs are found by the CSS selectors given per kind. Draw the cursors with `<PresenceLayer>`
17
+ * inside the element (make it `position: relative`).
18
+ */
19
+ export declare function useElementPlaybackSurface(playback: AgentPlayback | null | undefined, id: string | null | undefined, element: RefObject<HTMLElement | null>, options: ElementPlaybackSurfaceOptions): PresenceStore;
@@ -0,0 +1,19 @@
1
+ import { type RefObject } from "react";
2
+ import type { AgentPlayback, PresenceStore } from "@pixerate/editor/tools";
3
+ export interface ElementPlaybackSurfaceOptions {
4
+ /** The kind of a bare `id` / `ids` argument (e.g. `parameter`). */
5
+ defaultKind?: string;
6
+ /**
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)}"]\` }`.
9
+ */
10
+ selectors: Record<string, (id: string) => string>;
11
+ /** Bring the element on screen (switch to its tab) before the agent acts. */
12
+ reveal?: () => void | Promise<void>;
13
+ }
14
+ /**
15
+ * A playback surface for a plain DOM component: coordinates are pixels of `element`'s box, and
16
+ * refs are found by the CSS selectors given per kind. Draw the cursors with `<PresenceLayer>`
17
+ * inside the element (make it `position: relative`).
18
+ */
19
+ export declare function useElementPlaybackSurface(playback: AgentPlayback | null | undefined, id: string | null | undefined, element: RefObject<HTMLElement | null>, options: ElementPlaybackSurfaceOptions): PresenceStore;
@@ -0,0 +1,11 @@
1
+ import { PresenceStore, type AgentPlayback, type PlaybackSurface } from "@pixerate/editor/tools";
2
+ /** A surface's behaviour; every function is read fresh on each call, so inline closures are fine. */
3
+ export type PlaybackSurfaceOptions = Omit<PlaybackSurface, "presence">;
4
+ /**
5
+ * Attaches a playback surface under `id` (the tool provider's id, or its `playbackSurface`) while
6
+ * mounted, and returns its cursors to draw with `<PresenceLayer>`. `playback` defaults to the
7
+ * nearest `AgentPlaybackProvider`; with none, nothing is attached and calls run instantly.
8
+ */
9
+ export declare function usePlaybackSurface(playback: AgentPlayback | null | undefined, id: string | null | undefined, options?: PlaybackSurfaceOptions,
10
+ /** Use this presence store (e.g. a director's, so its cursor and playback's are one) instead of a new one. */
11
+ sharedPresence?: PresenceStore | null): PresenceStore;
@@ -0,0 +1,11 @@
1
+ import { PresenceStore, type AgentPlayback, type PlaybackSurface } from "@pixerate/editor/tools";
2
+ /** A surface's behaviour; every function is read fresh on each call, so inline closures are fine. */
3
+ export type PlaybackSurfaceOptions = Omit<PlaybackSurface, "presence">;
4
+ /**
5
+ * Attaches a playback surface under `id` (the tool provider's id, or its `playbackSurface`) while
6
+ * mounted, and returns its cursors to draw with `<PresenceLayer>`. `playback` defaults to the
7
+ * nearest `AgentPlaybackProvider`; with none, nothing is attached and calls run instantly.
8
+ */
9
+ export declare function usePlaybackSurface(playback: AgentPlayback | null | undefined, id: string | null | undefined, options?: PlaybackSurfaceOptions,
10
+ /** Use this presence store (e.g. a director's, so its cursor and playback's are one) instead of a new one. */
11
+ sharedPresence?: PresenceStore | null): PresenceStore;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type SpreadsheetColumn, type SpreadsheetRow, type CellData } from '@pixerate/editor/spreadsheet';
3
+ import type { AgentPlayback } from '@pixerate/editor/tools';
3
4
  import { useSpreadsheetEditor } from './useSpreadsheetEditor.cjs';
4
5
  export interface SpreadsheetEditorProps {
5
6
  state?: ReturnType<typeof useSpreadsheetEditor>;
@@ -20,5 +21,14 @@ export interface SpreadsheetEditorProps {
20
21
  * `true` / `false` force it.
21
22
  */
22
23
  virtualize?: boolean | 'auto';
24
+ /**
25
+ * Agent playback: act out the spreadsheet tools' calls here with the agent's cursor (default:
26
+ * the nearest `AgentPlaybackProvider`; `null` turns it off).
27
+ */
28
+ playback?: AgentPlayback | null;
29
+ /** The playback surface id (default `spreadsheet`, where `createSpreadsheetToolProvider` plays). */
30
+ playbackId?: string;
31
+ /** Bring the grid on screen (switch to its tab) before the agent acts. */
32
+ onPlaybackReveal?: () => void | Promise<void>;
23
33
  }
24
34
  export declare const SpreadsheetEditor: React.FC<SpreadsheetEditorProps>;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type SpreadsheetColumn, type SpreadsheetRow, type CellData } from '@pixerate/editor/spreadsheet';
3
+ import type { AgentPlayback } from '@pixerate/editor/tools';
3
4
  import { useSpreadsheetEditor } from './useSpreadsheetEditor.js';
4
5
  export interface SpreadsheetEditorProps {
5
6
  state?: ReturnType<typeof useSpreadsheetEditor>;
@@ -20,5 +21,14 @@ export interface SpreadsheetEditorProps {
20
21
  * `true` / `false` force it.
21
22
  */
22
23
  virtualize?: boolean | 'auto';
24
+ /**
25
+ * Agent playback: act out the spreadsheet tools' calls here with the agent's cursor (default:
26
+ * the nearest `AgentPlaybackProvider`; `null` turns it off).
27
+ */
28
+ playback?: AgentPlayback | null;
29
+ /** The playback surface id (default `spreadsheet`, where `createSpreadsheetToolProvider` plays). */
30
+ playbackId?: string;
31
+ /** Bring the grid on screen (switch to its tab) before the agent acts. */
32
+ onPlaybackReveal?: () => void | Promise<void>;
23
33
  }
24
34
  export declare const SpreadsheetEditor: React.FC<SpreadsheetEditorProps>;