@pixerate/editor-react 0.172.1 → 0.174.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/{paint-editor → brushes}/BrushLibraryBrowser.d.cts +2 -2
- package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.ts +2 -2
- package/dist/brushes/index.cjs +102 -0
- package/dist/brushes/index.d.cts +2 -0
- package/dist/brushes/index.d.ts +2 -0
- package/dist/brushes/index.js +10 -0
- package/dist/brushes/useBrushLibrary.d.cts +7 -0
- package/dist/brushes/useBrushLibrary.d.ts +7 -0
- package/dist/canvas/index.cjs +7 -2
- package/dist/canvas/index.js +7 -2
- package/dist/canvas/useCanvasDraw.d.cts +4 -2
- package/dist/canvas/useCanvasDraw.d.ts +4 -2
- package/dist/canvas/useShapeBrushstroke.d.cts +6 -2
- package/dist/canvas/useShapeBrushstroke.d.ts +6 -2
- package/dist/chunk-62FMEDGG.js +54 -0
- package/dist/chunk-PQK2UMAY.js +23 -0
- package/dist/{chunk-NQ22NA7S.js → chunk-UR4KL7WE.js} +28 -0
- package/dist/image-editor/BrushOptionsBar.d.cts +2 -1
- package/dist/image-editor/BrushOptionsBar.d.ts +2 -1
- package/dist/image-editor/index.cjs +964 -869
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +1484 -1389
- package/dist/index.js +12 -10
- package/dist/paint-editor/PaintCanvas.d.cts +9 -1
- package/dist/paint-editor/PaintCanvas.d.ts +9 -1
- package/dist/paint-editor/PaintEditor.d.cts +3 -1
- package/dist/paint-editor/PaintEditor.d.ts +3 -1
- package/dist/paint-editor/index.cjs +77 -7
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +416 -389
- package/dist/paint-editor/usePaintEditor.d.cts +30 -1
- package/dist/paint-editor/usePaintEditor.d.ts +30 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +3 -4
- package/package.json +16 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaintDirector, PaintEditorController, PaintPresence, type PaintDirectorOptions, type PaintEditorOptions, type PaintEditorState, type SerializedPaintDocument } from '@pixerate/editor/paint-editor';
|
|
1
|
+
import { PaintDirector, PaintEditorController, PaintPresence, type PaintChange, type PaintChangeFeed, type PaintDirectorOptions, type PaintEditorOptions, type PaintEditorState, type PaintProposal, type PaintProposals, type PaintProposalsOptions, type SerializedPaintDocument } from '@pixerate/editor/paint-editor';
|
|
2
2
|
import type { EditorDocument } from '@pixerate/editor/persistence';
|
|
3
3
|
export interface UsePaintEditorReturn {
|
|
4
4
|
controller: PaintEditorController;
|
|
@@ -23,3 +23,32 @@ export declare function usePaintDirector(controller: PaintEditorController, opti
|
|
|
23
23
|
presence: PaintPresence;
|
|
24
24
|
director: PaintDirector;
|
|
25
25
|
};
|
|
26
|
+
export interface PaintProposalsHandle {
|
|
27
|
+
/** The framework-free store (for `createPaintProposalToolProvider` and agents). */
|
|
28
|
+
readonly store: PaintProposals;
|
|
29
|
+
/** Pending proposals; pass `store` to `PaintCanvas` (`proposals`) to draw them as ghosts. */
|
|
30
|
+
proposals: readonly PaintProposal[];
|
|
31
|
+
propose: PaintProposals['propose'];
|
|
32
|
+
accept: PaintProposals['accept'];
|
|
33
|
+
reject: PaintProposals['reject'];
|
|
34
|
+
clear: PaintProposals['clear'];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Paint an agent suggests without painting it: ghosts the user accepts (painted on a layer of
|
|
38
|
+
* their own as one undo step, made by the proposer) or dismisses. Pass `store` to `PaintCanvas`
|
|
39
|
+
* as `proposals` to draw the ghosts, and to `createPaintProposalToolProvider` for agents. Options
|
|
40
|
+
* are read on the first render. The same API as the Svelte `createPaintProposalState`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function usePaintProposals(controller: PaintEditorController, options?: Omit<PaintProposalsOptions, 'controller'>): PaintProposalsHandle;
|
|
43
|
+
/**
|
|
44
|
+
* What changed in the painting, after each change: strokes, fills and layers added, removed or
|
|
45
|
+
* changed, and the start and end of each stroke, with who made it. For agents that paint
|
|
46
|
+
* alongside the user. Returns the feed (`null` until mounted) and the latest change. The same API
|
|
47
|
+
* as the Svelte `createPaintChangeWatcher`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function usePaintChangeFeed(controller: PaintEditorController, options?: {
|
|
50
|
+
onChange?: (change: PaintChange) => void;
|
|
51
|
+
}): {
|
|
52
|
+
feed: PaintChangeFeed | null;
|
|
53
|
+
last: PaintChange | null;
|
|
54
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaintDirector, PaintEditorController, PaintPresence, type PaintDirectorOptions, type PaintEditorOptions, type PaintEditorState, type SerializedPaintDocument } from '@pixerate/editor/paint-editor';
|
|
1
|
+
import { PaintDirector, PaintEditorController, PaintPresence, type PaintChange, type PaintChangeFeed, type PaintDirectorOptions, type PaintEditorOptions, type PaintEditorState, type PaintProposal, type PaintProposals, type PaintProposalsOptions, type SerializedPaintDocument } from '@pixerate/editor/paint-editor';
|
|
2
2
|
import type { EditorDocument } from '@pixerate/editor/persistence';
|
|
3
3
|
export interface UsePaintEditorReturn {
|
|
4
4
|
controller: PaintEditorController;
|
|
@@ -23,3 +23,32 @@ export declare function usePaintDirector(controller: PaintEditorController, opti
|
|
|
23
23
|
presence: PaintPresence;
|
|
24
24
|
director: PaintDirector;
|
|
25
25
|
};
|
|
26
|
+
export interface PaintProposalsHandle {
|
|
27
|
+
/** The framework-free store (for `createPaintProposalToolProvider` and agents). */
|
|
28
|
+
readonly store: PaintProposals;
|
|
29
|
+
/** Pending proposals; pass `store` to `PaintCanvas` (`proposals`) to draw them as ghosts. */
|
|
30
|
+
proposals: readonly PaintProposal[];
|
|
31
|
+
propose: PaintProposals['propose'];
|
|
32
|
+
accept: PaintProposals['accept'];
|
|
33
|
+
reject: PaintProposals['reject'];
|
|
34
|
+
clear: PaintProposals['clear'];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Paint an agent suggests without painting it: ghosts the user accepts (painted on a layer of
|
|
38
|
+
* their own as one undo step, made by the proposer) or dismisses. Pass `store` to `PaintCanvas`
|
|
39
|
+
* as `proposals` to draw the ghosts, and to `createPaintProposalToolProvider` for agents. Options
|
|
40
|
+
* are read on the first render. The same API as the Svelte `createPaintProposalState`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function usePaintProposals(controller: PaintEditorController, options?: Omit<PaintProposalsOptions, 'controller'>): PaintProposalsHandle;
|
|
43
|
+
/**
|
|
44
|
+
* What changed in the painting, after each change: strokes, fills and layers added, removed or
|
|
45
|
+
* changed, and the start and end of each stroke, with who made it. For agents that paint
|
|
46
|
+
* alongside the user. Returns the feed (`null` until mounted) and the latest change. The same API
|
|
47
|
+
* as the Svelte `createPaintChangeWatcher`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function usePaintChangeFeed(controller: PaintEditorController, options?: {
|
|
50
|
+
onChange?: (change: PaintChange) => void;
|
|
51
|
+
}): {
|
|
52
|
+
feed: PaintChangeFeed | null;
|
|
53
|
+
last: PaintChange | null;
|
|
54
|
+
};
|
package/dist/vector/index.cjs
CHANGED
|
@@ -1169,7 +1169,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1169
1169
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-brushstroke": "", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1170
1170
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1171
1171
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { type: "color", "aria-label": `${name} colour`, className: "h-7 w-10 cursor-pointer rounded border border-border bg-background", value: l.color ?? "#000000", onChange: (e) => controller.setBrushstroke(l.index, { color: e.target.value }, { ids, merge: true }), onBlur: end }),
|
|
1172
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children:
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children: controller.listBrushstrokeBrushes().map((b) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: b.id, children: b.name }, b.id)) }),
|
|
1173
1173
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1174
1174
|
"input",
|
|
1175
1175
|
{
|
|
@@ -1298,7 +1298,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1298
1298
|
children: "+"
|
|
1299
1299
|
}
|
|
1300
1300
|
),
|
|
1301
|
-
kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId:
|
|
1301
|
+
kind === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId: controller.listBrushstrokeBrushes()[0].id, seed: (0, import_vector5.randomVectorBrushstrokeSeed)() }, { ids }), children: "\u270E+" })
|
|
1302
1302
|
] }),
|
|
1303
1303
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1304
1304
|
] });
|
package/dist/vector/index.js
CHANGED
|
@@ -1054,8 +1054,7 @@ import {
|
|
|
1054
1054
|
VECTOR_FILTER_MENU,
|
|
1055
1055
|
VECTOR_STROKE_ALIGN_LABELS,
|
|
1056
1056
|
getVectorAppearancePanel,
|
|
1057
|
-
randomVectorBrushstrokeSeed
|
|
1058
|
-
vectorBrushstrokeBrushes
|
|
1057
|
+
randomVectorBrushstrokeSeed
|
|
1059
1058
|
} from "@pixerate/editor/vector";
|
|
1060
1059
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1061
1060
|
var buttonClass2 = "inline-flex h-7 min-w-7 items-center justify-center rounded-md border border-border bg-background px-1.5 text-xs font-medium text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40";
|
|
@@ -1076,7 +1075,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1076
1075
|
return /* @__PURE__ */ jsx4("div", { className: "space-y-1 rounded border border-border p-1", "data-vector-layer": `${l.kind}-${l.index}`, "data-vector-brushstroke": "", children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
|
|
1077
1076
|
/* @__PURE__ */ jsx4("input", { type: "checkbox", "aria-label": `${name} visible`, title: "Show", checked: l.visible, onChange: (e) => update(l, { visible: e.target.checked }) }),
|
|
1078
1077
|
/* @__PURE__ */ jsx4("input", { type: "color", "aria-label": `${name} colour`, className: "h-7 w-10 cursor-pointer rounded border border-border bg-background", value: l.color ?? "#000000", onChange: (e) => controller.setBrushstroke(l.index, { color: e.target.value }, { ids, merge: true }), onBlur: end }),
|
|
1079
|
-
/* @__PURE__ */ jsx4("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children:
|
|
1078
|
+
/* @__PURE__ */ jsx4("select", { "aria-label": `${name} brush`, className: selectClass2, value: l.brushstroke.brushId, onChange: (e) => controller.setBrushstroke(l.index, { brushId: e.target.value }, { ids }), children: controller.listBrushstrokeBrushes().map((b) => /* @__PURE__ */ jsx4("option", { value: b.id, children: b.name }, b.id)) }),
|
|
1080
1079
|
/* @__PURE__ */ jsx4(
|
|
1081
1080
|
"input",
|
|
1082
1081
|
{
|
|
@@ -1205,7 +1204,7 @@ function VectorAppearancePanel({ controller, className }) {
|
|
|
1205
1204
|
children: "+"
|
|
1206
1205
|
}
|
|
1207
1206
|
),
|
|
1208
|
-
kind === "stroke" && /* @__PURE__ */ jsx4("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId:
|
|
1207
|
+
kind === "stroke" && /* @__PURE__ */ jsx4("button", { type: "button", className: buttonClass2, title: "Add a brushstroke (a natural-media brush along the path)", "aria-label": "Add brushstroke", "data-vector-add-brushstroke": "", disabled: !ids.length, onClick: () => controller.addBrushstroke({ brushId: controller.listBrushstrokeBrushes()[0].id, seed: randomVectorBrushstrokeSeed() }, { ids }), children: "\u270E+" })
|
|
1209
1208
|
] }),
|
|
1210
1209
|
[...layers].reverse().map((l) => layerRow(l, layers.length))
|
|
1211
1210
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.174.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
"default": "./dist/paint-editor/index.cjs"
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
|
+
"./brushes": {
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./dist/brushes/index.d.ts",
|
|
90
|
+
"default": "./dist/brushes/index.js"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./dist/brushes/index.d.cts",
|
|
94
|
+
"default": "./dist/brushes/index.cjs"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
87
97
|
"./commands": {
|
|
88
98
|
"import": {
|
|
89
99
|
"types": "./dist/commands/index.d.ts",
|
|
@@ -219,6 +229,9 @@
|
|
|
219
229
|
"paint-editor": [
|
|
220
230
|
"./dist/paint-editor/index.d.ts"
|
|
221
231
|
],
|
|
232
|
+
"brushes": [
|
|
233
|
+
"./dist/brushes/index.d.ts"
|
|
234
|
+
],
|
|
222
235
|
"commands": [
|
|
223
236
|
"./dist/commands/index.d.ts"
|
|
224
237
|
],
|
|
@@ -264,7 +277,7 @@
|
|
|
264
277
|
"dependencies": {},
|
|
265
278
|
"peerDependencies": {
|
|
266
279
|
"@dagrejs/dagre": "^1.1.8",
|
|
267
|
-
"@pixerate/editor": ">=0.
|
|
280
|
+
"@pixerate/editor": ">=0.256.0 <1.0.0-0",
|
|
268
281
|
"@tiptap/core": "^2.27.3",
|
|
269
282
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
270
283
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
@@ -315,7 +328,7 @@
|
|
|
315
328
|
"tsup": "^9.0.0",
|
|
316
329
|
"typescript": "^5.7.3",
|
|
317
330
|
"vitest": "^5.0.5",
|
|
318
|
-
"@pixerate/editor": "0.
|
|
331
|
+
"@pixerate/editor": "0.256.0"
|
|
319
332
|
},
|
|
320
333
|
"scripts": {
|
|
321
334
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|