@pixerate/editor-react 0.112.0 → 0.113.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/index.js CHANGED
@@ -30,10 +30,14 @@ import {
30
30
  CurvesEditor,
31
31
  FreeTransformOptionsBar,
32
32
  Histogram,
33
+ ImageCheckbox,
33
34
  ImageEditor,
34
35
  ImageEditorCanvas,
36
+ ImageEditorControlsProvider,
35
37
  ImageEffectControls,
36
38
  ImageProviderEffectsPanel,
39
+ ImageRange,
40
+ ImageSelect,
37
41
  LayerEffectsPanel,
38
42
  LayersPanel,
39
43
  PaintGradientEditor,
@@ -42,11 +46,12 @@ import {
42
46
  ShapeOptionsBar,
43
47
  TypeOptionsBar,
44
48
  useImageEditor,
49
+ useImageEditorControls,
45
50
  useImageEffectsTools,
46
51
  useImageHistogram
47
- } from "./chunk-6XI62THS.js";
52
+ } from "./chunk-HWZHG6GV.js";
48
53
  import "./chunk-AJCWF6SN.js";
49
- import "./chunk-ZQ6H2C7N.js";
54
+ import "./chunk-BWEARAWR.js";
50
55
  import "./chunk-5LFQ2UQZ.js";
51
56
  import "./chunk-KIRIU53A.js";
52
57
  import "./chunk-3I7FOSLF.js";
@@ -2538,10 +2543,14 @@ export {
2538
2543
  GenerationSettings,
2539
2544
  Histogram,
2540
2545
  HistoryManager2 as HistoryManager,
2546
+ ImageCheckbox,
2541
2547
  ImageEditor,
2542
2548
  ImageEditorCanvas,
2549
+ ImageEditorControlsProvider,
2543
2550
  ImageEffectControls,
2544
2551
  ImageProviderEffectsPanel,
2552
+ ImageRange,
2553
+ ImageSelect,
2545
2554
  InsertTableGrid,
2546
2555
  JobProgress,
2547
2556
  LayerEffectsPanel,
@@ -2598,6 +2607,7 @@ export {
2598
2607
  useHistoryDirty,
2599
2608
  useHistoryShortcuts,
2600
2609
  useImageEditor,
2610
+ useImageEditorControls,
2601
2611
  useImageEffectsTools,
2602
2612
  useImageHistogram,
2603
2613
  useJobProgress,
@@ -5,7 +5,7 @@ import {
5
5
  EffectParameters,
6
6
  EffectsBrowser,
7
7
  useEffectDescription
8
- } from "../chunk-ZQ6H2C7N.js";
8
+ } from "../chunk-BWEARAWR.js";
9
9
  import "../chunk-5LFQ2UQZ.js";
10
10
  import "../chunk-KIRIU53A.js";
11
11
  import "../chunk-3I7FOSLF.js";
@@ -3,7 +3,7 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-ZQ6H2C7N.js";
6
+ } from "../chunk-BWEARAWR.js";
7
7
  import "../chunk-5LFQ2UQZ.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
