@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.
- package/README.md +2 -2
- package/dist/animation-editor/index.cjs +24 -6
- package/dist/animation-editor/index.js +2 -2
- package/dist/canvas/index.cjs +24 -6
- package/dist/canvas/index.js +2 -2
- package/dist/chart/index.cjs +2 -2
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-7I73DW4V.js → chunk-NEQI2ZIU.js} +1 -1
- package/dist/chunk-Q7LAFHGP.js +655 -0
- package/dist/{chunk-GECXTPSH.js → chunk-S6C2W5JW.js} +1 -1
- package/dist/{chunk-IPVWWVSF.js → chunk-SI2V7XPZ.js} +2 -2
- package/dist/{chunk-IY6YOY5B.js → chunk-TFEKLNC7.js} +3083 -3031
- package/dist/effects/EffectAuthoringEditor.d.cts +22 -0
- package/dist/effects/EffectAuthoringEditor.d.ts +22 -0
- package/dist/effects/EffectParameters.d.cts +5 -1
- package/dist/effects/EffectParameters.d.ts +5 -1
- package/dist/effects/index.cjs +456 -4
- package/dist/effects/index.d.cts +2 -0
- package/dist/effects/index.d.ts +2 -0
- package/dist/effects/index.js +5 -1
- package/dist/effects/useEffectAuthoring.d.cts +6 -0
- package/dist/effects/useEffectAuthoring.d.ts +6 -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 +12 -0
- package/dist/image-editor/ImageEffectControls.d.ts +12 -0
- package/dist/image-editor/index.cjs +4709 -4644
- package/dist/image-editor/index.d.cts +2 -0
- package/dist/image-editor/index.d.ts +2 -0
- package/dist/image-editor/index.js +7 -3
- package/dist/index.cjs +5125 -5060
- package/dist/index.js +9 -5
- package/dist/paint-editor/index.cjs +24 -6
- package/dist/paint-editor/index.js +2 -2
- package/dist/parameters/index.cjs +2 -2
- 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/spreadsheet/index.cjs +2 -2
- package/dist/spreadsheet/index.js +2 -2
- package/dist/vector/index.cjs +24 -6
- package/dist/vector/index.js +2 -2
- package/dist/video-editor/index.cjs +24 -6
- package/dist/video-editor/index.js +2 -2
- package/package.json +3 -3
- package/dist/chunk-GLSOQNQR.js +0 -205
|
@@ -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,12 @@
|
|
|
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
|
+
}
|
|
11
|
+
/** One effect's controls, loaded from the provider; a note when it does not have the effect. Parity with Svelte's `<ImageEffectControls>`. */
|
|
12
|
+
export declare function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }: ImageEffectControlsProps): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
11
|
+
/** One effect's controls, loaded from the provider; a note when it does not have the effect. Parity with Svelte's `<ImageEffectControls>`. */
|
|
12
|
+
export declare function ImageEffectControls({ provider, effect, name, values, onChange, onPreset }: ImageEffectControlsProps): React.JSX.Element;
|