@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/animation-editor/index.js +1 -1
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-ZQ6H2C7N.js → chunk-BWEARAWR.js} +26 -11
- package/dist/{chunk-6XI62THS.js → chunk-HWZHG6GV.js} +710 -780
- package/dist/effects/index.cjs +26 -11
- package/dist/effects/index.js +1 -1
- package/dist/image-editor/controls/controls.d.cts +66 -0
- package/dist/image-editor/controls/controls.d.ts +66 -0
- package/dist/image-editor/index.cjs +1041 -1106
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +12 -2
- package/dist/index.cjs +1550 -1615
- package/dist/index.js +12 -2
- package/dist/paint-editor/index.js +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +26 -11
- package/dist/video-editor/index.js +1 -1
- package/package.json +3 -3
package/dist/canvas/index.js
CHANGED
|
@@ -248,6 +248,7 @@ function EffectAuthoringEditor({
|
|
|
248
248
|
const pendingRef = useRef2(false);
|
|
249
249
|
const timeRef = useRef2(0);
|
|
250
250
|
const inputsRef = useRef2({});
|
|
251
|
+
const [previewError, setPreviewError] = useState4(null);
|
|
251
252
|
const [savingPreset, setSavingPreset] = useState4(false);
|
|
252
253
|
const [presetName, setPresetName] = useState4("");
|
|
253
254
|
const textareaRef = useRef2(null);
|
|
@@ -255,6 +256,9 @@ function EffectAuthoringEditor({
|
|
|
255
256
|
const [sourceCode, setSourceCode] = useState4("");
|
|
256
257
|
const sourceDebounceRef = useRef2(null);
|
|
257
258
|
useEffect4(() => {
|
|
259
|
+
const canvas = canvasRef.current;
|
|
260
|
+
canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
|
|
261
|
+
setPreviewError(null);
|
|
258
262
|
if (!session) {
|
|
259
263
|
if (rendererRef.current) {
|
|
260
264
|
rendererRef.current.dispose();
|
|
@@ -272,6 +276,8 @@ function EffectAuthoringEditor({
|
|
|
272
276
|
createdRenderer = renderer;
|
|
273
277
|
rendererRef.current = renderer;
|
|
274
278
|
setRendererReady((c) => c + 1);
|
|
279
|
+
}).catch((e) => {
|
|
280
|
+
if (live) setPreviewError(session.getState().previewError || (e instanceof Error ? e.message : String(e)));
|
|
275
281
|
});
|
|
276
282
|
return () => {
|
|
277
283
|
live = false;
|
|
@@ -300,7 +306,13 @@ function EffectAuthoringEditor({
|
|
|
300
306
|
if (ctx && typeof ImageData !== "undefined") {
|
|
301
307
|
ctx.putImageData(new ImageData(new Uint8ClampedArray(pixels.data), pixels.width, pixels.height), 0, 0);
|
|
302
308
|
}
|
|
303
|
-
|
|
309
|
+
if (rendererRef.current === renderer) setPreviewError(null);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
if (rendererRef.current === renderer) {
|
|
312
|
+
const canvas = canvasRef.current;
|
|
313
|
+
canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
|
|
314
|
+
setPreviewError(e instanceof Error ? e.message : String(e));
|
|
315
|
+
}
|
|
304
316
|
}
|
|
305
317
|
} while (pendingRef.current);
|
|
306
318
|
} finally {
|
|
@@ -447,16 +459,19 @@ function EffectAuthoringEditor({
|
|
|
447
459
|
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
|
|
448
460
|
/* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
|
|
449
461
|
/* @__PURE__ */ jsx4("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
462
|
+
/* @__PURE__ */ jsxs3("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: [
|
|
463
|
+
/* @__PURE__ */ jsx4(
|
|
464
|
+
"canvas",
|
|
465
|
+
{
|
|
466
|
+
ref: canvasRef,
|
|
467
|
+
width: previewSize.width,
|
|
468
|
+
height: previewSize.height,
|
|
469
|
+
className: "h-full w-full object-contain",
|
|
470
|
+
"aria-label": "Effect preview canvas"
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
previewError && /* @__PURE__ */ jsx4("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 })
|
|
474
|
+
] }),
|
|
460
475
|
state.issues.length > 0 && /* @__PURE__ */ jsx4("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__ */ jsxs3(
|
|
461
476
|
"div",
|
|
462
477
|
{
|