@pixerate/editor-react 0.150.0 → 0.151.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.cjs +5 -4
- package/dist/animation-editor/index.js +1 -1
- package/dist/canvas/index.cjs +5 -4
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-6BWTJ3EE.js → chunk-IDUWADYT.js} +6 -5
- package/dist/{chunk-4GVCM2UX.js → chunk-M75ZC7DI.js} +26 -3
- package/dist/effects/EffectThumbnail.d.cts +0 -4
- package/dist/effects/EffectThumbnail.d.ts +0 -4
- package/dist/effects/index.cjs +5 -4
- package/dist/effects/index.js +1 -1
- package/dist/image-editor/ImageProviderEffectsPanel.d.cts +4 -3
- package/dist/image-editor/ImageProviderEffectsPanel.d.ts +4 -3
- package/dist/image-editor/index.cjs +30 -6
- package/dist/image-editor/index.js +2 -2
- package/dist/index.cjs +30 -6
- package/dist/index.js +2 -2
- package/dist/paint-editor/index.cjs +5 -4
- package/dist/paint-editor/index.js +1 -1
- package/dist/vector/index.cjs +5 -4
- package/dist/vector/index.js +1 -1
- package/dist/video-editor/index.cjs +5 -4
- package/dist/video-editor/index.js +1 -1
- package/package.json +3 -3
|
@@ -1170,11 +1170,12 @@ function useEffectDescription(provider, effect) {
|
|
|
1170
1170
|
var import_react13 = require("react");
|
|
1171
1171
|
var import_effects = require("@pixerate/editor/effects");
|
|
1172
1172
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1173
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
1173
1174
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1174
1175
|
const ref = (0, import_react13.useRef)(null);
|
|
1175
|
-
const [failed, setFailed] = (0, import_react13.useState)(effect.kind
|
|
1176
|
+
const [failed, setFailed] = (0, import_react13.useState)(effect.kind in LABELS);
|
|
1176
1177
|
(0, import_react13.useEffect)(() => {
|
|
1177
|
-
if (effect.kind
|
|
1178
|
+
if (effect.kind in LABELS) return;
|
|
1178
1179
|
let live = true;
|
|
1179
1180
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
1180
1181
|
(pixels) => {
|
|
@@ -1194,7 +1195,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1194
1195
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
1195
1196
|
style: { aspectRatio: `${width} / ${height}` },
|
|
1196
1197
|
"data-effect-thumbnail": effect.id,
|
|
1197
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
1198
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
1198
1199
|
}
|
|
1199
1200
|
);
|
|
1200
1201
|
}
|
|
@@ -1229,7 +1230,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1229
1230
|
live = false;
|
|
1230
1231
|
};
|
|
1231
1232
|
}, [provider, query, category, use]);
|
|
1232
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
1233
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
1233
1234
|
const categories = (0, import_react14.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
1234
1235
|
const shown = found.filter(allowed);
|
|
1235
1236
|
if (!provider)
|
package/dist/canvas/index.cjs
CHANGED
|
@@ -1992,11 +1992,12 @@ function useEffectDescription(provider, effect) {
|
|
|
1992
1992
|
var import_react22 = require("react");
|
|
1993
1993
|
var import_effects = require("@pixerate/editor/effects");
|
|
1994
1994
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1995
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
1995
1996
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1996
1997
|
const ref = (0, import_react22.useRef)(null);
|
|
1997
|
-
const [failed, setFailed] = (0, import_react22.useState)(effect.kind
|
|
1998
|
+
const [failed, setFailed] = (0, import_react22.useState)(effect.kind in LABELS);
|
|
1998
1999
|
(0, import_react22.useEffect)(() => {
|
|
1999
|
-
if (effect.kind
|
|
2000
|
+
if (effect.kind in LABELS) return;
|
|
2000
2001
|
let live = true;
|
|
2001
2002
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
2002
2003
|
(pixels) => {
|
|
@@ -2016,7 +2017,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
2016
2017
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
2017
2018
|
style: { aspectRatio: `${width} / ${height}` },
|
|
2018
2019
|
"data-effect-thumbnail": effect.id,
|
|
2019
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
2020
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
2020
2021
|
}
|
|
2021
2022
|
);
|
|
2022
2023
|
}
|
|
@@ -2051,7 +2052,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2051
2052
|
live = false;
|
|
2052
2053
|
};
|
|
2053
2054
|
}, [provider, query, category, use]);
|
|
2054
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
2055
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
2055
2056
|
const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
2056
2057
|
const shown = found.filter(allowed);
|
|
2057
2058
|
if (!provider)
|
package/dist/canvas/index.js
CHANGED
|
@@ -34,11 +34,12 @@ function useEffectDescription(provider, effect) {
|
|
|
34
34
|
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
35
35
|
import { renderEffectThumbnail } from "@pixerate/editor/effects";
|
|
36
36
|
import { jsx } from "react/jsx-runtime";
|
|
37
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
37
38
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
38
39
|
const ref = useRef(null);
|
|
39
|
-
const [failed, setFailed] = useState2(effect.kind
|
|
40
|
+
const [failed, setFailed] = useState2(effect.kind in LABELS);
|
|
40
41
|
useEffect2(() => {
|
|
41
|
-
if (effect.kind
|
|
42
|
+
if (effect.kind in LABELS) return;
|
|
42
43
|
let live = true;
|
|
43
44
|
renderEffectThumbnail(provider, effect, { width, height }).then(
|
|
44
45
|
(pixels) => {
|
|
@@ -58,14 +59,14 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
58
59
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
59
60
|
style: { aspectRatio: `${width} / ${height}` },
|
|
60
61
|
"data-effect-thumbnail": effect.id,
|
|
61
|
-
children: failed ? /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
62
|
+
children: failed ? /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ jsx("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// src/effects/EffectsBrowser.tsx
|
|
67
68
|
import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
|
|
68
|
-
import { EFFECT_USE_LABELS } from "@pixerate/editor/effects";
|
|
69
|
+
import { EFFECT_USE_LABELS, effectOffered } from "@pixerate/editor/effects";
|
|
69
70
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
70
71
|
function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
|
|
71
72
|
const [all, setAll] = useState3([]);
|
|
@@ -93,7 +94,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
93
94
|
live = false;
|
|
94
95
|
};
|
|
95
96
|
}, [provider, query, category, use]);
|
|
96
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
97
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses);
|
|
97
98
|
const categories = useMemo(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
98
99
|
const shown = found.filter(allowed);
|
|
99
100
|
if (!provider)
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
EffectsBrowser,
|
|
7
7
|
useEffectDescription,
|
|
8
8
|
useEffects
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IDUWADYT.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveParameterComponents,
|
|
12
12
|
useParameterComponents
|
|
@@ -2390,6 +2390,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2390
2390
|
const [, setTick] = useState10(0);
|
|
2391
2391
|
useEffect7(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
2392
2392
|
const [browse, setBrowse] = useState10(null);
|
|
2393
|
+
const [clip, setClip] = useState10(false);
|
|
2393
2394
|
const [message, setMessage] = useState10(null);
|
|
2394
2395
|
const [open, setOpen] = useState10(null);
|
|
2395
2396
|
const [scrubbed, setScrubbed] = useState10(null);
|
|
@@ -2529,7 +2530,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2529
2530
|
/* @__PURE__ */ jsx13("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
2530
2531
|
/* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
2531
2532
|
] }),
|
|
2532
|
-
browse === "filter" && layer && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
|
|
2533
|
+
browse === "filter" && layer && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true, preserveTransparency: true }))) }),
|
|
2533
2534
|
filters.length > 0 && layer && /* @__PURE__ */ jsx13("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
2534
2535
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
2535
2536
|
const all = layer.smartFilters.filters;
|
|
@@ -2550,6 +2551,17 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2550
2551
|
/* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
2551
2552
|
/* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
2552
2553
|
] }),
|
|
2554
|
+
/* @__PURE__ */ jsxs12("label", { className: "mt-0.5 flex items-center gap-1 pl-0.5 text-[11px] text-muted-foreground", title: "Draw the filter only over the layer's own pixels; clear it to let the effect fill transparent areas", children: [
|
|
2555
|
+
/* @__PURE__ */ jsx13(
|
|
2556
|
+
ImageCheckbox,
|
|
2557
|
+
{
|
|
2558
|
+
checked: f.preserveTransparency === true,
|
|
2559
|
+
label: `${label}: keep transparency`,
|
|
2560
|
+
onChange: (preserveTransparency) => run(() => controller.updateEffectFilter(layer.id, f.id, { preserveTransparency }))
|
|
2561
|
+
}
|
|
2562
|
+
),
|
|
2563
|
+
"Keep transparency"
|
|
2564
|
+
] }),
|
|
2553
2565
|
open === f.id && /* @__PURE__ */ jsxs12("div", { className: "mt-1 space-y-2", children: [
|
|
2554
2566
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
2555
2567
|
/* @__PURE__ */ jsx13("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
@@ -2581,7 +2593,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2581
2593
|
] })
|
|
2582
2594
|
] }, f.id);
|
|
2583
2595
|
}) }),
|
|
2584
|
-
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties
|
|
2596
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties." }),
|
|
2597
|
+
provider && /* @__PURE__ */ jsxs12("div", { className: "space-y-1", "data-effect-part": "add-layer", children: [
|
|
2598
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
2599
|
+
/* @__PURE__ */ jsx13("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effect layers" }),
|
|
2600
|
+
/* @__PURE__ */ jsx13("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Add effect layer\u2026" })
|
|
2601
|
+
] }),
|
|
2602
|
+
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", title: "Show the new effect layer only over the pixels of the layer below it (a clipping mask)", children: [
|
|
2603
|
+
/* @__PURE__ */ jsx13(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
2604
|
+
"Clip to layer below"
|
|
2605
|
+
] }),
|
|
2606
|
+
browse === "layer" && /* @__PURE__ */ jsx13(EffectsBrowser, { provider, uses: EFFECT_LAYER_USES, title: "Add an effect layer", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id, { clipped: clip }))) })
|
|
2607
|
+
] }),
|
|
2585
2608
|
!layer && /* @__PURE__ */ jsx13("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2586
2609
|
message && /* @__PURE__ */ jsx13("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2587
2610
|
] });
|
|
@@ -8,8 +8,4 @@ export interface EffectThumbnailProps {
|
|
|
8
8
|
height?: number;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* A preview of an effect drawn by the provider's own renderer (filters on a sample picture,
|
|
13
|
-
* transitions half way, generators mid-way through). Motion effects and failures show a label.
|
|
14
|
-
*/
|
|
15
11
|
export declare function EffectThumbnail({ provider, effect, width, height, className }: EffectThumbnailProps): React.JSX.Element;
|
|
@@ -8,8 +8,4 @@ export interface EffectThumbnailProps {
|
|
|
8
8
|
height?: number;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* A preview of an effect drawn by the provider's own renderer (filters on a sample picture,
|
|
13
|
-
* transitions half way, generators mid-way through). Motion effects and failures show a label.
|
|
14
|
-
*/
|
|
15
11
|
export declare function EffectThumbnail({ provider, effect, width, height, className }: EffectThumbnailProps): React.JSX.Element;
|
package/dist/effects/index.cjs
CHANGED
|
@@ -70,11 +70,12 @@ function useEffectDescription(provider, effect) {
|
|
|
70
70
|
var import_react2 = require("react");
|
|
71
71
|
var import_effects = require("@pixerate/editor/effects");
|
|
72
72
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
73
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
73
74
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
74
75
|
const ref = (0, import_react2.useRef)(null);
|
|
75
|
-
const [failed, setFailed] = (0, import_react2.useState)(effect.kind
|
|
76
|
+
const [failed, setFailed] = (0, import_react2.useState)(effect.kind in LABELS);
|
|
76
77
|
(0, import_react2.useEffect)(() => {
|
|
77
|
-
if (effect.kind
|
|
78
|
+
if (effect.kind in LABELS) return;
|
|
78
79
|
let live = true;
|
|
79
80
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
80
81
|
(pixels) => {
|
|
@@ -94,7 +95,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
94
95
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
95
96
|
style: { aspectRatio: `${width} / ${height}` },
|
|
96
97
|
"data-effect-thumbnail": effect.id,
|
|
97
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
98
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
101
|
}
|
|
@@ -129,7 +130,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
129
130
|
live = false;
|
|
130
131
|
};
|
|
131
132
|
}, [provider, query, category, use]);
|
|
132
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
133
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
133
134
|
const categories = (0, import_react3.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
134
135
|
const shown = found.filter(allowed);
|
|
135
136
|
if (!provider)
|
package/dist/effects/index.js
CHANGED
|
@@ -11,8 +11,9 @@ export interface ImageProviderEffectsPanelProps {
|
|
|
11
11
|
* Provider effects for the active layer. An effect layer first: its effect (change it or
|
|
12
12
|
* rasterize it), a still frame or an animation for an effect that moves, and its controls. Then
|
|
13
13
|
* the provider filters applied to the layer (smart filters; applying one converts a pixel layer to
|
|
14
|
-
* a smart object in the same undo step)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* a smart object in the same undo step), each keeping the layer's transparency unless "Keep
|
|
15
|
+
* transparency" is cleared. Then adding an effect layer, above the active layer and optionally
|
|
16
|
+
* clipped to it. Layer styles (drop shadow, stroke…) are not here: they are part of the layer's
|
|
17
|
+
* properties (`LayerEffectsPanel`). Without a provider it says why nothing can be added.
|
|
17
18
|
*/
|
|
18
19
|
export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
|
|
@@ -11,8 +11,9 @@ export interface ImageProviderEffectsPanelProps {
|
|
|
11
11
|
* Provider effects for the active layer. An effect layer first: its effect (change it or
|
|
12
12
|
* rasterize it), a still frame or an animation for an effect that moves, and its controls. Then
|
|
13
13
|
* the provider filters applied to the layer (smart filters; applying one converts a pixel layer to
|
|
14
|
-
* a smart object in the same undo step)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* a smart object in the same undo step), each keeping the layer's transparency unless "Keep
|
|
15
|
+
* transparency" is cleared. Then adding an effect layer, above the active layer and optionally
|
|
16
|
+
* clipped to it. Layer styles (drop shadow, stroke…) are not here: they are part of the layer's
|
|
17
|
+
* properties (`LayerEffectsPanel`). Without a provider it says why nothing can be added.
|
|
17
18
|
*/
|
|
18
19
|
export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
|
|
@@ -2407,11 +2407,12 @@ function useEffectDescription(provider, effect) {
|
|
|
2407
2407
|
var import_react15 = require("react");
|
|
2408
2408
|
var import_effects = require("@pixerate/editor/effects");
|
|
2409
2409
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2410
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
2410
2411
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
2411
2412
|
const ref = (0, import_react15.useRef)(null);
|
|
2412
|
-
const [failed, setFailed] = (0, import_react15.useState)(effect.kind
|
|
2413
|
+
const [failed, setFailed] = (0, import_react15.useState)(effect.kind in LABELS);
|
|
2413
2414
|
(0, import_react15.useEffect)(() => {
|
|
2414
|
-
if (effect.kind
|
|
2415
|
+
if (effect.kind in LABELS) return;
|
|
2415
2416
|
let live = true;
|
|
2416
2417
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
2417
2418
|
(pixels) => {
|
|
@@ -2431,7 +2432,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
2431
2432
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
2432
2433
|
style: { aspectRatio: `${width} / ${height}` },
|
|
2433
2434
|
"data-effect-thumbnail": effect.id,
|
|
2434
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
2435
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
2435
2436
|
}
|
|
2436
2437
|
);
|
|
2437
2438
|
}
|
|
@@ -2466,7 +2467,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2466
2467
|
live = false;
|
|
2467
2468
|
};
|
|
2468
2469
|
}, [provider, query, category, use]);
|
|
2469
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
2470
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
2470
2471
|
const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
2471
2472
|
const shown = found.filter(allowed);
|
|
2472
2473
|
if (!provider)
|
|
@@ -4225,6 +4226,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4225
4226
|
const [, setTick] = (0, import_react23.useState)(0);
|
|
4226
4227
|
(0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4227
4228
|
const [browse, setBrowse] = (0, import_react23.useState)(null);
|
|
4229
|
+
const [clip, setClip] = (0, import_react23.useState)(false);
|
|
4228
4230
|
const [message, setMessage] = (0, import_react23.useState)(null);
|
|
4229
4231
|
const [open, setOpen] = (0, import_react23.useState)(null);
|
|
4230
4232
|
const [scrubbed, setScrubbed] = (0, import_react23.useState)(null);
|
|
@@ -4364,7 +4366,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4364
4366
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
4365
4367
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
4366
4368
|
] }),
|
|
4367
|
-
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
|
|
4369
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true, preserveTransparency: true }))) }),
|
|
4368
4370
|
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
4369
4371
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
4370
4372
|
const all = layer.smartFilters.filters;
|
|
@@ -4385,6 +4387,17 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4385
4387
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
4386
4388
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
4387
4389
|
] }),
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "mt-0.5 flex items-center gap-1 pl-0.5 text-[11px] text-muted-foreground", title: "Draw the filter only over the layer's own pixels; clear it to let the effect fill transparent areas", children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4392
|
+
ImageCheckbox,
|
|
4393
|
+
{
|
|
4394
|
+
checked: f.preserveTransparency === true,
|
|
4395
|
+
label: `${label}: keep transparency`,
|
|
4396
|
+
onChange: (preserveTransparency) => run(() => controller.updateEffectFilter(layer.id, f.id, { preserveTransparency }))
|
|
4397
|
+
}
|
|
4398
|
+
),
|
|
4399
|
+
"Keep transparency"
|
|
4400
|
+
] }),
|
|
4388
4401
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
4389
4402
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4390
4403
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
@@ -4416,7 +4429,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4416
4429
|
] })
|
|
4417
4430
|
] }, f.id);
|
|
4418
4431
|
}) }),
|
|
4419
|
-
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties
|
|
4432
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties." }),
|
|
4433
|
+
provider && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "space-y-1", "data-effect-part": "add-layer", children: [
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4435
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effect layers" }),
|
|
4436
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Add effect layer\u2026" })
|
|
4437
|
+
] }),
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", title: "Show the new effect layer only over the pixels of the layer below it (a clipping mask)", children: [
|
|
4439
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
4440
|
+
"Clip to layer below"
|
|
4441
|
+
] }),
|
|
4442
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Add an effect layer", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id, { clipped: clip }))) })
|
|
4443
|
+
] }),
|
|
4420
4444
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
4421
4445
|
message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4422
4446
|
] });
|
|
@@ -36,9 +36,9 @@ import {
|
|
|
36
36
|
useImageEditorControls,
|
|
37
37
|
useImageEffectsTools,
|
|
38
38
|
useImageHistogram
|
|
39
|
-
} from "../chunk-
|
|
39
|
+
} from "../chunk-M75ZC7DI.js";
|
|
40
40
|
import "../chunk-AJCWF6SN.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-IDUWADYT.js";
|
|
42
42
|
import "../chunk-5RPB4WGT.js";
|
|
43
43
|
import "../chunk-KIRIU53A.js";
|
|
44
44
|
import "../chunk-3I7FOSLF.js";
|
package/dist/index.cjs
CHANGED
|
@@ -6121,11 +6121,12 @@ function useEffectDescription(provider, effect) {
|
|
|
6121
6121
|
var import_react51 = require("react");
|
|
6122
6122
|
var import_effects = require("@pixerate/editor/effects");
|
|
6123
6123
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
6124
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
6124
6125
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
6125
6126
|
const ref = (0, import_react51.useRef)(null);
|
|
6126
|
-
const [failed, setFailed] = (0, import_react51.useState)(effect.kind
|
|
6127
|
+
const [failed, setFailed] = (0, import_react51.useState)(effect.kind in LABELS);
|
|
6127
6128
|
(0, import_react51.useEffect)(() => {
|
|
6128
|
-
if (effect.kind
|
|
6129
|
+
if (effect.kind in LABELS) return;
|
|
6129
6130
|
let live = true;
|
|
6130
6131
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
6131
6132
|
(pixels) => {
|
|
@@ -6145,7 +6146,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
6145
6146
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
6146
6147
|
style: { aspectRatio: `${width} / ${height}` },
|
|
6147
6148
|
"data-effect-thumbnail": effect.id,
|
|
6148
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
6149
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
6149
6150
|
}
|
|
6150
6151
|
);
|
|
6151
6152
|
}
|
|
@@ -6180,7 +6181,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
6180
6181
|
live = false;
|
|
6181
6182
|
};
|
|
6182
6183
|
}, [provider, query, category, use]);
|
|
6183
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
6184
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
6184
6185
|
const categories = (0, import_react52.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
6185
6186
|
const shown = found.filter(allowed);
|
|
6186
6187
|
if (!provider)
|
|
@@ -7939,6 +7940,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7939
7940
|
const [, setTick] = (0, import_react59.useState)(0);
|
|
7940
7941
|
(0, import_react59.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
7941
7942
|
const [browse, setBrowse] = (0, import_react59.useState)(null);
|
|
7943
|
+
const [clip, setClip] = (0, import_react59.useState)(false);
|
|
7942
7944
|
const [message2, setMessage] = (0, import_react59.useState)(null);
|
|
7943
7945
|
const [open, setOpen] = (0, import_react59.useState)(null);
|
|
7944
7946
|
const [scrubbed, setScrubbed] = (0, import_react59.useState)(null);
|
|
@@ -8078,7 +8080,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8078
8080
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
8079
8081
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
8080
8082
|
] }),
|
|
8081
|
-
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true }))) }),
|
|
8083
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id, { useSelection: true, preserveTransparency: true }))) }),
|
|
8082
8084
|
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
8083
8085
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
8084
8086
|
const all = layer.smartFilters.filters;
|
|
@@ -8099,6 +8101,17 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8099
8101
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
8100
8102
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
8101
8103
|
] }),
|
|
8104
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "mt-0.5 flex items-center gap-1 pl-0.5 text-[11px] text-muted-foreground", title: "Draw the filter only over the layer's own pixels; clear it to let the effect fill transparent areas", children: [
|
|
8105
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
8106
|
+
ImageCheckbox,
|
|
8107
|
+
{
|
|
8108
|
+
checked: f.preserveTransparency === true,
|
|
8109
|
+
label: `${label}: keep transparency`,
|
|
8110
|
+
onChange: (preserveTransparency) => run(() => controller.updateEffectFilter(layer.id, f.id, { preserveTransparency }))
|
|
8111
|
+
}
|
|
8112
|
+
),
|
|
8113
|
+
"Keep transparency"
|
|
8114
|
+
] }),
|
|
8102
8115
|
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
8103
8116
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8104
8117
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
@@ -8130,7 +8143,18 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
8130
8143
|
] })
|
|
8131
8144
|
] }, f.id);
|
|
8132
8145
|
}) }),
|
|
8133
|
-
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties
|
|
8146
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No filters yet. A filter changes the layer's pixels and stays editable. Layer styles such as a drop shadow are in the layer's properties." }),
|
|
8147
|
+
provider && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "space-y-1", "data-effect-part": "add-layer", children: [
|
|
8148
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
8149
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effect layers" }),
|
|
8150
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Add effect layer\u2026" })
|
|
8151
|
+
] }),
|
|
8152
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "flex items-center gap-1 text-[11px] text-muted-foreground", title: "Show the new effect layer only over the pixels of the layer below it (a clipping mask)", children: [
|
|
8153
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ImageCheckbox, { checked: clip, label: "Clip to layer below", onChange: setClip }),
|
|
8154
|
+
"Clip to layer below"
|
|
8155
|
+
] }),
|
|
8156
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Add an effect layer", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id, { clipped: clip }))) })
|
|
8157
|
+
] }),
|
|
8134
8158
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
8135
8159
|
message2 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message2 })
|
|
8136
8160
|
] });
|
package/dist/index.js
CHANGED
|
@@ -60,9 +60,9 @@ import {
|
|
|
60
60
|
useImageEditorControls,
|
|
61
61
|
useImageEffectsTools,
|
|
62
62
|
useImageHistogram
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-M75ZC7DI.js";
|
|
64
64
|
import "./chunk-AJCWF6SN.js";
|
|
65
|
-
import "./chunk-
|
|
65
|
+
import "./chunk-IDUWADYT.js";
|
|
66
66
|
import "./chunk-5RPB4WGT.js";
|
|
67
67
|
import "./chunk-KIRIU53A.js";
|
|
68
68
|
import "./chunk-3I7FOSLF.js";
|
|
@@ -1458,11 +1458,12 @@ function useEffectDescription(provider, effect) {
|
|
|
1458
1458
|
var import_react15 = require("react");
|
|
1459
1459
|
var import_effects = require("@pixerate/editor/effects");
|
|
1460
1460
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1461
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
1461
1462
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1462
1463
|
const ref = (0, import_react15.useRef)(null);
|
|
1463
|
-
const [failed, setFailed] = (0, import_react15.useState)(effect.kind
|
|
1464
|
+
const [failed, setFailed] = (0, import_react15.useState)(effect.kind in LABELS);
|
|
1464
1465
|
(0, import_react15.useEffect)(() => {
|
|
1465
|
-
if (effect.kind
|
|
1466
|
+
if (effect.kind in LABELS) return;
|
|
1466
1467
|
let live = true;
|
|
1467
1468
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
1468
1469
|
(pixels) => {
|
|
@@ -1482,7 +1483,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1482
1483
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
1483
1484
|
style: { aspectRatio: `${width} / ${height}` },
|
|
1484
1485
|
"data-effect-thumbnail": effect.id,
|
|
1485
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
1486
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
1486
1487
|
}
|
|
1487
1488
|
);
|
|
1488
1489
|
}
|
|
@@ -1517,7 +1518,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1517
1518
|
live = false;
|
|
1518
1519
|
};
|
|
1519
1520
|
}, [provider, query, category, use]);
|
|
1520
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
1521
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
1521
1522
|
const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
1522
1523
|
const shown = found.filter(allowed);
|
|
1523
1524
|
if (!provider)
|
package/dist/vector/index.cjs
CHANGED
|
@@ -3176,11 +3176,12 @@ function useEffectDescription(provider, effect) {
|
|
|
3176
3176
|
var import_react16 = require("react");
|
|
3177
3177
|
var import_effects = require("@pixerate/editor/effects");
|
|
3178
3178
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3179
|
+
var LABELS = { motion: "Motion", camera: "Camera" };
|
|
3179
3180
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
3180
3181
|
const ref = (0, import_react16.useRef)(null);
|
|
3181
|
-
const [failed, setFailed] = (0, import_react16.useState)(effect.kind
|
|
3182
|
+
const [failed, setFailed] = (0, import_react16.useState)(effect.kind in LABELS);
|
|
3182
3183
|
(0, import_react16.useEffect)(() => {
|
|
3183
|
-
if (effect.kind
|
|
3184
|
+
if (effect.kind in LABELS) return;
|
|
3184
3185
|
let live = true;
|
|
3185
3186
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
3186
3187
|
(pixels) => {
|
|
@@ -3200,7 +3201,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
3200
3201
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
3201
3202
|
style: { aspectRatio: `${width} / ${height}` },
|
|
3202
3203
|
"data-effect-thumbnail": effect.id,
|
|
3203
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
3204
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
3204
3205
|
}
|
|
3205
3206
|
);
|
|
3206
3207
|
}
|
|
@@ -3235,7 +3236,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
3235
3236
|
live = false;
|
|
3236
3237
|
};
|
|
3237
3238
|
}, [provider, query, category, use]);
|
|
3238
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
3239
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
3239
3240
|
const categories = (0, import_react17.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
3240
3241
|
const shown = found.filter(allowed);
|
|
3241
3242
|
if (!provider)
|
package/dist/vector/index.js
CHANGED
|
@@ -1646,11 +1646,12 @@ function useEffectDescription(provider, effect) {
|
|
|
1646
1646
|
var import_react15 = require("react");
|
|
1647
1647
|
var import_effects = require("@pixerate/editor/effects");
|
|
1648
1648
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1649
|
+
var LABELS2 = { motion: "Motion", camera: "Camera" };
|
|
1649
1650
|
function EffectThumbnail({ provider, effect, width = 96, height = 54, className = "" }) {
|
|
1650
1651
|
const ref = (0, import_react15.useRef)(null);
|
|
1651
|
-
const [failed, setFailed] = (0, import_react15.useState)(effect.kind
|
|
1652
|
+
const [failed, setFailed] = (0, import_react15.useState)(effect.kind in LABELS2);
|
|
1652
1653
|
(0, import_react15.useEffect)(() => {
|
|
1653
|
-
if (effect.kind
|
|
1654
|
+
if (effect.kind in LABELS2) return;
|
|
1654
1655
|
let live = true;
|
|
1655
1656
|
(0, import_effects.renderEffectThumbnail)(provider, effect, { width, height }).then(
|
|
1656
1657
|
(pixels) => {
|
|
@@ -1670,7 +1671,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
|
|
|
1670
1671
|
className: `relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] ${className}`,
|
|
1671
1672
|
style: { aspectRatio: `${width} / ${height}` },
|
|
1672
1673
|
"data-effect-thumbnail": effect.id,
|
|
1673
|
-
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: effect.kind
|
|
1674
|
+
children: failed ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground", children: LABELS2[effect.kind] ?? "No preview" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("canvas", { ref, width, height, className: "h-full w-full", "aria-hidden": "true" })
|
|
1674
1675
|
}
|
|
1675
1676
|
);
|
|
1676
1677
|
}
|
|
@@ -1705,7 +1706,7 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
1705
1706
|
live = false;
|
|
1706
1707
|
};
|
|
1707
1708
|
}, [provider, query, category, use]);
|
|
1708
|
-
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (
|
|
1709
|
+
const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
|
|
1709
1710
|
const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
|
|
1710
1711
|
const shown = found.filter(allowed);
|
|
1711
1712
|
if (!provider)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.151.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
"dependencies": {},
|
|
255
255
|
"peerDependencies": {
|
|
256
256
|
"@dagrejs/dagre": "^1.1.8",
|
|
257
|
-
"@pixerate/editor": ">=0.
|
|
257
|
+
"@pixerate/editor": ">=0.226.0 <1.0.0-0",
|
|
258
258
|
"@tiptap/core": "^2.27.3",
|
|
259
259
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
260
260
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"tsup": "^9.0.0",
|
|
306
306
|
"typescript": "^5.7.3",
|
|
307
307
|
"vitest": "^5.0.5",
|
|
308
|
-
"@pixerate/editor": "0.
|
|
308
|
+
"@pixerate/editor": "0.226.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|