@pixerate/editor-react 0.198.1 → 0.200.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.
@@ -1108,7 +1108,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
1108
1108
  var import_react13 = require("react");
1109
1109
  var import_effects2 = require("@pixerate/editor/effects");
1110
1110
  var import_jsx_runtime13 = require("react/jsx-runtime");
1111
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
1111
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
1112
1112
  const [all, setAll] = (0, import_react13.useState)([]);
1113
1113
  const [query, setQuery] = (0, import_react13.useState)("");
1114
1114
  const [category, setCategory] = (0, import_react13.useState)("");
@@ -1134,8 +1134,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
1134
1134
  live = false;
1135
1135
  };
1136
1136
  }, [provider, query, category, use]);
1137
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
1138
- const categories = (0, import_react13.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
1137
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
1138
+ const categories = (0, import_react13.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
1139
1139
  const shown = found.filter(allowed);
1140
1140
  if (!provider)
1141
1141
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -4,7 +4,7 @@ import {
4
4
  EffectsBrowser,
5
5
  useEffectDescription,
6
6
  useEffects
7
- } from "../chunk-W6UZ7PVT.js";
7
+ } from "../chunk-WTW6HRFI.js";
8
8
  import "../chunk-5RPB4WGT.js";
9
9
  import "../chunk-KIRIU53A.js";
10
10
  import "../chunk-3I7FOSLF.js";
@@ -2069,7 +2069,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2069
2069
  var import_react23 = require("react");
2070
2070
  var import_effects2 = require("@pixerate/editor/effects");
2071
2071
  var import_jsx_runtime8 = require("react/jsx-runtime");
2072
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2072
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
2073
2073
  const [all, setAll] = (0, import_react23.useState)([]);
2074
2074
  const [query, setQuery] = (0, import_react23.useState)("");
2075
2075
  const [category, setCategory] = (0, import_react23.useState)("");
@@ -2095,8 +2095,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2095
2095
  live = false;
2096
2096
  };
2097
2097
  }, [provider, query, category, use]);
2098
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2099
- const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2098
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
2099
+ const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
2100
2100
  const shown = found.filter(allowed);
2101
2101
  if (!provider)
2102
2102
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -2,7 +2,7 @@ import {
2
2
  EffectParameters,
3
3
  EffectsBrowser,
4
4
  useEffectDescription
5
- } from "../chunk-W6UZ7PVT.js";
5
+ } from "../chunk-WTW6HRFI.js";
6
6
  import "../chunk-5RPB4WGT.js";
7
7
  import "../chunk-KIRIU53A.js";
8
8
  import "../chunk-3I7FOSLF.js";
@@ -31,7 +31,7 @@ import {
31
31
  EffectsBrowser,
32
32
  useEffectDescription,
33
33
  useEffects
34
- } from "./chunk-W6UZ7PVT.js";
34
+ } from "./chunk-WTW6HRFI.js";
35
35
  import {
36
36
  resolveParameterComponents,
37
37
  useParameterComponents
@@ -68,7 +68,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
68
68
  import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
69
69
  import { EFFECT_USE_LABELS, effectOffered } from "@pixerate/editor/effects";
70
70
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
71
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
71
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
72
72
  const [all, setAll] = useState3([]);
73
73
  const [query, setQuery] = useState3("");
74
74
  const [category, setCategory] = useState3("");
@@ -94,8 +94,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
94
94
  live = false;
95
95
  };
96
96
  }, [provider, query, category, use]);