@@ -3271,6 +3271,7 @@ function EffectAuthoringEditor({
3271
3271
  const pendingRef = (0, import_react23.useRef)(false);
3272
3272
  const timeRef = (0, import_react23.useRef)(0);
3273
3273
  const inputsRef = (0, import_react23.useRef)({});
3274
+ const [previewError, setPreviewError] = (0, import_react23.useState)(null);
3274
3275
  const [savingPreset, setSavingPreset] = (0, import_react23.useState)(false);
3275
3276
  const [presetName, setPresetName] = (0, import_react23.useState)("");
3276
3277
  const textareaRef = (0, import_react23.useRef)(null);
@@ -3278,6 +3279,9 @@ function EffectAuthoringEditor({
3278
3279
  const [sourceCode, setSourceCode] = (0, import_react23.useState)("");
3279
3280
  const sourceDebounceRef = (0, import_react23.useRef)(null);
3280
3281
  (0, import_react23.useEffect)(() => {
3282
+ const canvas = canvasRef.current;
3283
+ canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
3284
+ setPreviewError(null);
3281
3285
  if (!session) {
3282
3286
  if (rendererRef.current) {
3283
3287
  rendererRef.current.dispose();
@@ -3295,6 +3299,8 @@ function EffectAuthoringEditor({
3295
3299
  createdRenderer = renderer;
3296
3300
  rendererRef.current = renderer;
3297
3301
  setRendererReady((c) => c + 1);
3302
+ }).catch((e) => {
3303
+ if (live) setPreviewError(session.getState().previewError || (e instanceof Error ? e.message : String(e)));
3298
3304
  });
3299
3305
  return () => {
3300
3306
  live = false;
@@ -3323,7 +3329,13 @@ function EffectAuthoringEditor({
3323
3329
  if (ctx && typeof ImageData !== "undefined") {
3324
3330
  ctx.putImageData(new ImageData(new Uint8ClampedArray(pixels.data), pixels.width, pixels.height), 0, 0);
3325
3331
  }
3326
- } catch {
3332
+ if (rendererRef.current === renderer) setPreviewError(null);
3333
+ } catch (e) {
3334
+ if (rendererRef.current === renderer) {
3335
+ const canvas = canvasRef.current;
3336
+ canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
3337
+ setPreviewError(e instanceof Error ? e.message : String(e));
3338
+ }
3327
3339
  }
3328
3340
  } while (pendingRef.current);
3329
3341
  } finally {
@@ -3470,16 +3482,19 @@ function EffectAuthoringEditor({
3470
3482
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
3471
3483
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "space-y-2", children: [
3472
3484
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
3473
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3474
- "canvas",
3475
- {
3476
- ref: canvasRef,
3477
- width: previewSize.width,
3478
- height: previewSize.height,
3479
- className: "h-full w-full object-contain",
3480
- "aria-label": "Effect preview canvas"
3481
- }
3482
- ) }),
3485
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: [
3486
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3487
+ "canvas",
3488
+ {
3489
+ ref: canvasRef,
3490
+ width: previewSize.width,
3491
+ height: previewSize.height,
3492
+ className: "h-full w-full object-contain",
3493
+ "aria-label": "Effect preview canvas"
3494
+ }
3495
+ ),
3496
+ previewError && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "absolute inset-0 flex items-center justify-center p-4 text-center text-xs text-white/80", role: "status", "data-effect-preview-error": true, children: previewError })
3497
+ ] }),
3483
3498
  state.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "space-y-1 rounded border border-destructive/20 bg-destructive/10 p-2 text-xs", "data-effect-issues": true, children: state.issues.map((issue, idx) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3484
3499
  "div",
3485
3500
  {
@@ -4,7 +4,7 @@ import {
4
4
  EffectsBrowser,
5
5
  useEffectDescription,
6
6
  useEffects
7
- } from "../chunk-ZQ6H2C7N.js";
7
+ } from "../chunk-BWEARAWR.js";
8
8
  import "../chunk-5LFQ2UQZ.js";
9
9
  import "../chunk-KIRIU53A.js";
10
10
  import "../chunk-3I7FOSLF.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.112.0",
3
+ "version": "0.113.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -258,7 +258,7 @@
258
258
  },
259
259
  "peerDependencies": {
260
260
  "@dagrejs/dagre": "^1.1.8",
261
- "@pixerate/editor": ">=0.167.0 <1.0.0-0",
261
+ "@pixerate/editor": ">=0.169.0 <1.0.0-0",
262
262
  "@tiptap/core": "^2.27.3",
263
263
  "@tiptap/pm": "^2.27.3",
264
264
  "@tiptap/react": "^2.27.3",
@@ -285,7 +285,7 @@
285
285
  "tsup": "^9.0.0",
286
286
  "typescript": "^5.7.3",
287
287
  "vitest": "^5.0.5",
288
- "@pixerate/editor": "0.167.0"
288
+ "@pixerate/editor": "0.169.0"
289
289
  },
290
290
  "scripts": {
291
291
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",