@pixerate/editor-react 0.172.0 → 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.
Files changed (37) hide show
  1. package/dist/animation-editor/index.cjs +1 -1
  2. package/dist/animation-editor/index.js +1 -1
  3. package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.cts +2 -2
  4. package/dist/{paint-editor → brushes}/BrushLibraryBrowser.d.ts +2 -2
  5. package/dist/brushes/index.cjs +102 -0
  6. package/dist/brushes/index.d.cts +2 -0
  7. package/dist/brushes/index.d.ts +2 -0
  8. package/dist/brushes/index.js +10 -0
  9. package/dist/brushes/useBrushLibrary.d.cts +7 -0
  10. package/dist/brushes/useBrushLibrary.d.ts +7 -0
  11. package/dist/canvas/index.cjs +8 -3
  12. package/dist/canvas/index.js +8 -3
  13. package/dist/canvas/useCanvasDraw.d.cts +4 -2
  14. package/dist/canvas/useCanvasDraw.d.ts +4 -2
  15. package/dist/canvas/useShapeBrushstroke.d.cts +6 -2
  16. package/dist/canvas/useShapeBrushstroke.d.ts +6 -2
  17. package/dist/chunk-62FMEDGG.js +54 -0
  18. package/dist/chunk-PQK2UMAY.js +23 -0
  19. package/dist/{chunk-2UD3JH4W.js → chunk-UR4KL7WE.js} +29 -1
  20. package/dist/{chunk-TOYSB4DK.js → chunk-W6UZ7PVT.js} +1 -1
  21. package/dist/effects/index.cjs +1 -1
  22. package/dist/effects/index.js +1 -1
  23. package/dist/image-editor/BrushOptionsBar.d.cts +2 -1
  24. package/dist/image-editor/BrushOptionsBar.d.ts +2 -1
  25. package/dist/image-editor/index.cjs +965 -870
  26. package/dist/image-editor/index.js +4 -2
  27. package/dist/index.cjs +1485 -1390
  28. package/dist/index.js +13 -11
  29. package/dist/paint-editor/index.cjs +18 -3
  30. package/dist/paint-editor/index.d.cts +1 -1
  31. package/dist/paint-editor/index.d.ts +1 -1
  32. package/dist/paint-editor/index.js +326 -359
  33. package/dist/vector/index.cjs +3 -3
  34. package/dist/vector/index.js +4 -5
  35. package/dist/video-editor/index.cjs +1 -1
  36. package/dist/video-editor/index.js +1 -1
  37. 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-2UD3JH4W.js";
65
+ } from "./chunk-UR4KL7WE.js";
57
66
  import {
58
67
  ImageCheckbox,
59
68
  ImageColor,
@@ -63,7 +72,7 @@ import {
63
72
  LayerEffectsPanel,
64
73
  useImageEditorControls
65
74
  } from "./chunk-EP6C5N54.js";
66
- import "./chunk-TOYSB4DK.js";
75
+ import "./chunk-W6UZ7PVT.js";
67
76
  import "./chunk-5RPB4WGT.js";
68
77
  import "./chunk-KIRIU53A.js";
69
78
  import "./chunk-3I7FOSLF.js";
@@ -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/paint-editor/BrushLibraryBrowser.tsx
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)(PixelCanvas, { pixels: thumbnail(e.brush.id), label: `${e.brush.name} thumbnail`, className: "rounded", style: { width: "100%", aspectRatio: `${thumbnailWidth} / ${thumbnailHeight}` } }),
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
  },
@@ -1946,7 +1961,7 @@ function useEffectDescription(provider, effect) {
1946
1961
  var import_react20 = require("react");
1947
1962
  var import_effects = require("@pixerate/editor/effects");
1948
1963
  var import_jsx_runtime21 = require("react/jsx-runtime");
1949
- var LABELS = { motion: "Motion", camera: "Camera" };
1964
+ var LABELS = { motion: "Motion", camera: "Camera", timing: "Timing" };
1950
1965
  function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
1951
1966
  const ref = (0, import_react20.useRef)(null);
1952
1967
  const [failed, setFailed] = (0, import_react20.useState)(effect.kind in LABELS);
@@ -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 * from './BrushLibraryBrowser.cjs';
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 * from './BrushLibraryBrowser.js';
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';