@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
|
@@ -229,7 +229,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
// src/image-editor/ImageEditor.tsx
|
|
232
|
-
var
|
|
232
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
233
233
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
234
234
|
|
|
235
235
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -2117,7 +2117,7 @@ var LayersPanel = ({ controller, thumbnailSize = 32, psd = true, psdFileName = "
|
|
|
2117
2117
|
};
|
|
2118
2118
|
|
|
2119
2119
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
2120
|
-
var
|
|
2120
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
2121
2121
|
var import_image_editor9 = require("@pixerate/editor/image-editor");
|
|
2122
2122
|
|
|
2123
2123
|
// src/effects/useEffects.ts
|
|
@@ -2257,12 +2257,12 @@ function EffectsBrowser({ provider, uses, kinds, onPick, thumbnails = true, titl
|
|
|
2257
2257
|
}
|
|
2258
2258
|
|
|
2259
2259
|
// src/effects/EffectParameters.tsx
|
|
2260
|
-
var
|
|
2260
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
2261
2261
|
var import_effects3 = require("@pixerate/editor/effects");
|
|
2262
2262
|
var import_parameters2 = require("@pixerate/editor/parameters");
|
|
2263
2263
|
|
|
2264
2264
|
// src/parameters/fields.tsx
|
|
2265
|
-
var
|
|
2265
|
+
var import_react19 = require("react");
|
|
2266
2266
|
var import_parameters = require("@pixerate/editor/parameters");
|
|
2267
2267
|
|
|
2268
2268
|
// src/color/index.ts
|
|
@@ -3304,18 +3304,57 @@ function useResolvedColor(value, scheme) {
|
|
|
3304
3304
|
// src/color/index.ts
|
|
3305
3305
|
__reExport(color_exports, require("@pixerate/editor/color"));
|
|
3306
3306
|
|
|
3307
|
-
// src/parameters/
|
|
3307
|
+
// src/parameters/controls.tsx
|
|
3308
|
+
var import_react18 = require("react");
|
|
3308
3309
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3310
|
+
var ParameterComponentsContext = (0, import_react18.createContext)({});
|
|
3311
|
+
function useParameterComponents() {
|
|
3312
|
+
return (0, import_react18.useContext)(ParameterComponentsContext);
|
|
3313
|
+
}
|
|
3314
|
+
function resolveParameterComponents(explicit, context) {
|
|
3315
|
+
return {
|
|
3316
|
+
input: explicit?.input ?? context?.input,
|
|
3317
|
+
slider: explicit?.slider ?? context?.slider,
|
|
3318
|
+
select: explicit?.select ?? context?.select
|
|
3319
|
+
};
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
// src/parameters/fields.tsx
|
|
3323
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3324
|
+
var parameterInputStyle = import_parameters.parameterThemeStyles.input;
|
|
3325
|
+
var parameterSelectStyle = import_parameters.parameterThemeStyles.select;
|
|
3326
|
+
var parameterButtonStyle = import_parameters.parameterThemeStyles.button;
|
|
3327
|
+
var parameterRangeStyle = import_parameters.parameterThemeStyles.range;
|
|
3309
3328
|
var parameterInputClass = "h-7 w-full min-w-0 rounded-md border border-input bg-background px-2 text-xs text-foreground tabular-nums focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3310
3329
|
var parameterButtonClass = "inline-flex h-7 items-center justify-center gap-1 rounded-md border border-input bg-background px-2 text-xs text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50";
|
|
3311
3330
|
var rangeClass = "h-4 w-full min-w-0 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50";
|
|
3312
|
-
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, ...rest }) {
|
|
3331
|
+
function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown, style, ...rest }) {
|
|
3332
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
3333
|
+
const lastCommitted = (0, import_react19.useRef)(null);
|
|
3334
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
3335
|
+
lastCommitted.current = null;
|
|
3336
|
+
const el = inputRef.current;
|
|
3337
|
+
if (el && el.value !== value) el.value = value;
|
|
3338
|
+
}, [value]);
|
|
3313
3339
|
const commit = (el) => {
|
|
3314
|
-
|
|
3340
|
+
const text = el.value;
|
|
3341
|
+
if (text === value || text === lastCommitted.current) return;
|
|
3342
|
+
onCommit(text, el);
|
|
3343
|
+
lastCommitted.current = el.value === text ? text : null;
|
|
3315
3344
|
};
|
|
3345
|
+
const commitRef = (0, import_react19.useRef)(commit);
|
|
3346
|
+
commitRef.current = commit;
|
|
3347
|
+
(0, import_react19.useEffect)(() => {
|
|
3348
|
+
const el = inputRef.current;
|
|
3349
|
+
if (!el) return;
|
|
3350
|
+
const change = () => commitRef.current(el);
|
|
3351
|
+
el.addEventListener("change", change);
|
|
3352
|
+
return () => el.removeEventListener("change", change);
|
|
3353
|
+
}, [multiline]);
|
|
3316
3354
|
const keyDown = (e) => {
|
|
3317
3355
|
onKeyDown?.(e);
|
|
3318
3356
|
if (e.defaultPrevented) return;
|
|
3357
|
+
if (e.key === "Tab") commit(e.currentTarget);
|
|
3319
3358
|
if (e.key === "Enter" && (!multiline || e.metaKey || e.ctrlKey)) {
|
|
3320
3359
|
e.preventDefault();
|
|
3321
3360
|
commit(e.currentTarget);
|
|
@@ -3325,86 +3364,114 @@ function ParameterCommitInput({ value, onCommit, multiline, className, onKeyDown
|
|
|
3325
3364
|
const props = {
|
|
3326
3365
|
defaultValue: value,
|
|
3327
3366
|
className: className ?? parameterInputClass,
|
|
3367
|
+
style: { ...parameterInputStyle, ...style },
|
|
3328
3368
|
onBlur: (e) => commit(e.currentTarget),
|
|
3329
3369
|
onKeyDown: keyDown,
|
|
3330
3370
|
...rest
|
|
3331
3371
|
};
|
|
3332
|
-
|
|
3372
|
+
const forwarded = rest.ref;
|
|
3373
|
+
const setRef = (el) => {
|
|
3374
|
+
inputRef.current = el;
|
|
3375
|
+
if (typeof forwarded === "function") forwarded(el);
|
|
3376
|
+
else if (forwarded) forwarded.current = el;
|
|
3377
|
+
};
|
|
3378
|
+
return multiline ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("textarea", { ...props, ref: setRef, className: `${props.className} h-auto min-h-[3.5rem] py-1` }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("input", { type: "text", ...props, ref: setRef });
|
|
3333
3379
|
}
|
|
3334
3380
|
var plainNumber = (field, value) => (0, import_parameters.formatParameterNumber)({ ...field, unit: void 0 }, value);
|
|
3335
|
-
function ParameterNumberInput({
|
|
3336
|
-
field,
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3381
|
+
function ParameterNumberInput(props) {
|
|
3382
|
+
const { field, value, onChange, disabled, id, components, "aria-label": ariaLabel } = props;
|
|
3383
|
+
const ctx = useParameterComponents();
|
|
3384
|
+
const resolved = resolveParameterComponents(components, ctx);
|
|
3385
|
+
const CustomInput = resolved.input;
|
|
3386
|
+
const plain = plainNumber(field, value);
|
|
3387
|
+
const handleCommit = (text, input) => {
|
|
3388
|
+
const n = (0, import_parameters.parseParameterNumberInput)(field, text);
|
|
3389
|
+
if (n === null || n === value) {
|
|
3390
|
+
if (input) input.value = plain;
|
|
3391
|
+
} else {
|
|
3392
|
+
onChange(n);
|
|
3393
|
+
}
|
|
3394
|
+
};
|
|
3395
|
+
const handleKeyDown = (e) => {
|
|
3396
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
3397
|
+
e.preventDefault();
|
|
3398
|
+
const step = (0, import_parameters.parameterStep)(field) * (e.shiftKey ? 10 : 1);
|
|
3399
|
+
onChange((0, import_parameters.clampParameterNumber)(field, value + (e.key === "ArrowUp" ? step : -step)));
|
|
3400
|
+
};
|
|
3401
|
+
const inputProps = {
|
|
3402
|
+
id,
|
|
3403
|
+
inputMode: "decimal",
|
|
3404
|
+
"aria-label": ariaLabel ?? (0, import_parameters.parameterLabel)(field),
|
|
3405
|
+
value: plain,
|
|
3406
|
+
disabled: disabled || field.readOnly,
|
|
3407
|
+
className: `${parameterInputClass} ${field.unit ? "pr-6" : ""}`,
|
|
3408
|
+
style: parameterInputStyle,
|
|
3409
|
+
onCommit: handleCommit,
|
|
3410
|
+
onKeyDown: handleKeyDown
|
|
3411
|
+
};
|
|
3412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative min-w-0 flex-1", children: [
|
|
3413
|
+
CustomInput ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CustomInput, { ...inputProps, label: (0, import_parameters.parameterLabel)(field) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterCommitInput, { ...inputProps }),
|
|
3414
|
+
field.unit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground", children: field.unit })
|
|
3367
3415
|
] });
|
|
3368
3416
|
}
|
|
3369
3417
|
function ParameterSlider(props) {
|
|
3370
|
-
const { field, value, onChange, onGestureStart, onGestureEnd, disabled } = props;
|
|
3371
|
-
const
|
|
3418
|
+
const { field, value, onChange, onGestureStart, onGestureEnd, disabled, components } = props;
|
|
3419
|
+
const ctx = useParameterComponents();
|
|
3420
|
+
const resolved = resolveParameterComponents(components, ctx);
|
|
3421
|
+
const CustomSlider = resolved.slider;
|
|
3422
|
+
const dragging = (0, import_react19.useRef)(false);
|
|
3423
|
+
const start = () => {
|
|
3424
|
+
if (dragging.current) return;
|
|
3425
|
+
dragging.current = true;
|
|
3426
|
+
onGestureStart?.();
|
|
3427
|
+
};
|
|
3372
3428
|
const end = () => {
|
|
3373
3429
|
if (!dragging.current) return;
|
|
3374
3430
|
dragging.current = false;
|
|
3375
3431
|
onGestureEnd?.();
|
|
3376
3432
|
};
|
|
3377
|
-
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0,
|
|
3433
|
+
if (!(0, import_parameters.isSliderField)(field)) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props });
|
|
3378
3434
|
const step = (0, import_parameters.parameterStep)(field);
|
|
3379
|
-
|
|
3380
|
-
|
|
3435
|
+
const sliderProps = {
|
|
3436
|
+
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
3437
|
+
"aria-valuetext": (0, import_parameters.formatParameterNumber)(field, value),
|
|
3438
|
+
// A `control: 'slider'` field may leave out a bound: the range input's own defaults.
|
|
3439
|
+
min: field.min ?? 0,
|
|
3440
|
+
max: field.max ?? 100,
|
|
3441
|
+
step,
|
|
3442
|
+
value,
|
|
3443
|
+
disabled: disabled || field.readOnly,
|
|
3444
|
+
className: rangeClass,
|
|
3445
|
+
style: parameterRangeStyle
|
|
3446
|
+
};
|
|
3447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3448
|
+
CustomSlider ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3449
|
+
CustomSlider,
|
|
3450
|
+
{
|
|
3451
|
+
...sliderProps,
|
|
3452
|
+
id: props.id ? `${props.id}-slider` : void 0,
|
|
3453
|
+
label: (0, import_parameters.parameterLabel)(field),
|
|
3454
|
+
onChange: (v) => onChange((0, import_parameters.clampParameterNumber)(field, v)),
|
|
3455
|
+
onGestureStart: start,
|
|
3456
|
+
onGestureEnd: end
|
|
3457
|
+
}
|
|
3458
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3381
3459
|
"input",
|
|
3382
3460
|
{
|
|
3383
3461
|
type: "range",
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
min: field.min,
|
|
3387
|
-
max: field.max,
|
|
3388
|
-
step,
|
|
3389
|
-
value,
|
|
3390
|
-
disabled: disabled || field.readOnly,
|
|
3391
|
-
className: rangeClass,
|
|
3392
|
-
onPointerDown: () => {
|
|
3393
|
-
if (dragging.current) return;
|
|
3394
|
-
dragging.current = true;
|
|
3395
|
-
onGestureStart?.();
|
|
3396
|
-
},
|
|
3462
|
+
...sliderProps,
|
|
3463
|
+
onPointerDown: start,
|
|
3397
3464
|
onPointerUp: end,
|
|
3398
3465
|
onPointerCancel: end,
|
|
3399
3466
|
onBlur: end,
|
|
3400
3467
|
onChange: (e) => onChange((0, import_parameters.clampParameterNumber)(field, Number(e.target.value)))
|
|
3401
3468
|
}
|
|
3402
3469
|
),
|
|
3403
|
-
/* @__PURE__ */ (0,
|
|
3470
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-20 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterNumberInput, { ...props, id: props.id, "aria-label": `${(0, import_parameters.parameterLabel)(field)} value` }) })
|
|
3404
3471
|
] });
|
|
3405
3472
|
}
|
|
3406
3473
|
function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
3407
|
-
return /* @__PURE__ */ (0,
|
|
3474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3408
3475
|
"button",
|
|
3409
3476
|
{
|
|
3410
3477
|
type: "button",
|
|
@@ -3415,7 +3482,7 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3415
3482
|
disabled: disabled || field.readOnly,
|
|
3416
3483
|
onClick: () => onChange(!value),
|
|
3417
3484
|
className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:opacity-50 ${value ? "bg-primary" : "bg-muted"}`,
|
|
3418
|
-
children: /* @__PURE__ */ (0,
|
|
3485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3419
3486
|
"span",
|
|
3420
3487
|
{
|
|
3421
3488
|
className: `pointer-events-none block h-4 w-4 rounded-full bg-background shadow transition-transform ${value ? "translate-x-4" : "translate-x-0.5"}`
|
|
@@ -3424,11 +3491,15 @@ function ParameterToggle({ field, value, onChange, disabled, id }) {
|
|
|
3424
3491
|
}
|
|
3425
3492
|
);
|
|
3426
3493
|
}
|
|
3427
|
-
function ParameterSelect(
|
|
3494
|
+
function ParameterSelect(props) {
|
|
3495
|
+
const { field, value, onChange, disabled, id, components } = props;
|
|
3496
|
+
const ctx = useParameterComponents();
|
|
3497
|
+
const resolved = resolveParameterComponents(components, ctx);
|
|
3498
|
+
const CustomSelect = resolved.select;
|
|
3428
3499
|
const options = (0, import_parameters.getChoiceOptions)(field);
|
|
3429
3500
|
const off = disabled || field.readOnly;
|
|
3430
3501
|
if (field.control === "segmented") {
|
|
3431
|
-
return /* @__PURE__ */ (0,
|
|
3502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { role: "radiogroup", "aria-label": (0, import_parameters.parameterLabel)(field), className: "inline-flex flex-wrap rounded-md border border-input bg-muted p-0.5", children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3432
3503
|
"button",
|
|
3433
3504
|
{
|
|
3434
3505
|
type: "button",
|
|
@@ -3443,8 +3514,25 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3443
3514
|
String(o.value)
|
|
3444
3515
|
)) });
|
|
3445
3516
|
}
|
|
3517
|
+
if (CustomSelect) {
|
|
3518
|
+
const customOptions = options.map((o) => ({ value: o.value, label: (0, import_parameters.choiceOptionLabel)(o), description: o.description }));
|
|
3519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3520
|
+
CustomSelect,
|
|
3521
|
+
{
|
|
3522
|
+
id,
|
|
3523
|
+
label: (0, import_parameters.parameterLabel)(field),
|
|
3524
|
+
"aria-label": (0, import_parameters.parameterLabel)(field),
|
|
3525
|
+
value,
|
|
3526
|
+
options: customOptions,
|
|
3527
|
+
disabled: off,
|
|
3528
|
+
className: parameterInputClass,
|
|
3529
|
+
style: parameterSelectStyle,
|
|
3530
|
+
onChange: (v) => onChange((0, import_parameters.matchParameterOptionValue)(options, v))
|
|
3531
|
+
}
|
|
3532
|
+
);
|
|
3533
|
+
}
|
|
3446
3534
|
const index = options.findIndex((o) => o.value === value);
|
|
3447
|
-
return /* @__PURE__ */ (0,
|
|
3535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3448
3536
|
"select",
|
|
3449
3537
|
{
|
|
3450
3538
|
id,
|
|
@@ -3456,22 +3544,23 @@ function ParameterSelect({ field, value, onChange, disabled, id }) {
|
|
|
3456
3544
|
if (option) onChange(option.value);
|
|
3457
3545
|
},
|
|
3458
3546
|
className: parameterInputClass,
|
|
3459
|
-
|
|
3547
|
+
style: parameterSelectStyle,
|
|
3548
|
+
children: options.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("option", { value: String(i), title: o.description, style: parameterSelectStyle, children: (0, import_parameters.choiceOptionLabel)(o) }, String(o.value)))
|
|
3460
3549
|
}
|
|
3461
3550
|
);
|
|
3462
3551
|
}
|
|
3463
3552
|
function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd, disabled, id }) {
|
|
3464
|
-
const [open, setOpen] = (0,
|
|
3465
|
-
const containerRef = (0,
|
|
3466
|
-
const buttonRef = (0,
|
|
3467
|
-
const popoverRef = (0,
|
|
3553
|
+
const [open, setOpen] = (0, import_react19.useState)(false);
|
|
3554
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
3555
|
+
const buttonRef = (0, import_react19.useRef)(null);
|
|
3556
|
+
const popoverRef = (0, import_react19.useRef)(null);
|
|
3468
3557
|
const alpha = !!field.alpha;
|
|
3469
3558
|
const hex = (0, import_parameters.normalizeHexColor)(value, true) ?? "#000000ff";
|
|
3470
3559
|
const rgb = hex.slice(0, 7);
|
|
3471
3560
|
const shown = alpha ? hex : rgb;
|
|
3472
3561
|
const off = disabled || field.readOnly;
|
|
3473
3562
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3474
|
-
(0,
|
|
3563
|
+
(0, import_react19.useEffect)(() => {
|
|
3475
3564
|
if (!open) return;
|
|
3476
3565
|
const onPointerDown = (e) => {
|
|
3477
3566
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -3492,9 +3581,9 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3492
3581
|
window.removeEventListener("keydown", onKeyDown, true);
|
|
3493
3582
|
};
|
|
3494
3583
|
}, [open]);
|
|
3495
|
-
return /* @__PURE__ */ (0,
|
|
3496
|
-
/* @__PURE__ */ (0,
|
|
3497
|
-
/* @__PURE__ */ (0,
|
|
3584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, className: "relative space-y-1.5", children: [
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3498
3587
|
"button",
|
|
3499
3588
|
{
|
|
3500
3589
|
ref: buttonRef,
|
|
@@ -3505,10 +3594,10 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3505
3594
|
disabled: off,
|
|
3506
3595
|
onClick: () => setOpen((prev) => !prev),
|
|
3507
3596
|
className: "relative h-7 w-9 shrink-0 overflow-hidden rounded-md border border-input bg-[repeating-conic-gradient(#d4d4d8_0_25%,#fff_0_50%)] bg-[length:8px_8px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
3508
|
-
children: /* @__PURE__ */ (0,
|
|
3597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "absolute inset-0", style: { background: shown } })
|
|
3509
3598
|
}
|
|
3510
3599
|
),
|
|
3511
|
-
/* @__PURE__ */ (0,
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3512
3601
|
ParameterCommitInput,
|
|
3513
3602
|
{
|
|
3514
3603
|
id,
|
|
@@ -3524,7 +3613,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3524
3613
|
}
|
|
3525
3614
|
)
|
|
3526
3615
|
] }),
|
|
3527
|
-
open && /* @__PURE__ */ (0,
|
|
3616
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3528
3617
|
"div",
|
|
3529
3618
|
{
|
|
3530
3619
|
ref: popoverRef,
|
|
@@ -3538,7 +3627,7 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3538
3627
|
},
|
|
3539
3628
|
className: "absolute left-0 top-full z-50 mt-1 w-64 rounded-lg border border-border bg-popover p-2 text-popover-foreground shadow-xl",
|
|
3540
3629
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
3541
|
-
children: /* @__PURE__ */ (0,
|
|
3630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3542
3631
|
ColorPicker,
|
|
3543
3632
|
{
|
|
3544
3633
|
value: shown,
|
|
@@ -3554,13 +3643,13 @@ function ParameterColor({ field, value, onChange, onGestureStart, onGestureEnd,
|
|
|
3554
3643
|
)
|
|
3555
3644
|
] });
|
|
3556
3645
|
}
|
|
3557
|
-
function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
3646
|
+
function ParameterVector({ field, value, onChange, disabled, id, components }) {
|
|
3558
3647
|
const size = (0, import_parameters.vectorSize)(field);
|
|
3559
|
-
return /* @__PURE__ */ (0,
|
|
3648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "grid gap-1.5", style: { gridTemplateColumns: `repeat(${size}, minmax(0, 1fr))` }, children: Array.from({ length: size }, (_, i) => {
|
|
3560
3649
|
const component = (0, import_parameters.vectorComponentField)(field, i);
|
|
3561
|
-
return /* @__PURE__ */ (0,
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("label", { className: "flex min-w-0 items-center gap-1", children: [
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "w-3 shrink-0 text-[10px] uppercase text-muted-foreground", children: component.label }),
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3564
3653
|
ParameterNumberInput,
|
|
3565
3654
|
{
|
|
3566
3655
|
field: component,
|
|
@@ -3568,6 +3657,7 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
3568
3657
|
id: i === 0 ? id : void 0,
|
|
3569
3658
|
"aria-label": `${(0, import_parameters.parameterLabel)(field)} ${component.label}`,
|
|
3570
3659
|
disabled: disabled || field.readOnly,
|
|
3660
|
+
components,
|
|
3571
3661
|
onChange: (n) => onChange(Array.from({ length: size }, (_2, j) => j === i ? n : value[j] ?? 0))
|
|
3572
3662
|
}
|
|
3573
3663
|
)
|
|
@@ -3577,11 +3667,11 @@ function ParameterVector({ field, value, onChange, disabled, id }) {
|
|
|
3577
3667
|
function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
3578
3668
|
const off = disabled || field.readOnly;
|
|
3579
3669
|
const name = (0, import_parameters.parameterLabel)(field);
|
|
3580
|
-
return /* @__PURE__ */ (0,
|
|
3581
|
-
/* @__PURE__ */ (0,
|
|
3582
|
-
/* @__PURE__ */ (0,
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
3584
|
-
/* @__PURE__ */ (0,
|
|
3670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "space-y-1.5", children: [
|
|
3671
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex h-12 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md border border-input bg-muted", children: value ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: value, alt: name, className: "h-full w-full object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "None" }) }),
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
3674
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3585
3675
|
ParameterCommitInput,
|
|
3586
3676
|
{
|
|
3587
3677
|
id,
|
|
@@ -3592,30 +3682,48 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3592
3682
|
onCommit: (text) => onChange(text.trim())
|
|
3593
3683
|
}
|
|
3594
3684
|
),
|
|
3595
|
-
/* @__PURE__ */ (0,
|
|
3596
|
-
resolveFile && /* @__PURE__ */ (0,
|
|
3597
|
-
"
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
{
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-1", children: [
|
|
3686
|
+
resolveFile && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3687
|
+
"label",
|
|
3688
|
+
{
|
|
3689
|
+
style: parameterButtonStyle,
|
|
3690
|
+
className: `${parameterButtonClass} cursor-pointer ${off ? "pointer-events-none opacity-50" : ""}`,
|
|
3691
|
+
children: [
|
|
3692
|
+
"Choose file\u2026",
|
|
3693
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3694
|
+
"input",
|
|
3695
|
+
{
|
|
3696
|
+
type: "file",
|
|
3697
|
+
className: "sr-only",
|
|
3698
|
+
accept: field.accept ?? "image/*",
|
|
3699
|
+
disabled: off,
|
|
3700
|
+
"aria-label": `${name} file`,
|
|
3701
|
+
onChange: async (e) => {
|
|
3702
|
+
const file = e.target.files?.[0];
|
|
3703
|
+
e.target.value = "";
|
|
3704
|
+
if (file) onChange(await resolveFile(file));
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
)
|
|
3708
|
+
]
|
|
3709
|
+
}
|
|
3710
|
+
),
|
|
3711
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3712
|
+
"button",
|
|
3713
|
+
{
|
|
3714
|
+
type: "button",
|
|
3715
|
+
style: parameterButtonStyle,
|
|
3716
|
+
className: parameterButtonClass,
|
|
3717
|
+
disabled: off,
|
|
3718
|
+
onClick: () => onChange(""),
|
|
3719
|
+
"aria-label": `Clear ${name}`,
|
|
3720
|
+
children: "Clear"
|
|
3721
|
+
}
|
|
3722
|
+
)
|
|
3615
3723
|
] })
|
|
3616
3724
|
] })
|
|
3617
3725
|
] }),
|
|
3618
|
-
field.options && field.options.length > 0 && /* @__PURE__ */ (0,
|
|
3726
|
+
field.options && field.options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-wrap gap-1", children: field.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3619
3727
|
"button",
|
|
3620
3728
|
{
|
|
3621
3729
|
type: "button",
|
|
@@ -3625,14 +3733,14 @@ function ParameterImage({ field, value, onChange, disabled, id, resolveFile }) {
|
|
|
3625
3733
|
disabled: off,
|
|
3626
3734
|
onClick: () => onChange(o.url),
|
|
3627
3735
|
className: "h-9 w-12 overflow-hidden rounded border border-input aria-pressed:ring-2 aria-pressed:ring-primary",
|
|
3628
|
-
children: /* @__PURE__ */ (0,
|
|
3736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: o.url, alt: "", className: "h-full w-full object-cover" })
|
|
3629
3737
|
},
|
|
3630
3738
|
o.url
|
|
3631
3739
|
)) })
|
|
3632
3740
|
] });
|
|
3633
3741
|
}
|
|
3634
3742
|
function ParameterText({ field, value, onChange, disabled, id }) {
|
|
3635
|
-
return /* @__PURE__ */ (0,
|
|
3743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3636
3744
|
ParameterCommitInput,
|
|
3637
3745
|
{
|
|
3638
3746
|
id,
|
|
@@ -3651,24 +3759,24 @@ function ParameterFieldControl({ field, value, onChange, resolveFile, ...rest })
|
|
|
3651
3759
|
switch (field.type) {
|
|
3652
3760
|
case "number":
|
|
3653
3761
|
case "int":
|
|
3654
|
-
return /* @__PURE__ */ (0,
|
|
3762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSlider, { field, value, onChange: set, ...rest });
|
|
3655
3763
|
case "boolean":
|
|
3656
|
-
return /* @__PURE__ */ (0,
|
|
3764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterToggle, { field, value, onChange: set, ...rest });
|
|
3657
3765
|
case "choice":
|
|
3658
|
-
return /* @__PURE__ */ (0,
|
|
3766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterSelect, { field, value, onChange: set, ...rest });
|
|
3659
3767
|
case "color":
|
|
3660
|
-
return /* @__PURE__ */ (0,
|
|
3768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterColor, { field, value, onChange: set, ...rest });
|
|
3661
3769
|
case "vector":
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
3770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterVector, { field, value, onChange: set, ...rest });
|
|
3663
3771
|
case "image":
|
|
3664
|
-
return /* @__PURE__ */ (0,
|
|
3772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterImage, { field, value, onChange: set, resolveFile, ...rest });
|
|
3665
3773
|
case "text":
|
|
3666
|
-
return /* @__PURE__ */ (0,
|
|
3774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ParameterText, { field, value, onChange: set, ...rest });
|
|
3667
3775
|
}
|
|
3668
3776
|
}
|
|
3669
3777
|
|
|
3670
3778
|
// src/effects/EffectParameters.tsx
|
|
3671
|
-
var
|
|
3779
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3672
3780
|
function EffectParameters({
|
|
3673
3781
|
description,
|
|
3674
3782
|
values,
|
|
@@ -3680,56 +3788,75 @@ function EffectParameters({
|
|
|
3680
3788
|
renderControlAddon,
|
|
3681
3789
|
fonts,
|
|
3682
3790
|
disabled = false,
|
|
3683
|
-
className = ""
|
|
3791
|
+
className = "",
|
|
3792
|
+
components
|
|
3684
3793
|
}) {
|
|
3685
|
-
const fields = (0,
|
|
3686
|
-
const idBase = (0,
|
|
3687
|
-
const gesture =
|
|
3688
|
-
const count =
|
|
3689
|
-
|
|
3690
|
-
|
|
3794
|
+
const fields = (0, import_react20.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
|
|
3795
|
+
const idBase = (0, import_react20.useId)();
|
|
3796
|
+
const gesture = import_react20.default.useRef(null);
|
|
3797
|
+
const count = import_react20.default.useRef(0);
|
|
3798
|
+
const CustomPresetSelect = resolveParameterComponents(components, useParameterComponents()).select;
|
|
3799
|
+
const handlePresetSelect = (name) => {
|
|
3800
|
+
if (!name) return;
|
|
3801
|
+
if (onPresetName) {
|
|
3802
|
+
onPresetName(name);
|
|
3803
|
+
} else if (onPreset) {
|
|
3804
|
+
const preset = description.presets.find((p) => p.name === name);
|
|
3805
|
+
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
3806
|
+
}
|
|
3807
|
+
};
|
|
3808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: `space-y-2 ${className}`, "data-effect-parameters": description.id, children: [
|
|
3809
|
+
(onPreset || onPresetName) && description.presets.length > 0 && (CustomPresetSelect ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3810
|
+
CustomPresetSelect,
|
|
3811
|
+
{
|
|
3812
|
+
"aria-label": `${description.name} presets`,
|
|
3813
|
+
label: `${description.name} presets`,
|
|
3814
|
+
value: "",
|
|
3815
|
+
disabled,
|
|
3816
|
+
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
3817
|
+
style: parameterSelectStyle,
|
|
3818
|
+
options: [
|
|
3819
|
+
{ value: "", label: "Presets\u2026" },
|
|
3820
|
+
...description.presets.map((p) => ({ value: p.name, label: p.name }))
|
|
3821
|
+
],
|
|
3822
|
+
onChange: (name) => handlePresetSelect(String(name))
|
|
3823
|
+
}
|
|
3824
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3691
3825
|
"select",
|
|
3692
3826
|
{
|
|
3693
|
-
className: "w-full rounded border border-border
|
|
3827
|
+
className: "w-full rounded border border-border px-1 py-0.5 text-xs",
|
|
3828
|
+
style: parameterSelectStyle,
|
|
3694
3829
|
"aria-label": `${description.name} presets`,
|
|
3695
3830
|
value: "",
|
|
3696
3831
|
disabled,
|
|
3697
|
-
onChange: (e) =>
|
|
3698
|
-
const name = e.currentTarget.value;
|
|
3699
|
-
if (!name) return;
|
|
3700
|
-
if (onPresetName) {
|
|
3701
|
-
onPresetName(name);
|
|
3702
|
-
} else if (onPreset) {
|
|
3703
|
-
const preset = description.presets.find((p) => p.name === name);
|
|
3704
|
-
if (preset) onPreset({ ...description.defaults, ...preset.values });
|
|
3705
|
-
}
|
|
3706
|
-
},
|
|
3832
|
+
onChange: (e) => handlePresetSelect(e.currentTarget.value),
|
|
3707
3833
|
children: [
|
|
3708
|
-
/* @__PURE__ */ (0,
|
|
3709
|
-
description.presets.map((p) => /* @__PURE__ */ (0,
|
|
3834
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: "", style: parameterSelectStyle, children: "Presets\u2026" }),
|
|
3835
|
+
description.presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("option", { value: p.name, style: parameterSelectStyle, children: p.name }, p.name))
|
|
3710
3836
|
]
|
|
3711
3837
|
}
|
|
3712
|
-
),
|
|
3838
|
+
)),
|
|
3713
3839
|
fields.map((field) => {
|
|
3714
3840
|
const label = (0, import_parameters2.parameterLabel)(field);
|
|
3715
3841
|
const inputId = `${idBase}-${field.id}`;
|
|
3716
3842
|
const keyed = keyframed?.has(field.id) ?? false;
|
|
3717
3843
|
const value = (0, import_effects3.effectFieldValue)(field, values[field.id]);
|
|
3718
3844
|
const changed = !keyed && !(0, import_parameters2.parameterValuesEqual)(value, field.default);
|
|
3719
|
-
return /* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3721
|
-
/* @__PURE__ */ (0,
|
|
3722
|
-
keyed && /* @__PURE__ */ (0,
|
|
3845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "space-y-1", "data-effect-control": field.id, children: [
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
3847
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("label", { htmlFor: inputId, className: "min-w-0 flex-1 truncate text-xs font-medium", title: field.description, children: label }),
|
|
3848
|
+
keyed && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-[10px] text-muted-foreground", children: "keyframed" }),
|
|
3723
3849
|
renderControlAddon?.(field.id),
|
|
3724
|
-
onReset && changed && !disabled && /* @__PURE__ */ (0,
|
|
3850
|
+
onReset && changed && !disabled && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", className: "rounded px-1 text-[11px] text-muted-foreground hover:text-foreground", "aria-label": `Reset ${label}`, onClick: () => onReset(field.id), children: "\u21BA" })
|
|
3725
3851
|
] }),
|
|
3726
|
-
/* @__PURE__ */ (0,
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3727
3853
|
ParameterFieldControl,
|
|
3728
3854
|
{
|
|
3729
3855
|
field,
|
|
3730
3856
|
value,
|
|
3731
3857
|
id: inputId,
|
|
3732
3858
|
disabled: disabled || keyed,
|
|
3859
|
+
components,
|
|
3733
3860
|
onChange: (v) => onChange(field.id, v, gesture.current),
|
|
3734
3861
|
onGestureStart: () => gesture.current = `${idBase}:${field.id}:${++count.current}`,
|
|
3735
3862
|
onGestureEnd: () => gesture.current = null
|
|
@@ -3737,34 +3864,76 @@ function EffectParameters({
|
|
|
3737
3864
|
)
|
|
3738
3865
|
] }, field.id);
|
|
3739
3866
|
}),
|
|
3740
|
-
!fields.length && /* @__PURE__ */ (0,
|
|
3867
|
+
!fields.length && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No controls." })
|
|
3741
3868
|
] });
|
|
3742
3869
|
}
|
|
3743
3870
|
|
|
3871
|
+
// src/image-editor/controls/parameterControls.tsx
|
|
3872
|
+
var import_parameters3 = require("@pixerate/editor/parameters");
|
|
3873
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3874
|
+
function ImageParameterSlider({ value, min, max, step, label, disabled, className, onChange, onGestureStart, onGestureEnd }) {
|
|
3875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3876
|
+
ImageRange,
|
|
3877
|
+
{
|
|
3878
|
+
value,
|
|
3879
|
+
min,
|
|
3880
|
+
max,
|
|
3881
|
+
step,
|
|
3882
|
+
label,
|
|
3883
|
+
disabled,
|
|
3884
|
+
className,
|
|
3885
|
+
onChange,
|
|
3886
|
+
onStart: onGestureStart,
|
|
3887
|
+
onEnd: onGestureEnd
|
|
3888
|
+
}
|
|
3889
|
+
);
|
|
3890
|
+
}
|
|
3891
|
+
function ImageParameterSelect({ value, options, label, disabled, className, onChange }) {
|
|
3892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3893
|
+
ImageSelect,
|
|
3894
|
+
{
|
|
3895
|
+
value: String(value),
|
|
3896
|
+
options: options.map((o) => ({ value: String(o.value), label: o.label })),
|
|
3897
|
+
label,
|
|
3898
|
+
disabled,
|
|
3899
|
+
className,
|
|
3900
|
+
onChange: (v) => onChange((0, import_parameters3.matchParameterOptionValue)(options, v))
|
|
3901
|
+
}
|
|
3902
|
+
);
|
|
3903
|
+
}
|
|
3904
|
+
function imageEditorParameterComponents(controls) {
|
|
3905
|
+
return {
|
|
3906
|
+
slider: controls.Range ? ImageParameterSlider : void 0,
|
|
3907
|
+
select: controls.Select ? ImageParameterSelect : void 0
|
|
3908
|
+
};
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3744
3911
|
// src/image-editor/ImageEffectControls.tsx
|
|
3745
|
-
var
|
|
3746
|
-
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className }) {
|
|
3912
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3913
|
+
function ImageEffectControls({ provider, effect, name, values, onChange, onPreset, className, components }) {
|
|
3747
3914
|
const { description, error } = useEffectDescription(provider, effect);
|
|
3915
|
+
const fallback = resolveParameterComponents(useParameterComponents(), imageEditorParameterComponents(useImageEditorControls()));
|
|
3916
|
+
const effectiveComponents = resolveParameterComponents(components, fallback);
|
|
3748
3917
|
let body;
|
|
3749
|
-
if (!provider) body = /* @__PURE__ */ (0,
|
|
3918
|
+
if (!provider) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "text-[11px] text-muted-foreground", children: [
|
|
3750
3919
|
'No effects provider: "',
|
|
3751
3920
|
name ?? effect,
|
|
3752
3921
|
'" is kept but not drawn.'
|
|
3753
3922
|
] });
|
|
3754
|
-
else if (error) body = /* @__PURE__ */ (0,
|
|
3755
|
-
else if (!description) body = /* @__PURE__ */ (0,
|
|
3756
|
-
else body = /* @__PURE__ */ (0,
|
|
3757
|
-
return /* @__PURE__ */ (0,
|
|
3923
|
+
else if (error) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-amber-600", children: error });
|
|
3924
|
+
else if (!description) body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Loading\u2026" });
|
|
3925
|
+
else body = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(EffectParameters, { description, values, onChange, onReset: (k) => onChange(k, description.defaults[k], null), onPreset, components: effectiveComponents });
|
|
3926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className, "data-testid": "image-effect-controls", children: body });
|
|
3758
3927
|
}
|
|
3759
3928
|
|
|
3760
3929
|
// src/image-editor/ImageProviderEffectsPanel.tsx
|
|
3761
|
-
var
|
|
3762
|
-
function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
3763
|
-
const [, setTick] = (0,
|
|
3764
|
-
(0,
|
|
3765
|
-
const [browse, setBrowse] = (0,
|
|
3766
|
-
const [message, setMessage] = (0,
|
|
3767
|
-
const [open, setOpen] = (0,
|
|
3930
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3931
|
+
function ImageProviderEffectsPanel({ controller, className = "", components }) {
|
|
3932
|
+
const [, setTick] = (0, import_react21.useState)(0);
|
|
3933
|
+
(0, import_react21.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
3934
|
+
const [browse, setBrowse] = (0, import_react21.useState)(null);
|
|
3935
|
+
const [message, setMessage] = (0, import_react21.useState)(null);
|
|
3936
|
+
const [open, setOpen] = (0, import_react21.useState)(null);
|
|
3768
3937
|
const provider = controller.effectsProvider;
|
|
3769
3938
|
const state = controller.getState();
|
|
3770
3939
|
const layer = state.activeLayerId ? (0, import_image_editor9.findLayer)(state.layers, state.activeLayerId)?.layer ?? null : null;
|
|
@@ -3772,7 +3941,7 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3772
3941
|
setMessage(null);
|
|
3773
3942
|
Promise.resolve().then(work).catch((e) => setMessage(e instanceof Error ? e.message : String(e)));
|
|
3774
3943
|
};
|
|
3775
|
-
const drags =
|
|
3944
|
+
const drags = import_react21.default.useRef(/* @__PURE__ */ new Set());
|
|
3776
3945
|
const commit = (gesture) => {
|
|
3777
3946
|
if (gesture) {
|
|
3778
3947
|
if (!drags.current.has(gesture)) {
|
|
@@ -3786,75 +3955,77 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3786
3955
|
const filters = layer?.type === "smart" ? (layer.smartFilters?.filters ?? []).filter((f) => f.kind === "effect") : [];
|
|
3787
3956
|
const generator = layer?.type === "pixel" ? layer.generator : void 0;
|
|
3788
3957
|
const canFilter = !!layer && layer.type !== "adjustment" && layer.type !== "annotation";
|
|
3789
|
-
return /* @__PURE__ */ (0,
|
|
3790
|
-
/* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3792
|
-
/* @__PURE__ */ (0,
|
|
3793
|
-
/* @__PURE__ */ (0,
|
|
3958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("section", { className: `flex flex-col gap-2 text-xs ${className}`, "aria-label": "Provider effects", "data-image-provider-effects": "", children: [
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3960
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-semibold uppercase tracking-wider text-[11px] text-foreground", children: "Effects" }),
|
|
3961
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider || !canFilter, "aria-pressed": browse === "filter", onClick: () => setBrowse(browse === "filter" ? null : "filter"), children: "Apply effect\u2026" }),
|
|
3962
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: !provider, "aria-pressed": browse === "layer", onClick: () => setBrowse(browse === "layer" ? null : "layer"), children: "Effect layer\u2026" })
|
|
3794
3963
|
] }),
|
|
3795
|
-
!provider && /* @__PURE__ */ (0,
|
|
3796
|
-
browse === "filter" && layer && /* @__PURE__ */ (0,
|
|
3797
|
-
browse === "layer" && /* @__PURE__ */ (0,
|
|
3798
|
-
generator && layer && /* @__PURE__ */ (0,
|
|
3799
|
-
/* @__PURE__ */ (0,
|
|
3800
|
-
/* @__PURE__ */ (0,
|
|
3801
|
-
/* @__PURE__ */ (0,
|
|
3964
|
+
!provider && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "No effects provider is registered. Effects in the document are kept." }),
|
|
3965
|
+
browse === "filter" && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: ["filter"], title: "Filters", onPick: (e) => (setBrowse(null), run(() => controller.applyEffectFilter(layer.id, e.id))) }),
|
|
3966
|
+
browse === "layer" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EffectsBrowser, { provider, uses: import_image_editor9.EFFECT_LAYER_USES, title: "Generators and overlays", onPick: (e) => (setBrowse(null), run(() => controller.addEffectLayer(e.id))) }),
|
|
3967
|
+
generator && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "space-y-1", "data-effect-part": "generator", children: [
|
|
3968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3969
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "flex-1 font-medium text-foreground", children: generator.name ?? generator.effect }),
|
|
3970
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, title: "Keep the pixels as a plain layer", onClick: () => run(() => controller.rasterizeEffectLayer(layer.id)), children: "Rasterize" })
|
|
3802
3971
|
] }),
|
|
3803
|
-
/* @__PURE__ */ (0,
|
|
3972
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3804
3973
|
ImageEffectControls,
|
|
3805
3974
|
{
|
|
3806
3975
|
provider,
|
|
3807
3976
|
effect: generator.effect,
|
|
3808
3977
|
name: generator.name,
|
|
3809
3978
|
values: generator.values,
|
|
3979
|
+
components,
|
|
3810
3980
|
onChange: (k, v, gesture) => run(() => controller.updateEffectLayer(layer.id, { values: { [k]: v } }, commit(gesture))),
|
|
3811
3981
|
onPreset: (values) => run(() => controller.updateEffectLayer(layer.id, { values }))
|
|
3812
3982
|
}
|
|
3813
3983
|
)
|
|
3814
3984
|
] }),
|
|
3815
|
-
filters.length > 0 && layer && /* @__PURE__ */ (0,
|
|
3985
|
+
filters.length > 0 && layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ol", { className: "space-y-1", "data-effect-part": "filters", children: filters.map((f) => {
|
|
3816
3986
|
const label = f.kind === "effect" ? f.name ?? f.effect : f.kind;
|
|
3817
3987
|
const all = layer.smartFilters.filters;
|
|
3818
3988
|
const index = all.indexOf(f);
|
|
3819
3989
|
if (f.kind !== "effect") return null;
|
|
3820
|
-
return /* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3822
|
-
/* @__PURE__ */ (0,
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("li", { className: "rounded border border-border p-1", "data-smart-effect": f.id, children: [
|
|
3991
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3992
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3993
|
+
ImageCheckbox,
|
|
3994
|
+
{
|
|
3995
|
+
checked: f.enabled,
|
|
3996
|
+
label: `${label} on`,
|
|
3997
|
+
onChange: (enabled) => run(() => controller.updateEffectFilter(layer.id, f.id, { enabled }))
|
|
3998
|
+
}
|
|
3999
|
+
),
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "min-w-0 flex-1 truncate text-left text-foreground", "aria-expanded": open === f.id, onClick: () => setOpen(open === f.id ? null : f.id), children: label }),
|
|
4001
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === all.length - 1, "aria-label": "Move up", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index + 1 })), children: "\u2191" }),
|
|
4002
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, disabled: index === 0, "aria-label": "Move down", onClick: () => run(() => controller.updateEffectFilter(layer.id, f.id, { index: index - 1 })), children: "\u2193" }),
|
|
4003
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: imageOutlineButtonClass, "aria-label": `Remove ${label}`, onClick: () => run(() => controller.removeSmartFilter(layer.id, f.id)), children: "\u2715" })
|
|
3830
4004
|
] }),
|
|
3831
|
-
open === f.id && /* @__PURE__ */ (0,
|
|
3832
|
-
/* @__PURE__ */ (0,
|
|
3833
|
-
/* @__PURE__ */ (0,
|
|
3834
|
-
/* @__PURE__ */ (0,
|
|
3835
|
-
|
|
4005
|
+
open === f.id && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "mt-1 space-y-2", children: [
|
|
4006
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4007
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "w-14 text-[11px] text-foreground", children: "Opacity" }),
|
|
4008
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4009
|
+
ImageRange,
|
|
3836
4010
|
{
|
|
3837
|
-
type: "range",
|
|
3838
4011
|
min: 0,
|
|
3839
4012
|
max: 1,
|
|
3840
4013
|
step: 0.01,
|
|
3841
4014
|
className: "flex-1",
|
|
3842
4015
|
value: f.opacity,
|
|
3843
|
-
|
|
3844
|
-
onChange: (
|
|
3845
|
-
const opacity = Number(e.currentTarget.value);
|
|
3846
|
-
run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }));
|
|
3847
|
-
}
|
|
4016
|
+
label: `${label} opacity`,
|
|
4017
|
+
onChange: (opacity) => run(() => controller.updateEffectFilter(layer.id, f.id, { opacity }))
|
|
3848
4018
|
}
|
|
3849
4019
|
)
|
|
3850
4020
|
] }),
|
|
3851
|
-
/* @__PURE__ */ (0,
|
|
4021
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3852
4022
|
ImageEffectControls,
|
|
3853
4023
|
{
|
|
3854
4024
|
provider,
|
|
3855
4025
|
effect: f.effect,
|
|
3856
4026
|
name: f.name,
|
|
3857
4027
|
values: f.values,
|
|
4028
|
+
components,
|
|
3858
4029
|
onChange: (k, v, gesture) => run(() => controller.updateEffectFilter(layer.id, f.id, { values: { [k]: v } }, commit(gesture))),
|
|
3859
4030
|
onPreset: (values) => run(() => controller.updateEffectFilter(layer.id, f.id, { values }))
|
|
3860
4031
|
}
|
|
@@ -3862,13 +4033,13 @@ function ImageProviderEffectsPanel({ controller, className = "" }) {
|
|
|
3862
4033
|
] })
|
|
3863
4034
|
] }, f.id);
|
|
3864
4035
|
}) }),
|
|
3865
|
-
!layer && /* @__PURE__ */ (0,
|
|
3866
|
-
message && /* @__PURE__ */ (0,
|
|
4036
|
+
!layer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-[11px] text-muted-foreground", children: "Select a layer to apply effects to it." }),
|
|
4037
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { role: "alert", className: "text-[11px] text-destructive", children: message })
|
|
3867
4038
|
] });
|
|
3868
4039
|
}
|
|
3869
4040
|
|
|
3870
4041
|
// src/image-editor/BrushOptionsBar.tsx
|
|
3871
|
-
var
|
|
4042
|
+
var import_react23 = require("react");
|
|
3872
4043
|
var import_image_editor11 = require("@pixerate/editor/image-editor");
|
|
3873
4044
|
var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
3874
4045
|
|
|
@@ -3876,8 +4047,8 @@ var import_image_editor12 = require("@pixerate/editor/image-editor");
|
|
|
3876
4047
|
var import_image_editor10 = require("@pixerate/editor/image-editor");
|
|
3877
4048
|
|
|
3878
4049
|
// src/paint-editor/PaintGradientEditorView.tsx
|
|
3879
|
-
var
|
|
3880
|
-
var
|
|
4050
|
+
var import_react22 = require("react");
|
|
4051
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3881
4052
|
var button = "px-2 py-1 rounded text-[11px] bg-slate-800 text-slate-200 hover:bg-slate-700 disabled:opacity-40";
|
|
3882
4053
|
var select = "rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
3883
4054
|
var number = "w-16 rounded bg-slate-800 px-1 py-0.5 text-[11px]";
|
|
@@ -3898,7 +4069,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3898
4069
|
reversePaintGradient,
|
|
3899
4070
|
updatePaintGradientStop
|
|
3900
4071
|
} = kit;
|
|
3901
|
-
const [selected, setSelected] = (0,
|
|
4072
|
+
const [selected, setSelected] = (0, import_react22.useState)(0);
|
|
3902
4073
|
const sel = Math.min(selected, value.stops.length - 1);
|
|
3903
4074
|
const stop = value.stops[sel];
|
|
3904
4075
|
const map = value.map;
|
|
@@ -3908,15 +4079,15 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3908
4079
|
setSelected(r.index);
|
|
3909
4080
|
onChange(r.paint);
|
|
3910
4081
|
};
|
|
3911
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
-
/* @__PURE__ */ (0,
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
3914
|
-
/* @__PURE__ */ (0,
|
|
3915
|
-
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0,
|
|
4082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: `flex flex-col gap-1.5 text-xs text-slate-200 ${className ?? ""}`, "data-testid": "paint-gradient-editor", "aria-label": "Gradient paint", children: [
|
|
4083
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4084
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Gradient preset", className: select, value: "", onChange: (e) => e.target.value && (setSelected(0), onChange(PAINT_GRADIENT_PRESETS[Number(e.target.value)].paint)), children: [
|
|
4085
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Presets\u2026" }),
|
|
4086
|
+
PAINT_GRADIENT_PRESETS.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: i, children: p.name }, p.name))
|
|
3916
4087
|
] }),
|
|
3917
|
-
/* @__PURE__ */ (0,
|
|
4088
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, onClick: () => onChange(reversePaintGradient(value)), children: "Reverse" })
|
|
3918
4089
|
] }),
|
|
3919
|
-
/* @__PURE__ */ (0,
|
|
4090
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3920
4091
|
"div",
|
|
3921
4092
|
{
|
|
3922
4093
|
role: "slider",
|
|
@@ -3938,7 +4109,7 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3938
4109
|
}
|
|
3939
4110
|
}
|
|
3940
4111
|
),
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
4112
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative h-4", "aria-label": "Stops", children: value.stops.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3942
4113
|
"button",
|
|
3943
4114
|
{
|
|
3944
4115
|
type: "button",
|
|
@@ -3950,63 +4121,63 @@ var PaintGradientEditorView = ({ value, onChange, colors, className, kit }) => {
|
|
|
3950
4121
|
},
|
|
3951
4122
|
i
|
|
3952
4123
|
)) }),
|
|
3953
|
-
/* @__PURE__ */ (0,
|
|
3954
|
-
/* @__PURE__ */ (0,
|
|
3955
|
-
/* @__PURE__ */ (0,
|
|
3956
|
-
/* @__PURE__ */ (0,
|
|
3957
|
-
/* @__PURE__ */ (0,
|
|
4124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-stop", children: [
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Stop colour source", className: select, value: stop.color === "paint" || stop.color === "secondary" ? stop.color : "color", onChange: (e) => patchStop({ color: e.target.value === "color" ? stopHex(stop.color) : e.target.value }), children: [
|
|
4126
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "color", children: "Colour" }),
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "paint", children: "Paint colour" }),
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "secondary", children: "Second colour" })
|
|
3958
4129
|
] }),
|
|
3959
|
-
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0,
|
|
3960
|
-
/* @__PURE__ */ (0,
|
|
4130
|
+
stop.color !== "paint" && stop.color !== "secondary" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "color", "aria-label": "Stop colour", value: stop.color, onChange: (e) => patchStop({ color: e.target.value }), className: "h-6 w-8 rounded bg-transparent" }),
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3961
4132
|
"At",
|
|
3962
|
-
/* @__PURE__ */ (0,
|
|
4133
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop position", min: 0, max: 100, step: 1, value: pct(stop.offset), onChange: (e) => patchStop({ offset: Number(e.target.value) / 100 }), className: number }),
|
|
3963
4134
|
"%"
|
|
3964
4135
|
] }),
|
|
3965
|
-
/* @__PURE__ */ (0,
|
|
4136
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3966
4137
|
"Opacity",
|
|
3967
|
-
/* @__PURE__ */ (0,
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop opacity", min: 0, max: 100, step: 5, value: pct(stop.opacity ?? 1), onChange: (e) => patchStop({ opacity: Number(e.target.value) / 100 }), className: number }),
|
|
3968
4139
|
"%"
|
|
3969
4140
|
] }),
|
|
3970
|
-
sel < value.stops.length - 1 && /* @__PURE__ */ (0,
|
|
4141
|
+
sel < value.stops.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
3971
4142
|
"Midpoint",
|
|
3972
|
-
/* @__PURE__ */ (0,
|
|
4143
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Stop midpoint", min: 5, max: 95, step: 1, value: pct(stop.midpoint ?? 0.5), onChange: (e) => patchStop({ midpoint: Number(e.target.value) / 100 }), className: number }),
|
|
3973
4144
|
"%"
|
|
3974
4145
|
] }),
|
|
3975
|
-
/* @__PURE__ */ (0,
|
|
4146
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { type: "button", className: button, disabled: value.stops.length <= 2, onClick: () => (setSelected(Math.max(0, sel - 1)), onChange(removePaintGradientStop(value, sel))), children: "Remove stop" })
|
|
3976
4147
|
] }),
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3979
|
-
map.by === "distance" && /* @__PURE__ */ (0,
|
|
3980
|
-
/* @__PURE__ */ (0,
|
|
3981
|
-
/* @__PURE__ */ (0,
|
|
3982
|
-
/* @__PURE__ */ (0,
|
|
3983
|
-
/* @__PURE__ */ (0,
|
|
4148
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-1", "data-testid": "paint-gradient-mapping", children: [
|
|
4149
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient follows", className: select, value: map.by, onChange: (e) => onChange({ ...value, map: paintGradientMappingFor(e.target.value, map) }), children: PAINT_GRADIENT_MAPPINGS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: m, children: PAINT_GRADIENT_MAPPING_LABELS[m] }, m)) }),
|
|
4150
|
+
map.by === "distance" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Gradient length", min: 1, max: 1e5, value: map.length, onChange: (e) => onChange({ ...value, map: { ...map, length: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { "aria-label": "Gradient length unit", className: select, value: map.unit ?? "px", onChange: (e) => onChange({ ...value, map: { ...map, unit: e.target.value } }), children: [
|
|
4153
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "px", children: "px" }),
|
|
4154
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "dabs", children: "dabs" })
|
|
3984
4155
|
] })
|
|
3985
4156
|
] }),
|
|
3986
|
-
map.by === "time" && /* @__PURE__ */ (0,
|
|
3987
|
-
map.by === "random" && /* @__PURE__ */ (0,
|
|
3988
|
-
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0,
|
|
4157
|
+
map.by === "time" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Gradient duration", min: 1, max: 6e5, value: map.duration, onChange: (e) => onChange({ ...value, map: { ...map, duration: Math.max(1, Number(e.target.value) || 1) } }), className: number }),
|
|
4158
|
+
map.by === "random" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "number", "aria-label": "Dabs per pick", min: 1, max: 500, value: map.every ?? 1, onChange: (e) => onChange({ ...value, map: { ...map, every: Math.max(1, Math.round(Number(e.target.value) || 1)) } }), className: number }),
|
|
4159
|
+
(map.by === "distance" || map.by === "time") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient repeat", className: select, value: map.repeat ?? "clamp", onChange: (e) => onChange({ ...value, map: { ...map, repeat: e.target.value } }), children: PAINT_GRADIENT_REPEATS.map((r) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: r, children: PAINT_GRADIENT_REPEAT_LABELS[r] }, r)) })
|
|
3989
4160
|
] }),
|
|
3990
|
-
/* @__PURE__ */ (0,
|
|
3991
|
-
/* @__PURE__ */ (0,
|
|
3992
|
-
/* @__PURE__ */ (0,
|
|
4161
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4162
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("select", { "aria-label": "Gradient mixing", className: select, value: value.space, onChange: (e) => onChange({ ...value, space: e.target.value }), children: PAINT_GRADIENT_SPACES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: s, children: PAINT_GRADIENT_SPACE_LABELS[s] }, s)) }),
|
|
4163
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex flex-1 items-center gap-1", children: [
|
|
3993
4164
|
"Softness",
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "range", "aria-label": "Gradient softness", min: 0, max: 1, step: 0.05, value: value.softness ?? 1, onChange: (e) => onChange({ ...value, softness: Number(e.target.value) }), className: "flex-1 accent-indigo-500" })
|
|
3995
4166
|
] })
|
|
3996
4167
|
] })
|
|
3997
4168
|
] });
|
|
3998
4169
|
};
|
|
3999
4170
|
|
|
4000
4171
|
// src/image-editor/PaintGradientEditor.tsx
|
|
4001
|
-
var
|
|
4002
|
-
var PaintGradientEditor = (props) => /* @__PURE__ */ (0,
|
|
4172
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4173
|
+
var PaintGradientEditor = (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaintGradientEditorView, { ...props, kit: import_image_editor10.PAINT_GRADIENT_KIT });
|
|
4003
4174
|
|
|
4004
4175
|
// src/image-editor/BrushOptionsBar.tsx
|
|
4005
|
-
var
|
|
4176
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4006
4177
|
var BrushOptionsBar = ({ controller, className }) => {
|
|
4007
|
-
const [, setTick] = (0,
|
|
4008
|
-
(0,
|
|
4009
|
-
const [error, setError] = (0,
|
|
4178
|
+
const [, setTick] = (0, import_react23.useState)(0);
|
|
4179
|
+
(0, import_react23.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4180
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
4010
4181
|
const state = controller.getState();
|
|
4011
4182
|
const { brush, foreground, background, mixer, mixerLoad, retouch, cloneSource, paint } = state.paint;
|
|
4012
4183
|
const tool = state.activeTool;
|
|
@@ -4018,8 +4189,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4018
4189
|
setError((0, import_image_editor12.userErrorMessage)(err));
|
|
4019
4190
|
}
|
|
4020
4191
|
};
|
|
4021
|
-
return /* @__PURE__ */ (0,
|
|
4022
|
-
/* @__PURE__ */ (0,
|
|
4192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "brush-options", children: [
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Paint tools", children: import_image_editor11.PAINT_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4023
4194
|
"button",
|
|
4024
4195
|
{
|
|
4025
4196
|
type: "button",
|
|
@@ -4031,9 +4202,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4031
4202
|
},
|
|
4032
4203
|
t.id
|
|
4033
4204
|
)) }),
|
|
4034
|
-
/* @__PURE__ */ (0,
|
|
4035
|
-
/* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", role: "group", "aria-label": "Colours", children: [
|
|
4206
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4037
4208
|
"input",
|
|
4038
4209
|
{
|
|
4039
4210
|
type: "color",
|
|
@@ -4043,10 +4214,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4043
4214
|
className: imageColorInputClass
|
|
4044
4215
|
}
|
|
4045
4216
|
),
|
|
4046
|
-
/* @__PURE__ */ (0,
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "FG" })
|
|
4047
4218
|
] }),
|
|
4048
|
-
/* @__PURE__ */ (0,
|
|
4049
|
-
/* @__PURE__ */ (0,
|
|
4219
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4220
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4050
4221
|
"input",
|
|
4051
4222
|
{
|
|
4052
4223
|
type: "color",
|
|
@@ -4056,11 +4227,11 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4056
4227
|
className: imageColorInputClass
|
|
4057
4228
|
}
|
|
4058
4229
|
),
|
|
4059
|
-
/* @__PURE__ */ (0,
|
|
4230
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: "BG" })
|
|
4060
4231
|
] }),
|
|
4061
|
-
/* @__PURE__ */ (0,
|
|
4062
|
-
/* @__PURE__ */ (0,
|
|
4063
|
-
state.activeTool === "brush" && /* @__PURE__ */ (0,
|
|
4232
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Swap colours (X)", className: imageChipClass(false), onClick: () => controller.swapPaintColors(), children: "Swap" }),
|
|
4233
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Default colours (D)", className: imageChipClass(false), onClick: () => controller.resetPaintColors(), children: "Default" }),
|
|
4234
|
+
state.activeTool === "brush" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4064
4235
|
"button",
|
|
4065
4236
|
{
|
|
4066
4237
|
type: "button",
|
|
@@ -4072,8 +4243,8 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4072
4243
|
}
|
|
4073
4244
|
)
|
|
4074
4245
|
] }),
|
|
4075
|
-
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0,
|
|
4076
|
-
import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4246
|
+
state.activeTool === "brush" && paint.type === "gradient" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaintGradientEditor, { value: paint, colors: { paint: foreground, secondary: background }, onChange: (g) => attempt(() => controller.setPaintOptions({ paint: g })) }),
|
|
4247
|
+
import_image_editor11.BRUSH_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4077
4248
|
ControlSlider,
|
|
4078
4249
|
{
|
|
4079
4250
|
spec,
|
|
@@ -4082,9 +4253,9 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4082
4253
|
},
|
|
4083
4254
|
spec.id
|
|
4084
4255
|
)),
|
|
4085
|
-
state.activeTool === "mixer" && /* @__PURE__ */ (0,
|
|
4086
|
-
/* @__PURE__ */ (0,
|
|
4087
|
-
/* @__PURE__ */ (0,
|
|
4256
|
+
state.activeTool === "mixer" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Mixer Brush", "data-testid": "mixer-options", children: [
|
|
4257
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4258
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4088
4259
|
"span",
|
|
4089
4260
|
{
|
|
4090
4261
|
"aria-label": "Brush load",
|
|
@@ -4093,10 +4264,10 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4093
4264
|
style: { background: mixerLoad.reservoir ? (0, import_image_editor11.rgbUnitToHex)(mixerLoad.reservoir) : "transparent" }
|
|
4094
4265
|
}
|
|
4095
4266
|
),
|
|
4096
|
-
/* @__PURE__ */ (0,
|
|
4097
|
-
/* @__PURE__ */ (0,
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Fill the reservoir with the foreground colour", className: imageChipClass(false), onClick: () => controller.loadMixerBrush(), children: "Load brush" }),
|
|
4268
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Empty the picked-up colour", className: imageChipClass(false), onClick: () => controller.cleanMixerBrush(), children: "Clean brush" })
|
|
4098
4269
|
] }),
|
|
4099
|
-
/* @__PURE__ */ (0,
|
|
4270
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Mixing", children: import_image_editor11.MIXER_MIXING_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4100
4271
|
"button",
|
|
4101
4272
|
{
|
|
4102
4273
|
type: "button",
|
|
@@ -4108,34 +4279,34 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4108
4279
|
},
|
|
4109
4280
|
m.id
|
|
4110
4281
|
)) }),
|
|
4111
|
-
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4112
|
-
/* @__PURE__ */ (0,
|
|
4113
|
-
/* @__PURE__ */ (0,
|
|
4114
|
-
/* @__PURE__ */ (0,
|
|
4282
|
+
import_image_editor11.MIXER_OPTION_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: mixer[spec.id], onChange: (v) => controller.setPaintOptions({ mixer: { [spec.id]: v } }) }, spec.id)),
|
|
4283
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", children: [
|
|
4284
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Load the brush after each stroke", checked: mixer.loadEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { loadEachStroke: on } }) }),
|
|
4115
4286
|
"Load each stroke"
|
|
4116
4287
|
] }),
|
|
4117
|
-
/* @__PURE__ */ (0,
|
|
4118
|
-
/* @__PURE__ */ (0,
|
|
4288
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4289
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Clean the brush after each stroke", checked: mixer.cleanEachStroke, onChange: (on) => controller.setPaintOptions({ mixer: { cleanEachStroke: on } }) }),
|
|
4119
4290
|
"Clean each stroke"
|
|
4120
4291
|
] })
|
|
4121
4292
|
] })
|
|
4122
4293
|
] }),
|
|
4123
|
-
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0,
|
|
4124
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4125
|
-
/* @__PURE__ */ (0,
|
|
4126
|
-
cloneSource && /* @__PURE__ */ (0,
|
|
4294
|
+
(0, import_image_editor11.isRetouchPaintTool)(tool) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-2 border-t border-border pt-2", role: "group", "aria-label": "Retouch options", "data-testid": "retouch-options", children: [
|
|
4295
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", "data-testid": "clone-source", children: (0, import_image_editor11.cloneSourceLabel)(controller) }),
|
|
4297
|
+
cloneSource && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Forget the source point", className: imageChipClass(false), onClick: () => controller.setCloneSource(null), children: "Clear source" })
|
|
4127
4298
|
] }),
|
|
4128
|
-
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0,
|
|
4129
|
-
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
4130
|
-
/* @__PURE__ */ (0,
|
|
4131
|
-
/* @__PURE__ */ (0,
|
|
4132
|
-
/* @__PURE__ */ (0,
|
|
4133
|
-
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0,
|
|
4299
|
+
(tool === "clone" || tool === "heal") && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col gap-1", role: "group", "aria-label": "Clone source transform", "data-testid": "clone-transform", children: [
|
|
4300
|
+
import_image_editor11.CLONE_TRANSFORM_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: (0, import_image_editor11.cloneTransformView)(controller)[spec.id], onChange: (v) => (0, import_image_editor11.setCloneTransformValue)(controller, spec.id, v) }, spec.id)),
|
|
4301
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipH, title: "Mirror the source left to right", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipH), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipH"), children: "Flip H" }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", "aria-pressed": (0, import_image_editor11.cloneTransformView)(controller).flipV, title: "Mirror the source top to bottom", className: imageChipClass((0, import_image_editor11.cloneTransformView)(controller).flipV), onClick: () => (0, import_image_editor11.setCloneTransformValue)(controller, "flipV"), children: "Flip V" }),
|
|
4304
|
+
!(0, import_image_editor11.cloneTransformView)(controller).identity && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", title: "Back to 100 %, no flip, 0\xB0", className: imageChipClass(false), onClick: () => controller.setCloneTransform(null), children: "Reset transform" })
|
|
4134
4305
|
] })
|
|
4135
4306
|
] }),
|
|
4136
|
-
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0,
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4138
|
-
choice.options.map((o) => /* @__PURE__ */ (0,
|
|
4307
|
+
import_image_editor11.RETOUCH_CHOICES.filter((c) => c.tools.includes(tool)).map((choice) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": choice.label, children: [
|
|
4308
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-muted-foreground", children: choice.label }),
|
|
4309
|
+
choice.options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4139
4310
|
"button",
|
|
4140
4311
|
{
|
|
4141
4312
|
type: "button",
|
|
@@ -4148,43 +4319,43 @@ var BrushOptionsBar = ({ controller, className }) => {
|
|
|
4148
4319
|
o.id
|
|
4149
4320
|
))
|
|
4150
4321
|
] }, choice.id)),
|
|
4151
|
-
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0,
|
|
4152
|
-
/* @__PURE__ */ (0,
|
|
4153
|
-
/* @__PURE__ */ (0,
|
|
4322
|
+
import_image_editor11.RETOUCH_OPTION_CONTROLS.filter((c) => c.tools.includes(tool)).map((spec) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ControlSlider, { spec, value: retouch[spec.id], onChange: (v) => controller.setPaintOptions({ retouch: { [spec.id]: v } }) }, spec.id)),
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-wrap gap-3 text-foreground", children: import_image_editor11.RETOUCH_TOGGLES.filter((t) => t.tools.includes(tool)).map((t) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: t.label, checked: retouch[t.id], onChange: (on) => controller.setPaintOptions({ retouch: { [t.id]: on } }) }),
|
|
4154
4325
|
t.label
|
|
4155
4326
|
] }, t.id)) })
|
|
4156
4327
|
] }),
|
|
4157
|
-
/* @__PURE__ */ (0,
|
|
4158
|
-
/* @__PURE__ */ (0,
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4328
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-wrap gap-3 text-foreground", role: "group", "aria-label": "Pressure", children: [
|
|
4329
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4330
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Pressure controls size", checked: brush.pressureSize, onChange: (on) => controller.setPaintOptions({ brush: { pressureSize: on } }) }),
|
|
4160
4331
|
"Pressure size"
|
|
4161
4332
|
] }),
|
|
4162
|
-
/* @__PURE__ */ (0,
|
|
4163
|
-
/* @__PURE__ */ (0,
|
|
4333
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "flex items-center gap-1.5", children: [
|
|
4334
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ImageCheckbox, { label: "Pressure controls opacity", checked: brush.pressureOpacity, onChange: (on) => controller.setPaintOptions({ brush: { pressureOpacity: on } }) }),
|
|
4164
4335
|
"Pressure opacity"
|
|
4165
4336
|
] })
|
|
4166
4337
|
] }),
|
|
4167
|
-
/* @__PURE__ */ (0,
|
|
4168
|
-
/* @__PURE__ */ (0,
|
|
4169
|
-
/* @__PURE__ */ (0,
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1", children: [
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.fillPixels()), children: "Fill" }),
|
|
4340
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { type: "button", className: imageChipClass(false), onClick: () => attempt(() => controller.clearPixels()), children: "Clear" })
|
|
4170
4341
|
] }),
|
|
4171
|
-
error && /* @__PURE__ */ (0,
|
|
4342
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4172
4343
|
] });
|
|
4173
4344
|
};
|
|
4174
4345
|
|
|
4175
4346
|
// src/image-editor/ColorProfilePanel.tsx
|
|
4176
|
-
var
|
|
4347
|
+
var import_react24 = require("react");
|
|
4177
4348
|
var import_image_editor13 = require("@pixerate/editor/image-editor");
|
|
4178
|
-
var
|
|
4349
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4179
4350
|
var chip = imageChipClass(false);
|
|
4180
4351
|
var select2 = "rounded bg-muted px-1 py-0.5 text-[11px] text-foreground";
|
|
4181
4352
|
var ColorProfilePanel = ({ controller, className }) => {
|
|
4182
|
-
const [, setTick] = (0,
|
|
4183
|
-
(0,
|
|
4184
|
-
const [target, setTarget] = (0,
|
|
4185
|
-
const [intent, setIntent] = (0,
|
|
4186
|
-
const [bpc, setBpc] = (0,
|
|
4187
|
-
const [error, setError] = (0,
|
|
4353
|
+
const [, setTick] = (0, import_react24.useState)(0);
|
|
4354
|
+
(0, import_react24.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4355
|
+
const [target, setTarget] = (0, import_react24.useState)("display-p3");
|
|
4356
|
+
const [intent, setIntent] = (0, import_react24.useState)("relative");
|
|
4357
|
+
const [bpc, setBpc] = (0, import_react24.useState)(true);
|
|
4358
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
4188
4359
|
const view = (0, import_image_editor13.colorPanelView)(controller);
|
|
4189
4360
|
const attempt = (fn) => {
|
|
4190
4361
|
try {
|
|
@@ -4206,29 +4377,29 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4206
4377
|
})
|
|
4207
4378
|
);
|
|
4208
4379
|
};
|
|
4209
|
-
return /* @__PURE__ */ (0,
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
/* @__PURE__ */ (0,
|
|
4212
|
-
/* @__PURE__ */ (0,
|
|
4380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "color-profile-panel", children: [
|
|
4381
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4382
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Profile" }),
|
|
4383
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "data-testid": "color-profile-name", children: view.profileName })
|
|
4213
4384
|
] }),
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
4217
|
-
view.cmykProfileName && /* @__PURE__ */ (0,
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Colour mode", children: [
|
|
4386
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Mode" }),
|
|
4387
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Colour mode", className: select2, value: view.mode, onChange: (e) => attempt(() => controller.setColorMode(e.target.value)), children: import_image_editor13.COLOR_MODE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4388
|
+
view.cmykProfileName && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: view.cmykProfileName })
|
|
4218
4389
|
] }),
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
4221
|
-
/* @__PURE__ */ (0,
|
|
4222
|
-
/* @__PURE__ */ (0,
|
|
4223
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Assign or convert", children: [
|
|
4391
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Target profile", className: select2, value: target, onChange: (e) => setTarget(e.target.value), children: import_image_editor13.WORKING_SPACE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Rendering intent", className: select2, value: intent, onChange: (e) => setIntent(e.target.value), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, title: o.title, children: o.label }, o.id)) }),
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4394
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Black point compensation", checked: bpc, onChange: (e) => setBpc(e.target.checked), className: "accent-primary" }),
|
|
4224
4395
|
"BPC"
|
|
4225
4396
|
] }),
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4227
|
-
/* @__PURE__ */ (0,
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Assign Profile: keep the numbers", onClick: () => attempt(() => controller.assignProfile(target)), children: "Assign" }),
|
|
4398
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { type: "button", className: chip, title: "Edit \u203A Convert to Profile: keep the look", onClick: () => attempt(() => controller.convertToProfile(target, { intent, bpc })), children: "Convert" })
|
|
4228
4399
|
] }),
|
|
4229
|
-
/* @__PURE__ */ (0,
|
|
4230
|
-
/* @__PURE__ */ (0,
|
|
4231
|
-
/* @__PURE__ */ (0,
|
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Proof setup", children: [
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-muted-foreground", children: "Proof" }),
|
|
4402
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4232
4403
|
"select",
|
|
4233
4404
|
{
|
|
4234
4405
|
"aria-label": "Proof profile",
|
|
@@ -4236,31 +4407,31 @@ var ColorProfilePanel = ({ controller, className }) => {
|
|
|
4236
4407
|
value: view.proof?.id ?? "",
|
|
4237
4408
|
onChange: (e) => e.target.value ? proofWith({ id: e.target.value }) : attempt(() => controller.setProofSetup(null)),
|
|
4238
4409
|
children: [
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4240
|
-
import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0,
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Off" }),
|
|
4411
|
+
import_image_editor13.PROOF_PROFILE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
4241
4412
|
]
|
|
4242
4413
|
}
|
|
4243
4414
|
),
|
|
4244
|
-
view.proof && /* @__PURE__ */ (0,
|
|
4245
|
-
/* @__PURE__ */ (0,
|
|
4246
|
-
/* @__PURE__ */ (0,
|
|
4247
|
-
/* @__PURE__ */ (0,
|
|
4415
|
+
view.proof && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("select", { "aria-label": "Proof intent", className: select2, value: view.proof.intent, onChange: (e) => proofWith({ intent: e.target.value }), children: import_image_editor13.INTENT_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: o.id, children: o.label }, o.id)) }),
|
|
4417
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4418
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Simulate paper colour", checked: view.proof.simulatePaper, onChange: (e) => proofWith({ simulatePaper: e.target.checked }), className: "accent-primary" }),
|
|
4248
4419
|
"Paper"
|
|
4249
4420
|
] }),
|
|
4250
|
-
/* @__PURE__ */ (0,
|
|
4251
|
-
/* @__PURE__ */ (0,
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4422
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("input", { type: "checkbox", "aria-label": "Gamut warning", checked: view.proof.gamutWarning, onChange: (e) => proofWith({ gamutWarning: e.target.checked }), className: "accent-primary" }),
|
|
4252
4423
|
"Gamut warning"
|
|
4253
4424
|
] })
|
|
4254
4425
|
] })
|
|
4255
4426
|
] }),
|
|
4256
|
-
error && /* @__PURE__ */ (0,
|
|
4427
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4257
4428
|
] });
|
|
4258
4429
|
};
|
|
4259
4430
|
|
|
4260
4431
|
// src/image-editor/SelectionOptionsBar.tsx
|
|
4261
|
-
var
|
|
4432
|
+
var import_react25 = require("react");
|
|
4262
4433
|
var import_image_editor14 = require("@pixerate/editor/image-editor");
|
|
4263
|
-
var
|
|
4434
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4264
4435
|
var MODIFY_OPS = [
|
|
4265
4436
|
{ op: "grow", label: "Grow" },
|
|
4266
4437
|
{ op: "shrink", label: "Shrink" },
|
|
@@ -4277,32 +4448,32 @@ var SelectionOptionsBar = ({
|
|
|
4277
4448
|
quickMask,
|
|
4278
4449
|
className = ""
|
|
4279
4450
|
}) => {
|
|
4280
|
-
const [radius, setRadius] = (0,
|
|
4451
|
+
const [radius, setRadius] = (0, import_react25.useState)(2);
|
|
4281
4452
|
const set = (patch) => onOptionsChange({ ...options, ...patch });
|
|
4282
4453
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4283
4454
|
const qm = quickMask ?? Boolean(controller.getState().quickMask);
|
|
4284
|
-
return /* @__PURE__ */ (0,
|
|
4285
|
-
/* @__PURE__ */ (0,
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4287
|
-
options.tool === "wand" && /* @__PURE__ */ (0,
|
|
4288
|
-
/* @__PURE__ */ (0,
|
|
4289
|
-
/* @__PURE__ */ (0,
|
|
4290
|
-
/* @__PURE__ */ (0,
|
|
4291
|
-
/* @__PURE__ */ (0,
|
|
4455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4456
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
4457
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
4458
|
+
options.tool === "wand" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4461
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Tolerance" }),
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: options.tolerance })
|
|
4292
4463
|
] }),
|
|
4293
|
-
/* @__PURE__ */ (0,
|
|
4464
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Tolerance", min: 0, max: 255, step: 1, value: options.tolerance, onChange: (v) => set({ tolerance: v }) })
|
|
4294
4465
|
] }),
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4296
|
-
/* @__PURE__ */ (0,
|
|
4466
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Contiguous", checked: options.contiguous, onChange: (on) => set({ contiguous: on }) }),
|
|
4297
4468
|
"Contiguous"
|
|
4298
4469
|
] }),
|
|
4299
|
-
/* @__PURE__ */ (0,
|
|
4300
|
-
/* @__PURE__ */ (0,
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Sample adjusted image", checked: options.sampleMerged, onChange: (on) => set({ sampleMerged: on }) }),
|
|
4301
4472
|
"Sample adjusted image"
|
|
4302
4473
|
] }),
|
|
4303
|
-
/* @__PURE__ */ (0,
|
|
4474
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4304
4475
|
"Sample",
|
|
4305
|
-
/* @__PURE__ */ (0,
|
|
4476
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4306
4477
|
ImageSelect,
|
|
4307
4478
|
{
|
|
4308
4479
|
label: "Sample from",
|
|
@@ -4316,20 +4487,20 @@ var SelectionOptionsBar = ({
|
|
|
4316
4487
|
)
|
|
4317
4488
|
] })
|
|
4318
4489
|
] }),
|
|
4319
|
-
/* @__PURE__ */ (0,
|
|
4320
|
-
/* @__PURE__ */ (0,
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4491
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
4321
4492
|
"Anti-alias"
|
|
4322
4493
|
] }),
|
|
4323
|
-
/* @__PURE__ */ (0,
|
|
4324
|
-
/* @__PURE__ */ (0,
|
|
4325
|
-
/* @__PURE__ */ (0,
|
|
4326
|
-
/* @__PURE__ */ (0,
|
|
4327
|
-
/* @__PURE__ */ (0,
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.selectAll(), children: "Select All" }),
|
|
4496
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.deselect(), children: "Deselect" }),
|
|
4497
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), onClick: () => controller.invertSelection(), children: "Inverse" }),
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": qm, className: btn(qm), onClick: () => controller.setQuickMask(!qm), children: "Quick Mask" })
|
|
4328
4499
|
] }),
|
|
4329
|
-
/* @__PURE__ */ (0,
|
|
4330
|
-
/* @__PURE__ */ (0,
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
4331
4502
|
"Radius",
|
|
4332
|
-
/* @__PURE__ */ (0,
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4333
4504
|
"input",
|
|
4334
4505
|
{
|
|
4335
4506
|
type: "number",
|
|
@@ -4343,24 +4514,24 @@ var SelectionOptionsBar = ({
|
|
|
4343
4514
|
}
|
|
4344
4515
|
)
|
|
4345
4516
|
] }),
|
|
4346
|
-
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0,
|
|
4517
|
+
MODIFY_OPS.map(({ op, label }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: !sel, onClick: () => controller.modifySelection(op, radius), children: label }, op))
|
|
4347
4518
|
] }),
|
|
4348
|
-
/* @__PURE__ */ (0,
|
|
4519
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { "data-testid": "selection-status", className: "text-muted-foreground", children: (0, import_image_editor14.describeSelection)(sel) })
|
|
4349
4520
|
] });
|
|
4350
4521
|
};
|
|
4351
4522
|
|
|
4352
4523
|
// src/image-editor/RefineEdgePanel.tsx
|
|
4353
|
-
var
|
|
4524
|
+
var import_react26 = require("react");
|
|
4354
4525
|
var import_image_editor15 = require("@pixerate/editor/image-editor");
|
|
4355
|
-
var
|
|
4526
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4356
4527
|
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
4357
4528
|
var button2 = "px-2 py-1 rounded-md border border-border bg-background text-[11px] text-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40";
|
|
4358
4529
|
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
4359
|
-
const [params, setParams] = (0,
|
|
4360
|
-
const [busy, setBusy] = (0,
|
|
4361
|
-
const [error, setError] = (0,
|
|
4362
|
-
const [layerId, setLayerId] = (0,
|
|
4363
|
-
const [newKind, setNewKind] = (0,
|
|
4530
|
+
const [params, setParams] = (0, import_react26.useState)(DEFAULT_PARAMS);
|
|
4531
|
+
const [busy, setBusy] = (0, import_react26.useState)(false);
|
|
4532
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
4533
|
+
const [layerId, setLayerId] = (0, import_react26.useState)("");
|
|
4534
|
+
const [newKind, setNewKind] = (0, import_react26.useState)("hueSaturation");
|
|
4364
4535
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
4365
4536
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
4366
4537
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -4375,17 +4546,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4375
4546
|
setBusy(false);
|
|
4376
4547
|
}
|
|
4377
4548
|
};
|
|
4378
|
-
return /* @__PURE__ */ (0,
|
|
4379
|
-
/* @__PURE__ */ (0,
|
|
4380
|
-
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
4381
|
-
/* @__PURE__ */ (0,
|
|
4382
|
-
/* @__PURE__ */ (0,
|
|
4383
|
-
/* @__PURE__ */ (0,
|
|
4549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
4551
|
+
import_image_editor15.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4552
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4553
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: c.label }),
|
|
4554
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4384
4555
|
params[c.id],
|
|
4385
4556
|
c.unit
|
|
4386
4557
|
] })
|
|
4387
4558
|
] }),
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4559
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4389
4560
|
"input",
|
|
4390
4561
|
{
|
|
4391
4562
|
type: "range",
|
|
@@ -4399,28 +4570,28 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4399
4570
|
}
|
|
4400
4571
|
)
|
|
4401
4572
|
] }, c.id)),
|
|
4402
|
-
/* @__PURE__ */ (0,
|
|
4403
|
-
/* @__PURE__ */ (0,
|
|
4573
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4574
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
4404
4575
|
"Smart Radius"
|
|
4405
4576
|
] }),
|
|
4406
|
-
/* @__PURE__ */ (0,
|
|
4407
|
-
/* @__PURE__ */ (0,
|
|
4408
|
-
/* @__PURE__ */ (0,
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
4579
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
4409
4580
|
] }),
|
|
4410
|
-
error && /* @__PURE__ */ (0,
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4412
|
-
/* @__PURE__ */ (0,
|
|
4413
|
-
/* @__PURE__ */ (0,
|
|
4581
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
4583
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
4584
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4414
4585
|
"select",
|
|
4415
4586
|
{
|
|
4416
4587
|
"aria-label": "New masked layer kind",
|
|
4417
4588
|
value: newKind,
|
|
4418
4589
|
onChange: (e) => setNewKind(e.target.value),
|
|
4419
4590
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4420
|
-
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
4591
|
+
children: import_image_editor15.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
4421
4592
|
}
|
|
4422
4593
|
),
|
|
4423
|
-
/* @__PURE__ */ (0,
|
|
4594
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4424
4595
|
"button",
|
|
4425
4596
|
{
|
|
4426
4597
|
type: "button",
|
|
@@ -4431,35 +4602,35 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4431
4602
|
}
|
|
4432
4603
|
)
|
|
4433
4604
|
] }),
|
|
4434
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
4435
|
-
/* @__PURE__ */ (0,
|
|
4605
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4436
4607
|
"select",
|
|
4437
4608
|
{
|
|
4438
4609
|
"aria-label": "Mask layer",
|
|
4439
4610
|
value: target.id,
|
|
4440
4611
|
onChange: (e) => setLayerId(e.target.value),
|
|
4441
4612
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
4442
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
4613
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("option", { value: l.id, children: [
|
|
4443
4614
|
l.name || (0, import_image_editor15.adjustmentKindLabel)(l.kind),
|
|
4444
4615
|
l.mask ? " (masked)" : ""
|
|
4445
4616
|
] }, l.id))
|
|
4446
4617
|
}
|
|
4447
4618
|
),
|
|
4448
|
-
/* @__PURE__ */ (0,
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4450
|
-
/* @__PURE__ */ (0,
|
|
4451
|
-
/* @__PURE__ */ (0,
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
4620
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
4621
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
4622
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
4452
4623
|
] }),
|
|
4453
|
-
target.mask && /* @__PURE__ */ (0,
|
|
4454
|
-
/* @__PURE__ */ (0,
|
|
4455
|
-
/* @__PURE__ */ (0,
|
|
4456
|
-
/* @__PURE__ */ (0,
|
|
4457
|
-
/* @__PURE__ */ (0,
|
|
4624
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4625
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Density" }),
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4458
4629
|
Math.round((target.mask.density ?? 1) * 100),
|
|
4459
4630
|
"%"
|
|
4460
4631
|
] })
|
|
4461
4632
|
] }),
|
|
4462
|
-
/* @__PURE__ */ (0,
|
|
4633
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4463
4634
|
"input",
|
|
4464
4635
|
{
|
|
4465
4636
|
type: "range",
|
|
@@ -4473,15 +4644,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4473
4644
|
}
|
|
4474
4645
|
)
|
|
4475
4646
|
] }),
|
|
4476
|
-
/* @__PURE__ */ (0,
|
|
4477
|
-
/* @__PURE__ */ (0,
|
|
4478
|
-
/* @__PURE__ */ (0,
|
|
4479
|
-
/* @__PURE__ */ (0,
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4649
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "Mask Feather" }),
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
4480
4651
|
target.mask.feather ?? 0,
|
|
4481
4652
|
"px"
|
|
4482
4653
|
] })
|
|
4483
4654
|
] }),
|
|
4484
|
-
/* @__PURE__ */ (0,
|
|
4655
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4485
4656
|
"input",
|
|
4486
4657
|
{
|
|
4487
4658
|
type: "range",
|
|
@@ -4501,13 +4672,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
4501
4672
|
};
|
|
4502
4673
|
|
|
4503
4674
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
4504
|
-
var
|
|
4675
|
+
var import_react27 = require("react");
|
|
4505
4676
|
var import_image_editor16 = require("@pixerate/editor/image-editor");
|
|
4506
|
-
var
|
|
4677
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4507
4678
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
4508
4679
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
4509
|
-
const [, setTick] = (0,
|
|
4510
|
-
(0,
|
|
4680
|
+
const [, setTick] = (0, import_react27.useState)(0);
|
|
4681
|
+
(0, import_react27.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
4511
4682
|
const bar = tool.bar();
|
|
4512
4683
|
if (!tool.active || !bar) return null;
|
|
4513
4684
|
const warp = tool.warpBar();
|
|
@@ -4519,17 +4690,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4519
4690
|
const v = Number(raw);
|
|
4520
4691
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
4521
4692
|
};
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
4523
|
-
/* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4525
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
4526
|
-
/* @__PURE__ */ (0,
|
|
4527
|
-
/* @__PURE__ */ (0,
|
|
4528
|
-
/* @__PURE__ */ (0,
|
|
4693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex flex-wrap items-center gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "free-transform-options", role: "toolbar", "aria-label": "Free Transform options", children: [
|
|
4694
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor16.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: m.title, "aria-pressed": tool.mode === m.id, className: imageChipClass(tool.mode === m.id), onClick: () => tool.setMode(m.id), children: m.label }, m.id)) }),
|
|
4695
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor16.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", "aria-label": `Reference point ${a}`, title: `Reference point: ${a}`, className: "h-2.5 w-2.5 rounded-sm bg-accent hover:bg-primary/90", onClick: () => tool.setReference(a) }, a)) }),
|
|
4696
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
4697
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
4699
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor16.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
4529
4700
|
] }),
|
|
4530
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
4531
|
-
/* @__PURE__ */ (0,
|
|
4532
|
-
/* @__PURE__ */ (0,
|
|
4701
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4702
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4533
4704
|
"input",
|
|
4534
4705
|
{
|
|
4535
4706
|
type: "number",
|
|
@@ -4550,9 +4721,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4550
4721
|
},
|
|
4551
4722
|
`${k}:${warp[k]}`
|
|
4552
4723
|
),
|
|
4553
|
-
/* @__PURE__ */ (0,
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
4554
4725
|
] }, k)),
|
|
4555
|
-
/* @__PURE__ */ (0,
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4556
4727
|
"button",
|
|
4557
4728
|
{
|
|
4558
4729
|
type: "button",
|
|
@@ -4564,9 +4735,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4564
4735
|
children: "Vertical"
|
|
4565
4736
|
}
|
|
4566
4737
|
),
|
|
4567
|
-
/* @__PURE__ */ (0,
|
|
4568
|
-
/* @__PURE__ */ (0,
|
|
4569
|
-
/* @__PURE__ */ (0,
|
|
4738
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4739
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
4740
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4570
4741
|
"select",
|
|
4571
4742
|
{
|
|
4572
4743
|
"aria-label": "Warp grid",
|
|
@@ -4576,14 +4747,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4576
4747
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
4577
4748
|
},
|
|
4578
4749
|
className: imageFieldClass,
|
|
4579
|
-
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
4750
|
+
children: import_image_editor16.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
4580
4751
|
}
|
|
4581
4752
|
)
|
|
4582
4753
|
] })
|
|
4583
4754
|
] }),
|
|
4584
|
-
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4755
|
+
tool.mode !== "warp" && import_image_editor16.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
4756
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
4757
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4587
4758
|
"input",
|
|
4588
4759
|
{
|
|
4589
4760
|
type: "number",
|
|
@@ -4603,8 +4774,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4603
4774
|
},
|
|
4604
4775
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
4605
4776
|
),
|
|
4606
|
-
/* @__PURE__ */ (0,
|
|
4607
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
4777
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
4778
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4608
4779
|
"button",
|
|
4609
4780
|
{
|
|
4610
4781
|
type: "button",
|
|
@@ -4619,33 +4790,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
4619
4790
|
}
|
|
4620
4791
|
)
|
|
4621
4792
|
] }, f.id)),
|
|
4622
|
-
/* @__PURE__ */ (0,
|
|
4623
|
-
/* @__PURE__ */ (0,
|
|
4624
|
-
/* @__PURE__ */ (0,
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
4795
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4625
4796
|
"select",
|
|
4626
4797
|
{
|
|
4627
4798
|
"aria-label": "Interpolation",
|
|
4628
4799
|
value: tool.interpolation,
|
|
4629
4800
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
4630
4801
|
className: imageFieldClass,
|
|
4631
|
-
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
4802
|
+
children: import_image_editor16.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
4632
4803
|
}
|
|
4633
4804
|
)
|
|
4634
4805
|
] }),
|
|
4635
|
-
/* @__PURE__ */ (0,
|
|
4636
|
-
/* @__PURE__ */ (0,
|
|
4637
|
-
tool.error && /* @__PURE__ */ (0,
|
|
4806
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: "Commit (Enter)", className: "px-2 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90", onClick: () => tool.commit(), children: "Commit" }),
|
|
4807
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
4808
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
4638
4809
|
] });
|
|
4639
4810
|
};
|
|
4640
4811
|
|
|
4641
4812
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
4642
|
-
var
|
|
4813
|
+
var import_react28 = require("react");
|
|
4643
4814
|
var import_image_editor17 = require("@pixerate/editor/image-editor");
|
|
4644
|
-
var
|
|
4815
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4645
4816
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
4646
|
-
const [, setTick] = (0,
|
|
4647
|
-
(0,
|
|
4648
|
-
const [error, setError] = (0,
|
|
4817
|
+
const [, setTick] = (0, import_react28.useState)(0);
|
|
4818
|
+
(0, import_react28.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4819
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
4649
4820
|
const active = controller.getActiveLayer();
|
|
4650
4821
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
4651
4822
|
const set = (change) => {
|
|
@@ -4659,13 +4830,13 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4659
4830
|
}
|
|
4660
4831
|
};
|
|
4661
4832
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
4662
|
-
return /* @__PURE__ */ (0,
|
|
4663
|
-
/* @__PURE__ */ (0,
|
|
4664
|
-
/* @__PURE__ */ (0,
|
|
4665
|
-
/* @__PURE__ */ (0,
|
|
4666
|
-
/* @__PURE__ */ (0,
|
|
4833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
4834
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor17.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor17.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4837
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
4667
4838
|
"Fill",
|
|
4668
|
-
/* @__PURE__ */ (0,
|
|
4839
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4669
4840
|
"input",
|
|
4670
4841
|
{
|
|
4671
4842
|
type: "color",
|
|
@@ -4677,10 +4848,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4677
4848
|
}
|
|
4678
4849
|
)
|
|
4679
4850
|
] }),
|
|
4680
|
-
/* @__PURE__ */ (0,
|
|
4681
|
-
/* @__PURE__ */ (0,
|
|
4851
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
4682
4853
|
"Stroke",
|
|
4683
|
-
/* @__PURE__ */ (0,
|
|
4854
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4684
4855
|
"input",
|
|
4685
4856
|
{
|
|
4686
4857
|
type: "color",
|
|
@@ -4692,9 +4863,9 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4692
4863
|
}
|
|
4693
4864
|
)
|
|
4694
4865
|
] }),
|
|
4695
|
-
/* @__PURE__ */ (0,
|
|
4866
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4696
4867
|
"Width",
|
|
4697
|
-
/* @__PURE__ */ (0,
|
|
4868
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4698
4869
|
"input",
|
|
4699
4870
|
{
|
|
4700
4871
|
type: "number",
|
|
@@ -4708,51 +4879,51 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
4708
4879
|
)
|
|
4709
4880
|
] })
|
|
4710
4881
|
] }),
|
|
4711
|
-
/* @__PURE__ */ (0,
|
|
4712
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
4883
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4713
4884
|
"Radius",
|
|
4714
|
-
/* @__PURE__ */ (0,
|
|
4885
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Corner radius", min: 0, max: 1e3, value: options.radius, onChange: (e) => set({ radius: num(e.target.value, 0, 1e3) }), className: `w-14 ${imageFieldClass}` })
|
|
4715
4886
|
] }),
|
|
4716
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
4887
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4717
4888
|
"Sides",
|
|
4718
|
-
/* @__PURE__ */ (0,
|
|
4889
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Sides", min: 3, max: 100, value: options.sides, onChange: (e) => set({ sides: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4719
4890
|
] }),
|
|
4720
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
4721
|
-
/* @__PURE__ */ (0,
|
|
4891
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4892
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4722
4893
|
"Points",
|
|
4723
|
-
/* @__PURE__ */ (0,
|
|
4894
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Points", min: 3, max: 100, value: options.points, onChange: (e) => set({ points: num(e.target.value, 3, 100) }), className: `w-14 ${imageFieldClass}` })
|
|
4724
4895
|
] }),
|
|
4725
|
-
/* @__PURE__ */ (0,
|
|
4896
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4726
4897
|
"Inner",
|
|
4727
|
-
/* @__PURE__ */ (0,
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
4728
4899
|
] })
|
|
4729
4900
|
] }),
|
|
4730
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
4731
|
-
/* @__PURE__ */ (0,
|
|
4901
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
4902
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4732
4903
|
"Weight",
|
|
4733
|
-
/* @__PURE__ */ (0,
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("input", { type: "number", "aria-label": "Line weight", min: 1, max: 200, value: options.weight, onChange: (e) => set({ weight: num(e.target.value, 1, 200) }), className: `w-14 ${imageFieldClass}` })
|
|
4734
4905
|
] }),
|
|
4735
|
-
/* @__PURE__ */ (0,
|
|
4736
|
-
/* @__PURE__ */ (0,
|
|
4906
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4907
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
4737
4908
|
"Arrowhead"
|
|
4738
4909
|
] })
|
|
4739
4910
|
] })
|
|
4740
4911
|
] }),
|
|
4741
|
-
/* @__PURE__ */ (0,
|
|
4742
|
-
error && /* @__PURE__ */ (0,
|
|
4912
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Drag on the image to draw. Shift: square, circle or 45\xB0 line. Alt: from the centre." }),
|
|
4913
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4743
4914
|
] });
|
|
4744
4915
|
};
|
|
4745
4916
|
|
|
4746
4917
|
// src/image-editor/TypeOptionsBar.tsx
|
|
4747
|
-
var
|
|
4918
|
+
var import_react29 = require("react");
|
|
4748
4919
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
4749
|
-
var
|
|
4920
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4750
4921
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
4751
4922
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
4752
|
-
const [, setTick] = (0,
|
|
4753
|
-
(0,
|
|
4754
|
-
(0,
|
|
4755
|
-
const [error, setError] = (0,
|
|
4923
|
+
const [, setTick] = (0, import_react29.useState)(0);
|
|
4924
|
+
(0, import_react29.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
4925
|
+
(0, import_react29.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
4926
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
4756
4927
|
const active = controller.getActiveLayer();
|
|
4757
4928
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
4758
4929
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -4784,11 +4955,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4784
4955
|
setError(e instanceof Error ? e.message : String(e));
|
|
4785
4956
|
}
|
|
4786
4957
|
};
|
|
4787
|
-
return /* @__PURE__ */ (0,
|
|
4788
|
-
/* @__PURE__ */ (0,
|
|
4789
|
-
/* @__PURE__ */ (0,
|
|
4958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
4959
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4960
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4790
4961
|
"Font",
|
|
4791
|
-
/* @__PURE__ */ (0,
|
|
4962
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4792
4963
|
"input",
|
|
4793
4964
|
{
|
|
4794
4965
|
list: "pixerate-type-fonts",
|
|
@@ -4798,11 +4969,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4798
4969
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
4799
4970
|
}
|
|
4800
4971
|
),
|
|
4801
|
-
/* @__PURE__ */ (0,
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("option", { value: f }, f)) })
|
|
4802
4973
|
] }),
|
|
4803
|
-
/* @__PURE__ */ (0,
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
4804
4975
|
"Size",
|
|
4805
|
-
/* @__PURE__ */ (0,
|
|
4976
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4806
4977
|
"input",
|
|
4807
4978
|
{
|
|
4808
4979
|
type: "number",
|
|
@@ -4815,24 +4986,24 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
4815
4986
|
}
|
|
4816
4987
|
)
|
|
4817
4988
|
] }),
|
|
4818
|
-
/* @__PURE__ */ (0,
|
|
4819
|
-
/* @__PURE__ */ (0,
|
|
4820
|
-
/* @__PURE__ */ (0,
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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" }),
|
|
4990
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
4991
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("input", { type: "color", "aria-label": "Text colour", value: shown.color, onChange: (e) => style({ color: e.target.value }), className: imageColorInputClass })
|
|
4821
4992
|
] }),
|
|
4822
|
-
/* @__PURE__ */ (0,
|
|
4823
|
-
/* @__PURE__ */ (0,
|
|
4824
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor18.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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." }),
|
|
4995
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
4825
4996
|
"Missing ",
|
|
4826
4997
|
missing.length === 1 ? "font" : "fonts",
|
|
4827
4998
|
": ",
|
|
4828
4999
|
missing.join(", ")
|
|
4829
5000
|
] }),
|
|
4830
|
-
error && /* @__PURE__ */ (0,
|
|
5001
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
4831
5002
|
] });
|
|
4832
5003
|
};
|
|
4833
5004
|
|
|
4834
5005
|
// src/image-editor/ImageEditor.tsx
|
|
4835
|
-
var
|
|
5006
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4836
5007
|
var ImageEditor = ({
|
|
4837
5008
|
editor: externalEditor,
|
|
4838
5009
|
src,
|
|
@@ -4857,32 +5028,32 @@ var ImageEditor = ({
|
|
|
4857
5028
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
4858
5029
|
});
|
|
4859
5030
|
const legacyProcess = (0, import_image_editor19.normalizeProcessVersion)(state.adjustments.process) < import_image_editor19.LATEST_PROCESS_VERSION;
|
|
4860
|
-
const [activeTab, setActiveTab] = (0,
|
|
4861
|
-
const rootRef = (0,
|
|
5031
|
+
const [activeTab, setActiveTab] = (0, import_react30.useState)("crop");
|
|
5032
|
+
const rootRef = (0, import_react30.useRef)(null);
|
|
4862
5033
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
4863
|
-
const activeTabRef = (0,
|
|
5034
|
+
const activeTabRef = (0, import_react30.useRef)(activeTab);
|
|
4864
5035
|
activeTabRef.current = activeTab;
|
|
4865
5036
|
const openPanel = async (ref) => {
|
|
4866
5037
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
4867
5038
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
4868
5039
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
4869
5040
|
};
|
|
4870
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
4871
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
4872
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
4873
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
4874
|
-
const [typeSession, setTypeSession] = (0,
|
|
4875
|
-
const [selectionError, setSelectionError] = (0,
|
|
4876
|
-
const [paintError, setPaintError] = (0,
|
|
4877
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
5041
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react30.useState)(null);
|
|
5042
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
5043
|
+
const [shapeOptions, setShapeOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
5044
|
+
const [typeOptions, setTypeOptions] = (0, import_react30.useState)(import_image_editor19.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
5045
|
+
const [typeSession, setTypeSession] = (0, import_react30.useState)(null);
|
|
5046
|
+
const [selectionError, setSelectionError] = (0, import_react30.useState)(null);
|
|
5047
|
+
const [paintError, setPaintError] = (0, import_react30.useState)(null);
|
|
5048
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react30.useState)(null);
|
|
4878
5049
|
const handleCanvasError = (source, message) => {
|
|
4879
5050
|
if (source === "paint") setPaintError(message);
|
|
4880
5051
|
else if (source === "select") setSelectionError(message);
|
|
4881
5052
|
else setShapeTypeError(message);
|
|
4882
5053
|
};
|
|
4883
5054
|
const finishTyping = () => setTypeSession(null);
|
|
4884
|
-
const transformToolRef = (0,
|
|
4885
|
-
const transformControllerRef = (0,
|
|
5055
|
+
const transformToolRef = (0, import_react30.useRef)(null);
|
|
5056
|
+
const transformControllerRef = (0, import_react30.useRef)(controller);
|
|
4886
5057
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
4887
5058
|
transformToolRef.current?.cancel();
|
|
4888
5059
|
transformToolRef.current = new import_image_editor19.FreeTransformTool(controller, {
|
|
@@ -4891,16 +5062,16 @@ var ImageEditor = ({
|
|
|
4891
5062
|
transformControllerRef.current = controller;
|
|
4892
5063
|
}
|
|
4893
5064
|
const transformTool = transformToolRef.current;
|
|
4894
|
-
const [, setTransformTick] = (0,
|
|
4895
|
-
(0,
|
|
4896
|
-
(0,
|
|
4897
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
4898
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
4899
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
4900
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
4901
|
-
const [aiError, setAiError] = (0,
|
|
4902
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
4903
|
-
const [aiTarget, setAiTarget] = (0,
|
|
5065
|
+
const [, setTransformTick] = (0, import_react30.useState)(0);
|
|
5066
|
+
(0, import_react30.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
5067
|
+
(0, import_react30.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
5068
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react30.useState)("");
|
|
5069
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react30.useState)("annotations");
|
|
5070
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react30.useState)(false);
|
|
5071
|
+
const [isInpainting, setIsInpainting] = (0, import_react30.useState)(false);
|
|
5072
|
+
const [aiError, setAiError] = (0, import_react30.useState)(null);
|
|
5073
|
+
const [aiSuccess, setAiSuccess] = (0, import_react30.useState)(null);
|
|
5074
|
+
const [aiTarget, setAiTarget] = (0, import_react30.useState)("auto");
|
|
4904
5075
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
4905
5076
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
4906
5077
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -4963,11 +5134,11 @@ var ImageEditor = ({
|
|
|
4963
5134
|
setIsInpainting(false);
|
|
4964
5135
|
}
|
|
4965
5136
|
};
|
|
4966
|
-
const [activeColor, setActiveColor] = (0,
|
|
4967
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
4968
|
-
const [fontSize, setFontSize] = (0,
|
|
4969
|
-
const [textInput, setTextInput] = (0,
|
|
4970
|
-
(0,
|
|
5137
|
+
const [activeColor, setActiveColor] = (0, import_react30.useState)("#ef4444");
|
|
5138
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react30.useState)(3);
|
|
5139
|
+
const [fontSize, setFontSize] = (0, import_react30.useState)(24);
|
|
5140
|
+
const [textInput, setTextInput] = (0, import_react30.useState)("");
|
|
5141
|
+
(0, import_react30.useEffect)(() => {
|
|
4971
5142
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
4972
5143
|
editor.setTool("crop");
|
|
4973
5144
|
}
|
|
@@ -4995,16 +5166,16 @@ var ImageEditor = ({
|
|
|
4995
5166
|
link.click();
|
|
4996
5167
|
}
|
|
4997
5168
|
};
|
|
4998
|
-
return /* @__PURE__ */ (0,
|
|
5169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
4999
5170
|
"div",
|
|
5000
5171
|
{
|
|
5001
5172
|
ref: rootRef,
|
|
5002
5173
|
className: `${imageEditorFrameClass} ${className}`,
|
|
5003
5174
|
style,
|
|
5004
5175
|
children: [
|
|
5005
|
-
/* @__PURE__ */ (0,
|
|
5006
|
-
/* @__PURE__ */ (0,
|
|
5007
|
-
/* @__PURE__ */ (0,
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
5177
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5008
5179
|
"button",
|
|
5009
5180
|
{
|
|
5010
5181
|
type: "button",
|
|
@@ -5019,7 +5190,7 @@ var ImageEditor = ({
|
|
|
5019
5190
|
children: "Transform & Crop"
|
|
5020
5191
|
}
|
|
5021
5192
|
),
|
|
5022
|
-
/* @__PURE__ */ (0,
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5023
5194
|
"button",
|
|
5024
5195
|
{
|
|
5025
5196
|
type: "button",
|
|
@@ -5034,7 +5205,7 @@ var ImageEditor = ({
|
|
|
5034
5205
|
children: "Adjustments"
|
|
5035
5206
|
}
|
|
5036
5207
|
),
|
|
5037
|
-
/* @__PURE__ */ (0,
|
|
5208
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5038
5209
|
"button",
|
|
5039
5210
|
{
|
|
5040
5211
|
type: "button",
|
|
@@ -5049,7 +5220,7 @@ var ImageEditor = ({
|
|
|
5049
5220
|
children: "Layers"
|
|
5050
5221
|
}
|
|
5051
5222
|
),
|
|
5052
|
-
/* @__PURE__ */ (0,
|
|
5223
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5053
5224
|
"button",
|
|
5054
5225
|
{
|
|
5055
5226
|
type: "button",
|
|
@@ -5064,7 +5235,7 @@ var ImageEditor = ({
|
|
|
5064
5235
|
children: "Paint"
|
|
5065
5236
|
}
|
|
5066
5237
|
),
|
|
5067
|
-
/* @__PURE__ */ (0,
|
|
5238
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5068
5239
|
"button",
|
|
5069
5240
|
{
|
|
5070
5241
|
type: "button",
|
|
@@ -5079,7 +5250,7 @@ var ImageEditor = ({
|
|
|
5079
5250
|
children: "Select & Mask"
|
|
5080
5251
|
}
|
|
5081
5252
|
),
|
|
5082
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5083
5254
|
"button",
|
|
5084
5255
|
{
|
|
5085
5256
|
type: "button",
|
|
@@ -5094,7 +5265,7 @@ var ImageEditor = ({
|
|
|
5094
5265
|
children: "Annotations"
|
|
5095
5266
|
}
|
|
5096
5267
|
),
|
|
5097
|
-
/* @__PURE__ */ (0,
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5098
5269
|
"button",
|
|
5099
5270
|
{
|
|
5100
5271
|
type: "button",
|
|
@@ -5109,7 +5280,7 @@ var ImageEditor = ({
|
|
|
5109
5280
|
children: "Depth Mask"
|
|
5110
5281
|
}
|
|
5111
5282
|
),
|
|
5112
|
-
/* @__PURE__ */ (0,
|
|
5283
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5113
5284
|
"button",
|
|
5114
5285
|
{
|
|
5115
5286
|
type: "button",
|
|
@@ -5122,14 +5293,14 @@ var ImageEditor = ({
|
|
|
5122
5293
|
"aria-selected": activeTab === "ai",
|
|
5123
5294
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
5124
5295
|
children: [
|
|
5125
|
-
/* @__PURE__ */ (0,
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5126
5297
|
"AI Tools"
|
|
5127
5298
|
]
|
|
5128
5299
|
}
|
|
5129
5300
|
)
|
|
5130
5301
|
] }),
|
|
5131
|
-
/* @__PURE__ */ (0,
|
|
5132
|
-
/* @__PURE__ */ (0,
|
|
5302
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
5303
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5133
5304
|
"button",
|
|
5134
5305
|
{
|
|
5135
5306
|
type: "button",
|
|
@@ -5140,7 +5311,7 @@ var ImageEditor = ({
|
|
|
5140
5311
|
children: "\u21A9"
|
|
5141
5312
|
}
|
|
5142
5313
|
),
|
|
5143
|
-
/* @__PURE__ */ (0,
|
|
5314
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5144
5315
|
"button",
|
|
5145
5316
|
{
|
|
5146
5317
|
type: "button",
|
|
@@ -5151,7 +5322,7 @@ var ImageEditor = ({
|
|
|
5151
5322
|
children: "\u21AA"
|
|
5152
5323
|
}
|
|
5153
5324
|
),
|
|
5154
|
-
/* @__PURE__ */ (0,
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5155
5326
|
"button",
|
|
5156
5327
|
{
|
|
5157
5328
|
type: "button",
|
|
@@ -5160,8 +5331,8 @@ var ImageEditor = ({
|
|
|
5160
5331
|
children: "Reset"
|
|
5161
5332
|
}
|
|
5162
5333
|
),
|
|
5163
|
-
/* @__PURE__ */ (0,
|
|
5164
|
-
/* @__PURE__ */ (0,
|
|
5334
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5165
5336
|
"button",
|
|
5166
5337
|
{
|
|
5167
5338
|
type: "button",
|
|
@@ -5171,11 +5342,11 @@ var ImageEditor = ({
|
|
|
5171
5342
|
children: "-"
|
|
5172
5343
|
}
|
|
5173
5344
|
),
|
|
5174
|
-
/* @__PURE__ */ (0,
|
|
5345
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
5175
5346
|
Math.round(state.zoom * 100),
|
|
5176
5347
|
"%"
|
|
5177
5348
|
] }),
|
|
5178
|
-
/* @__PURE__ */ (0,
|
|
5349
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5179
5350
|
"button",
|
|
5180
5351
|
{
|
|
5181
5352
|
type: "button",
|
|
@@ -5185,8 +5356,8 @@ var ImageEditor = ({
|
|
|
5185
5356
|
children: "+"
|
|
5186
5357
|
}
|
|
5187
5358
|
),
|
|
5188
|
-
/* @__PURE__ */ (0,
|
|
5189
|
-
/* @__PURE__ */ (0,
|
|
5359
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
5360
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5190
5361
|
"button",
|
|
5191
5362
|
{
|
|
5192
5363
|
type: "button",
|
|
@@ -5197,7 +5368,7 @@ var ImageEditor = ({
|
|
|
5197
5368
|
children: "Hold Compare"
|
|
5198
5369
|
}
|
|
5199
5370
|
),
|
|
5200
|
-
/* @__PURE__ */ (0,
|
|
5371
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5201
5372
|
"button",
|
|
5202
5373
|
{
|
|
5203
5374
|
type: "button",
|
|
@@ -5208,10 +5379,10 @@ var ImageEditor = ({
|
|
|
5208
5379
|
)
|
|
5209
5380
|
] })
|
|
5210
5381
|
] }),
|
|
5211
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
5212
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
5213
|
-
/* @__PURE__ */ (0,
|
|
5214
|
-
/* @__PURE__ */ (0,
|
|
5382
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
5383
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
5384
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
5385
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5215
5386
|
ImageEditorCanvas,
|
|
5216
5387
|
{
|
|
5217
5388
|
editor,
|
|
@@ -5235,11 +5406,11 @@ var ImageEditor = ({
|
|
|
5235
5406
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
5236
5407
|
}
|
|
5237
5408
|
),
|
|
5238
|
-
/* @__PURE__ */ (0,
|
|
5239
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
5240
|
-
/* @__PURE__ */ (0,
|
|
5241
|
-
/* @__PURE__ */ (0,
|
|
5242
|
-
/* @__PURE__ */ (0,
|
|
5409
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: imageSidebarClass, children: [
|
|
5410
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5411
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
5412
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
5413
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5243
5414
|
"button",
|
|
5244
5415
|
{
|
|
5245
5416
|
type: "button",
|
|
@@ -5251,7 +5422,7 @@ var ImageEditor = ({
|
|
|
5251
5422
|
children: "Freeform"
|
|
5252
5423
|
}
|
|
5253
5424
|
),
|
|
5254
|
-
/* @__PURE__ */ (0,
|
|
5425
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5255
5426
|
"button",
|
|
5256
5427
|
{
|
|
5257
5428
|
type: "button",
|
|
@@ -5263,7 +5434,7 @@ var ImageEditor = ({
|
|
|
5263
5434
|
children: "1:1 Square"
|
|
5264
5435
|
}
|
|
5265
5436
|
),
|
|
5266
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5267
5438
|
"button",
|
|
5268
5439
|
{
|
|
5269
5440
|
type: "button",
|
|
@@ -5275,7 +5446,7 @@ var ImageEditor = ({
|
|
|
5275
5446
|
children: "4:3 Standard"
|
|
5276
5447
|
}
|
|
5277
5448
|
),
|
|
5278
|
-
/* @__PURE__ */ (0,
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5279
5450
|
"button",
|
|
5280
5451
|
{
|
|
5281
5452
|
type: "button",
|
|
@@ -5287,7 +5458,7 @@ var ImageEditor = ({
|
|
|
5287
5458
|
children: "16:9 Wide"
|
|
5288
5459
|
}
|
|
5289
5460
|
),
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5461
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5291
5462
|
"button",
|
|
5292
5463
|
{
|
|
5293
5464
|
type: "button",
|
|
@@ -5299,7 +5470,7 @@ var ImageEditor = ({
|
|
|
5299
5470
|
children: "3:2 Photo"
|
|
5300
5471
|
}
|
|
5301
5472
|
),
|
|
5302
|
-
/* @__PURE__ */ (0,
|
|
5473
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5303
5474
|
"button",
|
|
5304
5475
|
{
|
|
5305
5476
|
type: "button",
|
|
@@ -5312,10 +5483,10 @@ var ImageEditor = ({
|
|
|
5312
5483
|
}
|
|
5313
5484
|
)
|
|
5314
5485
|
] }),
|
|
5315
|
-
/* @__PURE__ */ (0,
|
|
5316
|
-
/* @__PURE__ */ (0,
|
|
5317
|
-
/* @__PURE__ */ (0,
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5486
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
|
|
5487
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
5488
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
5489
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5319
5490
|
"button",
|
|
5320
5491
|
{
|
|
5321
5492
|
type: "button",
|
|
@@ -5324,7 +5495,7 @@ var ImageEditor = ({
|
|
|
5324
5495
|
children: "Rotate -90\xB0"
|
|
5325
5496
|
}
|
|
5326
5497
|
),
|
|
5327
|
-
/* @__PURE__ */ (0,
|
|
5498
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5328
5499
|
"button",
|
|
5329
5500
|
{
|
|
5330
5501
|
type: "button",
|
|
@@ -5333,7 +5504,7 @@ var ImageEditor = ({
|
|
|
5333
5504
|
children: "Rotate +90\xB0"
|
|
5334
5505
|
}
|
|
5335
5506
|
),
|
|
5336
|
-
/* @__PURE__ */ (0,
|
|
5507
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5337
5508
|
"button",
|
|
5338
5509
|
{
|
|
5339
5510
|
type: "button",
|
|
@@ -5342,7 +5513,7 @@ var ImageEditor = ({
|
|
|
5342
5513
|
children: "Flip Horizontal"
|
|
5343
5514
|
}
|
|
5344
5515
|
),
|
|
5345
|
-
/* @__PURE__ */ (0,
|
|
5516
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5346
5517
|
"button",
|
|
5347
5518
|
{
|
|
5348
5519
|
type: "button",
|
|
@@ -5353,10 +5524,10 @@ var ImageEditor = ({
|
|
|
5353
5524
|
)
|
|
5354
5525
|
] })
|
|
5355
5526
|
] }),
|
|
5356
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
5357
|
-
/* @__PURE__ */ (0,
|
|
5358
|
-
/* @__PURE__ */ (0,
|
|
5359
|
-
/* @__PURE__ */ (0,
|
|
5527
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5528
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5529
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5360
5531
|
"button",
|
|
5361
5532
|
{
|
|
5362
5533
|
type: "button",
|
|
@@ -5366,9 +5537,9 @@ var ImageEditor = ({
|
|
|
5366
5537
|
}
|
|
5367
5538
|
)
|
|
5368
5539
|
] }),
|
|
5369
|
-
/* @__PURE__ */ (0,
|
|
5370
|
-
import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
5371
|
-
/* @__PURE__ */ (0,
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Histogram, { histogram: editor.histogram }),
|
|
5541
|
+
import_image_editor19.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react30.default.Fragment, { children: [
|
|
5542
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5372
5543
|
ControlSlider,
|
|
5373
5544
|
{
|
|
5374
5545
|
spec,
|
|
@@ -5377,14 +5548,14 @@ var ImageEditor = ({
|
|
|
5377
5548
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
5378
5549
|
}
|
|
5379
5550
|
),
|
|
5380
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
5551
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5381
5552
|
"div",
|
|
5382
5553
|
{
|
|
5383
5554
|
className: "flex items-center justify-between gap-2 rounded border border-amber-500/30 bg-amber-500/10 px-2 py-1.5 text-[10px] text-amber-600",
|
|
5384
5555
|
"data-testid": "image-editor-process-notice",
|
|
5385
5556
|
children: [
|
|
5386
|
-
/* @__PURE__ */ (0,
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5557
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
5558
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5388
5559
|
"button",
|
|
5389
5560
|
{
|
|
5390
5561
|
type: "button",
|
|
@@ -5397,7 +5568,7 @@ var ImageEditor = ({
|
|
|
5397
5568
|
}
|
|
5398
5569
|
)
|
|
5399
5570
|
] }, spec.id)),
|
|
5400
|
-
/* @__PURE__ */ (0,
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5401
5572
|
AdjustmentLayersPanel,
|
|
5402
5573
|
{
|
|
5403
5574
|
controller,
|
|
@@ -5406,9 +5577,9 @@ var ImageEditor = ({
|
|
|
5406
5577
|
}
|
|
5407
5578
|
) })
|
|
5408
5579
|
] }),
|
|
5409
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
5410
|
-
/* @__PURE__ */ (0,
|
|
5411
|
-
/* @__PURE__ */ (0,
|
|
5580
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5581
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
5582
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5412
5583
|
"button",
|
|
5413
5584
|
{
|
|
5414
5585
|
type: "button",
|
|
@@ -5419,15 +5590,15 @@ var ImageEditor = ({
|
|
|
5419
5590
|
children: "Free Transform"
|
|
5420
5591
|
}
|
|
5421
5592
|
),
|
|
5422
|
-
/* @__PURE__ */ (0,
|
|
5423
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
5424
|
-
/* @__PURE__ */ (0,
|
|
5425
|
-
/* @__PURE__ */ (0,
|
|
5593
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayersPanel, { controller }),
|
|
5594
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
5595
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ColorProfilePanel, { controller })
|
|
5426
5597
|
] }),
|
|
5427
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
5428
|
-
/* @__PURE__ */ (0,
|
|
5429
|
-
/* @__PURE__ */ (0,
|
|
5430
|
-
/* @__PURE__ */ (0,
|
|
5598
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5599
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
5600
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrushOptionsBar, { controller }),
|
|
5601
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5431
5602
|
"button",
|
|
5432
5603
|
{
|
|
5433
5604
|
type: "button",
|
|
@@ -5438,12 +5609,12 @@ var ImageEditor = ({
|
|
|
5438
5609
|
children: "Free Transform"
|
|
5439
5610
|
}
|
|
5440
5611
|
),
|
|
5441
|
-
paintError && /* @__PURE__ */ (0,
|
|
5442
|
-
/* @__PURE__ */ (0,
|
|
5612
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
5613
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LayersPanel, { controller }) })
|
|
5443
5614
|
] }),
|
|
5444
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
5445
|
-
/* @__PURE__ */ (0,
|
|
5446
|
-
/* @__PURE__ */ (0,
|
|
5615
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers" }),
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5447
5618
|
"button",
|
|
5448
5619
|
{
|
|
5449
5620
|
type: "button",
|
|
@@ -5454,13 +5625,13 @@ var ImageEditor = ({
|
|
|
5454
5625
|
},
|
|
5455
5626
|
t
|
|
5456
5627
|
)) }),
|
|
5457
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
5458
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
5459
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
5460
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
5461
|
-
/* @__PURE__ */ (0,
|
|
5462
|
-
/* @__PURE__ */ (0,
|
|
5463
|
-
/* @__PURE__ */ (0,
|
|
5628
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
5629
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
5630
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", onClick: finishTyping, className: "self-start rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent", children: "Done editing text" }),
|
|
5631
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
5632
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
|
|
5633
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
5634
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5464
5635
|
"button",
|
|
5465
5636
|
{
|
|
5466
5637
|
type: "button",
|
|
@@ -5470,9 +5641,9 @@ var ImageEditor = ({
|
|
|
5470
5641
|
},
|
|
5471
5642
|
t
|
|
5472
5643
|
)) }),
|
|
5473
|
-
/* @__PURE__ */ (0,
|
|
5474
|
-
/* @__PURE__ */ (0,
|
|
5475
|
-
/* @__PURE__ */ (0,
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
5645
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
5646
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5476
5647
|
"input",
|
|
5477
5648
|
{
|
|
5478
5649
|
type: "color",
|
|
@@ -5481,15 +5652,15 @@ var ImageEditor = ({
|
|
|
5481
5652
|
className: "w-8 h-8 rounded border border-border cursor-pointer bg-transparent"
|
|
5482
5653
|
}
|
|
5483
5654
|
),
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5485
|
-
/* @__PURE__ */ (0,
|
|
5486
|
-
/* @__PURE__ */ (0,
|
|
5487
|
-
/* @__PURE__ */ (0,
|
|
5655
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
5657
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Width:" }),
|
|
5658
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5488
5659
|
strokeWidth,
|
|
5489
5660
|
"px"
|
|
5490
5661
|
] })
|
|
5491
5662
|
] }),
|
|
5492
|
-
/* @__PURE__ */ (0,
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5493
5664
|
"input",
|
|
5494
5665
|
{
|
|
5495
5666
|
type: "range",
|
|
@@ -5502,10 +5673,10 @@ var ImageEditor = ({
|
|
|
5502
5673
|
)
|
|
5503
5674
|
] })
|
|
5504
5675
|
] }),
|
|
5505
|
-
/* @__PURE__ */ (0,
|
|
5506
|
-
/* @__PURE__ */ (0,
|
|
5507
|
-
/* @__PURE__ */ (0,
|
|
5508
|
-
/* @__PURE__ */ (0,
|
|
5676
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
5678
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2", children: [
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5509
5680
|
"input",
|
|
5510
5681
|
{
|
|
5511
5682
|
type: "text",
|
|
@@ -5516,7 +5687,7 @@ var ImageEditor = ({
|
|
|
5516
5687
|
className: "flex-1 bg-background border border-border rounded-lg px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-primary"
|
|
5517
5688
|
}
|
|
5518
5689
|
),
|
|
5519
|
-
/* @__PURE__ */ (0,
|
|
5690
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5520
5691
|
"button",
|
|
5521
5692
|
{
|
|
5522
5693
|
type: "button",
|
|
@@ -5526,14 +5697,14 @@ var ImageEditor = ({
|
|
|
5526
5697
|
}
|
|
5527
5698
|
)
|
|
5528
5699
|
] }),
|
|
5529
|
-
/* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
5700
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
5701
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Font Size:" }),
|
|
5702
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-mono", children: [
|
|
5532
5703
|
fontSize,
|
|
5533
5704
|
"px"
|
|
5534
5705
|
] })
|
|
5535
5706
|
] }),
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5707
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5537
5708
|
"input",
|
|
5538
5709
|
{
|
|
5539
5710
|
type: "range",
|
|
@@ -5544,14 +5715,14 @@ var ImageEditor = ({
|
|
|
5544
5715
|
className: imageRangeClass
|
|
5545
5716
|
}
|
|
5546
5717
|
),
|
|
5547
|
-
/* @__PURE__ */ (0,
|
|
5548
|
-
/* @__PURE__ */ (0,
|
|
5549
|
-
/* @__PURE__ */ (0,
|
|
5718
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageDividerClass }),
|
|
5719
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5720
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5550
5721
|
"Layers (",
|
|
5551
5722
|
state.annotations.length,
|
|
5552
5723
|
")"
|
|
5553
5724
|
] }),
|
|
5554
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
5725
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5555
5726
|
"button",
|
|
5556
5727
|
{
|
|
5557
5728
|
type: "button",
|
|
@@ -5560,7 +5731,7 @@ var ImageEditor = ({
|
|
|
5560
5731
|
children: "Delete Selected"
|
|
5561
5732
|
}
|
|
5562
5733
|
),
|
|
5563
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
5734
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5564
5735
|
"button",
|
|
5565
5736
|
{
|
|
5566
5737
|
type: "button",
|
|
@@ -5571,10 +5742,10 @@ var ImageEditor = ({
|
|
|
5571
5742
|
)
|
|
5572
5743
|
] })
|
|
5573
5744
|
] }),
|
|
5574
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
5575
|
-
/* @__PURE__ */ (0,
|
|
5576
|
-
/* @__PURE__ */ (0,
|
|
5577
|
-
/* @__PURE__ */ (0,
|
|
5745
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
5746
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5747
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
5748
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5578
5749
|
"button",
|
|
5579
5750
|
{
|
|
5580
5751
|
type: "button",
|
|
@@ -5584,8 +5755,8 @@ var ImageEditor = ({
|
|
|
5584
5755
|
}
|
|
5585
5756
|
)
|
|
5586
5757
|
] }),
|
|
5587
|
-
/* @__PURE__ */ (0,
|
|
5588
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5589
5760
|
"input",
|
|
5590
5761
|
{
|
|
5591
5762
|
type: "checkbox",
|
|
@@ -5594,12 +5765,12 @@ var ImageEditor = ({
|
|
|
5594
5765
|
className: "rounded accent-primary"
|
|
5595
5766
|
}
|
|
5596
5767
|
),
|
|
5597
|
-
/* @__PURE__ */ (0,
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
5598
5769
|
] }),
|
|
5599
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
5600
|
-
/* @__PURE__ */ (0,
|
|
5601
|
-
/* @__PURE__ */ (0,
|
|
5602
|
-
/* @__PURE__ */ (0,
|
|
5770
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5771
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
5773
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5603
5774
|
"input",
|
|
5604
5775
|
{
|
|
5605
5776
|
type: "text",
|
|
@@ -5610,8 +5781,8 @@ var ImageEditor = ({
|
|
|
5610
5781
|
}
|
|
5611
5782
|
)
|
|
5612
5783
|
] }),
|
|
5613
|
-
/* @__PURE__ */ (0,
|
|
5614
|
-
/* @__PURE__ */ (0,
|
|
5784
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2", children: [
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5615
5786
|
"button",
|
|
5616
5787
|
{
|
|
5617
5788
|
type: "button",
|
|
@@ -5620,7 +5791,7 @@ var ImageEditor = ({
|
|
|
5620
5791
|
children: "Threshold Mode"
|
|
5621
5792
|
}
|
|
5622
5793
|
),
|
|
5623
|
-
/* @__PURE__ */ (0,
|
|
5794
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5624
5795
|
"button",
|
|
5625
5796
|
{
|
|
5626
5797
|
type: "button",
|
|
@@ -5630,12 +5801,12 @@ var ImageEditor = ({
|
|
|
5630
5801
|
}
|
|
5631
5802
|
)
|
|
5632
5803
|
] }),
|
|
5633
|
-
/* @__PURE__ */ (0,
|
|
5634
|
-
/* @__PURE__ */ (0,
|
|
5635
|
-
/* @__PURE__ */ (0,
|
|
5636
|
-
/* @__PURE__ */ (0,
|
|
5804
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5805
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5806
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
5807
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
5637
5808
|
] }),
|
|
5638
|
-
/* @__PURE__ */ (0,
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5639
5810
|
"input",
|
|
5640
5811
|
{
|
|
5641
5812
|
type: "range",
|
|
@@ -5649,12 +5820,12 @@ var ImageEditor = ({
|
|
|
5649
5820
|
}
|
|
5650
5821
|
)
|
|
5651
5822
|
] }),
|
|
5652
|
-
/* @__PURE__ */ (0,
|
|
5653
|
-
/* @__PURE__ */ (0,
|
|
5654
|
-
/* @__PURE__ */ (0,
|
|
5655
|
-
/* @__PURE__ */ (0,
|
|
5823
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5824
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5825
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
5826
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
5656
5827
|
] }),
|
|
5657
|
-
/* @__PURE__ */ (0,
|
|
5828
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5658
5829
|
"input",
|
|
5659
5830
|
{
|
|
5660
5831
|
type: "range",
|
|
@@ -5668,12 +5839,12 @@ var ImageEditor = ({
|
|
|
5668
5839
|
}
|
|
5669
5840
|
)
|
|
5670
5841
|
] }),
|
|
5671
|
-
/* @__PURE__ */ (0,
|
|
5672
|
-
/* @__PURE__ */ (0,
|
|
5673
|
-
/* @__PURE__ */ (0,
|
|
5674
|
-
/* @__PURE__ */ (0,
|
|
5842
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
5843
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Softness:" }),
|
|
5845
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
5675
5846
|
] }),
|
|
5676
|
-
/* @__PURE__ */ (0,
|
|
5847
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5677
5848
|
"input",
|
|
5678
5849
|
{
|
|
5679
5850
|
type: "range",
|
|
@@ -5685,8 +5856,8 @@ var ImageEditor = ({
|
|
|
5685
5856
|
}
|
|
5686
5857
|
)
|
|
5687
5858
|
] }),
|
|
5688
|
-
/* @__PURE__ */ (0,
|
|
5689
|
-
/* @__PURE__ */ (0,
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5690
5861
|
"input",
|
|
5691
5862
|
{
|
|
5692
5863
|
type: "checkbox",
|
|
@@ -5695,12 +5866,12 @@ var ImageEditor = ({
|
|
|
5695
5866
|
className: "rounded accent-primary"
|
|
5696
5867
|
}
|
|
5697
5868
|
),
|
|
5698
|
-
/* @__PURE__ */ (0,
|
|
5869
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Invert Mask" })
|
|
5699
5870
|
] })
|
|
5700
5871
|
] })
|
|
5701
5872
|
] }),
|
|
5702
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
5703
|
-
/* @__PURE__ */ (0,
|
|
5873
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5874
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5704
5875
|
SelectionOptionsBar,
|
|
5705
5876
|
{
|
|
5706
5877
|
controller,
|
|
@@ -5710,9 +5881,9 @@ var ImageEditor = ({
|
|
|
5710
5881
|
quickMask: Boolean(state.quickMask)
|
|
5711
5882
|
}
|
|
5712
5883
|
),
|
|
5713
|
-
selectionError && /* @__PURE__ */ (0,
|
|
5714
|
-
/* @__PURE__ */ (0,
|
|
5715
|
-
/* @__PURE__ */ (0,
|
|
5884
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5716
5887
|
"button",
|
|
5717
5888
|
{
|
|
5718
5889
|
type: "button",
|
|
@@ -5723,7 +5894,7 @@ var ImageEditor = ({
|
|
|
5723
5894
|
children: "Transform Selection"
|
|
5724
5895
|
}
|
|
5725
5896
|
),
|
|
5726
|
-
/* @__PURE__ */ (0,
|
|
5897
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5727
5898
|
"button",
|
|
5728
5899
|
{
|
|
5729
5900
|
type: "button",
|
|
@@ -5735,12 +5906,12 @@ var ImageEditor = ({
|
|
|
5735
5906
|
}
|
|
5736
5907
|
)
|
|
5737
5908
|
] }),
|
|
5738
|
-
/* @__PURE__ */ (0,
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers })
|
|
5739
5910
|
] }),
|
|
5740
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
5741
|
-
/* @__PURE__ */ (0,
|
|
5742
|
-
/* @__PURE__ */ (0,
|
|
5743
|
-
/* @__PURE__ */ (0,
|
|
5911
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
5912
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
5913
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { children: "Results go to" }),
|
|
5914
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5744
5915
|
"select",
|
|
5745
5916
|
{
|
|
5746
5917
|
"aria-label": "AI result target",
|
|
@@ -5748,54 +5919,54 @@ var ImageEditor = ({
|
|
|
5748
5919
|
onChange: (e) => setAiTarget(e.target.value),
|
|
5749
5920
|
className: imageSelectClass,
|
|
5750
5921
|
children: [
|
|
5751
|
-
/* @__PURE__ */ (0,
|
|
5752
|
-
/* @__PURE__ */ (0,
|
|
5753
|
-
/* @__PURE__ */ (0,
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
5923
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
5924
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "replace", children: "Replace image" })
|
|
5754
5925
|
]
|
|
5755
5926
|
}
|
|
5756
5927
|
)
|
|
5757
5928
|
] }),
|
|
5758
|
-
/* @__PURE__ */ (0,
|
|
5759
|
-
/* @__PURE__ */ (0,
|
|
5760
|
-
/* @__PURE__ */ (0,
|
|
5761
|
-
/* @__PURE__ */ (0,
|
|
5929
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5930
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5931
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z" }) }),
|
|
5762
5933
|
"Background Removal"
|
|
5763
5934
|
] }),
|
|
5764
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
5935
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Removing..." })
|
|
5765
5936
|
] }),
|
|
5766
|
-
/* @__PURE__ */ (0,
|
|
5767
|
-
/* @__PURE__ */ (0,
|
|
5937
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
5938
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5768
5939
|
"button",
|
|
5769
5940
|
{
|
|
5770
5941
|
type: "button",
|
|
5771
5942
|
onClick: handleRemoveBackground,
|
|
5772
5943
|
disabled: isRemovingBg || isInpainting,
|
|
5773
5944
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
5774
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
5945
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5946
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSpinnerClass }),
|
|
5776
5947
|
"Removing Background..."
|
|
5777
|
-
] }) : /* @__PURE__ */ (0,
|
|
5778
|
-
/* @__PURE__ */ (0,
|
|
5948
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
5949
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5779
5950
|
"Remove Background"
|
|
5780
5951
|
] })
|
|
5781
5952
|
}
|
|
5782
5953
|
)
|
|
5783
5954
|
] }),
|
|
5784
|
-
/* @__PURE__ */ (0,
|
|
5785
|
-
/* @__PURE__ */ (0,
|
|
5786
|
-
/* @__PURE__ */ (0,
|
|
5787
|
-
/* @__PURE__ */ (0,
|
|
5788
|
-
/* @__PURE__ */ (0,
|
|
5789
|
-
/* @__PURE__ */ (0,
|
|
5955
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
5956
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5957
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
5958
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
5959
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "m21.64 3.64-1.28-1.28a1.2 1.2 0 0 0-1.7 0l-9.72 9.72-1.94 4.86 4.86-1.94 9.72-9.72a1.2 1.2 0 0 0 .06-1.64z" }),
|
|
5960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "m14 7 3 3" })
|
|
5790
5961
|
] }),
|
|
5791
5962
|
"Generative Inpainting"
|
|
5792
5963
|
] }),
|
|
5793
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
5964
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-primary/15 text-primary animate-pulse", children: "Inpainting..." })
|
|
5794
5965
|
] }),
|
|
5795
|
-
/* @__PURE__ */ (0,
|
|
5796
|
-
/* @__PURE__ */ (0,
|
|
5797
|
-
/* @__PURE__ */ (0,
|
|
5798
|
-
/* @__PURE__ */ (0,
|
|
5966
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
5967
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5968
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
5969
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5799
5970
|
"textarea",
|
|
5800
5971
|
{
|
|
5801
5972
|
id: "ai-inpaint-prompt-react",
|
|
@@ -5807,10 +5978,10 @@ var ImageEditor = ({
|
|
|
5807
5978
|
}
|
|
5808
5979
|
)
|
|
5809
5980
|
] }),
|
|
5810
|
-
/* @__PURE__ */ (0,
|
|
5811
|
-
/* @__PURE__ */ (0,
|
|
5812
|
-
/* @__PURE__ */ (0,
|
|
5813
|
-
/* @__PURE__ */ (0,
|
|
5981
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
5982
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5814
5985
|
"button",
|
|
5815
5986
|
{
|
|
5816
5987
|
type: "button",
|
|
@@ -5823,7 +5994,7 @@ var ImageEditor = ({
|
|
|
5823
5994
|
]
|
|
5824
5995
|
}
|
|
5825
5996
|
),
|
|
5826
|
-
/* @__PURE__ */ (0,
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5827
5998
|
"button",
|
|
5828
5999
|
{
|
|
5829
6000
|
type: "button",
|
|
@@ -5838,25 +6009,25 @@ var ImageEditor = ({
|
|
|
5838
6009
|
)
|
|
5839
6010
|
] })
|
|
5840
6011
|
] }),
|
|
5841
|
-
/* @__PURE__ */ (0,
|
|
6012
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5842
6013
|
"button",
|
|
5843
6014
|
{
|
|
5844
6015
|
type: "button",
|
|
5845
6016
|
onClick: handleInpaint,
|
|
5846
6017
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
5847
6018
|
className: "mt-1 px-3 py-2 rounded-lg bg-primary hover:bg-primary/90 disabled:opacity-50 text-primary-foreground font-medium shadow transition-colors flex items-center justify-center gap-2",
|
|
5848
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
5849
|
-
/* @__PURE__ */ (0,
|
|
6019
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
6020
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: imageSpinnerClass }),
|
|
5850
6021
|
"Generating Inpaint..."
|
|
5851
|
-
] }) : /* @__PURE__ */ (0,
|
|
5852
|
-
/* @__PURE__ */ (0,
|
|
6022
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
6023
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("svg", { className: "w-3.5 h-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("path", { d: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83" }) }),
|
|
5853
6024
|
"Apply Inpainting"
|
|
5854
6025
|
] })
|
|
5855
6026
|
}
|
|
5856
6027
|
)
|
|
5857
6028
|
] }),
|
|
5858
|
-
aiError && /* @__PURE__ */ (0,
|
|
5859
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
6029
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
6030
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
5860
6031
|
] })
|
|
5861
6032
|
] })
|
|
5862
6033
|
] })
|