97
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses);
98
- const categories = useMemo(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
97
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses) && (!filter || filter(e));
98
+ const categories = useMemo(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
99
99
  const shown = found.filter(allowed);
100
100
  if (!provider)
101
101
  return /* @__PURE__ */ jsx2("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -7,6 +7,8 @@ export interface EffectsBrowserProps {
7
7
  uses?: readonly EffectUse[];
8
8
  /** Only effects of these kinds (default: any). */
9
9
  kinds?: readonly EffectKind[];
10
+ /** Only effects this also keeps (e.g. `paintEffectOffered` for the paint editor's paint, which honours provider paint hints). */
11
+ filter?: (effect: EffectSummary) => boolean;
10
12
  /** Called with the effect the user picks. */
11
13
  onPick: (effect: EffectSummary) => void;
12
14
  /** Draw previews with the provider's renderer (default true). */
@@ -19,4 +21,4 @@ export interface EffectsBrowserProps {
19
21
  * Browses a provider's effects: a search box, a category filter (and a use filter when more than
20
22
  * one use is allowed), and a grid of effects with previews. Picking one calls `onPick`.
21
23
  */
22
- export declare function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails, title, className }: EffectsBrowserProps): React.JSX.Element;
24
+ export declare function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails, title, className }: EffectsBrowserProps): React.JSX.Element;
@@ -7,6 +7,8 @@ export interface EffectsBrowserProps {
7
7
  uses?: readonly EffectUse[];
8
8
  /** Only effects of these kinds (default: any). */
9
9
  kinds?: readonly EffectKind[];
10
+ /** Only effects this also keeps (e.g. `paintEffectOffered` for the paint editor's paint, which honours provider paint hints). */
11
+ filter?: (effect: EffectSummary) => boolean;
10
12
  /** Called with the effect the user picks. */
11
13
  onPick: (effect: EffectSummary) => void;
12
14
  /** Draw previews with the provider's renderer (default true). */
@@ -19,4 +21,4 @@ export interface EffectsBrowserProps {
19
21
  * Browses a provider's effects: a search box, a category filter (and a use filter when more than
20
22
  * one use is allowed), and a grid of effects with previews. Picking one calls `onPick`.
21
23
  */
22
- export declare function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails, title, className }: EffectsBrowserProps): React.JSX.Element;
24
+ export declare function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails, title, className }: EffectsBrowserProps): React.JSX.Element;
@@ -105,7 +105,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
105
105
  var import_react3 = require("react");
106
106
  var import_effects2 = require("@pixerate/editor/effects");
107
107
  var import_jsx_runtime2 = require("react/jsx-runtime");
108
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
108
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
109
109
  const [all, setAll] = (0, import_react3.useState)([]);
110
110
  const [query, setQuery] = (0, import_react3.useState)("");
111
111
  const [category, setCategory] = (0, import_react3.useState)("");
@@ -131,8 +131,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
131
131
  live = false;
132
132
  };
133
133
  }, [provider, query, category, use]);
134
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
135
- const categories = (0, import_react3.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
134
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
135
+ const categories = (0, import_react3.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
136
136
  const shown = found.filter(allowed);
137
137
  if (!provider)
138
138
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -7,7 +7,7 @@ import {
7
7
  useEffectAuthoring,
8
8
  useEffectDescription,
9
9
  useEffects
10
- } from "../chunk-W6UZ7PVT.js";
10
+ } from "../chunk-WTW6HRFI.js";
11
11
  import "../chunk-5RPB4WGT.js";
12
12
  import "../chunk-KIRIU53A.js";
13
13
  import "../chunk-3I7FOSLF.js";
@@ -2449,7 +2449,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2449
2449
  var import_react16 = require("react");
2450
2450
  var import_effects2 = require("@pixerate/editor/effects");
2451
2451
  var import_jsx_runtime14 = require("react/jsx-runtime");
2452
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2452
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
2453
2453
  const [all, setAll] = (0, import_react16.useState)([]);
2454
2454
  const [query, setQuery] = (0, import_react16.useState)("");
2455
2455
  const [category, setCategory] = (0, import_react16.useState)("");
@@ -2475,8 +2475,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2475
2475
  live = false;
2476
2476
  };
2477
2477
  }, [provider, query, category, use]);
2478
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2479
- const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2478
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
2479
+ const categories = (0, import_react16.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
2480
2480
  const shown = found.filter(allowed);
2481
2481
  if (!provider)
2482
2482
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -29,7 +29,7 @@ import {
29
29
  useImageEditor,
30
30
  useImageEffectsTools,
31
31
  useImageHistogram
32
- } from "../chunk-BICTULEJ.js";
32
+ } from "../chunk-JYWF6IGM.js";
33
33
  import {
34
34
  ImageCheckbox,
35
35
  ImageColor,
@@ -39,7 +39,7 @@ import {
39
39
  LayerEffectsPanel,
40
40
  useImageEditorControls
41
41
  } from "../chunk-EP6C5N54.js";
42
- import "../chunk-W6UZ7PVT.js";
42
+ import "../chunk-WTW6HRFI.js";
43
43
  import "../chunk-5RPB4WGT.js";
44
44
  import "../chunk-KIRIU53A.js";
45
45
  import "../chunk-3I7FOSLF.js";
package/dist/index.cjs CHANGED
@@ -6006,7 +6006,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
6006
6006
  var import_react52 = require("react");
6007
6007
  var import_effects2 = require("@pixerate/editor/effects");
6008
6008
  var import_jsx_runtime31 = require("react/jsx-runtime");
6009
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
6009
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
6010
6010
  const [all, setAll] = (0, import_react52.useState)([]);
6011
6011
  const [query, setQuery] = (0, import_react52.useState)("");
6012
6012
  const [category, setCategory] = (0, import_react52.useState)("");
@@ -6032,8 +6032,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
6032
6032
  live = false;
6033
6033
  };
