@pixerate/editor-react 0.91.0 → 0.92.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.
- package/dist/canvas/AgentPresenceLayer.d.cts +3 -0
- package/dist/canvas/AgentPresenceLayer.d.ts +3 -0
- package/dist/canvas/index.cjs +1032 -893
- package/dist/canvas/index.d.cts +2 -0
- package/dist/canvas/index.d.ts +2 -0
- package/dist/canvas/index.js +125 -74
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +28 -0
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +28 -0
- package/dist/{chunk-SMMO7CZB.js → chunk-6MDTFAPY.js} +84 -2
- package/dist/chunk-ECBC4HD7.js +95 -0
- package/dist/hooks/useAgentToolProvider.d.cts +6 -2
- package/dist/hooks/useAgentToolProvider.d.ts +6 -2
- package/dist/image-editor/ImageEditor.d.cts +10 -0
- package/dist/image-editor/ImageEditor.d.ts +10 -0
- package/dist/image-editor/index.cjs +1027 -864
- package/dist/image-editor/index.js +2 -1
- package/dist/index.cjs +1986 -1810
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -2
- package/dist/playback/AgentPlaybackContext.d.cts +9 -0
- package/dist/playback/AgentPlaybackContext.d.ts +9 -0
- package/dist/playback/PresenceLayer.d.cts +28 -0
- package/dist/playback/PresenceLayer.d.ts +28 -0
- package/dist/playback/index.d.cts +3 -0
- package/dist/playback/index.d.ts +3 -0
- package/dist/playback/usePlaybackSurface.d.cts +9 -0
- package/dist/playback/usePlaybackSurface.d.ts +9 -0
- package/dist/vector/VectorCanvas.d.cts +11 -1
- package/dist/vector/VectorCanvas.d.ts +11 -1
- package/dist/vector/index.cjs +945 -826
- package/dist/vector/index.js +42 -3
- package/package.json +13 -13
package/dist/index.d.cts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./hooks/useFileImport.cjs";
|
|
|
9
9
|
export * from "./hooks/useDocxExport.cjs";
|
|
10
10
|
export * from "./components/ExportDocxButton.cjs";
|
|
11
11
|
export * from "./hooks/useAgentToolProvider.cjs";
|
|
12
|
+
export * from "./playback/index.cjs";
|
|
12
13
|
export * from "./hooks/useToolBridge.cjs";
|
|
13
14
|
export * from "./hooks/useToolRegistryView.cjs";
|
|
14
15
|
export * from "./components/EditorContent.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./hooks/useFileImport.js";
|
|
|
9
9
|
export * from "./hooks/useDocxExport.js";
|
|
10
10
|
export * from "./components/ExportDocxButton.js";
|
|
11
11
|
export * from "./hooks/useAgentToolProvider.js";
|
|
12
|
+
export * from "./playback/index.js";
|
|
12
13
|
export * from "./hooks/useToolBridge.js";
|
|
13
14
|
export * from "./hooks/useToolRegistryView.js";
|
|
14
15
|
export * from "./components/EditorContent.js";
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,13 @@ import {
|
|
|
39
39
|
useImageEditor,
|
|
40
40
|
useImageEffectsTools,
|
|
41
41
|
useImageHistogram
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-6MDTFAPY.js";
|
|
43
|
+
import {
|
|
44
|
+
AgentPlaybackProvider,
|
|
45
|
+
PresenceLayer,
|
|
46
|
+
useAgentPlayback,
|
|
47
|
+
usePlaybackSurface
|
|
48
|
+
} from "./chunk-ECBC4HD7.js";
|
|
43
49
|
import "./chunk-AJCWF6SN.js";
|
|
44
50
|
import "./chunk-5R67YSSD.js";
|
|
45
51
|
import "./chunk-OTGJEYHV.js";
|
|
@@ -688,7 +694,11 @@ var ExportDocxButton = ({
|
|
|
688
694
|
|
|
689
695
|
// src/hooks/useAgentToolProvider.ts
|
|
690
696
|
import { useEffect as useEffect7 } from "react";
|
|
691
|
-
function useAgentToolProvider(registry, provider) {
|
|
697
|
+
function useAgentToolProvider(registry, provider, options = {}) {
|
|
698
|
+
const { playback } = options;
|
|
699
|
+
useEffect7(() => {
|
|
700
|
+
if (registry && playback) playback.install(registry);
|
|
701
|
+
}, [registry, playback]);
|
|
692
702
|
useEffect7(() => {
|
|
693
703
|
if (!registry || !provider) return;
|
|
694
704
|
return registry.register(provider);
|
|
@@ -2378,6 +2388,7 @@ function createReactChartNodeView(options = {}) {
|
|
|
2378
2388
|
}
|
|
2379
2389
|
export {
|
|
2380
2390
|
AdjustmentLayersPanel,
|
|
2391
|
+
AgentPlaybackProvider,
|
|
2381
2392
|
AssetMentionChips,
|
|
2382
2393
|
BrushOptionsBar,
|
|
2383
2394
|
BubbleMenu,
|
|
@@ -2409,6 +2420,7 @@ export {
|
|
|
2409
2420
|
NameManager,
|
|
2410
2421
|
OutlinePanel,
|
|
2411
2422
|
PaintGradientEditor,
|
|
2423
|
+
PresenceLayer,
|
|
2412
2424
|
RecoveryPrompt,
|
|
2413
2425
|
RefineEdgePanel,
|
|
2414
2426
|
ReviewToolbar,
|
|
@@ -2433,6 +2445,7 @@ export {
|
|
|
2433
2445
|
createHistoryManager2 as createHistoryManager,
|
|
2434
2446
|
createReactChartNodeView,
|
|
2435
2447
|
defaultIsEqual,
|
|
2448
|
+
useAgentPlayback,
|
|
2436
2449
|
useAgentToolProvider,
|
|
2437
2450
|
useAutosave,
|
|
2438
2451
|
useCommandPalette,
|
|
@@ -2459,6 +2472,7 @@ export {
|
|
|
2459
2472
|
useNavigationGuard,
|
|
2460
2473
|
useOutline,
|
|
2461
2474
|
useParagraphStyles,
|
|
2475
|
+
usePlaybackSurface,
|
|
2462
2476
|
usePromptEditor,
|
|
2463
2477
|
useRegisterCommands,
|
|
2464
2478
|
useSpreadsheetClipboard,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { AgentPlayback } from "@pixerate/editor/tools";
|
|
3
|
+
/** Makes `playback` the default for every editor surface below it (`useAgentPlayback`). */
|
|
4
|
+
export declare function AgentPlaybackProvider({ playback, children }: {
|
|
5
|
+
playback: AgentPlayback | null | undefined;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
/** The nearest `AgentPlaybackProvider`'s playback, or `null`. */
|
|
9
|
+
export declare function useAgentPlayback(): AgentPlayback | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { AgentPlayback } from "@pixerate/editor/tools";
|
|
3
|
+
/** Makes `playback` the default for every editor surface below it (`useAgentPlayback`). */
|
|
4
|
+
export declare function AgentPlaybackProvider({ playback, children }: {
|
|
5
|
+
playback: AgentPlayback | null | undefined;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
/** The nearest `AgentPlaybackProvider`'s playback, or `null`. */
|
|
9
|
+
export declare function useAgentPlayback(): AgentPlayback | 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,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,9 @@
|
|
|
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): PresenceStore;
|
|
@@ -0,0 +1,9 @@
|
|
|
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): PresenceStore;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type VectorEditorController, type VectorRenderNode, type VectorRenderMask, type VectorRenderFilter, type VectorPaintDef, type VectorRenderGradientAnnotator, type VectorRenderText } from '@pixerate/editor/vector';
|
|
3
|
+
import type { AgentPlayback } from '@pixerate/editor/tools';
|
|
3
4
|
export interface VectorCanvasProps {
|
|
4
5
|
controller: VectorEditorController;
|
|
5
6
|
/** Fit the artboard into the canvas when it first gets a size (default `true`). */
|
|
@@ -14,6 +15,15 @@ export interface VectorCanvasProps {
|
|
|
14
15
|
style?: React.CSSProperties;
|
|
15
16
|
/** Accessible label (default "Vector canvas"). */
|
|
16
17
|
'aria-label'?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Agent playback: act out the vector commands' calls here with the agent's cursor (default: the
|
|
20
|
+
* nearest `AgentPlaybackProvider`; `null` turns it off).
|
|
21
|
+
*/
|
|
22
|
+
playback?: AgentPlayback | null;
|
|
23
|
+
/** The playback surface id (default `vector`, where the vector commands play). */
|
|
24
|
+
playbackId?: string;
|
|
25
|
+
/** Bring the canvas on screen (switch to its tab) before the agent acts. */
|
|
26
|
+
onPlaybackReveal?: () => void | Promise<void>;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
19
29
|
* Renders paint servers: `<linearGradient>` / `<radialGradient>` descriptors and patterns of
|
|
@@ -55,4 +65,4 @@ export declare function VectorMaskedNodes({ mask, nodes }: {
|
|
|
55
65
|
* An SVG canvas for a `VectorEditorController`: draws the document and the editing overlay
|
|
56
66
|
* and forwards pointer, wheel, keyboard and clipboard events. Focus it to use shortcuts.
|
|
57
67
|
*/
|
|
58
|
-
export declare function VectorCanvas({ controller, fitOnMount, checkerboard, accentColor, guideColor, className, style, 'aria-label': ariaLabel, }: VectorCanvasProps): React.JSX.Element;
|
|
68
|
+
export declare function VectorCanvas({ controller, fitOnMount, checkerboard, accentColor, guideColor, className, style, 'aria-label': ariaLabel, playback, playbackId, onPlaybackReveal, }: VectorCanvasProps): React.JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type VectorEditorController, type VectorRenderNode, type VectorRenderMask, type VectorRenderFilter, type VectorPaintDef, type VectorRenderGradientAnnotator, type VectorRenderText } from '@pixerate/editor/vector';
|
|
3
|
+
import type { AgentPlayback } from '@pixerate/editor/tools';
|
|
3
4
|
export interface VectorCanvasProps {
|
|
4
5
|
controller: VectorEditorController;
|
|
5
6
|
/** Fit the artboard into the canvas when it first gets a size (default `true`). */
|
|
@@ -14,6 +15,15 @@ export interface VectorCanvasProps {
|
|
|
14
15
|
style?: React.CSSProperties;
|
|
15
16
|
/** Accessible label (default "Vector canvas"). */
|
|
16
17
|
'aria-label'?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Agent playback: act out the vector commands' calls here with the agent's cursor (default: the
|
|
20
|
+
* nearest `AgentPlaybackProvider`; `null` turns it off).
|
|
21
|
+
*/
|
|
22
|
+
playback?: AgentPlayback | null;
|
|
23
|
+
/** The playback surface id (default `vector`, where the vector commands play). */
|
|
24
|
+
playbackId?: string;
|
|
25
|
+
/** Bring the canvas on screen (switch to its tab) before the agent acts. */
|
|
26
|
+
onPlaybackReveal?: () => void | Promise<void>;
|
|
17
27
|
}
|
|
18
28
|
/**
|
|
19
29
|
* Renders paint servers: `<linearGradient>` / `<radialGradient>` descriptors and patterns of
|
|
@@ -55,4 +65,4 @@ export declare function VectorMaskedNodes({ mask, nodes }: {
|
|
|
55
65
|
* An SVG canvas for a `VectorEditorController`: draws the document and the editing overlay
|
|
56
66
|
* and forwards pointer, wheel, keyboard and clipboard events. Focus it to use shortcuts.
|
|
57
67
|
*/
|
|
58
|
-
export declare function VectorCanvas({ controller, fitOnMount, checkerboard, accentColor, guideColor, className, style, 'aria-label': ariaLabel, }: VectorCanvasProps): React.JSX.Element;
|
|
68
|
+
export declare function VectorCanvas({ controller, fitOnMount, checkerboard, accentColor, guideColor, className, style, 'aria-label': ariaLabel, playback, playbackId, onPlaybackReveal, }: VectorCanvasProps): React.JSX.Element;
|