@pixerate/editor-react 0.116.0 → 0.118.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/{chunk-ZQ54FEXL.js → chunk-CDKNJK56.js} +10 -20
- package/dist/image-editor/ImageProviderEffectsPanel.d.cts +5 -4
- package/dist/image-editor/ImageProviderEffectsPanel.d.ts +5 -4
- package/dist/image-editor/LayerEffectsPanel.d.cts +2 -2
- package/dist/image-editor/LayerEffectsPanel.d.ts +2 -2
- package/dist/image-editor/index.cjs +9 -19
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +9 -19
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -382,6 +382,7 @@ var ImageEditorCanvas = ({
|
|
|
382
382
|
if (!canvas || !container) return;
|
|
383
383
|
const viewport = measureCanvasViewport(container);
|
|
384
384
|
viewRef.current = { width: viewport.width, height: viewport.height };
|
|
385
|
+
transformTool.setView(getViewportProjection(controller.getState(), viewport.width, viewport.height, mode === "crop").scale);
|
|
385
386
|
await controller.render(canvas, {
|
|
386
387
|
viewportWidth: viewport.width,
|
|
387
388
|
viewportHeight: viewport.height,
|
|
@@ -1533,9 +1534,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1533
1534
|
] }, c.key);
|
|
1534
1535
|
}
|
|
1535
1536
|
};
|
|
1536
|
-
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer
|
|
1537
|
+
return /* @__PURE__ */ jsxs7("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
|
|
1537
1538
|
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1538
|
-
/* @__PURE__ */ jsx7("span", { className: "font-semibold text-foreground", children: heading ? "
|
|
1539
|
+
/* @__PURE__ */ jsx7("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
|
|
1539
1540
|
/* @__PURE__ */ jsxs7("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1540
1541
|
/* @__PURE__ */ jsx7(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
1541
1542
|
"On"
|
|
@@ -1564,9 +1565,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1564
1565
|
heading && /* @__PURE__ */ jsx7(
|
|
1565
1566
|
ImageSelect,
|
|
1566
1567
|
{
|
|
1567
|
-
label: "Add
|
|
1568
|
+
label: "Add style",
|
|
1568
1569
|
value: "",
|
|
1569
|
-
placeholder: "Add
|
|
1570
|
+
placeholder: "Add style\u2026",
|
|
1570
1571
|
disabled: model.readOnly,
|
|
1571
1572
|
options: LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1572
1573
|
onChange: (v) => {
|
|
@@ -2047,7 +2048,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2047
2048
|
|
|
2048
2049
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2049
2050
|
import { useEffect as useEffect7, useRef as useRef6, useState as useState8 } from "react";
|
|
2050
|
-
import { EFFECT_LAYER_USES,
|
|
2051
|
+
import { EFFECT_LAYER_USES, effectLayerTiming, findLayer } from "@pixerate/editor/image-editor";
|
|
2051
2052
|
|
|
2052
2053
|
// src/image-editor/controls/parameterControls.tsx
|
|
2053
2054
|
import { matchParameterOptionValue } from "@pixerate/editor/parameters";
|
|
@@ -2153,19 +2154,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2153
2154
|
};
|
|
2154
2155
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
2155
2156
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
2156
|
-
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2157
|
-
const styles = layerEffectsPanel2(layer);
|
|
2157
|
+
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
2158
2158
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
2159
2159
|
const timing = generator ? effectLayerTiming(generator, description) : null;
|
|
2160
|
-
const addOptions = [
|
|
2161
|
-
...provider && canFilter ? [{ value: "filter", label: "Filter\u2026" }] : [],
|
|
2162
|
-
...styles.available && !styles.readOnly ? LAYER_EFFECT_MENU2.map((m) => ({ value: `style:${m.kind}`, label: m.label })) : []
|
|
2163
|
-
];
|
|
2164
|
-
const add = (value) => {
|
|
2165
|
-
if (!value || !layer) return;
|
|
2166
|
-
if (value === "filter") setBrowse(browse === "filter" ? null : "filter");
|
|
2167
|
-
else run(() => controller.addLayerEffect(layer.id, value.slice("style:".length)));
|
|
2168
|
-
};
|
|
2169
2160
|
const scrub = useRef6({ next: null, busy: false, gesture: null });
|
|
2170
2161
|
const scrubTo = (layerId, time) => {
|
|
2171
2162
|
const s = scrub.current;
|
|
@@ -2276,8 +2267,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2276
2267
|
)
|
|
2277
2268
|
] }),
|
|
2278
2269
|
layer && canFilter && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
|
|
2279
|
-
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children:
|
|
2280
|
-
|
|
2270
|
+
/* @__PURE__ */ jsx11("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
2271
|
+
/* @__PURE__ */ jsx11("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
2281
2272
|
] }),
|
|
2282
2273
|
browse === "filter" && layer && /* @__PURE__ */ jsx11(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
2283
2274
|
filters.length > 0 && layer && /* @__PURE__ */ jsx11("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
@@ -2331,8 +2322,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
2331
2322
|
] })
|
|
2332
2323
|
] }, f.id);
|
|
2333
2324
|
}) }),
|
|
2334
|
-
layer &&
|
|
2335
|
-
layer && canFilter && !generator && filters.length === 0 && styles.rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "No effects yet. Add a filter, or a style such as a drop shadow. New effect layers are added from the layers panel." }),
|
|
2325
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ jsx11("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; new effect layers are added from the layers panel." }),
|
|
2336
2326
|
!layer && /* @__PURE__ */ jsx11("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
2337
2327
|
message && /* @__PURE__ */ jsx11("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
2338
2328
|
] });
|
|
@@ -8,10 +8,11 @@ export interface ImageProviderEffectsPanelProps {
|
|
|
8
8
|
components?: ParameterComponents;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
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
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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). Layer styles (drop shadow, stroke…) are not here: they
|
|
15
|
+
* are part of the layer's properties (`LayerEffectsPanel`). New effect layers come from the layers
|
|
16
|
+
* panel. Without a provider it says why nothing can be added.
|
|
16
17
|
*/
|
|
17
18
|
export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
|
|
@@ -8,10 +8,11 @@ export interface ImageProviderEffectsPanelProps {
|
|
|
8
8
|
components?: ParameterComponents;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
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
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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). Layer styles (drop shadow, stroke…) are not here: they
|
|
15
|
+
* are part of the layer's properties (`LayerEffectsPanel`). New effect layers come from the layers
|
|
16
|
+
* panel. Without a provider it says why nothing can be added.
|
|
16
17
|
*/
|
|
17
18
|
export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
|
|
@@ -5,14 +5,14 @@ export interface LayerEffectsPanelProps {
|
|
|
5
5
|
/** The layer whose effects to show (default: the active layer). */
|
|
6
6
|
layerId?: string | null;
|
|
7
7
|
/**
|
|
8
|
-
* Show the "
|
|
8
|
+
* Show the "Layer Style" title and the "Add style" menu (default true). Without them (inside a
|
|
9
9
|
* panel that adds styles from its own menu) the master switch and Scale stay.
|
|
10
10
|
*/
|
|
11
11
|
heading?: boolean;
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* A layer's effects (Photoshop's layer styles): the master switch, Scale Effects, an "Add
|
|
15
|
+
* A layer's effects (Photoshop's layer styles): the master switch, Scale Effects, an "Add style"
|
|
16
16
|
* menu, and each effect with its enabled toggle, remove button and, when expanded, its settings.
|
|
17
17
|
* Every change is one undo step (a slider drag is one step too).
|
|
18
18
|
*/
|
|
@@ -5,14 +5,14 @@ export interface LayerEffectsPanelProps {
|
|
|
5
5
|
/** The layer whose effects to show (default: the active layer). */
|
|
6
6
|
layerId?: string | null;
|
|
7
7
|
/**
|
|
8
|
-
* Show the "
|
|
8
|
+
* Show the "Layer Style" title and the "Add style" menu (default true). Without them (inside a
|
|
9
9
|
* panel that adds styles from its own menu) the master switch and Scale stay.
|
|
10
10
|
*/
|
|
11
11
|
heading?: boolean;
|
|
12
12
|
className?: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* A layer's effects (Photoshop's layer styles): the master switch, Scale Effects, an "Add
|
|
15
|
+
* A layer's effects (Photoshop's layer styles): the master switch, Scale Effects, an "Add style"
|
|
16
16
|
* menu, and each effect with its enabled toggle, remove button and, when expanded, its settings.
|
|
17
17
|
* Every change is one undo step (a slider drag is one step too).
|
|
18
18
|
*/
|
|
@@ -486,6 +486,7 @@ var ImageEditorCanvas = ({
|
|
|
486
486
|
if (!canvas || !container) return;
|
|
487
487
|
const viewport = (0, import_image_editor2.measureCanvasViewport)(container);
|
|
488
488
|
viewRef.current = { width: viewport.width, height: viewport.height };
|
|
489
|
+
transformTool.setView((0, import_image_editor2.getViewportProjection)(controller.getState(), viewport.width, viewport.height, mode === "crop").scale);
|
|
489
490
|
await controller.render(canvas, {
|
|
490
491
|
viewportWidth: viewport.width,
|
|
491
492
|
viewportHeight: viewport.height,
|
|
@@ -1618,9 +1619,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1618
1619
|
] }, c.key);
|
|
1619
1620
|
}
|
|
1620
1621
|
};
|
|
1621
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer
|
|
1622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
|
|
1622
1623
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1623
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
|
|
1624
1625
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
1625
1626
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
1626
1627
|
"On"
|
|
@@ -1649,9 +1650,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
1649
1650
|
heading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1650
1651
|
ImageSelect,
|
|
1651
1652
|
{
|
|
1652
|
-
label: "Add
|
|
1653
|
+
label: "Add style",
|
|
1653
1654
|
value: "",
|
|
1654
|
-
placeholder: "Add
|
|
1655
|
+
placeholder: "Add style\u2026",
|
|
1655
1656
|
disabled: model.readOnly,
|
|
1656
1657
|
options: import_image_editor7.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
1657
1658
|
onChange: (v) => {
|
|
@@ -3989,19 +3990,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
3989
3990
|
};
|
|
3990
3991
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
3991
3992
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
3992
|
-
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3993
|
-
const styles = (0, import_image_editor9.layerEffectsPanel)(layer);
|
|
3993
|
+
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3994
3994
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
3995
3995
|
const timing = generator ? (0, import_image_editor9.effectLayerTiming)(generator, description) : null;
|
|
3996
|
-
const addOptions = [
|
|
3997
|
-
...provider && canFilter ? [{ value: "filter", label: "Filter\u2026" }] : [],
|
|
3998
|
-
...styles.available && !styles.readOnly ? import_image_editor9.LAYER_EFFECT_MENU.map((m) => ({ value: `style:${m.kind}`, label: m.label })) : []
|
|
3999
|
-
];
|
|
4000
|
-
const add = (value) => {
|
|
4001
|
-
if (!value || !layer) return;
|
|
4002
|
-
if (value === "filter") setBrowse(browse === "filter" ? null : "filter");
|
|
4003
|
-
else run(() => controller.addLayerEffect(layer.id, value.slice("style:".length)));
|
|
4004
|
-
};
|
|
4005
3996
|
const scrub = (0, import_react21.useRef)({ next: null, busy: false, gesture: null });
|
|
4006
3997
|
const scrubTo = (layerId, time) => {
|
|
4007
3998
|
const s = scrub.current;
|
|
@@ -4112,8 +4103,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4112
4103
|
)
|
|
4113
4104
|
] }),
|
|
4114
4105
|
layer && canFilter && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
|
|
4115
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children:
|
|
4116
|
-
|
|
4106
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
4107
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
4117
4108
|
] }),
|
|
4118
4109
|
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
4119
4110
|
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
@@ -4167,8 +4158,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
4167
4158
|
] })
|
|
4168
4159
|
] }, f.id);
|
|
4169
4160
|
}) }),
|
|
4170
|
-
layer &&
|
|
4171
|
-
layer && canFilter && !generator && filters.length === 0 && styles.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects yet. Add a filter, or a style such as a drop shadow. New effect layers are added from the layers panel." }),
|
|
4161
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.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; new effect layers are added from the layers panel." }),
|
|
4172
4162
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
4173
4163
|
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
4174
4164
|
] });
|
package/dist/index.cjs
CHANGED
|
@@ -4200,6 +4200,7 @@ var ImageEditorCanvas = ({
|
|
|
4200
4200
|
if (!canvas || !container) return;
|
|
4201
4201
|
const viewport = (0, import_image_editor2.measureCanvasViewport)(container);
|
|
4202
4202
|
viewRef.current = { width: viewport.width, height: viewport.height };
|
|
4203
|
+
transformTool.setView((0, import_image_editor2.getViewportProjection)(controller.getState(), viewport.width, viewport.height, mode === "crop").scale);
|
|
4203
4204
|
await controller.render(canvas, {
|
|
4204
4205
|
viewportWidth: viewport.width,
|
|
4205
4206
|
viewportHeight: viewport.height,
|
|
@@ -5332,9 +5333,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5332
5333
|
] }, c.key);
|
|
5333
5334
|
}
|
|
5334
5335
|
};
|
|
5335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer
|
|
5336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-foreground ${className ?? ""}`, "data-testid": "layer-effects", "aria-label": "Layer style", role: "group", children: [
|
|
5336
5337
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5337
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "Layer Style" : "Styles" }),
|
|
5338
5339
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
5339
5340
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
5340
5341
|
"On"
|
|
@@ -5363,9 +5364,9 @@ var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) =>
|
|
|
5363
5364
|
heading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5364
5365
|
ImageSelect,
|
|
5365
5366
|
{
|
|
5366
|
-
label: "Add
|
|
5367
|
+
label: "Add style",
|
|
5367
5368
|
value: "",
|
|
5368
|
-
placeholder: "Add
|
|
5369
|
+
placeholder: "Add style\u2026",
|
|
5369
5370
|
disabled: model.readOnly,
|
|
5370
5371
|
options: import_image_editor7.LAYER_EFFECT_MENU.map((m) => ({ value: m.kind, label: m.label })),
|
|
5371
5372
|
onChange: (v) => {
|
|
@@ -7703,19 +7704,9 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7703
7704
|
};
|
|
7704
7705
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
7705
7706
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
7706
|
-
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
7707
|
-
const styles = (0, import_image_editor9.layerEffectsPanel)(layer);
|
|
7707
|
+
const canFilter = !!provider && !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
7708
7708
|
const { description } = useEffectDescription(provider, generator?.effect);
|
|
7709
7709
|
const timing = generator ? (0, import_image_editor9.effectLayerTiming)(generator, description) : null;
|
|
7710
|
-
const addOptions = [
|
|
7711
|
-
...provider && canFilter ? [{ value: "filter", label: "Filter\u2026" }] : [],
|
|
7712
|
-
...styles.available && !styles.readOnly ? import_image_editor9.LAYER_EFFECT_MENU.map((m) => ({ value: `style:${m.kind}`, label: m.label })) : []
|
|
7713
|
-
];
|
|
7714
|
-
const add = (value) => {
|
|
7715
|
-
if (!value || !layer) return;
|
|
7716
|
-
if (value === "filter") setBrowse(browse === "filter" ? null : "filter");
|
|
7717
|
-
else run(() => controller.addLayerEffect(layer.id, value.slice("style:".length)));
|
|
7718
|
-
};
|
|
7719
7710
|
const scrub = (0, import_react57.useRef)({ next: null, busy: false, gesture: null });
|
|
7720
7711
|
const scrubTo = (layerId, time) => {
|
|
7721
7712
|
const s = scrub.current;
|
|
@@ -7826,8 +7817,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7826
7817
|
)
|
|
7827
7818
|
] }),
|
|
7828
7819
|
layer && canFilter && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", "data-effect-part": "applied", children: [
|
|
7829
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children:
|
|
7830
|
-
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Filters" }),
|
|
7821
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Add filter\u2026" })
|
|
7831
7822
|
] }),
|
|
7832
7823
|
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
7833
7824
|
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", "aria-label": "Filters", children: filters.map((f) => {
|
|
@@ -7881,8 +7872,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7881
7872
|
] })
|
|
7882
7873
|
] }, f.id);
|
|
7883
7874
|
}) }),
|
|
7884
|
-
layer &&
|
|
7885
|
-
layer && canFilter && !generator && filters.length === 0 && styles.rows.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects yet. Add a filter, or a style such as a drop shadow. New effect layers are added from the layers panel." }),
|
|
7875
|
+
layer && canFilter && !generator && filters.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime36.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; new effect layers are added from the layers panel." }),
|
|
7886
7876
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
7887
7877
|
message2 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message2 })
|
|
7888
7878
|
] });
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.118.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.179.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.179.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|