6034
6034
  }, [provider, query, category, use]);
6035
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
6036
- const categories = (0, import_react52.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
6035
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
6036
+ const categories = (0, import_react52.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
6037
6037
  const shown = found.filter(allowed);
6038
6038
  if (!provider)
6039
6039
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  useImageEditor,
63
63
  useImageEffectsTools,
64
64
  useImageHistogram
65
- } from "./chunk-BICTULEJ.js";
65
+ } from "./chunk-JYWF6IGM.js";
66
66
  import {
67
67
  ImageCheckbox,
68
68
  ImageColor,
@@ -72,7 +72,7 @@ import {
72
72
  LayerEffectsPanel,
73
73
  useImageEditorControls
74
74
  } from "./chunk-EP6C5N54.js";
75
- import "./chunk-W6UZ7PVT.js";
75
+ import "./chunk-WTW6HRFI.js";
76
76
  import "./chunk-5RPB4WGT.js";
77
77
  import "./chunk-KIRIU53A.js";
78
78
  import "./chunk-3I7FOSLF.js";
@@ -6,9 +6,16 @@ export interface PaintEffectsPanelProps {
6
6
  controller: PaintEditorController;
7
7
  className?: string;
8
8
  }
9
- /** The controller's effects provider, following `setEffectsProvider`. */
9
+ /**
10
+ * The effects the panel offers: the controller's provider with the painting's authored effects
11
+ * (`controller.effectsCatalog`), following `setEffectsProvider` and saved or removed authored effects.
12
+ */
10
13
  export declare function usePaintEffectsProvider(controller: PaintEditorController): EffectProvider | null;
11
- /** Registers the paint effect tools (`set_paper_effect`, `add_effect_layer`, `apply_effect`, …) while mounted. */
14
+ /**
15
+ * Registers the paint effect tools (`set_paper_effect`, `add_effect_layer`, `apply_effect`, …) and
16
+ * the effect authoring tools (`open_effect_authoring`, `save_authored_effect`, the
17
+ * `effect_authoring_*` tools, …) while mounted.
18
+ */
12
19
  export declare function usePaintEffectsTools(registry: ToolRegistry | null | undefined, controller: PaintEditorController, options?: PaintEffectsToolProviderOptions): void;
13
20
  /**
14
21
  * Provider effects in the paint editor: effect paper (a generator over the sheet, multiplied so
@@ -6,9 +6,16 @@ export interface PaintEffectsPanelProps {
6
6
  controller: PaintEditorController;
7
7
  className?: string;
8
8
  }
9
- /** The controller's effects provider, following `setEffectsProvider`. */
9
+ /**
10
+ * The effects the panel offers: the controller's provider with the painting's authored effects
11
+ * (`controller.effectsCatalog`), following `setEffectsProvider` and saved or removed authored effects.
12
+ */
10
13
  export declare function usePaintEffectsProvider(controller: PaintEditorController): EffectProvider | null;
11
- /** Registers the paint effect tools (`set_paper_effect`, `add_effect_layer`, `apply_effect`, …) while mounted. */
14
+ /**
15
+ * Registers the paint effect tools (`set_paper_effect`, `add_effect_layer`, `apply_effect`, …) and
16
+ * the effect authoring tools (`open_effect_authoring`, `save_authored_effect`, the
17
+ * `effect_authoring_*` tools, …) while mounted.
18
+ */
12
19
  export declare function usePaintEffectsTools(registry: ToolRegistry | null | undefined, controller: PaintEditorController, options?: PaintEffectsToolProviderOptions): void;
13
20
  /**
14
21
  * Provider effects in the paint editor: effect paper (a generator over the sheet, multiplied so
@@ -2759,7 +2759,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
2759
2759
  var import_react24 = require("react");
2760
2760
  var import_effects2 = require("@pixerate/editor/effects");
2761
2761
  var import_jsx_runtime27 = require("react/jsx-runtime");
2762
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
2762
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
2763
2763
  const [all, setAll] = (0, import_react24.useState)([]);
2764
2764
  const [query, setQuery] = (0, import_react24.useState)("");
2765
2765
  const [category, setCategory] = (0, import_react24.useState)("");
@@ -2785,8 +2785,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
2785
2785
  live = false;
2786
2786
  };
2787
2787
  }, [provider, query, category, use]);
2788
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
2789
- const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
2788
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
2789
+ const categories = (0, import_react24.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
2790
2790
  const shown = found.filter(allowed);
2791
2791
  if (!provider)
2792
2792
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -4466,10 +4466,16 @@ function EffectParameters({
4466
4466
  // src/paint-editor/PaintEffectsPanel.tsx
4467
4467
  var import_jsx_runtime33 = require("react/jsx-runtime");
4468
4468
  function usePaintEffectsProvider(controller) {
4469
- const [provider, setProvider] = (0, import_react31.useState)(controller.effectsProvider);
4469
+ const [provider, setProvider] = (0, import_react31.useState)(controller.effectsCatalog);
4470
4470
  (0, import_react31.useEffect)(() => {
4471
- setProvider(controller.effectsProvider);
4472
- return controller.effects.subscribe(setProvider);
4471
+ const sync = () => setProvider(controller.effectsCatalog);
4472
+ sync();
4473
+ const a = controller.effects.subscribe(sync);
4474
+ const b = controller.subscribe(sync);
4475
+ return () => {
4476
+ a();
4477
+ b();
4478
+ };
4473
4479
  }, [controller]);
4474
4480
  return provider;
4475
4481
  }
@@ -4477,7 +4483,12 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4477
4483
  const { id, namespace, readOnly, playbackSurface } = options;
4478
4484
  (0, import_react31.useEffect)(() => {
4479
4485
  if (!registry) return;
4480
- return registry.register((0, import_paint_editor18.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4486
+ const a = registry.register((0, import_paint_editor18.createPaintEffectsToolProvider)(controller, { id, namespace, readOnly, playbackSurface }));
4487
+ const b = registry.register((0, import_paint_editor18.createPaintEffectAuthoringToolProvider)(controller, { id: id ? `${id}-authoring` : void 0, namespace: namespace === void 0 ? void 0 : namespace && `${namespace}-authoring`, readOnly, playbackSurface }));
4488
+ return () => {
4489
+ a();
4490
+ b();
4491
+ };
4481
4492
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
4482
4493
  }
4483
4494
  function Controls({ provider, effect, name, values, apply }) {
@@ -4530,7 +4541,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
4530
4541
  const playback = state.effectPlayback;
4531
4542
  const repaint = (patch) => {
4532
4543
  if (!effectPaint) return;
4533
- run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
4544
+ run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map ?? { by: "canvas" }, live: effectPaint.live ?? false, ...patch }));
4534
4545
  };
4535
4546
  const thumbnail = (0, import_react31.useMemo)(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
4536
4547
  const run = (work) => attempt(() => {
@@ -4547,6 +4558,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
4547
4558
  else if (kind === "paint") run(() => controller.setEffectPaint({ effect: id }));
4548
4559
  };
4549
4560
  const toggle = (b) => setBrowse(browse === b ? null : b);
4561
+ const offered = (0, import_react31.useMemo)(() => browse ? (e) => (0, import_paint_editor18.paintEffectOffered)(e, browse, provider?.capabilities) : void 0, [browse, provider]);
4550
4562
  const pixel = active?.type === "pixel";
4551
4563
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
4552
4564
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
@@ -4558,7 +4570,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
4558
4570
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
4559
4571
  ] }),
4560
4572
  !provider && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
4561
- browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4573
+ browse && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, filter: offered, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
4562
4574
  paper && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
4563
4575
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1", children: [
4564
4576
  /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex-1 truncate", children: [
@@ -9,7 +9,7 @@ import {
9
9
  EffectParameters,
10
10
  EffectsBrowser,
11
11
  useEffectDescription
12
- } from "../chunk-W6UZ7PVT.js";
12
+ } from "../chunk-WTW6HRFI.js";
13
13
  import "../chunk-5RPB4WGT.js";
14
14
  import "../chunk-KIRIU53A.js";
15
15
  import "../chunk-3I7FOSLF.js";
@@ -1913,14 +1913,20 @@ import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2,
1913
1913
 
1914
1914
  // src/paint-editor/PaintEffectsPanel.tsx
1915
1915
  import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState10 } from "react";
1916
- import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1916
+ import { createPaintEffectAuthoringToolProvider, createPaintEffectsToolProvider, paintEffectOffered, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1917
1917
  import { pathControlsOf } from "@pixerate/editor/effects";
1918
1918
  import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1919
1919
  function usePaintEffectsProvider(controller) {
1920
- const [provider, setProvider] = useState10(controller.effectsProvider);
1920
+ const [provider, setProvider] = useState10(controller.effectsCatalog);
1921
1921
  useEffect5(() => {
1922
- setProvider(controller.effectsProvider);
1923
- return controller.effects.subscribe(setProvider);
1922
+ const sync = () => setProvider(controller.effectsCatalog);
1923
+ sync();
1924
+ const a = controller.effects.subscribe(sync);
1925
+ const b = controller.subscribe(sync);
1926
+ return () => {
1927
+ a();
1928
+ b();
1929
+ };
1924
1930
  }, [controller]);
1925
1931
  return provider;
1926
1932
  }
@@ -1928,7 +1934,12 @@ function usePaintEffectsTools(registry, controller, options = {}) {
1928
1934
  const { id, namespace, readOnly, playbackSurface } = options;
1929
1935
  useEffect5(() => {
1930
1936
  if (!registry) return;
1931
- return registry.register(createPaintEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
1937
+ const a = registry.register(createPaintEffectsToolProvider(controller, { id, namespace, readOnly, playbackSurface }));
1938
+ const b = registry.register(createPaintEffectAuthoringToolProvider(controller, { id: id ? `${id}-authoring` : void 0, namespace: namespace === void 0 ? void 0 : namespace && `${namespace}-authoring`, readOnly, playbackSurface }));
1939
+ return () => {
1940
+ a();
1941
+ b();
1942
+ };
1932
1943
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
1933
1944
  }
1934
1945
  function Controls({ provider, effect, name, values, apply }) {
@@ -1981,7 +1992,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
1981
1992
  const playback = state.effectPlayback;
1982
1993
  const repaint = (patch) => {
1983
1994
  if (!effectPaint) return;
1984
- run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map, live: effectPaint.live, ...patch }));
1995
+ run(() => controller.setEffectPaint({ effect: effectPaint.effect, values: effectPaint.values, time: effectPaint.time, map: effectPaint.map ?? { by: "canvas" }, live: effectPaint.live ?? false, ...patch }));
1985
1996
  };
1986
1997
  const thumbnail = useMemo7(() => effectPaint && !state.effectPaintRendering ? controller.effectPaintThumbnail(48) : null, [controller, effectPaint, state.effectPaintRendering]);
1987
1998
  const run = (work) => attempt(() => {
@@ -1998,6 +2009,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
1998
2009
  else if (kind === "paint") run(() => controller.setEffectPaint({ effect: id }));
1999
2010
  };
2000
2011
  const toggle = (b) => setBrowse(browse === b ? null : b);
2012
+ const offered = useMemo7(() => browse ? (e) => paintEffectOffered(e, browse, provider?.capabilities) : void 0, [browse, provider]);
2001
2013
  const pixel = active?.type === "pixel";
2002
2014
  return /* @__PURE__ */ jsxs16("div", { className: `${panel} ${className ?? ""}`, "data-testid": "paint-effects-panel", "aria-busy": busy, children: [
2003
2015
  /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-1", children: [
@@ -2009,7 +2021,7 @@ var PaintEffectsPanel = ({ controller, className }) => {
2009
2021
  /* @__PURE__ */ jsx17("button", { type: "button", className: button, disabled: !provider, "aria-pressed": browse === "paint", onClick: () => toggle("paint"), title: "Paint with an effect: brushes take each pixel's colour from it", children: "Paint\u2026" })
2010
2022
  ] }),
2011
2023
  !provider && /* @__PURE__ */ jsx17("p", { className: "text-[11px] text-slate-400", children: "No effects provider is registered. Effects in the painting are kept." }),
2012
- browse && /* @__PURE__ */ jsx17(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
2024
+ browse && /* @__PURE__ */ jsx17(EffectsBrowser, { provider, uses: BROWSERS[browse].uses, filter: offered, title: BROWSERS[browse].title, onPick: (e) => pick(e.id) }),
2013
2025
  paper && /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1 rounded border border-slate-700 p-1", "data-effect-part": "paper", children: [
2014
2026
  /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
2015
2027
  /* @__PURE__ */ jsxs16("span", { className: "flex-1 truncate", children: [
@@ -3622,7 +3622,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
3622
3622
  var import_react23 = require("react");
3623
3623
  var import_effects2 = require("@pixerate/editor/effects");
3624
3624
  var import_jsx_runtime27 = require("react/jsx-runtime");
3625
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
3625
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
3626
3626
  const [all, setAll] = (0, import_react23.useState)([]);
3627
3627
  const [query, setQuery] = (0, import_react23.useState)("");
3628
3628
  const [category, setCategory] = (0, import_react23.useState)("");
@@ -3648,8 +3648,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
3648
3648
  live = false;
3649
3649
  };
3650
3650
  }, [provider, query, category, use]);
3651
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
3652
- const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
3651
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
3652
+ const categories = (0, import_react23.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
3653
3653
  const shown = found.filter(allowed);
3654
3654
  if (!provider)
3655
3655
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -3,7 +3,7 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-W6UZ7PVT.js";
6
+ } from "../chunk-WTW6HRFI.js";
7
7
  import "../chunk-5RPB4WGT.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
@@ -845,7 +845,7 @@ function EffectThumbnail({ provider, effect, width = 96, height = 54, className
845
845
  var import_react10 = require("react");
846
846
  var import_effects2 = require("@pixerate/editor/effects");
847
847
  var import_jsx_runtime8 = require("react/jsx-runtime");
848
- function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, title = "Effects", className = "" }) {
848
+ function EffectsBrowser({ provider, uses, kinds, filter, onPick, thumbnails = true, title = "Effects", className = "" }) {
849
849
  const [all, setAll] = (0, import_react10.useState)([]);
850
850
  const [query, setQuery] = (0, import_react10.useState)("");
851
851
  const [category, setCategory] = (0, import_react10.useState)("");
@@ -871,8 +871,8 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
871
871
  live = false;
872
872
  };
873
873
  }, [provider, query, category, use]);
874
- const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses);
875
- const categories = (0, import_react10.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds]);
874
+ const allowed = (e) => (!kinds || kinds.includes(e.kind)) && (0, import_effects2.effectOffered)(e, uses) && (!filter || filter(e));
875
+ const categories = (0, import_react10.useMemo)(() => [...new Set(all.filter(allowed).map((e) => e.category))], [all, uses, kinds, filter]);
876
876
  const shown = found.filter(allowed);
