@pixerate/editor-react 0.97.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.
- package/README.md +2 -2
- package/dist/animation-editor/index.cjs +13 -9
- package/dist/animation-editor/index.js +7 -7
- package/dist/canvas/index.cjs +22 -13
- package/dist/canvas/index.js +14 -9
- package/dist/canvas/useCanvasPlaybackSurface.d.cts +8 -2
- package/dist/canvas/useCanvasPlaybackSurface.d.ts +8 -2
- package/dist/chart/index.cjs +10 -6
- package/dist/chart/index.js +2 -2
- package/dist/{chunk-NC4RLZTK.js → chunk-EFF4YWJK.js} +3169 -3085
- package/dist/{chunk-GECXTPSH.js → chunk-EP6MSQN4.js} +1 -1
- package/dist/{chunk-AILJ4JOW.js → chunk-GDPWLGPD.js} +3 -3
- package/dist/{chunk-IPVWWVSF.js → chunk-GNO54NFG.js} +7 -3
- package/dist/{chunk-7I73DW4V.js → chunk-V2YC5T4R.js} +14 -8
- package/dist/image-editor/AdjustmentLayersPanel.d.cts +2 -0
- package/dist/image-editor/AdjustmentLayersPanel.d.ts +2 -0
- package/dist/image-editor/ControlSlider.d.cts +2 -0
- package/dist/image-editor/ControlSlider.d.ts +2 -0
- package/dist/image-editor/CurvesEditor.d.cts +2 -0
- package/dist/image-editor/CurvesEditor.d.ts +2 -0
- package/dist/image-editor/ImageEditor.d.cts +3 -1
- package/dist/image-editor/ImageEditor.d.ts +3 -1
- package/dist/image-editor/ImageEditorCanvas.d.cts +77 -0
- package/dist/image-editor/ImageEditorCanvas.d.ts +77 -0
- package/dist/image-editor/ImageEffectControls.d.cts +14 -0
- package/dist/image-editor/ImageEffectControls.d.ts +14 -0
- package/dist/image-editor/index.cjs +4659 -4576
- package/dist/image-editor/index.d.cts +2 -0
- package/dist/image-editor/index.d.ts +2 -0
- package/dist/image-editor/index.js +6 -2
- package/dist/image-editor/styles.d.cts +51 -0
- package/dist/image-editor/styles.d.ts +51 -0
- package/dist/index.cjs +5262 -5173
- package/dist/index.js +9 -5
- package/dist/paint-editor/index.cjs +10 -6
- package/dist/paint-editor/index.js +4 -4
- package/dist/parameters/index.cjs +20 -10
- package/dist/parameters/index.js +2 -2
- package/dist/playback/PresenceLayer.d.cts +3 -1
- package/dist/playback/PresenceLayer.d.ts +3 -1
- package/dist/playback/useElementPlaybackSurface.d.cts +5 -4
- package/dist/playback/useElementPlaybackSurface.d.ts +5 -4
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.js +2 -2
- package/dist/vector/index.cjs +7 -3
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +13 -9
- package/dist/video-editor/index.js +7 -7
- package/package.json +3 -3
|
@@ -50,12 +50,12 @@ function useChartCommands(registry, controller, options = {}) {
|
|
|
50
50
|
function useChartToolProvider(registry, controller, options = {}) {
|
|
51
51
|
const latest = useRef(options);
|
|
52
52
|
latest.current = options;
|
|
53
|
-
const { id, namespace } = options;
|
|
53
|
+
const { id, namespace, playbackSurface } = options;
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (!registry) return;
|
|
56
56
|
const { rasterize, ...rest } = latest.current;
|
|
57
|
-
return registry.register(createChartToolProvider(controller, { ...rest, id, namespace, rasterize: rasterize === false ? void 0 : rasterize ?? createChartRasterizer() }));
|
|
58
|
-
}, [registry, controller, id, namespace]);
|
|
57
|
+
return registry.register(createChartToolProvider(controller, { ...rest, id, namespace, playbackSurface, rasterize: rasterize === false ? void 0 : rasterize ?? createChartRasterizer() }));
|
|
58
|
+
}, [registry, controller, id, namespace, playbackSurface]);
|
|
59
59
|
}
|
|
60
60
|
function useOfficeChartToolProvider(registry, options = {}) {
|
|
61
61
|
const latest = useRef(options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/playback/PresenceLayer.tsx
|
|
2
2
|
import React, { useSyncExternalStore } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
function PresenceLayer({ presence, viewport, className = "" }) {
|
|
4
|
+
function PresenceLayer({ presence, viewport, clip = true, 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;
|
|
@@ -11,7 +11,7 @@ function PresenceLayer({ presence, viewport, className = "" }) {
|
|
|
11
11
|
className: `pixerate-presence ${className}`.trim(),
|
|
12
12
|
"aria-hidden": "true",
|
|
13
13
|
"data-testid": "presence-layer",
|
|
14
|
-
style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: "hidden", zIndex: 50 },
|
|
14
|
+
style: { position: "absolute", inset: 0, pointerEvents: "none", overflow: clip ? "hidden" : "visible", zIndex: 50 },
|
|
15
15
|
children: actors.map((a) => {
|
|
16
16
|
const at = map(a);
|
|
17
17
|
const ring = a.focus && (() => {
|
|
@@ -74,7 +74,11 @@ function usePlaybackSurface(playback, id, options = {}, sharedPresence) {
|
|
|
74
74
|
beginGesture: (key) => o().beginGesture?.(key),
|
|
75
75
|
endGesture: () => o().endGesture?.(),
|
|
76
76
|
reveal: () => o().reveal?.(),
|
|
77
|
-
open
|
|
77
|
+
// Only a surface whose options can open things has `open`, so playback skips `open` steps
|
|
78
|
+
// (and their wait) everywhere else. Read per step, like the other options.
|
|
79
|
+
get open() {
|
|
80
|
+
return o().open ? (ref) => o().open?.(ref) : void 0;
|
|
81
|
+
},
|
|
78
82
|
get defaultKind() {
|
|
79
83
|
return o().defaultKind;
|
|
80
84
|
}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
usePlaybackSurface
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GNO54NFG.js";
|
|
4
4
|
|
|
5
5
|
// src/playback/useElementPlaybackSurface.ts
|
|
6
6
|
import { useRef } from "react";
|
|
7
|
+
import { locatePlaybackChrome } from "@pixerate/editor/tools";
|
|
7
8
|
function useElementPlaybackSurface(playback, id, element, options) {
|
|
8
9
|
const latest = useRef(options);
|
|
9
10
|
latest.current = options;
|
|
10
11
|
const box = () => element.current?.getBoundingClientRect() ?? null;
|
|
12
|
+
const fromViewport = (p) => {
|
|
13
|
+
const r = box();
|
|
14
|
+
return { x: p.x - (r?.left ?? 0), y: p.y - (r?.top ?? 0) };
|
|
15
|
+
};
|
|
11
16
|
return usePlaybackSurface(playback, id, {
|
|
12
17
|
get defaultKind() {
|
|
13
18
|
return latest.current.defaultKind;
|
|
14
19
|
},
|
|
15
20
|
locate: (ref) => {
|
|
16
|
-
const selector = latest.current.selectors[ref.kind]?.(ref.id);
|
|
21
|
+
const selector = latest.current.selectors?.[ref.kind]?.(ref.id);
|
|
17
22
|
const b = box();
|
|
18
23
|
const r = selector ? element.current?.querySelector(selector)?.getBoundingClientRect() : null;
|
|
19
|
-
|
|
24
|
+
if (b && r && r.width > 0) return { x: r.left - b.left, y: r.top - b.top, width: r.width, height: r.height };
|
|
25
|
+
return locatePlaybackChrome(ref, latest.current, fromViewport);
|
|
20
26
|
},
|
|
21
27
|
bounds: () => {
|
|
22
28
|
const r = box();
|
|
@@ -30,11 +36,11 @@ function useElementPlaybackSurface(playback, id, element, options) {
|
|
|
30
36
|
const r = box();
|
|
31
37
|
return { x: (r?.left ?? 0) + p.x, y: (r?.top ?? 0) + p.y };
|
|
32
38
|
},
|
|
33
|
-
fromViewport
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
fromViewport,
|
|
40
|
+
reveal: () => latest.current.reveal?.(),
|
|
41
|
+
get open() {
|
|
42
|
+
return latest.current.open ? (ref) => latest.current.open?.(ref) : void 0;
|
|
43
|
+
}
|
|
38
44
|
});
|
|
39
45
|
}
|
|
40
46
|
|
|
@@ -5,6 +5,8 @@ export interface AdjustmentLayersPanelProps {
|
|
|
5
5
|
/** The current layers (`state.adjustments.layers`), bottom to top. Omit to follow the controller. */
|
|
6
6
|
layers?: AdjustmentLayer[];
|
|
7
7
|
histogram?: ImageHistogram | null;
|
|
8
|
+
/** Extra classes on the root element. */
|
|
9
|
+
className?: string;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Adjustment-layer stack: add, reorder, show / hide and remove layers, and edit the selected
|
|
@@ -5,6 +5,8 @@ export interface AdjustmentLayersPanelProps {
|
|
|
5
5
|
/** The current layers (`state.adjustments.layers`), bottom to top. Omit to follow the controller. */
|
|
6
6
|
layers?: AdjustmentLayer[];
|
|
7
7
|
histogram?: ImageHistogram | null;
|
|
8
|
+
/** Extra classes on the root element. */
|
|
9
|
+
className?: string;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Adjustment-layer stack: add, reorder, show / hide and remove layers, and edit the selected
|
|
@@ -7,6 +7,8 @@ export interface ControlSliderProps {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
/** Overrides `spec.label` (also the accessible name). */
|
|
9
9
|
label?: string;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
10
12
|
}
|
|
11
13
|
/** A labelled range input described by a control-table entry. */
|
|
12
14
|
export declare const ControlSlider: React.FC<ControlSliderProps>;
|
|
@@ -7,6 +7,8 @@ export interface ControlSliderProps {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
/** Overrides `spec.label` (also the accessible name). */
|
|
9
9
|
label?: string;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
10
12
|
}
|
|
11
13
|
/** A labelled range input described by a control-table entry. */
|
|
12
14
|
export declare const ControlSlider: React.FC<ControlSliderProps>;
|
|
@@ -7,6 +7,8 @@ export interface CurvesEditorProps {
|
|
|
7
7
|
histogram?: ImageHistogram | null;
|
|
8
8
|
channel?: 'master' | 'red' | 'green' | 'blue';
|
|
9
9
|
size?: number;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Curves editor over the histogram: click to add a point, drag to move it, double-click to
|
|
@@ -7,6 +7,8 @@ export interface CurvesEditorProps {
|
|
|
7
7
|
histogram?: ImageHistogram | null;
|
|
8
8
|
channel?: 'master' | 'red' | 'green' | 'blue';
|
|
9
9
|
size?: number;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Curves editor over the histogram: click to add a point, drag to move it, double-click to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AgentPlayback } from '@pixerate/editor/tools';
|
|
3
|
-
import type { ExportOptions, InpaintHook, RemoveBackgroundHook, ImageEditorAIHooks } from '@pixerate/editor/image-editor';
|
|
3
|
+
import type { ExportOptions, ImageEditorFit, InpaintHook, RemoveBackgroundHook, ImageEditorAIHooks } from '@pixerate/editor/image-editor';
|
|
4
4
|
import { type UseImageEditorReturn } from './useImageEditor.cjs';
|
|
5
5
|
import type { EffectProvider } from '@pixerate/editor/effects';
|
|
6
6
|
export interface ImageEditorProps {
|
|
@@ -13,6 +13,8 @@ export interface ImageEditorProps {
|
|
|
13
13
|
onInpaint?: InpaintHook;
|
|
14
14
|
onRemoveBackground?: RemoveBackgroundHook;
|
|
15
15
|
aiHooks?: ImageEditorAIHooks;
|
|
16
|
+
/** How the image fits the canvas (default: the renderer's). */
|
|
17
|
+
fit?: ImageEditorFit;
|
|
16
18
|
/**
|
|
17
19
|
* An effects provider (see `@pixerate/editor/effects`), registered with the controller while
|
|
18
20
|
* mounted: filter effects as smart filters and generator or overlay effects as effect layers,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { AgentPlayback } from '@pixerate/editor/tools';
|
|
3
|
-
import type { ExportOptions, InpaintHook, RemoveBackgroundHook, ImageEditorAIHooks } from '@pixerate/editor/image-editor';
|
|
3
|
+
import type { ExportOptions, ImageEditorFit, InpaintHook, RemoveBackgroundHook, ImageEditorAIHooks } from '@pixerate/editor/image-editor';
|
|
4
4
|
import { type UseImageEditorReturn } from './useImageEditor.js';
|
|
5
5
|
import type { EffectProvider } from '@pixerate/editor/effects';
|
|
6
6
|
export interface ImageEditorProps {
|
|
@@ -13,6 +13,8 @@ export interface ImageEditorProps {
|
|
|
13
13
|
onInpaint?: InpaintHook;
|
|
14
14
|
onRemoveBackground?: RemoveBackgroundHook;
|
|
15
15
|
aiHooks?: ImageEditorAIHooks;
|
|
16
|
+
/** How the image fits the canvas (default: the renderer's). */
|
|
17
|
+
fit?: ImageEditorFit;
|
|
16
18
|
/**
|
|
17
19
|
* An effects provider (see `@pixerate/editor/effects`), registered with the controller while
|
|
18
20
|
* mounted: filter effects as smart filters and generator or overlay effects as effect layers,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AgentPlayback, PlaybackRect, PlaybackRef } from '@pixerate/editor/tools';
|
|
3
|
+
import type { ImageEditorFit } from '@pixerate/editor/image-editor';
|
|
4
|
+
import { FreeTransformTool, type SelectionToolOptions, type ShapeToolOptions, type TextEditSession, type TypeToolOptions } from '@pixerate/editor/image-editor';
|
|
5
|
+
import type { UseImageEditorReturn } from './useImageEditor.cjs';
|
|
6
|
+
/** What pointer gestures on the canvas do (and whether the crop overlay shows). */
|
|
7
|
+
export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'none';
|
|
8
|
+
/** Which gesture an `onError` report comes from. */
|
|
9
|
+
export type ImageEditorCanvasErrorSource = 'paint' | 'select' | 'shape' | 'type';
|
|
10
|
+
export interface ImageEditorCanvasProps {
|
|
11
|
+
/** The editor to draw and edit (`useImageEditor`). */
|
|
12
|
+
editor: UseImageEditorReturn;
|
|
13
|
+
/**
|
|
14
|
+
* What pointer gestures do: `crop` (crop box and its overlay, in the crop margin), `select`
|
|
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`.
|
|
18
|
+
*/
|
|
19
|
+
mode?: ImageEditorCanvasMode;
|
|
20
|
+
/** How the image fits the canvas (default: the renderer's). */
|
|
21
|
+
fit?: ImageEditorFit;
|
|
22
|
+
/** Options of the selection tools (magic wand tolerance, feather, …). */
|
|
23
|
+
selectionOptions?: SelectionToolOptions;
|
|
24
|
+
/** Options of the shape tool. */
|
|
25
|
+
shapeOptions?: ShapeToolOptions;
|
|
26
|
+
/** Options of the type tool. */
|
|
27
|
+
typeOptions?: TypeToolOptions;
|
|
28
|
+
/** Colour of new annotations (default `#ef4444`). */
|
|
29
|
+
annotationColor?: string;
|
|
30
|
+
/** Stroke width of new annotations, in image pixels (default 3). */
|
|
31
|
+
annotationWidth?: number;
|
|
32
|
+
/** Aspect ratio a crop handle drag keeps (width / height), or null for free (default). */
|
|
33
|
+
cropRatio?: number | null;
|
|
34
|
+
/** A gesture failed (`message`) or recovered (`null`). */
|
|
35
|
+
onError?: (source: ImageEditorCanvasErrorSource, message: string | null) => void;
|
|
36
|
+
/**
|
|
37
|
+
* The text being edited on the canvas. Pass it with `onTypeSessionChange` to follow it; changing
|
|
38
|
+
* it from a session to `null` finishes editing.
|
|
39
|
+
*/
|
|
40
|
+
typeSession?: TextEditSession | null;
|
|
41
|
+
/** Called when on-canvas text editing starts or ends. */
|
|
42
|
+
onTypeSessionChange?: (session: TextEditSession | null) => void;
|
|
43
|
+
/**
|
|
44
|
+
* The Free Transform tool (Ctrl/Cmd+T) the canvas drives and draws. Pass your own to show its
|
|
45
|
+
* options bar or begin transforms from your UI; by default the canvas makes one.
|
|
46
|
+
*/
|
|
47
|
+
transformTool?: FreeTransformTool;
|
|
48
|
+
/**
|
|
49
|
+
* Agent playback: act out the image tools' calls on this canvas with the agent's cursor
|
|
50
|
+
* (default: the nearest `AgentPlaybackProvider`; `null` turns it off).
|
|
51
|
+
*/
|
|
52
|
+
playback?: AgentPlayback | null;
|
|
53
|
+
/** The playback surface id (default `image`, where the image tool providers play). */
|
|
54
|
+
playbackId?: string;
|
|
55
|
+
/** Bring the canvas on screen (switch to its tab) before the agent acts. */
|
|
56
|
+
onPlaybackReveal?: () => void | Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Where the default playback lookups find the editor's chrome: tabs (`[data-image-tab]`),
|
|
59
|
+
* sliders (`[data-control-id]`) and layer rows (`[data-layer-id]`). Default: the canvas itself.
|
|
60
|
+
*/
|
|
61
|
+
chromeRoot?: React.RefObject<HTMLElement | null>;
|
|
62
|
+
/** Your own lookup for a playback ref, in document pixels (tried first). */
|
|
63
|
+
locate?: (ref: PlaybackRef) => PlaybackRect | null;
|
|
64
|
+
/** Your own element for a playback ref, anywhere on the page; its box is mapped to document pixels. */
|
|
65
|
+
locateElement?: (ref: PlaybackRef) => Element | null;
|
|
66
|
+
/** Show a panel for an `open` step (default: click its `[data-image-tab]` under `chromeRoot`). */
|
|
67
|
+
open?: (ref: PlaybackRef) => void | Promise<void>;
|
|
68
|
+
className?: string;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The image editor's canvas on its own: the render loop (sized by its container), every pointer
|
|
73
|
+
* gesture of the crop, select, paint and annotate modes, Free Transform, the hidden textarea for
|
|
74
|
+
* on-canvas type, and the agent playback surface. Give it a size (it fills its box). Parity with
|
|
75
|
+
* Svelte's `<ImageEditorCanvas>`.
|
|
76
|
+
*/
|
|
77
|
+
export declare const ImageEditorCanvas: React.FC<ImageEditorCanvasProps>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AgentPlayback, PlaybackRect, PlaybackRef } from '@pixerate/editor/tools';
|
|
3
|
+
import type { ImageEditorFit } from '@pixerate/editor/image-editor';
|
|
4
|
+
import { FreeTransformTool, type SelectionToolOptions, type ShapeToolOptions, type TextEditSession, type TypeToolOptions } from '@pixerate/editor/image-editor';
|
|
5
|
+
import type { UseImageEditorReturn } from './useImageEditor.js';
|
|
6
|
+
/** What pointer gestures on the canvas do (and whether the crop overlay shows). */
|
|
7
|
+
export type ImageEditorCanvasMode = 'crop' | 'select' | 'paint' | 'annotate' | 'none';
|
|
8
|
+
/** Which gesture an `onError` report comes from. */
|
|
9
|
+
export type ImageEditorCanvasErrorSource = 'paint' | 'select' | 'shape' | 'type';
|
|
10
|
+
export interface ImageEditorCanvasProps {
|
|
11
|
+
/** The editor to draw and edit (`useImageEditor`). */
|
|
12
|
+
editor: UseImageEditorReturn;
|
|
13
|
+
/**
|
|
14
|
+
* What pointer gestures do: `crop` (crop box and its overlay, in the crop margin), `select`
|
|
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`.
|
|
18
|
+
*/
|
|
19
|
+
mode?: ImageEditorCanvasMode;
|
|
20
|
+
/** How the image fits the canvas (default: the renderer's). */
|
|
21
|
+
fit?: ImageEditorFit;
|
|
22
|
+
/** Options of the selection tools (magic wand tolerance, feather, …). */
|
|
23
|
+
selectionOptions?: SelectionToolOptions;
|
|
24
|
+
/** Options of the shape tool. */
|
|
25
|
+
shapeOptions?: ShapeToolOptions;
|
|
26
|
+
/** Options of the type tool. */
|
|
27
|
+
typeOptions?: TypeToolOptions;
|
|
28
|
+
/** Colour of new annotations (default `#ef4444`). */
|
|
29
|
+
annotationColor?: string;
|
|
30
|
+
/** Stroke width of new annotations, in image pixels (default 3). */
|
|
31
|
+
annotationWidth?: number;
|
|
32
|
+
/** Aspect ratio a crop handle drag keeps (width / height), or null for free (default). */
|
|
33
|
+
cropRatio?: number | null;
|
|
34
|
+
/** A gesture failed (`message`) or recovered (`null`). */
|
|
35
|
+
onError?: (source: ImageEditorCanvasErrorSource, message: string | null) => void;
|
|
36
|
+
/**
|
|
37
|
+
* The text being edited on the canvas. Pass it with `onTypeSessionChange` to follow it; changing
|
|
38
|
+
* it from a session to `null` finishes editing.
|
|
39
|
+
*/
|
|
40
|
+
typeSession?: TextEditSession | null;
|
|
41
|
+
/** Called when on-canvas text editing starts or ends. */
|
|
42
|
+
onTypeSessionChange?: (session: TextEditSession | null) => void;
|
|
43
|
+
/**
|
|
44
|
+
* The Free Transform tool (Ctrl/Cmd+T) the canvas drives and draws. Pass your own to show its
|
|
45
|
+
* options bar or begin transforms from your UI; by default the canvas makes one.
|
|
46
|
+
*/
|
|
47
|
+
transformTool?: FreeTransformTool;
|
|
48
|
+
/**
|
|
49
|
+
* Agent playback: act out the image tools' calls on this canvas with the agent's cursor
|
|
50
|
+
* (default: the nearest `AgentPlaybackProvider`; `null` turns it off).
|
|
51
|
+
*/
|
|
52
|
+
playback?: AgentPlayback | null;
|
|
53
|
+
/** The playback surface id (default `image`, where the image tool providers play). */
|
|
54
|
+
playbackId?: string;
|
|
55
|
+
/** Bring the canvas on screen (switch to its tab) before the agent acts. */
|
|
56
|
+
onPlaybackReveal?: () => void | Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Where the default playback lookups find the editor's chrome: tabs (`[data-image-tab]`),
|
|
59
|
+
* sliders (`[data-control-id]`) and layer rows (`[data-layer-id]`). Default: the canvas itself.
|
|
60
|
+
*/
|
|
61
|
+
chromeRoot?: React.RefObject<HTMLElement | null>;
|
|
62
|
+
/** Your own lookup for a playback ref, in document pixels (tried first). */
|
|
63
|
+
locate?: (ref: PlaybackRef) => PlaybackRect | null;
|
|
64
|
+
/** Your own element for a playback ref, anywhere on the page; its box is mapped to document pixels. */
|
|
65
|
+
locateElement?: (ref: PlaybackRef) => Element | null;
|
|
66
|
+
/** Show a panel for an `open` step (default: click its `[data-image-tab]` under `chromeRoot`). */
|
|
67
|
+
open?: (ref: PlaybackRef) => void | Promise<void>;
|
|
68
|
+
className?: string;
|
|
69
|
+
style?: React.CSSProperties;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The image editor's canvas on its own: the render loop (sized by its container), every pointer
|
|
73
|
+
* gesture of the crop, select, paint and annotate modes, Free Transform, the hidden textarea for
|
|
74
|
+
* on-canvas type, and the agent playback surface. Give it a size (it fills its box). Parity with
|
|
75
|
+
* Svelte's `<ImageEditorCanvas>`.
|
|
76
|
+
*/
|
|
77
|
+
export declare const ImageEditorCanvas: React.FC<ImageEditorCanvasProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EffectProvider } from '@pixerate/editor/effects';
|
|
3
|
+
export interface ImageEffectControlsProps {
|
|
4
|
+
provider: EffectProvider | null;
|
|
5
|
+
effect: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
values: Readonly<Record<string, unknown>>;
|
|
8
|
+
onChange: (control: string, value: unknown, gesture: string | null) => void;
|
|
9
|
+
onPreset: (values: Readonly<Record<string, unknown>>) => void;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** One effect's controls, loaded from the provider; a note when it does not have the effect. Parity with Svelte's `<ImageEffectControls>`. */
|
|
14
|
+
export declare function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }: ImageEffectControlsProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EffectProvider } from '@pixerate/editor/effects';
|
|
3
|
+
export interface ImageEffectControlsProps {
|
|
4
|
+
provider: EffectProvider | null;
|
|
5
|
+
effect: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
values: Readonly<Record<string, unknown>>;
|
|
8
|
+
onChange: (control: string, value: unknown, gesture: string | null) => void;
|
|
9
|
+
onPreset: (values: Readonly<Record<string, unknown>>) => void;
|
|
10
|
+
/** Extra classes on the root element. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** One effect's controls, loaded from the provider; a note when it does not have the effect. Parity with Svelte's `<ImageEffectControls>`. */
|
|
14
|
+
export declare function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }: ImageEffectControlsProps): React.JSX.Element;
|