@pixerate/editor-react 0.198.0 → 0.199.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.
@@ -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
@@ -191,10 +191,11 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
191
191
  if (ctx && typeof ctx.createImageData === "function") (0, import_paint_editor2.drawWaterOverlay)(controller, ctx);
192
192
  }, [state, controller]);
193
193
  (0, import_react2.useEffect)(() => {
194
- controller.catchUpCultures();
194
+ const stopCatchUp = (0, import_paint_editor2.startCultureCatchUp)(controller);
195
195
  const player = controller.playEffects();
196
196
  const cultures = controller.playCultures();
197
197
  return () => {
198
+ stopCatchUp();
198
199
  player.stop();
199
200
  cultures.stop();
200
201
  };
@@ -4465,10 +4466,16 @@ function EffectParameters({
4465
4466
  // src/paint-editor/PaintEffectsPanel.tsx
4466
4467
  var import_jsx_runtime33 = require("react/jsx-runtime");
4467
4468
  function usePaintEffectsProvider(controller) {
4468
- const [provider, setProvider] = (0, import_react31.useState)(controller.effectsProvider);
4469
+ const [provider, setProvider] = (0, import_react31.useState)(controller.effectsCatalog);
4469
4470
  (0, import_react31.useEffect)(() => {
4470
- setProvider(controller.effectsProvider);
4471
- 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
+ };
4472
4479
  }, [controller]);
4473
4480
  return provider;
4474
4481
  }
@@ -4476,7 +4483,12 @@ function usePaintEffectsTools(registry, controller, options = {}) {
4476
4483
  const { id, namespace, readOnly, playbackSurface } = options;
4477
4484
  (0, import_react31.useEffect)(() => {
4478
4485
  if (!registry) return;
4479
- 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
+ };
4480
4492
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
4481
4493
  }
4482
4494
  function Controls({ provider, effect, name, values, apply }) {
@@ -116,6 +116,7 @@ import {
116
116
  drawWaterOverlay,
117
117
  startDeviceTilt,
118
118
  startWetClock,
119
+ startCultureCatchUp,
119
120
  fitZoom,
120
121
  guideOverlay,
121
122
  handlePaintShortcut,
@@ -178,10 +179,11 @@ var PaintCanvas = ({ controller, tool = "brush", fillOptions, showGuides = true,
178
179
  if (ctx && typeof ctx.createImageData === "function") drawWaterOverlay(controller, ctx);
179
180
  }, [state, controller]);
180
181
  useEffect2(() => {
181
- controller.catchUpCultures();
182
+ const stopCatchUp = startCultureCatchUp(controller);
182
183
  const player = controller.playEffects();
183
184
  const cultures = controller.playCultures();
184
185
  return () => {
186
+ stopCatchUp();
185
187
  player.stop();
186
188
  cultures.stop();
187
189
  };
@@ -1911,14 +1913,20 @@ import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2,
1911
1913
 
1912
1914
  // src/paint-editor/PaintEffectsPanel.tsx
1913
1915
  import { useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState10 } from "react";
1914
- import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1916
+ import { createPaintEffectAuthoringToolProvider, createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
1915
1917
  import { pathControlsOf } from "@pixerate/editor/effects";
1916
1918
  import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1917
1919
  function usePaintEffectsProvider(controller) {
1918
- const [provider, setProvider] = useState10(controller.effectsProvider);
1920
+ const [provider, setProvider] = useState10(controller.effectsCatalog);
1919
1921
  useEffect5(() => {
1920
- setProvider(controller.effectsProvider);
1921
- 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
+ };
1922
1930
  }, [controller]);
1923
1931
  return provider;
1924
1932
  }
@@ -1926,7 +1934,12 @@ function usePaintEffectsTools(registry, controller, options = {}) {
1926
1934
  const { id, namespace, readOnly, playbackSurface } = options;
1927
1935
  useEffect5(() => {
1928
1936
  if (!registry) return;
1929
- 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
+ };
1930
1943
  }, [registry, controller, id, namespace, readOnly, playbackSurface]);
1931
1944
  }
1932
1945
  function Controls({ provider, effect, name, values, apply }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.198.0",
3
+ "version": "0.199.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.285.0 <1.0.0-0",
286
+ "@pixerate/editor": ">=0.289.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.285.0"
337
+ "@pixerate/editor": "0.289.0"
338
338
  },
339
339
  "scripts": {
340
340
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",