877
877
  if (!provider)
878
878
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `rounded-md border border-dashed border-border p-3 text-xs text-muted-foreground ${className}`, "data-effects-browser": "", "data-effects-unavailable": "", children: "No effects provider is registered, so effects cannot be added. Effects already in the document are kept." });
@@ -5,7 +5,7 @@ import {
5
5
  EffectsBrowser,
6
6
  useEffectDescription,
7
7
  useEffects
8
- } from "../chunk-W6UZ7PVT.js";
8
+ } from "../chunk-WTW6HRFI.js";
9
9
  import "../chunk-5RPB4WGT.js";
10
10
  import "../chunk-KIRIU53A.js";
11
11
  import "../chunk-3I7FOSLF.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.198.1",
3
+ "version": "0.200.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -283,7 +283,7 @@
283
283
  "dependencies": {},
284
284
  "peerDependencies": {
285
285
  "@dagrejs/dagre": "^1.1.8",
286
- "@pixerate/editor": ">=0.286.1 <1.0.0-0",
286
+ "@pixerate/editor": ">=0.291.0 <1.0.0-0",
287
287
  "@tiptap/core": "^2.27.3",
288
288
  "@tiptap/extension-bubble-menu": "^2.27.3",
289
289
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -334,7 +334,7 @@
334
334
  "tsup": "^9.0.0",
335
335
  "typescript": "^5.7.3",
336
336
  "vitest": "^5.1.0",
337
- "@pixerate/editor": "0.286.1"
337
+ "@pixerate/editor": "0.291.0"
338
338
  },
339
339
  "scripts": {
340
340
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",