@pixerate/editor-react 0.114.3 → 0.116.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.
Files changed (36) hide show
  1. package/dist/animation-editor/index.cjs +20 -2
  2. package/dist/animation-editor/index.js +2 -2
  3. package/dist/canvas/index.cjs +20 -2
  4. package/dist/canvas/index.js +2 -2
  5. package/dist/{chunk-354TA5QV.js → chunk-5RPB4WGT.js} +20 -2
  6. package/dist/{chunk-TOGMXZM4.js → chunk-6BWTJ3EE.js} +1 -1
  7. package/dist/{chunk-SH63DFOO.js → chunk-ZQ54FEXL.js} +170 -98
  8. package/dist/effects/index.cjs +20 -2
  9. package/dist/effects/index.js +2 -2
  10. package/dist/image-editor/ImageProviderEffectsPanel.d.cts +5 -4
  11. package/dist/image-editor/ImageProviderEffectsPanel.d.ts +5 -4
  12. package/dist/image-editor/LayerEffectsPanel.d.cts +5 -0
  13. package/dist/image-editor/LayerEffectsPanel.d.ts +5 -0
  14. package/dist/image-editor/controls/controls.d.cts +19 -0
  15. package/dist/image-editor/controls/controls.d.ts +19 -0
  16. package/dist/image-editor/controls/parameterControls.d.cts +1 -1
  17. package/dist/image-editor/controls/parameterControls.d.ts +1 -1
  18. package/dist/image-editor/index.cjs +183 -92
  19. package/dist/image-editor/index.d.cts +1 -1
  20. package/dist/image-editor/index.d.ts +1 -1
  21. package/dist/image-editor/index.js +5 -3
  22. package/dist/index.cjs +183 -92
  23. package/dist/index.js +5 -3
  24. package/dist/paint-editor/index.cjs +20 -2
  25. package/dist/paint-editor/index.js +2 -2
  26. package/dist/parameters/controls.d.cts +20 -0
  27. package/dist/parameters/controls.d.ts +20 -0
  28. package/dist/parameters/fields.d.cts +1 -1
  29. package/dist/parameters/fields.d.ts +1 -1
  30. package/dist/parameters/index.cjs +20 -2
  31. package/dist/parameters/index.js +1 -1
  32. package/dist/vector/index.cjs +20 -2
  33. package/dist/vector/index.js +2 -2
  34. package/dist/video-editor/index.cjs +20 -2
  35. package/dist/video-editor/index.js +2 -2
  36. package/package.json +3 -3
@@ -1236,7 +1236,8 @@ function resolveParameterComponents(explicit, context) {
1236
1236
  return {
1237
1237
  input: explicit?.input ?? context?.input,
1238
1238
  slider: explicit?.slider ?? context?.slider,
1239
- select: explicit?.select ?? context?.select
1239
+ select: explicit?.select ?? context?.select,
1240
+ color: explicit?.color ?? context?.color
1240
1241
  };
1241
1242
  }
1242
1243
 
@@ -1470,7 +1471,8 @@ function ParameterSelect(props) {
1470
1471
  }
1471
1472
  );
1472
1473
  }
1473
- function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
1474
+ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
1475
+ const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
1474
1476
  const [open, setOpen] = (0, import_react8.useState)(false);
1475
1477
  const containerRef = (0, import_react8.useRef)(null);
1476
1478
  const buttonRef = (0, import_react8.useRef)(null);
@@ -1502,6 +1504,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
1502
1504
  window.removeEventListener("keydown", onKeyDown, true);
1503
1505
  };
1504
1506
  }, [open]);
1507
+ if (CustomColor) {
1508
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1509
+ CustomColor,
1510
+ {
1511
+ id,
1512
+ value: shown,
1513
+ alpha,
1514
+ swatches: field.swatches,
1515
+ disabled: off,
1516
+ label: name,
1517
+ onChange,
1518
+ onGestureStart,
1519
+ onGestureEnd
1520
+ }
1521
+ );
1522
+ }
1505
1523
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
1506
1524
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center gap-2", children: [
1507
1525
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -6,8 +6,8 @@ import {
6
6
  useEffectAuthoring,
7
7
  useEffectDescription,
8
8
  useEffects
9
- } from "../chunk-TOGMXZM4.js";
10
- import "../chunk-354TA5QV.js";
9
+ } from "../chunk-6BWTJ3EE.js";
10
+ import "../chunk-5RPB4WGT.js";
11
11
  import "../chunk-KIRIU53A.js";
