@pixerate/editor-react 0.111.0 → 0.112.1
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/chart/index.cjs +13 -0
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-VTLCQXIY.js → chunk-3MUK5ASL.js} +14 -0
- package/dist/{chunk-ZQ6H2C7N.js → chunk-BWEARAWR.js} +26 -11
- package/dist/{chunk-6XI62THS.js → chunk-X2AGIMF3.js} +1 -1
- package/dist/effects/index.cjs +26 -11
- package/dist/effects/index.js +1 -1
- package/dist/image-editor/index.js +2 -2
- package/dist/index.cjs +13 -0
- package/dist/index.js +3 -3
- 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
package/dist/chart/index.cjs
CHANGED
|
@@ -780,6 +780,19 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
780
780
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
781
781
|
}
|
|
782
782
|
) }),
|
|
783
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
|
|
784
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
|
|
785
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
786
|
+
ChartCommitInput,
|
|
787
|
+
{
|
|
788
|
+
id: `${idBase}-map-breaks`,
|
|
789
|
+
value: spec.mapThresholds.join(", "),
|
|
790
|
+
placeholder: "Equal classes",
|
|
791
|
+
"data-option": "mapThresholds",
|
|
792
|
+
className: chartInputClass,
|
|
793
|
+
onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
|
|
794
|
+
}
|
|
795
|
+
) }),
|
|
783
796
|
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
784
797
|
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
785
798
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
package/dist/chart/index.js
CHANGED
|
@@ -550,6 +550,7 @@ import {
|
|
|
550
550
|
parseChartAmountList,
|
|
551
551
|
chartSeriesType,
|
|
552
552
|
isCartesianChart,
|
|
553
|
+
listChartMaps,
|
|
553
554
|
suggestChartReferences
|
|
554
555
|
} from "@pixerate/editor/chart";
|
|
555
556
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -785,6 +786,19 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
785
786
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
786
787
|
}
|
|
787
788
|
) }),
|
|
789
|
+
spec.type === "choropleth" && /* @__PURE__ */ jsx3(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ jsx3("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...listChartMaps().map((m) => m.id)])].map((id) => /* @__PURE__ */ jsx3("option", { value: id, children: listChartMaps().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
|
|
790
|
+
spec.type === "choropleth" && /* @__PURE__ */ jsx3(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ jsx3(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
|
|
791
|
+
spec.type === "choropleth" && /* @__PURE__ */ jsx3(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ jsx3(
|
|
792
|
+
ChartCommitInput,
|
|
793
|
+
{
|
|
794
|
+
id: `${idBase}-map-breaks`,
|
|
795
|
+
value: spec.mapThresholds.join(", "),
|
|
796
|
+
placeholder: "Equal classes",
|
|
797
|
+
"data-option": "mapThresholds",
|
|
798
|
+
className: chartInputClass,
|
|
799
|
+
onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
|
|
800
|
+
}
|
|
801
|
+
) }),
|
|
788
802
|
spec.type === "barrace" && /* @__PURE__ */ jsx3(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ jsx3(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
789
803
|
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ jsx3(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-1", children: [
|
|
790
804
|
/* @__PURE__ */ jsx3("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
|
@@ -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
|
{
|
package/dist/effects/index.cjs
CHANGED
|
@@ -1695,6 +1695,7 @@ function EffectAuthoringEditor({
|
|
|
1695
1695
|
const pendingRef = (0, import_react10.useRef)(false);
|
|
1696
1696
|
const timeRef = (0, import_react10.useRef)(0);
|
|
1697
1697
|
const inputsRef = (0, import_react10.useRef)({});
|
|
1698
|
+
const [previewError, setPreviewError] = (0, import_react10.useState)(null);
|
|
1698
1699
|
const [savingPreset, setSavingPreset] = (0, import_react10.useState)(false);
|
|
1699
1700
|
const [presetName, setPresetName] = (0, import_react10.useState)("");
|
|
1700
1701
|
const textareaRef = (0, import_react10.useRef)(null);
|
|
@@ -1702,6 +1703,9 @@ function EffectAuthoringEditor({
|
|
|
1702
1703
|
const [sourceCode, setSourceCode] = (0, import_react10.useState)("");
|
|
1703
1704
|
const sourceDebounceRef = (0, import_react10.useRef)(null);
|
|
1704
1705
|
(0, import_react10.useEffect)(() => {
|
|
1706
|
+
const canvas = canvasRef.current;
|
|
1707
|
+
canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
|
|
1708
|
+
setPreviewError(null);
|
|
1705
1709
|
if (!session) {
|
|
1706
1710
|
if (rendererRef.current) {
|
|
1707
1711
|
rendererRef.current.dispose();
|
|
@@ -1719,6 +1723,8 @@ function EffectAuthoringEditor({
|
|
|
1719
1723
|
createdRenderer = renderer;
|
|
1720
1724
|
rendererRef.current = renderer;
|
|
1721
1725
|
setRendererReady((c) => c + 1);
|
|
1726
|
+
}).catch((e) => {
|
|
1727
|
+
if (live) setPreviewError(session.getState().previewError || (e instanceof Error ? e.message : String(e)));
|
|
1722
1728
|
});
|
|
1723
1729
|
return () => {
|
|
1724
1730
|
live = false;
|
|
@@ -1747,7 +1753,13 @@ function EffectAuthoringEditor({
|
|
|
1747
1753
|
if (ctx && typeof ImageData !== "undefined") {
|
|
1748
1754
|
ctx.putImageData(new ImageData(new Uint8ClampedArray(pixels.data), pixels.width, pixels.height), 0, 0);
|
|
1749
1755
|
}
|
|
1750
|
-
|
|
1756
|
+
if (rendererRef.current === renderer) setPreviewError(null);
|
|
1757
|
+
} catch (e) {
|
|
1758
|
+
if (rendererRef.current === renderer) {
|
|
1759
|
+
const canvas = canvasRef.current;
|
|
1760
|
+
canvas?.getContext("2d")?.clearRect(0, 0, canvas.width, canvas.height);
|
|
1761
|
+
setPreviewError(e instanceof Error ? e.message : String(e));
|
|
1762
|
+
}
|
|
1751
1763
|
}
|
|
1752
1764
|
} while (pendingRef.current);
|
|
1753
1765
|
} finally {
|
|
@@ -1894,16 +1906,19 @@ function EffectAuthoringEditor({
|
|
|
1894
1906
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
|
|
1895
1907
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
1896
1908
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground", children: "Preview" }),
|
|
1897
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1909
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative flex aspect-video w-full items-center justify-center overflow-hidden rounded border border-border bg-black", children: [
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1911
|
+
"canvas",
|
|
1912
|
+
{
|
|
1913
|
+
ref: canvasRef,
|
|
1914
|
+
width: previewSize.width,
|
|
1915
|
+
height: previewSize.height,
|
|
1916
|
+
className: "h-full w-full object-contain",
|
|
1917
|
+
"aria-label": "Effect preview canvas"
|
|
1918
|
+
}
|
|
1919
|
+
),
|
|
1920
|
+
previewError && /* @__PURE__ */ (0, import_jsx_runtime7.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 })
|
|
1921
|
+
] }),
|
|
1907
1922
|
state.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.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_runtime7.jsxs)(
|
|
1908
1923
|
"div",
|
|
1909
1924
|
{
|
package/dist/effects/index.js
CHANGED
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
useImageEditor,
|
|
21
21
|
useImageEffectsTools,
|
|
22
22
|
useImageHistogram
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-X2AGIMF3.js";
|
|
24
24
|
import "../chunk-AJCWF6SN.js";
|
|
25
|
-
import "../chunk-
|
|
25
|
+
import "../chunk-BWEARAWR.js";
|
|
26
26
|
import "../chunk-5LFQ2UQZ.js";
|
|
27
27
|
import "../chunk-KIRIU53A.js";
|
|
28
28
|
import "../chunk-3I7FOSLF.js";
|
package/dist/index.cjs
CHANGED
|
@@ -11892,6 +11892,19 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
11892
11892
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
11893
11893
|
}
|
|
11894
11894
|
) }),
|
|
11895
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
|
|
11896
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
|
|
11897
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
11898
|
+
ChartCommitInput,
|
|
11899
|
+
{
|
|
11900
|
+
id: `${idBase}-map-breaks`,
|
|
11901
|
+
value: spec.mapThresholds.join(", "),
|
|
11902
|
+
placeholder: "Equal classes",
|
|
11903
|
+
"data-option": "mapThresholds",
|
|
11904
|
+
className: chartInputClass,
|
|
11905
|
+
onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
|
|
11906
|
+
}
|
|
11907
|
+
) }),
|
|
11895
11908
|
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
11896
11909
|
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
11897
11910
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ChartDataGrid,
|
|
7
7
|
ChartInspector,
|
|
8
8
|
chartButtonClass
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3MUK5ASL.js";
|
|
10
10
|
import {
|
|
11
11
|
FormulaHints,
|
|
12
12
|
NameManager,
|
|
@@ -44,9 +44,9 @@ import {
|
|
|
44
44
|
useImageEditor,
|
|
45
45
|
useImageEffectsTools,
|
|
46
46
|
useImageHistogram
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-X2AGIMF3.js";
|
|
48
48
|
import "./chunk-AJCWF6SN.js";
|
|
49
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-BWEARAWR.js";
|
|
50
50
|
import "./chunk-5LFQ2UQZ.js";
|
|
51
51
|
import "./chunk-KIRIU53A.js";
|
|
52
52
|
import "./chunk-3I7FOSLF.js";
|
package/dist/vector/index.js
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
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
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.1",
|
|
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.
|
|
261
|
+
"@pixerate/editor": ">=0.168.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.
|
|
288
|
+
"@pixerate/editor": "0.168.0"
|
|
289
289
|
},
|
|
290
290
|
"scripts": {
|
|
291
291
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|