@pixerate/editor-react 0.114.1 → 0.114.3
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 +342 -215
- package/dist/animation-editor/index.js +2 -2
- package/dist/canvas/index.cjs +520 -393
- package/dist/canvas/index.js +2 -2
- package/dist/chart/index.cjs +2 -2
- package/dist/chart/index.js +1 -1
- package/dist/{chunk-5LFQ2UQZ.js → chunk-354TA5QV.js} +221 -101
- package/dist/{chunk-2INOKIJN.js → chunk-SH63DFOO.js} +345 -297
- package/dist/{chunk-BWEARAWR.js → chunk-TOGMXZM4.js} +40 -18
- package/dist/{chunk-N2F53ESC.js → chunk-VUSYAHIU.js} +2 -2
- package/dist/effects/EffectParameters.d.cts +4 -1
- package/dist/effects/EffectParameters.d.ts +4 -1
- package/dist/effects/index.cjs +348 -221
- package/dist/effects/index.js +2 -2
- package/dist/image-editor/ImageEffectControls.d.cts +4 -1
- package/dist/image-editor/ImageEffectControls.d.ts +4 -1
- package/dist/image-editor/ImageProviderEffectsPanel.d.cts +4 -1
- package/dist/image-editor/ImageProviderEffectsPanel.d.ts +4 -1
- package/dist/image-editor/controls/parameterControls.d.cts +4 -0
- package/dist/image-editor/controls/parameterControls.d.ts +4 -0
- package/dist/image-editor/index.cjs +868 -697
- package/dist/image-editor/index.js +3 -3
- package/dist/index.cjs +1390 -1219
- package/dist/index.js +4 -4
- package/dist/paint-editor/index.cjs +335 -208
- package/dist/paint-editor/index.js +2 -2
- package/dist/parameters/ParametersPanel.d.cts +4 -1
- package/dist/parameters/ParametersPanel.d.ts +4 -1
- package/dist/parameters/controls.d.cts +72 -0
- package/dist/parameters/controls.d.ts +72 -0
- package/dist/parameters/fields.d.cts +19 -6
- package/dist/parameters/fields.d.ts +19 -6
- package/dist/parameters/index.cjs +350 -183
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +70 -14
- package/dist/vector/index.cjs +321 -194
- package/dist/vector/index.js +2 -2
- package/dist/video-editor/index.cjs +418 -291
- package/dist/video-editor/index.js +2 -2
- package/package.json +3 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ParameterFieldControl
|
|
3
|
-
|
|
2
|
+
ParameterFieldControl,
|
|
3
|
+
parameterSelectStyle,
|
|
4
|
+
resolveParameterComponents,
|
|
5
|
+
useParameterComponents
|
|
6
|
+
} from "./chunk-354TA5QV.js";
|
|
4
7
|
|
|
5
8
|
// src/effects/useEffects.ts
|
|
6
9
|
import { useEffect, useState } from "react";
|
|
@@ -154,36 +157,54 @@ function EffectParameters({
|
|
|
154
157
|
renderControlAddon,
|
|
155
158
|
fonts,
|
|
156
159
|
disabled = false,
|
|
157
|
-
className = ""
|
|
160
|
+
className = "",
|
|
161
|
+
components
|
|
158
162
|
}) {
|
|
159
163
|
const fields = useMemo2(() => effectParameterFields(description, { fonts }), [description, fonts]);
|
|
160
164
|
const idBase = useId();
|
|
161
165
|
const gesture = React3.useRef(null);
|
|
162
166
|
const count = React3.useRef(0);
|
|
167
|
+
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
168
|
+
const handlePresetSelect = (name) => {
|
|
169
|
+
if (!name) return;
|
|
170
|
+
if (onPresetName) {
|
|
171
|
+
onPresetName(name);
|
|
172
|
+
} else if (onPreset) {
|
|
173
|
+
const preset = description.presets.find((p) => p.name === name);
|
|
174
|
+
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
163
177
|
return /* @__PURE__ */ jsxs2("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
164
|
-
(onPreset || onPresetName) && description.presets.length > 0 && /* @__PURE__ */
|
|
178
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ jsx3(
|
|
179
|
+
CustomPresetSelect,
|
|
180
|
+
{
|
|
181
|
+
"aria-label": `${description.name} presets`,
|
|
182
|
+
label: `${description.name} presets`,
|
|
183
|
+
value: "",
|
|
184
|
+
disabled,
|
|
185
|
+
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
186
|
+
style: parameterSelectStyle,
|
|
187
|
+
options: [
|
|
188
|
+
{ value: "", label: "Presets\u2026" },
|
|
189
|
+
...description.presets.map((p) => ({ value: p.name, label: p.name }))
|
|
190
|
+
],
|
|
191
|
+
onChange: (name) => handlePresetSelect(String(name))
|
|
192
|
+
}
|
|
193
|
+
) : /* @__PURE__ */ jsxs2(
|
|
165
194
|
"select",
|
|
166
195
|
{
|
|
167
|
-
className: "w-full rounded border border-border
|
|
196
|
+
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
197
|
+
style: parameterSelectStyle,
|
|
168
198
|
"aria-label": `${description.name} presets`,
|
|
169
199
|
value: "",
|
|
170
200
|
disabled,
|
|
171
|
-
onChange: (e) =>
|
|
172
|
-
const name = e.currentTarget.value;
|
|
173
|
-
if (!name) return;
|
|
174
|
-
if (onPresetName) {
|
|
175
|
-
onPresetName(name);
|
|
176
|
-
} else if (onPreset) {
|
|
177
|
-
const preset = description.presets.find((p) => p.name === name);
|
|
178
|
-
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
179
|
-
}
|
|
180
|
-
},
|
|
201
|
+
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
181
202
|
children: [
|
|
182
|
-
/* @__PURE__ */ jsx3("option", { value: "", children: "Presets\u2026" }),
|
|
183
|
-
description.presets.map((p) => /* @__PURE__ */ jsx3("option", { value: p.name, children: p.name }, p.name))
|
|
203
|
+
/* @__PURE__ */ jsx3("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
204
|
+
description.presets.map((p) => /* @__PURE__ */ jsx3("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
184
205
|
]
|
|
185
206
|
}
|
|
186
|
-
),
|
|
207
|
+
)),
|
|
187
208
|
fields.map((field) => {
|
|
188
209
|
const label = parameterLabel(field);
|
|
189
210
|
const inputId = `${idBase}-${field.id}`;
|
|
@@ -204,6 +225,7 @@ function EffectParameters({
|
|
|
204
225
|
value,
|
|
205
226
|
id: inputId,
|
|
206
227
|
disabled: disabled || keyed,
|
|
228
|
+
components,
|
|
207
229
|
onChange: (v) => onChange(field.id, v, gesture.current),
|
|
208
230
|
onGestureStart: () => gesture.current = `${idBase}:${field.id}:${++count.current}`,
|
|
209
231
|
onGestureEnd: () => gesture.current = null
|
|
@@ -300,8 +300,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
300
300
|
left: tipAt.left,
|
|
301
301
|
top: tipAt.top,
|
|
302
302
|
transform: `translate(${tipAt.flip ? "calc(-100% - 12px)" : "12px"}, calc(-100% - 8px))`,
|
|
303
|
-
background: "var(--popover, #ffffff)",
|
|
304
|
-
color: "var(--popover-foreground, #0f172a)",
|
|
303
|
+
background: "var(--popover, var(--background, #ffffff))",
|
|
304
|
+
color: "var(--popover-foreground, var(--foreground, #0f172a))",
|
|
305
305
|
borderColor: "var(--border, #e2e8f0)",
|
|
306
306
|
fontFamily: scene.theme.fontFamily
|
|
307
307
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type EffectDescription, type EffectFieldOptions } from '@pixerate/editor/effects';
|
|
3
3
|
import { type ParameterValue } from '@pixerate/editor/parameters';
|
|
4
|
+
import { type ParameterComponents } from '../parameters/controls.cjs';
|
|
4
5
|
export interface EffectParametersProps {
|
|
5
6
|
/** The effect's description (`describe`). */
|
|
6
7
|
description: EffectDescription;
|
|
@@ -25,10 +26,12 @@ export interface EffectParametersProps {
|
|
|
25
26
|
fonts?: EffectFieldOptions['fonts'];
|
|
26
27
|
disabled?: boolean;
|
|
27
28
|
className?: string;
|
|
29
|
+
/** Custom host controls (input, slider, select). */
|
|
30
|
+
components?: ParameterComponents;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* The parameter panel of an effect, generated from its JSON Schema controls: sliders for bounded
|
|
31
34
|
* numbers, switches, choices, colour pickers, vectors and text, with each control's description,
|
|
32
35
|
* per-control reset and the effect's presets.
|
|
33
36
|
*/
|
|
34
|
-
export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className }: EffectParametersProps): React.JSX.Element;
|
|
37
|
+
export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className, components, }: EffectParametersProps): React.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type EffectDescription, type EffectFieldOptions } from '@pixerate/editor/effects';
|
|
3
3
|
import { type ParameterValue } from '@pixerate/editor/parameters';
|
|
4
|
+
import { type ParameterComponents } from '../parameters/controls.js';
|
|
4
5
|
export interface EffectParametersProps {
|
|
5
6
|
/** The effect's description (`describe`). */
|
|
6
7
|
description: EffectDescription;
|
|
@@ -25,10 +26,12 @@ export interface EffectParametersProps {
|
|
|
25
26
|
fonts?: EffectFieldOptions['fonts'];
|
|
26
27
|
disabled?: boolean;
|
|
27
28
|
className?: string;
|
|
29
|
+
/** Custom host controls (input, slider, select). */
|
|
30
|
+
components?: ParameterComponents;
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
30
33
|
* The parameter panel of an effect, generated from its JSON Schema controls: sliders for bounded
|
|
31
34
|
* numbers, switches, choices, colour pickers, vectors and text, with each control's description,
|
|
32
35
|
* per-control reset and the effect's presets.
|
|
33
36
|
*/
|
|
34
|
-
export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className }: EffectParametersProps): React.JSX.Element;
|
|
37
|
+
export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className, components, }: EffectParametersProps): React.JSX.Element;
|