@pixerate/editor-react 0.184.0 → 0.186.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/hooks/useHistory.d.cts +2 -0
- package/dist/hooks/useHistory.d.ts +2 -0
- package/dist/index.cjs +5 -0
- package/dist/index.js +5 -0
- package/dist/paint-editor/PaintEffectsPanel.d.cts +1 -1
- package/dist/paint-editor/PaintEffectsPanel.d.ts +1 -1
- package/dist/paint-editor/index.cjs +9 -2
- package/dist/paint-editor/index.js +9 -2
- package/package.json +3 -3
|
@@ -15,6 +15,8 @@ export interface UseHistoryResult extends HistoryState {
|
|
|
15
15
|
mark: () => HistoryMark;
|
|
16
16
|
/** Takes back every step since `mark` without leaving redo (Escape-cancel). */
|
|
17
17
|
revertTo: (mark: HistoryMark) => number;
|
|
18
|
+
/** Removes the steps `match` picks without running them (stale steps). */
|
|
19
|
+
dropSteps: (match: (step: HistoryEntry) => boolean) => number;
|
|
18
20
|
/** Joins every merged execute into one step until `endGesture`. */
|
|
19
21
|
beginGesture: (key: string) => void;
|
|
20
22
|
endGesture: () => void;
|
|
@@ -15,6 +15,8 @@ export interface UseHistoryResult extends HistoryState {
|
|
|
15
15
|
mark: () => HistoryMark;
|
|
16
16
|
/** Takes back every step since `mark` without leaving redo (Escape-cancel). */
|
|
17
17
|
revertTo: (mark: HistoryMark) => number;
|
|
18
|
+
/** Removes the steps `match` picks without running them (stale steps). */
|
|
19
|
+
dropSteps: (match: (step: HistoryEntry) => boolean) => number;
|
|
18
20
|
/** Joins every merged execute into one step until `endGesture`. */
|
|
19
21
|
beginGesture: (key: string) => void;
|
|
20
22
|
endGesture: () => void;
|
package/dist/index.cjs
CHANGED
|
@@ -419,6 +419,10 @@ function useHistory(managerOrOptions) {
|
|
|
419
419
|
(m) => manager.revertTo(m),
|
|
420
420
|
[manager]
|
|
421
421
|
);
|
|
422
|
+
const dropSteps = (0, import_react6.useCallback)(
|
|
423
|
+
(match) => manager.dropSteps(match),
|
|
424
|
+
[manager]
|
|
425
|
+
);
|
|
422
426
|
const beginGesture = (0, import_react6.useCallback)(
|
|
423
427
|
(key) => manager.beginGesture(key),
|
|
424
428
|
[manager]
|
|
@@ -437,6 +441,7 @@ function useHistory(managerOrOptions) {
|
|
|
437
441
|
goTo,
|
|
438
442
|
mark,
|
|
439
443
|
revertTo,
|
|
444
|
+
dropSteps,
|
|
440
445
|
beginGesture,
|
|
441
446
|
endGesture
|
|
442
447
|
};
|
package/dist/index.js
CHANGED
|
@@ -368,6 +368,10 @@ function useHistory(managerOrOptions) {
|
|
|
368
368
|
(m) => manager.revertTo(m),
|
|
369
369
|
[manager]
|
|
370
370
|
);
|
|
371
|
+
const dropSteps = useCallback3(
|
|
372
|
+
(match) => manager.dropSteps(match),
|
|
373
|
+
[manager]
|
|
374
|
+
);
|
|
371
375
|
const beginGesture = useCallback3(
|
|
372
376
|
(key) => manager.beginGesture(key),
|
|
373
377
|
[manager]
|
|
@@ -386,6 +390,7 @@ function useHistory(managerOrOptions) {
|
|
|
386
390
|
goTo,
|
|
387
391
|
mark,
|
|
388
392
|
revertTo,
|
|
393
|
+
dropSteps,
|
|
389
394
|
beginGesture,
|
|
390
395
|
endGesture
|
|
391
396
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PaintEditorController, type PaintEffectsToolProviderOptions } from '@pixerate/editor/paint-editor';
|
|
3
|
-
import type
|
|
3
|
+
import { type EffectProvider } from '@pixerate/editor/effects';
|
|
4
4
|
import type { ToolRegistry } from '@pixerate/editor/tools';
|
|
5
5
|
export interface PaintEffectsPanelProps {
|
|
6
6
|
controller: PaintEditorController;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PaintEditorController, type PaintEffectsToolProviderOptions } from '@pixerate/editor/paint-editor';
|
|
3
|
-
import type
|
|
3
|
+
import { type EffectProvider } from '@pixerate/editor/effects';
|
|
4
4
|
import type { ToolRegistry } from '@pixerate/editor/tools';
|
|
5
5
|
export interface PaintEffectsPanelProps {
|
|
6
6
|
controller: PaintEditorController;
|
|
@@ -2097,6 +2097,7 @@ function PresenceLayer({ presence, viewport, clip = true, renderCursor, classNam
|
|
|
2097
2097
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
2098
2098
|
var import_react29 = require("react");
|
|
2099
2099
|
var import_paint_editor14 = require("@pixerate/editor/paint-editor");
|
|
2100
|
+
var import_effects4 = require("@pixerate/editor/effects");
|
|
2100
2101
|
|
|
2101
2102
|
// src/effects/useEffects.ts
|
|
2102
2103
|
var import_react20 = require("react");
|
|
@@ -3920,6 +3921,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
3920
3921
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
3921
3922
|
const active = activeId ? controller.getLayer(activeId) : void 0;
|
|
3922
3923
|
const effectPaint = state.effectPaint;
|
|
3924
|
+
const { description: paintDescription } = useEffectDescription(provider, effectPaint?.effect);
|
|
3925
|
+
const hasPathControl = Boolean(paintDescription && (0, import_effects4.pathControlsOf)(paintDescription).length > 0);
|
|
3923
3926
|
const animation = controller.getAnimation();
|
|
3924
3927
|
const playback = state.effectPlayback;
|
|
3925
3928
|
const repaint = (patch) => {
|
|
@@ -4006,15 +4009,19 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
4006
4009
|
] }),
|
|
4007
4010
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
|
|
4008
4011
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
|
|
4009
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked:
|
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
|
|
4010
4013
|
"Along the stroke"
|
|
4011
4014
|
] }),
|
|
4015
|
+
hasPathControl && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
|
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
|
|
4017
|
+
"Along the stroke (native)"
|
|
4018
|
+
] }),
|
|
4012
4019
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
|
|
4013
4020
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
|
|
4014
4021
|
"Live"
|
|
4015
4022
|
] })
|
|
4016
4023
|
] }),
|
|
4017
|
-
effectPaint.map && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4024
|
+
effectPaint.map?.by === "stroke" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4018
4025
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4019
4026
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-slate-400", children: "Length" }),
|
|
4020
4027
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -1306,6 +1306,7 @@ import { PaintPresence as PaintPresence2, documentToScreen as documentToScreen2,
|
|
|
1306
1306
|
// src/paint-editor/PaintEffectsPanel.tsx
|
|
1307
1307
|
import { useEffect as useEffect4, useMemo as useMemo6, useRef as useRef6, useState as useState8 } from "react";
|
|
1308
1308
|
import { createPaintEffectsToolProvider, PAPER_EFFECT_BLENDS } from "@pixerate/editor/paint-editor";
|
|
1309
|
+
import { pathControlsOf } from "@pixerate/editor/effects";
|
|
1309
1310
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1310
1311
|
function usePaintEffectsProvider(controller) {
|
|
1311
1312
|
const [provider, setProvider] = useState8(controller.effectsProvider);
|
|
@@ -1366,6 +1367,8 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1366
1367
|
const layerEffect = activeId ? controller.getEffectLayer(activeId) : void 0;
|
|
1367
1368
|
const active = activeId ? controller.getLayer(activeId) : void 0;
|
|
1368
1369
|
const effectPaint = state.effectPaint;
|
|
1370
|
+
const { description: paintDescription } = useEffectDescription(provider, effectPaint?.effect);
|
|
1371
|
+
const hasPathControl = Boolean(paintDescription && pathControlsOf(paintDescription).length > 0);
|
|
1369
1372
|
const animation = controller.getAnimation();
|
|
1370
1373
|
const playback = state.effectPlayback;
|
|
1371
1374
|
const repaint = (patch) => {
|
|
@@ -1452,15 +1455,19 @@ var PaintEffectsPanel = ({ controller, className }) => {
|
|
|
1452
1455
|
] }),
|
|
1453
1456
|
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", "data-testid": "effect-paint-placement", children: [
|
|
1454
1457
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", title: "Lay the effect along each stroke instead of fixing it to the canvas", children: [
|
|
1455
|
-
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked:
|
|
1458
|
+
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: effectPaint.map?.by === "stroke", onChange: (e) => repaint({ map: e.target.checked ? { by: "stroke", length: 300, repeat: "repeat" } : { by: "canvas" } }) }),
|
|
1456
1459
|
"Along the stroke"
|
|
1457
1460
|
] }),
|
|
1461
|
+
hasPathControl && /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", title: "Pass each stroke's centreline to the effect's own path control", children: [
|
|
1462
|
+
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: effectPaint.map?.by === "path", onChange: (e) => repaint({ map: e.target.checked ? { by: "path" } : { by: "canvas" } }) }),
|
|
1463
|
+
"Along the stroke (native)"
|
|
1464
|
+
] }),
|
|
1458
1465
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", title: "Strokes on a stroke layer keep playing the effect", children: [
|
|
1459
1466
|
/* @__PURE__ */ jsx13("input", { type: "checkbox", checked: Boolean(effectPaint.live), onChange: (e) => repaint({ live: e.target.checked }) }),
|
|
1460
1467
|
"Live"
|
|
1461
1468
|
] })
|
|
1462
1469
|
] }),
|
|
1463
|
-
effectPaint.map && /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1470
|
+
effectPaint.map?.by === "stroke" && /* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1464
1471
|
/* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-1", children: [
|
|
1465
1472
|
/* @__PURE__ */ jsx13("span", { className: "text-slate-400", children: "Length" }),
|
|
1466
1473
|
/* @__PURE__ */ jsx13(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.186.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
|
+
"@pixerate/editor": ">=0.271.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.0.5",
|
|
337
|
-
"@pixerate/editor": "0.
|
|
337
|
+
"@pixerate/editor": "0.271.0"
|
|
338
338
|
},
|
|
339
339
|
"scripts": {
|
|
340
340
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|