12
12
  import "../chunk-3I7FOSLF.js";
13
13
  export {
@@ -8,9 +8,10 @@ export interface ImageProviderEffectsPanelProps {
8
8
  components?: ParameterComponents;
9
9
  }
10
10
  /**
11
- * Provider effects in the image editor, for the active layer: its effect smart filters (apply,
12
- * turn on and off, opacity, reorder, change controls, remove) and, for an effect layer, its own
13
- * controls; plus adding effect layers. Applying a filter effect to a pixel layer converts it to a
14
- * smart object in the same undo step. Without a provider it says why nothing can be added.
11
+ * Effects for the active layer, in one place. An effect layer first: its effect (change it or
12
+ * rasterize it), a still frame or an animation for an effect that moves, and its controls. Then
13
+ * what is applied to any layer: provider filters (smart filters; applying one converts a pixel
14
+ * layer to a smart object in the same undo step) and layer styles, added from one menu. New
15
+ * effect layers come from the layers panel. Without a provider it says why nothing can be added.
15
16
  */
16
17
  export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
@@ -8,9 +8,10 @@ export interface ImageProviderEffectsPanelProps {
8
8
  components?: ParameterComponents;
9
9
  }
10
10
  /**
11
- * Provider effects in the image editor, for the active layer: its effect smart filters (apply,
12
- * turn on and off, opacity, reorder, change controls, remove) and, for an effect layer, its own
13
- * controls; plus adding effect layers. Applying a filter effect to a pixel layer converts it to a
14
- * smart object in the same undo step. Without a provider it says why nothing can be added.
11
+ * Effects for the active layer, in one place. An effect layer first: its effect (change it or
12
+ * rasterize it), a still frame or an animation for an effect that moves, and its controls. Then
13
+ * what is applied to any layer: provider filters (smart filters; applying one converts a pixel
14
+ * layer to a smart object in the same undo step) and layer styles, added from one menu. New
15
+ * effect layers come from the layers panel. Without a provider it says why nothing can be added.
15
16
  */
16
17
  export declare function ImageProviderEffectsPanel({ controller, className, components }: ImageProviderEffectsPanelProps): React.JSX.Element;
@@ -4,6 +4,11 @@ export interface LayerEffectsPanelProps {
4
4
  controller: ImageEditorController;
5
5
  /** The layer whose effects to show (default: the active layer). */
6
6
  layerId?: string | null;
7
+ /**
8
+ * Show the "fx Effects" title and the "Add effect" menu (default true). Without them (inside a
9
+ * panel that adds styles from its own menu) the master switch and Scale stay.
10
+ */
11
+ heading?: boolean;
7
12
  className?: string;
8
13
  }
9
14
  /**
@@ -4,6 +4,11 @@ export interface LayerEffectsPanelProps {
4
4
  controller: ImageEditorController;
5
5
  /** The layer whose effects to show (default: the active layer). */
6
6
  layerId?: string | null;
7
+ /**
8
+ * Show the "fx Effects" title and the "Add effect" menu (default true). Without them (inside a
9
+ * panel that adds styles from its own menu) the master switch and Scale stay.
10
+ */
11
+ heading?: boolean;
7
12
  className?: string;
8
13
  }
9
14
  /**
@@ -42,6 +42,22 @@ export interface ImageSelectProps {
42
42
  onChange: (value: string) => void;
43
43
  className?: string;
44
44
  }
45
+ /** A colour well in the image editor's panels. */
46
+ export interface ImageColorProps {
47
+ /** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
48
+ value: string;
49
+ /** The accessible name. */
50
+ label: string;
51
+ /** Whether the colour has an alpha channel. */
52
+ alpha?: boolean;
53
+ disabled?: boolean;
54
+ /** Every change while the colour is picked. */
55
+ onChange: (value: string) => void;
56
+ /** A pick (e.g. a drag in the picker) starts: changes until `onEnd` merge into one undo step. */
57
+ onStart?: () => void;
58
+ onEnd?: () => void;
59
+ className?: string;
60
+ }
45
61
  /**
46
62
  * The host's own form controls for the image editor's panels. Any left out fall back to the
47
63
  * editor's plain inputs.
@@ -50,6 +66,7 @@ export interface ImageEditorControls {
50
66
  Checkbox?: ComponentType<ImageCheckboxProps>;
51
67
  Range?: ComponentType<ImageRangeProps>;
52
68
  Select?: ComponentType<ImageSelectProps>;
69
+ Color?: ComponentType<ImageColorProps>;
53
70
  }
54
71
  /** Makes the image editor's panels inside it use the host's controls. */
