@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.
- package/dist/animation-editor/index.cjs +20 -2
- package/dist/animation-editor/index.js +2 -2
- package/dist/canvas/index.cjs +20 -2
- package/dist/canvas/index.js +2 -2
- package/dist/{chunk-354TA5QV.js → chunk-5RPB4WGT.js} +20 -2
- package/dist/{chunk-TOGMXZM4.js → chunk-6BWTJ3EE.js} +1 -1
- package/dist/{chunk-SH63DFOO.js → chunk-ZQ54FEXL.js} +170 -98
- package/dist/effects/index.cjs +20 -2
- package/dist/effects/index.js +2 -2
- 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 +5 -0
- package/dist/image-editor/LayerEffectsPanel.d.ts +5 -0
- package/dist/image-editor/controls/controls.d.cts +19 -0
- package/dist/image-editor/controls/controls.d.ts +19 -0
- package/dist/image-editor/controls/parameterControls.d.cts +1 -1
- package/dist/image-editor/controls/parameterControls.d.ts +1 -1
- package/dist/image-editor/index.cjs +183 -92
- package/dist/image-editor/index.d.cts +1 -1
- package/dist/image-editor/index.d.ts +1 -1
- package/dist/image-editor/index.js +5 -3
- package/dist/index.cjs +183 -92
- package/dist/index.js +5 -3
- package/dist/paint-editor/index.cjs +20 -2
- package/dist/paint-editor/index.js +2 -2
- package/dist/parameters/controls.d.cts +20 -0
- package/dist/parameters/controls.d.ts +20 -0
- package/dist/parameters/fields.d.cts +1 -1
- package/dist/parameters/fields.d.ts +1 -1
- package/dist/parameters/index.cjs +20 -2
- package/dist/parameters/index.js +1 -1
- package/dist/vector/index.cjs +20 -2
- package/dist/vector/index.js +2 -2
- package/dist/video-editor/index.cjs +20 -2
- package/dist/video-editor/index.js +2 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -55,6 +55,7 @@ __export(src_exports, {
|
|
|
55
55
|
Histogram: () => Histogram,
|
|
56
56
|
HistoryManager: () => import_editor23.HistoryManager,
|
|
57
57
|
ImageCheckbox: () => ImageCheckbox,
|
|
58
|
+
ImageColor: () => ImageColor,
|
|
58
59
|
ImageEditor: () => ImageEditor,
|
|
59
60
|
ImageEditorCanvas: () => ImageEditorCanvas,
|
|
60
61
|
ImageEditorControlsProvider: () => ImageEditorControlsProvider,
|
|
@@ -4854,6 +4855,22 @@ function ImageSelect(props) {
|
|
|
4854
4855
|
options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: o.value, children: o.label }, o.value))
|
|
4855
4856
|
] });
|
|
4856
4857
|
}
|
|
4858
|
+
function ImageColor(props) {
|
|
4859
|
+
const Host = useImageEditorControls().Color;
|
|
4860
|
+
if (Host) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Host, { ...props });
|
|
4861
|
+
const { value, label, alpha, disabled, onChange, className = "" } = props;
|
|
4862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4863
|
+
"input",
|
|
4864
|
+
{
|
|
4865
|
+
type: "color",
|
|
4866
|
+
"aria-label": label,
|
|
4867
|
+
value: value.slice(0, 7),
|
|
4868
|
+
disabled,
|
|
4869
|
+
onChange: (e) => onChange(e.target.value + (alpha ? value.slice(7, 9) : "")),
|
|
4870
|
+
className: `${imageColorInputClass} ${className}`
|
|
4871
|
+
}
|
|
4872
|
+
);
|
|
4873
|
+
}
|
|
4857
4874
|
|
|
4858
4875
|
// src/image-editor/ControlSlider.tsx
|
|
4859
4876
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -5094,32 +5111,14 @@ var AdjustmentLayersPanel = ({ controller, layers: layersProp, histogram, classN
|
|
|
5094
5111
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5095
5112
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageCheckbox, { label: "Tint", checked: layer.params.tint !== null, onChange: (on) => setParam(layer, "tint", on ? "#e1d3b3" : null) }),
|
|
5096
5113
|
"Tint",
|
|
5097
|
-
layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5098
|
-
"input",
|
|
5099
|
-
{
|
|
5100
|
-
type: "color",
|
|
5101
|
-
"aria-label": "Tint colour",
|
|
5102
|
-
value: layer.params.tint,
|
|
5103
|
-
onChange: (e) => setParam(layer, "tint", e.target.value),
|
|
5104
|
-
className: "h-5 w-8 bg-transparent"
|
|
5105
|
-
}
|
|
5106
|
-
)
|
|
5114
|
+
layer.params.tint && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageColor, { label: "Tint colour", value: layer.params.tint, onChange: (v) => setParam(layer, "tint", v) })
|
|
5107
5115
|
] })
|
|
5108
5116
|
] });
|
|
5109
5117
|
case "photoFilter":
|
|
5110
5118
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5111
5119
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5112
5120
|
"Filter colour",
|
|
5113
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5114
|
-
"input",
|
|
5115
|
-
{
|
|
5116
|
-
type: "color",
|
|
5117
|
-
"aria-label": "Filter colour",
|
|
5118
|
-
value: layer.params.color,
|
|
5119
|
-
onChange: (e) => setParam(layer, "color", e.target.value),
|
|
5120
|
-
className: "h-5 w-8 bg-transparent"
|
|
5121
|
-
}
|
|
5122
|
-
)
|
|
5121
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ImageColor, { label: "Filter colour", value: layer.params.color, onChange: (v) => setParam(layer, "color", v) })
|
|
5123
5122
|
] }),
|
|
5124
5123
|
controlsOf(layer).map((s) => slider(layer, s)),
|
|
5125
5124
|
checkbox(layer, "preserveLuminosity", "Preserve luminosity")
|
|
@@ -5251,7 +5250,7 @@ var import_react47 = require("react");
|
|
|
5251
5250
|
var import_react46 = require("react");
|
|
5252
5251
|
var import_image_editor7 = require("@pixerate/editor/image-editor");
|
|
5253
5252
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5254
|
-
var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
5253
|
+
var LayerEffectsPanel = ({ controller, layerId, heading = true, className }) => {
|
|
5255
5254
|
const [, setTick] = (0, import_react46.useState)(0);
|
|
5256
5255
|
(0, import_react46.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
5257
5256
|
const [open, setOpen] = (0, import_react46.useState)(null);
|
|
@@ -5309,7 +5308,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5309
5308
|
}
|
|
5310
5309
|
case "color":
|
|
5311
5310
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1.5 text-foreground", children: [
|
|
5312
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageColor, { label, value: c.value, disabled: model.readOnly, onChange: (v) => change(effectId, c, v) }),
|
|
5313
5312
|
label
|
|
5314
5313
|
] }, c.key);
|
|
5315
5314
|
case "checkbox":
|
|
@@ -5335,7 +5334,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5335
5334
|
};
|
|
5336
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 effects", role: "group", children: [
|
|
5337
5336
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5338
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-foreground", children: "fx Effects" }),
|
|
5337
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-semibold text-foreground", children: heading ? "fx Effects" : "Styles" }),
|
|
5339
5338
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
5340
5339
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Effects on", checked: model.enabled, disabled: model.readOnly, onChange: (on) => attempt(() => controller.setLayerEffectsEnabled(id, on)) }),
|
|
5341
5340
|
"On"
|
|
@@ -5361,7 +5360,7 @@ var LayerEffectsPanel = ({ controller, layerId, className }) => {
|
|
|
5361
5360
|
),
|
|
5362
5361
|
"%"
|
|
5363
5362
|
] }),
|
|
5364
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5363
|
+
heading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5365
5364
|
ImageSelect,
|
|
5366
5365
|
{
|
|
5367
5366
|
label: "Add effect",
|
|
@@ -5831,7 +5830,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
5831
5830
|
};
|
|
5832
5831
|
|
|
5833
5832
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
5834
|
-
var import_react57 =
|
|
5833
|
+
var import_react57 = require("react");
|
|
5835
5834
|
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
5836
5835
|
|
|
5837
5836
|
// src/effects/useEffects.ts
|
|
@@ -7029,7 +7028,8 @@ function resolveParameterComponents(explicit, context) {
|
|
|
7029
7028
|
return {
|
|
7030
7029
|
input: explicit?.input ?? context?.input,
|
|
7031
7030
|
slider: explicit?.slider ?? context?.slider,
|
|
7032
|
-
select: explicit?.select ?? context?.select
|
|
7031
|
+
select: explicit?.select ?? context?.select,
|
|
7032
|
+
color: explicit?.color ?? context?.color
|
|
7033
7033
|
};
|
|
7034
7034
|
}
|
|
7035
7035
|
|
|
@@ -7263,7 +7263,8 @@ function ParameterSelect(props) {
|
|
|
7263
7263
|
}
|
|
7264
7264
|
);
|
|
7265
7265
|
}
|
|
7266
|
-
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
7266
|
+
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
7267
|
+
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
7267
7268
|
const [open, setOpen] = (0, import_react55.useState)(false);
|
|
7268
7269
|
const containerRef = (0, import_react55.useRef)(null);
|
|
7269
7270
|
const buttonRef = (0, import_react55.useRef)(null);
|
|
@@ -7295,6 +7296,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
7295
7296
|
window.removeEventListener("keydown", onKeyDown, true);
|
|
7296
7297
|
};
|
|
7297
7298
|
}, [open]);
|
|
7299
|
+
if (CustomColor) {
|
|
7300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7301
|
+
CustomColor,
|
|
7302
|
+
{
|
|
7303
|
+
id,
|
|
7304
|
+
value: shown,
|
|
7305
|
+
alpha,
|
|
7306
|
+
swatches: field.swatches,
|
|
7307
|
+
disabled: off,
|
|
7308
|
+
label: name,
|
|
7309
|
+
onChange,
|
|
7310
|
+
onGestureStart,
|
|
7311
|
+
onGestureEnd
|
|
7312
|
+
}
|
|
7313
|
+
);
|
|
7314
|
+
}
|
|
7298
7315
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
7299
7316
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7300
7317
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -7615,10 +7632,26 @@ function ImageParameterSelect({ value, options, label, disabled, className, onCh
|
|
|
7615
7632
|
}
|
|
7616
7633
|
);
|
|
7617
7634
|
}
|
|
7635
|
+
function ImageParameterColor({ value, alpha, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
7636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7637
|
+
ImageColor,
|
|
7638
|
+
{
|
|
7639
|
+
value,
|
|
7640
|
+
alpha,
|
|
7641
|
+
label,
|
|
7642
|
+
disabled,
|
|
7643
|
+
className,
|
|
7644
|
+
onChange,
|
|
7645
|
+
onStart: onGestureStart,
|
|
7646
|
+
onEnd: onGestureEnd
|
|
7647
|
+
}
|
|
7648
|
+
);
|
|
7649
|
+
}
|
|
7618
7650
|
function imageEditorParameterComponents(controls) {
|
|
7619
7651
|
return {
|
|
7620
7652
|
slider: controls.Range ? ImageParameterSlider : void 0,
|
|
7621
|
-
select: controls.Select ? ImageParameterSelect : void 0
|
|
7653
|
+
select: controls.Select ? ImageParameterSelect : void 0,
|
|
7654
|
+
color: controls.Color ? ImageParameterColor : void 0
|
|
7622
7655
|
};
|
|
7623
7656
|
}
|
|
7624
7657
|
|
|
@@ -7642,12 +7675,14 @@ function ImageEffectControls({ provider, effect, name, values, onChange, onPrese
|
|
|
7642
7675
|
|
|
7643
7676
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
7644
7677
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
7678
|
+
var fmt = (ms) => `${(ms / 1e3).toFixed(ms < 1e4 ? 2 : 1)} s`;
|
|
7645
7679
|
function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
7646
7680
|
const [, setTick] = (0, import_react57.useState)(0);
|
|
7647
7681
|
(0, import_react57.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
7648
7682
|
const [browse, setBrowse] = (0, import_react57.useState)(null);
|
|
7649
7683
|
const [message2, setMessage] = (0, import_react57.useState)(null);
|
|
7650
7684
|
const [open, setOpen] = (0, import_react57.useState)(null);
|
|
7685
|
+
const [scrubbed, setScrubbed] = (0, import_react57.useState)(null);
|
|
7651
7686
|
const provider = controller.effectsProvider;
|
|
7652
7687
|
const state = controller.getState();
|
|
7653
7688
|
const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -7655,7 +7690,7 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7655
7690
|
setMessage(null);
|
|
7656
7691
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
7657
7692
|
};
|
|
7658
|
-
const drags = import_react57.
|
|
7693
|
+
const drags = (0, import_react57.useRef)(/* @__PURE__ */ new Set());
|
|
7659
7694
|
const commit = (gesture) => {
|
|
7660
7695
|
if (gesture) {
|
|
7661
7696
|
if (!drags.current.has(gesture)) {
|
|
@@ -7669,20 +7704,114 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7669
7704
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
7670
7705
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
7671
7706
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7707
|
+
const styles = (0, import_image_editor9.layerEffectsPanel)(layer);
|
|
7708
|
+
const { description } = useEffectDescription(provider, generator?.effect);
|
|
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
|
+
const scrub = (0, import_react57.useRef)({ next: null, busy: false, gesture: null });
|
|
7720
|
+
const scrubTo = (layerId, time) => {
|
|
7721
|
+
const s = scrub.current;
|
|
7722
|
+
setScrubbed(time);
|
|
7723
|
+
s.next = { layerId, time, commit: commit(s.gesture) };
|
|
7724
|
+
if (s.busy) return;
|
|
7725
|
+
s.busy = true;
|
|
7726
|
+
const step = () => {
|
|
7727
|
+
const n = s.next;
|
|
7728
|
+
s.next = null;
|
|
7729
|
+
if (!n) return Promise.resolve();
|
|
7730
|
+
return controller.updateEffectLayer(n.layerId, { time: n.time }, n.commit).then(step);
|
|
7731
|
+
};
|
|
7732
|
+
step().catch((e) => setMessage(e instanceof Error ? e.message : String(e))).finally(() => {
|
|
7733
|
+
s.busy = false;
|
|
7734
|
+
setScrubbed(null);
|
|
7735
|
+
});
|
|
7736
|
+
};
|
|
7737
|
+
const shown = scrubbed ?? timing?.time ?? 0;
|
|
7738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Effects", "data-image-provider-effects": "", children: [
|
|
7678
7739
|
!provider && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
7679
|
-
|
|
7680
|
-
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
7681
|
-
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
7740
|
+
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "space-y-2", "data-effect-part": "generator", children: [
|
|
7682
7741
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
7683
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
7742
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", title: generator.name ?? generator.effect, children: generator.name ?? generator.effect }),
|
|
7743
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "change", onClick: () => setBrowse(browse === "change" ? null : "change"), children: "Change\u2026" }),
|
|
7684
7744
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
7685
7745
|
] }),
|
|
7746
|
+
browse === "change" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Change the effect to", onPick: (e) => (setBrowse(null), run(() => controller.updateEffectLayer(layer.id, { effect: e.id }))) }),
|
|
7747
|
+
timing && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "space-y-1.5 rounded border border-border p-1.5", "data-effect-part": "timing", role: "group", "aria-label": "Frames", children: [
|
|
7748
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex gap-1", role: "radiogroup", "aria-label": "Output", children: [
|
|
7749
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7750
|
+
"button",
|
|
7751
|
+
{
|
|
7752
|
+
type: "button",
|
|
7753
|
+
role: "radio",
|
|
7754
|
+
"aria-checked": timing.mode === "still",
|
|
7755
|
+
className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "still" ? "bg-accent text-accent-foreground" : ""}`,
|
|
7756
|
+
onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: null })),
|
|
7757
|
+
children: "Still frame"
|
|
7758
|
+
}
|
|
7759
|
+
),
|
|
7760
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7761
|
+
"button",
|
|
7762
|
+
{
|
|
7763
|
+
type: "button",
|
|
7764
|
+
role: "radio",
|
|
7765
|
+
"aria-checked": timing.mode === "animate",
|
|
7766
|
+
className: `${imageOutlineButtonClass} flex-1 ${timing.mode === "animate" ? "bg-accent text-accent-foreground" : ""}`,
|
|
7767
|
+
onClick: () => run(() => controller.updateEffectLayer(layer.id, { animate: { duration: timing.duration } })),
|
|
7768
|
+
children: "Animate"
|
|
7769
|
+
}
|
|
7770
|
+
)
|
|
7771
|
+
] }),
|
|
7772
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7773
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: timing.mode === "still" ? "Frame" : "Starts at" }),
|
|
7774
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7775
|
+
ImageRange,
|
|
7776
|
+
{
|
|
7777
|
+
min: 0,
|
|
7778
|
+
max: timing.range,
|
|
7779
|
+
step: Math.max(1, Math.round(timing.range / 200)),
|
|
7780
|
+
className: "flex-1",
|
|
7781
|
+
value: shown,
|
|
7782
|
+
label: timing.mode === "still" ? "Frame" : "Starts at",
|
|
7783
|
+
onStart: () => scrub.current.gesture = `time:${Date.now()}`,
|
|
7784
|
+
onEnd: () => scrub.current.gesture = null,
|
|
7785
|
+
onChange: (t) => scrubTo(layer.id, t)
|
|
7786
|
+
}
|
|
7787
|
+
),
|
|
7788
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "w-12 shrink-0 text-right tabular-nums text-muted-foreground", children: fmt(shown) })
|
|
7789
|
+
] }),
|
|
7790
|
+
timing.mode === "animate" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
7791
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "w-16 shrink-0 text-[11px] text-foreground", children: "Length" }),
|
|
7792
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7793
|
+
"input",
|
|
7794
|
+
{
|
|
7795
|
+
type: "number",
|
|
7796
|
+
"aria-label": "Animation length in seconds",
|
|
7797
|
+
min: 0.1,
|
|
7798
|
+
max: 60,
|
|
7799
|
+
step: 0.1,
|
|
7800
|
+
defaultValue: Math.round(timing.duration / 100) / 10,
|
|
7801
|
+
className: "w-16 rounded border border-border bg-muted px-1 text-foreground",
|
|
7802
|
+
onBlur: (e) => {
|
|
7803
|
+
const s = Number(e.currentTarget.value);
|
|
7804
|
+
if (s > 0 && s * 1e3 !== timing.duration) run(() => controller.updateEffectLayer(layer.id, { animate: { duration: Math.min(60, s) * 1e3 } }));
|
|
7805
|
+
}
|
|
7806
|
+
},
|
|
7807
|
+
timing.duration
|
|
7808
|
+
),
|
|
7809
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
7810
|
+
"s",
|
|
7811
|
+
timing.loops ? ` \xB7 loops every ${fmt(timing.range)}` : ""
|
|
7812
|
+
] })
|
|
7813
|
+
] })
|
|
7814
|
+
] }),
|
|
7686
7815
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7687
7816
|
ImageEffectControls,
|
|
7688
7817
|
{
|
|
@@ -7696,7 +7825,12 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7696
7825
|
}
|
|
7697
7826
|
)
|
|
7698
7827
|
] }),
|
|
7699
|
-
|
|
7828
|
+
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: generator ? "On this layer" : "Effects" }),
|
|
7830
|
+
addOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ImageSelect, { label: "Add effect", value: "", placeholder: "Add\u2026", options: addOptions, onChange: add })
|
|
7831
|
+
] }),
|
|
7832
|
+
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
|
+
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) => {
|
|
7700
7834
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
7701
7835
|
const all = layer.smartFilters.filters;
|
|
7702
7836
|
const index = all.indexOf(f);
|
|
@@ -7747,6 +7881,8 @@ function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
|
7747
7881
|
] })
|
|
7748
7882
|
] }, f.id);
|
|
7749
7883
|
}) }),
|
|
7884
|
+
layer && styles.available && styles.rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LayerEffectsPanel, { controller, layerId: layer.id, heading: false }),
|
|
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." }),
|
|
7750
7886
|
!layer && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
7751
7887
|
message2 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message2 })
|
|
7752
7888
|
] });
|
|
@@ -7918,29 +8054,11 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
7918
8054
|
)) }),
|
|
7919
8055
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
7920
8056
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7921
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7922
|
-
"input",
|
|
7923
|
-
{
|
|
7924
|
-
type: "color",
|
|
7925
|
-
"aria-label": "Foreground colour",
|
|
7926
|
-
value: foreground,
|
|
7927
|
-
onChange: (e) => controller.setPaintOptions({ foreground: e.target.value }),
|
|
7928
|
-
className: imageColorInputClass
|
|
7929
|
-
}
|
|
7930
|
-
),
|
|
8057
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Foreground colour", value: foreground, onChange: (fg) => controller.setPaintOptions({ foreground: fg }) }),
|
|
7931
8058
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
7932
8059
|
] }),
|
|
7933
8060
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
7934
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7935
|
-
"input",
|
|
7936
|
-
{
|
|
7937
|
-
type: "color",
|
|
7938
|
-
"aria-label": "Background colour",
|
|
7939
|
-
value: background,
|
|
7940
|
-
onChange: (e) => controller.setPaintOptions({ background: e.target.value }),
|
|
7941
|
-
className: imageColorInputClass
|
|
7942
|
-
}
|
|
7943
|
-
),
|
|
8061
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ImageColor, { label: "Background colour", value: background, onChange: (bg) => controller.setPaintOptions({ background: bg }) }),
|
|
7944
8062
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
7945
8063
|
] }),
|
|
7946
8064
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
@@ -8550,32 +8668,12 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
8550
8668
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8551
8669
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
8552
8670
|
"Fill",
|
|
8553
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8554
|
-
"input",
|
|
8555
|
-
{
|
|
8556
|
-
type: "color",
|
|
8557
|
-
"aria-label": "Fill colour",
|
|
8558
|
-
disabled: options.fill === null,
|
|
8559
|
-
value: options.fill ?? "#4f46e5",
|
|
8560
|
-
onChange: (e) => set({ fill: e.target.value }),
|
|
8561
|
-
className: imageColorInputClass
|
|
8562
|
-
}
|
|
8563
|
-
)
|
|
8671
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
8564
8672
|
] }),
|
|
8565
8673
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8566
8674
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
8567
8675
|
"Stroke",
|
|
8568
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
8569
|
-
"input",
|
|
8570
|
-
{
|
|
8571
|
-
type: "color",
|
|
8572
|
-
"aria-label": "Stroke colour",
|
|
8573
|
-
disabled: options.stroke === null,
|
|
8574
|
-
value: options.stroke ?? "#000000",
|
|
8575
|
-
onChange: (e) => set({ stroke: e.target.value }),
|
|
8576
|
-
className: imageColorInputClass
|
|
8577
|
-
}
|
|
8578
|
-
)
|
|
8676
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
8579
8677
|
] }),
|
|
8580
8678
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
8581
8679
|
"Width",
|
|
@@ -8702,7 +8800,7 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
8702
8800
|
] }),
|
|
8703
8801
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": shown.fontWeight >= 600, className: `${imageChipClass(shown.fontWeight >= 600)} font-bold`, onClick: () => style({ fontWeight: shown.fontWeight >= 600 ? 400 : 700 }), children: "B" }),
|
|
8704
8802
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
8705
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
8803
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
8706
8804
|
] }),
|
|
8707
8805
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
8708
8806
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
@@ -9357,15 +9455,7 @@ var ImageEditor = ({
|
|
|
9357
9455
|
)) }),
|
|
9358
9456
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
9359
9457
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
9360
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
9361
|
-
"input",
|
|
9362
|
-
{
|
|
9363
|
-
type: "color",
|
|
9364
|
-
value: activeColor,
|
|
9365
|
-
onChange: (e) => setActiveColor(e.target.value),
|
|
9366
|
-
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
9367
|
-
}
|
|
9368
|
-
),
|
|
9458
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
9369
9459
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
9370
9460
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
9371
9461
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children: "Width:" }),
|
|
@@ -12454,6 +12544,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
|
|
|
12454
12544
|
Histogram,
|
|
12455
12545
|
HistoryManager,
|
|
12456
12546
|
ImageCheckbox,
|
|
12547
|
+
ImageColor,
|
|
12457
12548
|
ImageEditor,
|
|
12458
12549
|
ImageEditorCanvas,
|
|
12459
12550
|
ImageEditorControlsProvider,
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
FreeTransformOptionsBar,
|
|
32
32
|
Histogram,
|
|
33
33
|
ImageCheckbox,
|
|
34
|
+
ImageColor,
|
|
34
35
|
ImageEditor,
|
|
35
36
|
ImageEditorCanvas,
|
|
36
37
|
ImageEditorControlsProvider,
|
|
@@ -49,10 +50,10 @@ import {
|
|
|
49
50
|
useImageEditorControls,
|
|
50
51
|
useImageEffectsTools,
|
|
51
52
|
useImageHistogram
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-ZQ54FEXL.js";
|
|
53
54
|
import "./chunk-AJCWF6SN.js";
|
|
54
|
-
import "./chunk-
|
|
55
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-6BWTJ3EE.js";
|
|
56
|
+
import "./chunk-5RPB4WGT.js";
|
|
56
57
|
import "./chunk-KIRIU53A.js";
|
|
57
58
|
import "./chunk-3I7FOSLF.js";
|
|
58
59
|
import {
|
|
@@ -2547,6 +2548,7 @@ export {
|
|
|
2547
2548
|
Histogram,
|
|
2548
2549
|
HistoryManager2 as HistoryManager,
|
|
2549
2550
|
ImageCheckbox,
|
|
2551
|
+
ImageColor,
|
|
2550
2552
|
ImageEditor,
|
|
2551
2553
|
ImageEditorCanvas,
|
|
2552
2554
|
ImageEditorControlsProvider,
|
|
@@ -2624,7 +2624,8 @@ function resolveParameterComponents(explicit, context) {
|
|
|
2624
2624
|
return {
|
|
2625
2625
|
input: explicit?.input ?? context?.input,
|
|
2626
2626
|
slider: explicit?.slider ?? context?.slider,
|
|
2627
|
-
select: explicit?.select ?? context?.select
|
|
2627
|
+
select: explicit?.select ?? context?.select,
|
|
2628
|
+
color: explicit?.color ?? context?.color
|
|
2628
2629
|
};
|
|
2629
2630
|
}
|
|
2630
2631
|
|
|
@@ -2858,7 +2859,8 @@ function ParameterSelect(props) {
|
|
|
2858
2859
|
}
|
|
2859
2860
|
);
|
|
2860
2861
|
}
|
|
2861
|
-
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
2862
|
+
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }) {
|
|
2863
|
+
const CustomColor = resolveParameterComponents(components, useParameterComponents()).color;
|
|
2862
2864
|
const [open, setOpen] = (0, import_react21.useState)(false);
|
|
2863
2865
|
const containerRef = (0, import_react21.useRef)(null);
|
|
2864
2866
|
const buttonRef = (0, import_react21.useRef)(null);
|
|
@@ -2890,6 +2892,22 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
2890
2892
|
window.removeEventListener("keydown", onKeyDown, true);
|
|
2891
2893
|
};
|
|
2892
2894
|
}, [open]);
|
|
2895
|
+
if (CustomColor) {
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2897
|
+
CustomColor,
|
|
2898
|
+
{
|
|
2899
|
+
id,
|
|
2900
|
+
value: shown,
|
|
2901
|
+
alpha,
|
|
2902
|
+
swatches: field.swatches,
|
|
2903
|
+
disabled: off,
|
|
2904
|
+
label: name,
|
|
2905
|
+
onChange,
|
|
2906
|
+
onGestureStart,
|
|
2907
|
+
onGestureEnd
|
|
2908
|
+
}
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2893
2911
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
2894
2912
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2895
2913
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
EffectParameters,
|
|
6
6
|
EffectsBrowser,
|
|
7
7
|
useEffectDescription
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-6BWTJ3EE.js";
|
|
9
|
+
import "../chunk-5RPB4WGT.js";
|
|
10
10
|
import "../chunk-KIRIU53A.js";
|
|
11
11
|
import "../chunk-3I7FOSLF.js";
|
|
12
12
|
import {
|
|
@@ -56,10 +56,30 @@ export interface ParameterSelectProps {
|
|
|
56
56
|
onChange: (value: string | number) => void;
|
|
57
57
|
}
|
|
58
58
|
/** Host form controls for parameter panels. Any left out fall back to the default controls. */
|
|
59
|
+
/** Props for a custom colour control in parameter panels. */
|
|
60
|
+
export interface ParameterColorProps {
|
|
61
|
+
id?: string;
|
|
62
|
+
/** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
|
|
63
|
+
value: string;
|
|
64
|
+
/** Whether the field has an alpha channel. */
|
|
65
|
+
alpha?: boolean;
|
|
66
|
+
/** Suggested colours for the field, if it has any. */
|
|
67
|
+
swatches?: readonly string[];
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/** The field's label. */
|
|
70
|
+
label: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
style?: React.CSSProperties;
|
|
73
|
+
onChange: (value: string) => void;
|
|
74
|
+
/** A pick starts: changes until `onGestureEnd` merge into one undo step. */
|
|
75
|
+
onGestureStart?: () => void;
|
|
76
|
+
onGestureEnd?: () => void;
|
|
77
|
+
}
|
|
59
78
|
export interface ParameterComponents {
|
|
60
79
|
input?: ComponentType<ParameterInputProps>;
|
|
61
80
|
slider?: ComponentType<ParameterSliderProps>;
|
|
62
81
|
select?: ComponentType<ParameterSelectProps>;
|
|
82
|
+
color?: ComponentType<ParameterColorProps>;
|
|
63
83
|
}
|
|
64
84
|
/** Makes the parameter panels inside it use the host's controls. */
|
|
65
85
|
export declare function ParameterComponentsProvider({ components, children }: {
|
|
@@ -56,10 +56,30 @@ export interface ParameterSelectProps {
|
|
|
56
56
|
onChange: (value: string | number) => void;
|
|
57
57
|
}
|
|
58
58
|
/** Host form controls for parameter panels. Any left out fall back to the default controls. */
|
|
59
|
+
/** Props for a custom colour control in parameter panels. */
|
|
60
|
+
export interface ParameterColorProps {
|
|
61
|
+
id?: string;
|
|
62
|
+
/** `#rrggbb`, or `#rrggbbaa` with `alpha`. */
|
|
63
|
+
value: string;
|
|
64
|
+
/** Whether the field has an alpha channel. */
|
|
65
|
+
alpha?: boolean;
|
|
66
|
+
/** Suggested colours for the field, if it has any. */
|
|
67
|
+
swatches?: readonly string[];
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/** The field's label. */
|
|
70
|
+
label: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
style?: React.CSSProperties;
|
|
73
|
+
onChange: (value: string) => void;
|
|
74
|
+
/** A pick starts: changes until `onGestureEnd` merge into one undo step. */
|
|
75
|
+
onGestureStart?: () => void;
|
|
76
|
+
onGestureEnd?: () => void;
|
|
77
|
+
}
|
|
59
78
|
export interface ParameterComponents {
|
|
60
79
|
input?: ComponentType<ParameterInputProps>;
|
|
61
80
|
slider?: ComponentType<ParameterSliderProps>;
|
|
62
81
|
select?: ComponentType<ParameterSelectProps>;
|
|
82
|
+
color?: ComponentType<ParameterColorProps>;
|
|
63
83
|
}
|
|
64
84
|
/** Makes the parameter panels inside it use the host's controls. */
|
|
65
85
|
export declare function ParameterComponentsProvider({ components, children }: {
|
|
@@ -46,7 +46,7 @@ export declare function ParameterToggle({ field, value, onChange, disabled, id }
|
|
|
46
46
|
/** A dropdown (or segmented buttons with `control: 'segmented'`) for `choice` fields. */
|
|
47
47
|
export declare function ParameterSelect(props: ParameterControlProps<ChoiceParameterField, string | number>): React.JSX.Element;
|
|
48
48
|
/** A colour picker with a hex box and a popup ColorPicker. */
|
|
49
|
-
export declare function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }: ParameterControlProps<ColorParameterField, string>): React.JSX.Element;
|
|
49
|
+
export declare function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }: ParameterControlProps<ColorParameterField, string>): React.JSX.Element;
|
|
50
50
|
/** One number box per component for `vector` fields. */
|
|
51
51
|
export declare function ParameterVector({ field, value, onChange, disabled, id, components }: ParameterControlProps<VectorParameterField, number[]>): React.JSX.Element;
|
|
52
52
|
export interface ParameterImageProps extends ParameterControlProps<ImageParameterField, string> {
|
|
@@ -46,7 +46,7 @@ export declare function ParameterToggle({ field, value, onChange, disabled, id }
|
|
|
46
46
|
/** A dropdown (or segmented buttons with `control: 'segmented'`) for `choice` fields. */
|
|
47
47
|
export declare function ParameterSelect(props: ParameterControlProps<ChoiceParameterField, string | number>): React.JSX.Element;
|
|
48
48
|
/** A colour picker with a hex box and a popup ColorPicker. */
|
|
49
|
-
export declare function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }: ParameterControlProps<ColorParameterField, string>): React.JSX.Element;
|
|
49
|
+
export declare function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id, components }: ParameterControlProps<ColorParameterField, string>): React.JSX.Element;
|
|
50
50
|
/** One number box per component for `vector` fields. */
|
|
51
51
|
export declare function ParameterVector({ field, value, onChange, disabled, id, components }: ParameterControlProps<VectorParameterField, number[]>): React.JSX.Element;
|
|
52
52
|
export interface ParameterImageProps extends ParameterControlProps<ImageParameterField, string> {
|