@pixerate/editor-react 0.172.1 → 0.173.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/index.cjs +17 -2
- package/dist/paint-editor/index.d.cts +1 -1
- package/dist/paint-editor/index.d.ts +1 -1
- package/dist/paint-editor/index.js +325 -358
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +3 -4
- package/package.json +16 -3
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssetMentionChips,
|
|
3
|
+
GenerationHistory,
|
|
4
|
+
GenerationSettings,
|
|
5
|
+
JobProgress,
|
|
6
|
+
useGenerationPlan,
|
|
7
|
+
useGenerationRecords,
|
|
8
|
+
useJobProgress
|
|
9
|
+
} from "./chunk-FLS7Q32M.js";
|
|
1
10
|
import {
|
|
2
11
|
useElementPlaybackSurface
|
|
3
12
|
} from "./chunk-6CJEJTQB.js";
|
|
@@ -53,7 +62,7 @@ import {
|
|
|
53
62
|
useImageEditor,
|
|
54
63
|
useImageEffectsTools,
|
|
55
64
|
useImageHistogram
|
|
56
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UR4KL7WE.js";
|
|
57
66
|
import {
|
|
58
67
|
ImageCheckbox,
|
|
59
68
|
ImageColor,
|
|
@@ -73,6 +82,8 @@ import {
|
|
|
73
82
|
useAgentPlayback,
|
|
74
83
|
usePlaybackSurface
|
|
75
84
|
} from "./chunk-W5CMGX3I.js";
|
|
85
|
+
import "./chunk-PQK2UMAY.js";
|
|
86
|
+
import "./chunk-62FMEDGG.js";
|
|
76
87
|
import {
|
|
77
88
|
CommandPalette,
|
|
78
89
|
useCommandPalette,
|
|
@@ -84,15 +95,6 @@ import {
|
|
|
84
95
|
useAutosave,
|
|
85
96
|
useEditorAutosave
|
|
86
97
|
} from "./chunk-2JNRWM6S.js";
|
|
87
|
-
import {
|
|
88
|
-
AssetMentionChips,
|
|
89
|
-
GenerationHistory,
|
|
90
|
-
GenerationSettings,
|
|
91
|
-
JobProgress,
|
|
92
|
-
useGenerationPlan,
|
|
93
|
-
useGenerationRecords,
|
|
94
|
-
useJobProgress
|
|
95
|
-
} from "./chunk-FLS7Q32M.js";
|
|
96
98
|
|
|
97
99
|
// src/hooks/usePromptEditor.ts
|
|
98
100
|
import React, { useMemo, useEffect, useRef } from "react";
|
|
@@ -695,10 +695,25 @@ var EditorControl = ({ control: c, onSet }) => {
|
|
|
695
695
|
}
|
|
696
696
|
};
|
|
697
697
|
|
|
698
|
-
// src/
|
|
698
|
+
// src/brushes/BrushLibraryBrowser.tsx
|
|
699
699
|
var import_react6 = require("react");
|
|
700
700
|
var import_brushes2 = require("@pixerate/editor/brushes");
|
|
701
701
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
702
|
+
var Thumbnail = ({ image, label, style }) => {
|
|
703
|
+
const ref = (0, import_react6.useRef)(null);
|
|
704
|
+
(0, import_react6.useEffect)(() => {
|
|
705
|
+
const canvas = ref.current;
|
|
706
|
+
const ctx = canvas?.getContext("2d");
|
|
707
|
+
if (!canvas || !ctx || !image || typeof image === "string" || typeof ctx.createImageData !== "function") return;
|
|
708
|
+
canvas.width = image.width;
|
|
709
|
+
canvas.height = image.height;
|
|
710
|
+
const img = ctx.createImageData(image.width, image.height);
|
|
711
|
+
img.data.set(image.data);
|
|
712
|
+
ctx.putImageData(img, 0, 0);
|
|
713
|
+
}, [image]);
|
|
714
|
+
if (typeof image === "string") return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { src: image, alt: label, className: "rounded object-contain", style });
|
|
715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("canvas", { ref, role: "img", "aria-label": label, className: "rounded", style, width: image?.width, height: image?.height });
|
|
716
|
+
};
|
|
702
717
|
var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, thumbnailWidth = 112, thumbnailHeight = 32, className }) => {
|
|
703
718
|
const [text, setText] = (0, import_react6.useState)("");
|
|
704
719
|
const groups = (0, import_react6.useMemo)(() => (0, import_brushes2.brushLibraryGroups)(entries, { text, profile }), [entries, text, profile]);
|
|
@@ -718,7 +733,7 @@ var BrushLibraryBrowser = ({ entries, activeId, onSelect, profile, thumbnail, th
|
|
|
718
733
|
className: `flex flex-col items-start gap-0.5 rounded p-1 text-left ${activeId === e.brush.id ? "bg-indigo-600/30 ring-1 ring-indigo-500" : "bg-slate-900 hover:bg-slate-800"}`,
|
|
719
734
|
onClick: () => onSelect(e.brush.id),
|
|
720
735
|
children: [
|
|
721
|
-
thumbnail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
736
|
+
thumbnail && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Thumbnail, { image: thumbnail(e.brush.id) ?? null, label: `${e.brush.name} thumbnail`, style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
|
|
722
737
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "truncate text-[10px] text-slate-300", children: e.brush.name })
|
|
723
738
|
]
|
|
724
739
|
},
|
|
@@ -3,7 +3,7 @@ export * from './PaintCanvas.cjs';
|
|
|
3
3
|
export * from './PaintToolbar.cjs';
|
|
4
4
|
export * from './BrushPanel.cjs';
|
|
5
5
|
export * from './BrushEditor.cjs';
|
|
6
|
-
export
|
|
6
|
+
export { BrushLibraryBrowser, type BrushLibraryBrowserProps } from '../brushes/BrushLibraryBrowser.cjs';
|
|
7
7
|
export * from './PaperPanel.cjs';
|
|
8
8
|
export * from './ColorPanel.cjs';
|
|
9
9
|
export * from './PaintLayersPanel.cjs';
|
|
@@ -3,7 +3,7 @@ export * from './PaintCanvas.js';
|
|
|
3
3
|
export * from './PaintToolbar.js';
|
|
4
4
|
export * from './BrushPanel.js';
|
|
5
5
|
export * from './BrushEditor.js';
|
|
6
|
-
export
|
|
6
|
+
export { BrushLibraryBrowser, type BrushLibraryBrowserProps } from '../brushes/BrushLibraryBrowser.js';
|
|
7
7
|
export * from './PaperPanel.js';
|
|
8
8
|
export * from './ColorPanel.js';
|
|
9
9
|
export * from './PaintLayersPanel.js';
|