55
72
  export declare function ImageEditorControlsProvider({ controls, children }: {
@@ -64,3 +81,5 @@ export declare function ImageCheckbox(props: ImageCheckboxProps): import("react"
64
81
  export declare function ImageRange(props: ImageRangeProps): import("react").JSX.Element;
65
82
  /** A dropdown: the host's, or a plain select. */
66
83
  export declare function ImageSelect(props: ImageSelectProps): import("react").JSX.Element;
84
+ /** A colour well: the host's, or a plain colour input (which keeps the stored alpha). */
85
+ export declare function ImageColor(props: ImageColorProps): import("react").JSX.Element;
@@ -42,6 +42,22 @@ export interface ImageSelectProps {
42
42
  onChange: (value: string) => void;
43
43
  className?: string;
44
44
  }
45
+ /** A colour well in the image editor's panels. */
46
+ export interface ImageColorProps {
47
+ /** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
48
+ value: string;
49
+ /** The accessible name. */
50
+ label: string;
51
+ /** Whether the colour has an alpha channel. */
52
+ alpha?: boolean;
53
+ disabled?: boolean;
54
+ /** Every change while the colour is picked. */
55
+ onChange: (value: string) => void;
56
+ /** A pick (e.g. a drag in the picker) starts: changes until `onEnd` merge into one undo step. */
57
+ onStart?: () => void;
58
+ onEnd?: () => void;
59
+ className?: string;
60
+ }
45
61
  /**
46
62
  * The host's own form controls for the image editor's panels. Any left out fall back to the
47
63
  * editor's plain inputs.
@@ -50,6 +66,7 @@ export interface ImageEditorControls {
50
66
  Checkbox?: ComponentType<ImageCheckboxProps>;
51
67
  Range?: ComponentType<ImageRangeProps>;
52
68
  Select?: ComponentType<ImageSelectProps>;
69
+ Color?: ComponentType<ImageColorProps>;
53
70
  }
54
71
  /** Makes the image editor's panels inside it use the host's controls. */
55
72
  export declare function ImageEditorControlsProvider({ controls, children }: {
@@ -64,3 +81,5 @@ export declare function ImageCheckbox(props: ImageCheckboxProps): import("react"
64
81
  export declare function ImageRange(props: ImageRangeProps): import("react").JSX.Element;
65
82
  /** A dropdown: the host's, or a plain select. */
66
83
  export declare function ImageSelect(props: ImageSelectProps): import("react").JSX.Element;
84
+ /** A colour well: the host's, or a plain colour input (which keeps the stored alpha). */
85
+ export declare function ImageColor(props: ImageColorProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import type { ParameterComponents } from '../../parameters/controls.cjs';
2
2
  import { type ImageEditorControls } from './controls.cjs';
3
- /** The host's image-editor `Range` and `Select` as parameter controls (only the ones it set). */
3
+ /** The host's image-editor `Range`, `Select` and `Color` as parameter controls (only the ones it set). */
4
4
  export declare function imageEditorParameterComponents(controls: ImageEditorControls): ParameterComponents;
@@ -1,4 +1,4 @@
1
1
  import type { ParameterComponents } from '../../parameters/controls.js';
2
2
  import { type ImageEditorControls } from './controls.js';
3
- /** The host's image-editor `Range` and `Select` as parameter controls (only the ones it set). */
3
+ /** The host's image-editor `Range`, `Select` and `Color` as parameter controls (only the ones it set). */
4
4
  export declare function imageEditorParameterComponents(controls: ImageEditorControls): ParameterComponents;