@pixerate/editor-react 0.146.0 → 0.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3E32BAYS.js → chunk-HVGT7UE7.js} +519 -412
- package/dist/image-editor/SelectionChangeCheck.d.cts +14 -0
- package/dist/image-editor/SelectionChangeCheck.d.ts +14 -0
- package/dist/image-editor/SeparateSubjectPanel.d.cts +14 -0
- package/dist/image-editor/SeparateSubjectPanel.d.ts +14 -0
- package/dist/image-editor/index.cjs +531 -422
- package/dist/image-editor/index.d.cts +2 -0
- package/dist/image-editor/index.d.ts +2 -0
- package/dist/image-editor/index.js +5 -1
- package/dist/index.cjs +1056 -947
- package/dist/index.js +5 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -81,7 +81,9 @@ __export(src_exports, {
|
|
|
81
81
|
RefineEdgePanel: () => RefineEdgePanel,
|
|
82
82
|
ReviewToolbar: () => ReviewToolbar,
|
|
83
83
|
SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
|
|
84
|
+
SelectionChangeCheck: () => SelectionChangeCheck,
|
|
84
85
|
SelectionOptionsBar: () => SelectionOptionsBar,
|
|
86
|
+
SeparateSubjectPanel: () => SeparateSubjectPanel,
|
|
85
87
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
86
88
|
SheetTabs: () => SheetTabs,
|
|
87
89
|
SpreadsheetConditionalFormatPanel: () => SpreadsheetConditionalFormatPanel,
|
|
@@ -2212,17 +2214,17 @@ var SpreadsheetValidationDialog = ({ prompt, onResolve }) => {
|
|
|
2212
2214
|
style === "warning" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2", children: "Continue?" })
|
|
2213
2215
|
] })
|
|
2214
2216
|
] }),
|
|
2215
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button8, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2216
2218
|
"button",
|
|
2217
2219
|
{
|
|
2218
2220
|
ref: i === 0 ? firstButton : void 0,
|
|
2219
2221
|
type: "button",
|
|
2220
|
-
"data-action":
|
|
2222
|
+
"data-action": button8.action,
|
|
2221
2223
|
className: `rounded border border-border px-3 py-1 ${i === 0 ? "bg-primary text-primary-foreground" : "hover:bg-muted"}`,
|
|
2222
|
-
onClick: () => onResolve(
|
|
2223
|
-
children:
|
|
2224
|
+
onClick: () => onResolve(button8.action),
|
|
2225
|
+
children: button8.label
|
|
2224
2226
|
},
|
|
2225
|
-
|
|
2227
|
+
button8.action
|
|
2226
2228
|
)) })
|
|
2227
2229
|
]
|
|
2228
2230
|
}
|
|
@@ -4045,7 +4047,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
4045
4047
|
}
|
|
4046
4048
|
|
|
4047
4049
|
// src/image-editor/ImageEditor.tsx
|
|
4048
|
-
var
|
|
4050
|
+
var import_react74 = __toESM(require("react"), 1);
|
|
4049
4051
|
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
4050
4052
|
|
|
4051
4053
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -9465,7 +9467,7 @@ var SelectionOptionsBar = ({
|
|
|
9465
9467
|
};
|
|
9466
9468
|
|
|
9467
9469
|
// src/image-editor/RefineEdgePanel.tsx
|
|
9468
|
-
var
|
|
9470
|
+
var import_react68 = require("react");
|
|
9469
9471
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
9470
9472
|
|
|
9471
9473
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
@@ -9515,20 +9517,123 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
9515
9517
|
] });
|
|
9516
9518
|
};
|
|
9517
9519
|
|
|
9518
|
-
// src/image-editor/
|
|
9520
|
+
// src/image-editor/SelectionChangeCheck.tsx
|
|
9521
|
+
var import_react66 = require("react");
|
|
9519
9522
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
9520
|
-
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
9521
9523
|
var button5 = "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";
|
|
9522
|
-
var
|
|
9523
|
-
const
|
|
9524
|
-
const [
|
|
9524
|
+
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
9525
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
9526
|
+
const [result, setResult] = (0, import_react66.useState)(null);
|
|
9525
9527
|
const [error, setError] = (0, import_react66.useState)(null);
|
|
9526
|
-
const
|
|
9527
|
-
const
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9528
|
+
const diff = result && result.for === sel ? result.diff : null;
|
|
9529
|
+
const show = () => {
|
|
9530
|
+
setError(null);
|
|
9531
|
+
try {
|
|
9532
|
+
setResult({ diff: controller.compareSelections(), for: sel });
|
|
9533
|
+
} catch (err) {
|
|
9534
|
+
setResult(null);
|
|
9535
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
9536
|
+
}
|
|
9537
|
+
};
|
|
9538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
9539
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
|
|
9540
|
+
diff && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { "data-testid": "selection-change-summary", className: "text-foreground", children: diff.identical ? "The last step did not change the selection." : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
9541
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "text-green-600", children: [
|
|
9542
|
+
"+",
|
|
9543
|
+
diff.added.area,
|
|
9544
|
+
" px"
|
|
9545
|
+
] }),
|
|
9546
|
+
" ",
|
|
9547
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "text-destructive", children: [
|
|
9548
|
+
"\u2212",
|
|
9549
|
+
diff.removed.area,
|
|
9550
|
+
" px"
|
|
9551
|
+
] }),
|
|
9552
|
+
", overlap ",
|
|
9553
|
+
Math.round(diff.iou * 100),
|
|
9554
|
+
"%"
|
|
9555
|
+
] }) }),
|
|
9556
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9557
|
+
] });
|
|
9558
|
+
};
|
|
9559
|
+
|
|
9560
|
+
// src/image-editor/SeparateSubjectPanel.tsx
|
|
9561
|
+
var import_react67 = require("react");
|
|
9562
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9563
|
+
var button6 = "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";
|
|
9564
|
+
var SeparateSubjectPanel = ({ controller, selection, className = "" }) => {
|
|
9565
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
9566
|
+
const [dilate, setDilate] = (0, import_react67.useState)(8);
|
|
9567
|
+
const [fill, setFill] = (0, import_react67.useState)(true);
|
|
9568
|
+
const [progress, setProgress] = (0, import_react67.useState)(null);
|
|
9569
|
+
const [error, setError] = (0, import_react67.useState)(null);
|
|
9570
|
+
const abort = (0, import_react67.useRef)(null);
|
|
9571
|
+
const run = async () => {
|
|
9572
|
+
setError(null);
|
|
9573
|
+
abort.current = new AbortController();
|
|
9574
|
+
setProgress("Starting");
|
|
9575
|
+
try {
|
|
9576
|
+
await controller.separateSubject({
|
|
9577
|
+
dilate,
|
|
9578
|
+
fill: fill ? "content-aware" : "none",
|
|
9579
|
+
signal: abort.current.signal,
|
|
9580
|
+
onProgress: (fraction, stage) => setProgress(`${stage ?? "Filling"} ${Math.round(fraction * 100)}%`)
|
|
9581
|
+
});
|
|
9582
|
+
} catch (err) {
|
|
9583
|
+
if (!abort.current.signal.aborted) setError(err instanceof Error ? err.message : String(err));
|
|
9584
|
+
} finally {
|
|
9585
|
+
abort.current = null;
|
|
9586
|
+
setProgress(null);
|
|
9587
|
+
}
|
|
9588
|
+
};
|
|
9589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-testid": "separate-subject", className: `flex flex-col gap-1.5 text-xs ${className}`, children: [
|
|
9590
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px]", children: "Separate Subject" }),
|
|
9591
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { className: "text-muted-foreground", children: "The selection onto its own masked layer, over the background with the subject filled out." }),
|
|
9592
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
9593
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
9594
|
+
"Grow",
|
|
9595
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9596
|
+
"input",
|
|
9597
|
+
{
|
|
9598
|
+
type: "number",
|
|
9599
|
+
min: 0,
|
|
9600
|
+
max: 200,
|
|
9601
|
+
"aria-label": "Separate grow",
|
|
9602
|
+
value: dilate,
|
|
9603
|
+
onChange: (e) => setDilate(Math.min(200, Math.max(0, Number(e.target.value) || 0))),
|
|
9604
|
+
className: "w-12 bg-background border border-border rounded px-1 py-0.5 text-foreground"
|
|
9605
|
+
}
|
|
9606
|
+
),
|
|
9607
|
+
"px"
|
|
9608
|
+
] }),
|
|
9609
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-1 text-foreground", children: [
|
|
9610
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Fill the background", checked: fill, onChange: (e) => setFill(e.target.checked) }),
|
|
9611
|
+
"Fill the background"
|
|
9612
|
+
] })
|
|
9613
|
+
] }),
|
|
9614
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
|
|
9615
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel || progress !== null, onClick: run, children: "Separate Subject" }),
|
|
9616
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, onClick: () => abort.current?.abort(), children: "Cancel" })
|
|
9617
|
+
] }),
|
|
9618
|
+
progress !== null && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "status", className: "text-muted-foreground", children: progress }),
|
|
9619
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9620
|
+
] });
|
|
9621
|
+
};
|
|
9622
|
+
|
|
9623
|
+
// src/image-editor/RefineEdgePanel.tsx
|
|
9624
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9625
|
+
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
9626
|
+
var button7 = "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";
|
|
9627
|
+
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
9628
|
+
const [params, setParams] = (0, import_react68.useState)(DEFAULT_PARAMS);
|
|
9629
|
+
const [busy, setBusy] = (0, import_react68.useState)(false);
|
|
9630
|
+
const [error, setError] = (0, import_react68.useState)(null);
|
|
9631
|
+
const [layerId, setLayerId] = (0, import_react68.useState)("");
|
|
9632
|
+
const [newKind, setNewKind] = (0, import_react68.useState)("hueSaturation");
|
|
9633
|
+
const [output, setOutput] = (0, import_react68.useState)("selection");
|
|
9634
|
+
const [decontaminate, setDecontaminate] = (0, import_react68.useState)(0);
|
|
9635
|
+
const [objectAware, setObjectAware] = (0, import_react68.useState)(false);
|
|
9636
|
+
const [onlyUncertain, setOnlyUncertain] = (0, import_react68.useState)(false);
|
|
9532
9637
|
const canObject = Boolean(controller.segmentationProvider);
|
|
9533
9638
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
9534
9639
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -9551,17 +9656,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9551
9656
|
setBusy(false);
|
|
9552
9657
|
}
|
|
9553
9658
|
};
|
|
9554
|
-
return /* @__PURE__ */ (0,
|
|
9555
|
-
/* @__PURE__ */ (0,
|
|
9556
|
-
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
9557
|
-
/* @__PURE__ */ (0,
|
|
9558
|
-
/* @__PURE__ */ (0,
|
|
9559
|
-
/* @__PURE__ */ (0,
|
|
9659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
9660
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
9661
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9662
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9663
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: c.label }),
|
|
9664
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
|
|
9560
9665
|
params[c.id],
|
|
9561
9666
|
c.unit
|
|
9562
9667
|
] })
|
|
9563
9668
|
] }),
|
|
9564
|
-
/* @__PURE__ */ (0,
|
|
9669
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9565
9670
|
"input",
|
|
9566
9671
|
{
|
|
9567
9672
|
type: "range",
|
|
@@ -9575,43 +9680,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9575
9680
|
}
|
|
9576
9681
|
)
|
|
9577
9682
|
] }, c.id)),
|
|
9578
|
-
/* @__PURE__ */ (0,
|
|
9579
|
-
/* @__PURE__ */ (0,
|
|
9683
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
9684
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
9580
9685
|
"Smart Radius"
|
|
9581
9686
|
] }),
|
|
9582
|
-
/* @__PURE__ */ (0,
|
|
9583
|
-
/* @__PURE__ */ (0,
|
|
9687
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
9688
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
9584
9689
|
"Only uncertain areas"
|
|
9585
9690
|
] }),
|
|
9586
|
-
canObject && /* @__PURE__ */ (0,
|
|
9587
|
-
/* @__PURE__ */ (0,
|
|
9691
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
9692
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
9588
9693
|
"Object aware (segmentation model)"
|
|
9589
9694
|
] }),
|
|
9590
|
-
/* @__PURE__ */ (0,
|
|
9695
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
9591
9696
|
"Output to",
|
|
9592
|
-
/* @__PURE__ */ (0,
|
|
9697
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9593
9698
|
"select",
|
|
9594
9699
|
{
|
|
9595
9700
|
"aria-label": "Refine output",
|
|
9596
9701
|
value: output,
|
|
9597
9702
|
onChange: (e) => setOutput(e.target.value),
|
|
9598
9703
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9599
|
-
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0,
|
|
9704
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
9600
9705
|
}
|
|
9601
9706
|
)
|
|
9602
9707
|
] }),
|
|
9603
|
-
/* @__PURE__ */ (0,
|
|
9604
|
-
/* @__PURE__ */ (0,
|
|
9605
|
-
/* @__PURE__ */ (0,
|
|
9708
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9709
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9710
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { children: [
|
|
9606
9711
|
"Decontaminate colors",
|
|
9607
9712
|
toLayer ? "" : " (new layer or document outputs)"
|
|
9608
9713
|
] }),
|
|
9609
|
-
/* @__PURE__ */ (0,
|
|
9714
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
|
|
9610
9715
|
decontaminate,
|
|
9611
9716
|
"%"
|
|
9612
9717
|
] })
|
|
9613
9718
|
] }),
|
|
9614
|
-
/* @__PURE__ */ (0,
|
|
9719
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9615
9720
|
"input",
|
|
9616
9721
|
{
|
|
9617
9722
|
type: "range",
|
|
@@ -9626,64 +9731,66 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9626
9731
|
}
|
|
9627
9732
|
)
|
|
9628
9733
|
] }),
|
|
9629
|
-
/* @__PURE__ */ (0,
|
|
9630
|
-
/* @__PURE__ */ (0,
|
|
9631
|
-
/* @__PURE__ */ (0,
|
|
9734
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex gap-1", children: [
|
|
9735
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
9736
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
9632
9737
|
] }),
|
|
9633
|
-
error && /* @__PURE__ */ (0,
|
|
9634
|
-
/* @__PURE__ */ (0,
|
|
9635
|
-
/* @__PURE__ */ (0,
|
|
9636
|
-
/* @__PURE__ */ (0,
|
|
9637
|
-
|
|
9738
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
9739
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
9740
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectionChangeCheck, { controller, selection: sel }),
|
|
9741
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SeparateSubjectPanel, { controller, selection: sel, className: "mt-2" }),
|
|
9742
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
9743
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
9744
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9638
9745
|
"select",
|
|
9639
9746
|
{
|
|
9640
9747
|
"aria-label": "New masked layer kind",
|
|
9641
9748
|
value: newKind,
|
|
9642
9749
|
onChange: (e) => setNewKind(e.target.value),
|
|
9643
9750
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9644
|
-
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
9751
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
9645
9752
|
}
|
|
9646
9753
|
),
|
|
9647
|
-
/* @__PURE__ */ (0,
|
|
9754
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9648
9755
|
"button",
|
|
9649
9756
|
{
|
|
9650
9757
|
type: "button",
|
|
9651
|
-
className:
|
|
9758
|
+
className: button7,
|
|
9652
9759
|
disabled: !sel,
|
|
9653
9760
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
9654
9761
|
children: "New Masked Layer"
|
|
9655
9762
|
}
|
|
9656
9763
|
)
|
|
9657
9764
|
] }),
|
|
9658
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
9659
|
-
/* @__PURE__ */ (0,
|
|
9765
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
9766
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9660
9767
|
"select",
|
|
9661
9768
|
{
|
|
9662
9769
|
"aria-label": "Mask layer",
|
|
9663
9770
|
value: target.id,
|
|
9664
9771
|
onChange: (e) => setLayerId(e.target.value),
|
|
9665
9772
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9666
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
9773
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("option", { value: l.id, children: [
|
|
9667
9774
|
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
9668
9775
|
l.mask ? " (masked)" : ""
|
|
9669
9776
|
] }, l.id))
|
|
9670
9777
|
}
|
|
9671
9778
|
),
|
|
9672
|
-
/* @__PURE__ */ (0,
|
|
9673
|
-
/* @__PURE__ */ (0,
|
|
9674
|
-
/* @__PURE__ */ (0,
|
|
9675
|
-
/* @__PURE__ */ (0,
|
|
9779
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
9780
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
9781
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
9782
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: button7, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
9676
9783
|
] }),
|
|
9677
|
-
target.mask && /* @__PURE__ */ (0,
|
|
9678
|
-
/* @__PURE__ */ (0,
|
|
9679
|
-
/* @__PURE__ */ (0,
|
|
9680
|
-
/* @__PURE__ */ (0,
|
|
9681
|
-
/* @__PURE__ */ (0,
|
|
9784
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
9785
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9786
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9787
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Density" }),
|
|
9788
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
|
|
9682
9789
|
Math.round((target.mask.density ?? 1) * 100),
|
|
9683
9790
|
"%"
|
|
9684
9791
|
] })
|
|
9685
9792
|
] }),
|
|
9686
|
-
/* @__PURE__ */ (0,
|
|
9793
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9687
9794
|
"input",
|
|
9688
9795
|
{
|
|
9689
9796
|
type: "range",
|
|
@@ -9697,15 +9804,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9697
9804
|
}
|
|
9698
9805
|
)
|
|
9699
9806
|
] }),
|
|
9700
|
-
/* @__PURE__ */ (0,
|
|
9701
|
-
/* @__PURE__ */ (0,
|
|
9702
|
-
/* @__PURE__ */ (0,
|
|
9703
|
-
/* @__PURE__ */ (0,
|
|
9807
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9808
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9809
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Mask Feather" }),
|
|
9810
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "font-mono", children: [
|
|
9704
9811
|
target.mask.feather ?? 0,
|
|
9705
9812
|
"px"
|
|
9706
9813
|
] })
|
|
9707
9814
|
] }),
|
|
9708
|
-
/* @__PURE__ */ (0,
|
|
9815
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9709
9816
|
"input",
|
|
9710
9817
|
{
|
|
9711
9818
|
type: "range",
|
|
@@ -9725,13 +9832,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9725
9832
|
};
|
|
9726
9833
|
|
|
9727
9834
|
// src/image-editor/ChannelsPanel.tsx
|
|
9728
|
-
var
|
|
9835
|
+
var import_react69 = require("react");
|
|
9729
9836
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
9730
|
-
var
|
|
9837
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9731
9838
|
var btn2 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
9732
9839
|
var ChannelThumb = ({ channel, size }) => {
|
|
9733
|
-
const ref = (0,
|
|
9734
|
-
(0,
|
|
9840
|
+
const ref = (0, import_react69.useRef)(null);
|
|
9841
|
+
(0, import_react69.useEffect)(() => {
|
|
9735
9842
|
const canvas = ref.current;
|
|
9736
9843
|
const ctx = canvas?.getContext("2d");
|
|
9737
9844
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -9742,15 +9849,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
9742
9849
|
img.data.set(px.data);
|
|
9743
9850
|
ctx.putImageData(img, 0, 0);
|
|
9744
9851
|
}, [channel.mask]);
|
|
9745
|
-
return /* @__PURE__ */ (0,
|
|
9852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
9746
9853
|
};
|
|
9747
9854
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
9748
|
-
const [, setTick] = (0,
|
|
9749
|
-
(0,
|
|
9750
|
-
const [activeId, setActiveId] = (0,
|
|
9751
|
-
const [renaming, setRenaming] = (0,
|
|
9752
|
-
const [error, setError] = (0,
|
|
9753
|
-
const fileInput = (0,
|
|
9855
|
+
const [, setTick] = (0, import_react69.useState)(0);
|
|
9856
|
+
(0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
9857
|
+
const [activeId, setActiveId] = (0, import_react69.useState)(null);
|
|
9858
|
+
const [renaming, setRenaming] = (0, import_react69.useState)(null);
|
|
9859
|
+
const [error, setError] = (0, import_react69.useState)(null);
|
|
9860
|
+
const fileInput = (0, import_react69.useRef)(null);
|
|
9754
9861
|
const channels = controller.getChannels();
|
|
9755
9862
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
9756
9863
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -9772,13 +9879,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9772
9879
|
setError(err instanceof Error ? err.message : String(err));
|
|
9773
9880
|
}
|
|
9774
9881
|
};
|
|
9775
|
-
return /* @__PURE__ */ (0,
|
|
9776
|
-
/* @__PURE__ */ (0,
|
|
9777
|
-
/* @__PURE__ */ (0,
|
|
9778
|
-
/* @__PURE__ */ (0,
|
|
9882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
9883
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9884
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
9885
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", "aria-pressed": quickMask, className: btn2(quickMask), title: "Paint the selection: white selects, black deselects (Q)", onClick: () => controller.setQuickMaskMode(!quickMask), children: "Quick Mask" })
|
|
9779
9886
|
] }),
|
|
9780
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
9781
|
-
/* @__PURE__ */ (0,
|
|
9887
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
9888
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
9782
9889
|
"li",
|
|
9783
9890
|
{
|
|
9784
9891
|
"data-testid": "channel-row",
|
|
@@ -9790,7 +9897,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9790
9897
|
},
|
|
9791
9898
|
onDoubleClick: () => setRenaming(c.id),
|
|
9792
9899
|
children: [
|
|
9793
|
-
/* @__PURE__ */ (0,
|
|
9900
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9794
9901
|
"button",
|
|
9795
9902
|
{
|
|
9796
9903
|
type: "button",
|
|
@@ -9804,8 +9911,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9804
9911
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
9805
9912
|
}
|
|
9806
9913
|
),
|
|
9807
|
-
/* @__PURE__ */ (0,
|
|
9808
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
9914
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
9915
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9809
9916
|
"input",
|
|
9810
9917
|
{
|
|
9811
9918
|
autoFocus: true,
|
|
@@ -9822,16 +9929,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9822
9929
|
if (e.key === "Escape") setRenaming(null);
|
|
9823
9930
|
}
|
|
9824
9931
|
}
|
|
9825
|
-
) : /* @__PURE__ */ (0,
|
|
9932
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
9826
9933
|
]
|
|
9827
9934
|
},
|
|
9828
9935
|
c.id
|
|
9829
9936
|
)) }),
|
|
9830
|
-
/* @__PURE__ */ (0,
|
|
9831
|
-
/* @__PURE__ */ (0,
|
|
9832
|
-
/* @__PURE__ */ (0,
|
|
9833
|
-
/* @__PURE__ */ (0,
|
|
9834
|
-
/* @__PURE__ */ (0,
|
|
9937
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
9938
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
9939
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), disabled: !active || !hasSelection, title: "Add the selection to the channel", onClick: () => attempt(() => controller.saveSelection({ channelId: active.id, mode: "add" })), children: "Add to Channel" }),
|
|
9940
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
9941
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9835
9942
|
"button",
|
|
9836
9943
|
{
|
|
9837
9944
|
type: "button",
|
|
@@ -9844,8 +9951,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9844
9951
|
children: "Delete"
|
|
9845
9952
|
}
|
|
9846
9953
|
),
|
|
9847
|
-
/* @__PURE__ */ (0,
|
|
9848
|
-
/* @__PURE__ */ (0,
|
|
9954
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
9955
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9849
9956
|
"button",
|
|
9850
9957
|
{
|
|
9851
9958
|
type: "button",
|
|
@@ -9856,7 +9963,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9856
9963
|
children: "Export PNG"
|
|
9857
9964
|
}
|
|
9858
9965
|
),
|
|
9859
|
-
/* @__PURE__ */ (0,
|
|
9966
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9860
9967
|
"input",
|
|
9861
9968
|
{
|
|
9862
9969
|
ref: fileInput,
|
|
@@ -9871,22 +9978,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9871
9978
|
}
|
|
9872
9979
|
)
|
|
9873
9980
|
] }),
|
|
9874
|
-
error && /* @__PURE__ */ (0,
|
|
9981
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9875
9982
|
] });
|
|
9876
9983
|
};
|
|
9877
9984
|
|
|
9878
9985
|
// src/image-editor/PathsPanel.tsx
|
|
9879
|
-
var
|
|
9986
|
+
var import_react70 = require("react");
|
|
9880
9987
|
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
9881
|
-
var
|
|
9988
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9882
9989
|
var btn3 = (on = false) => `px-2 py-1 rounded-md border text-[11px] transition-colors disabled:opacity-40 ${on ? "bg-primary border-primary text-primary-foreground" : "bg-background border-border text-foreground hover:bg-accent hover:text-accent-foreground"}`;
|
|
9883
9990
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
9884
|
-
const [, setTick] = (0,
|
|
9885
|
-
(0,
|
|
9886
|
-
const [renaming, setRenaming] = (0,
|
|
9887
|
-
const [color, setColor] = (0,
|
|
9888
|
-
const [width, setWidth] = (0,
|
|
9889
|
-
const [error, setError] = (0,
|
|
9991
|
+
const [, setTick] = (0, import_react70.useState)(0);
|
|
9992
|
+
(0, import_react70.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
9993
|
+
const [renaming, setRenaming] = (0, import_react70.useState)(null);
|
|
9994
|
+
const [color, setColor] = (0, import_react70.useState)("#000000");
|
|
9995
|
+
const [width, setWidth] = (0, import_react70.useState)(2);
|
|
9996
|
+
const [error, setError] = (0, import_react70.useState)(null);
|
|
9890
9997
|
const paths = controller.getPaths();
|
|
9891
9998
|
const activeId = controller.getState().activePathId ?? null;
|
|
9892
9999
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -9902,10 +10009,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9902
10009
|
};
|
|
9903
10010
|
return (
|
|
9904
10011
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
9905
|
-
/* @__PURE__ */ (0,
|
|
9906
|
-
/* @__PURE__ */ (0,
|
|
9907
|
-
paths.length === 0 && /* @__PURE__ */ (0,
|
|
9908
|
-
/* @__PURE__ */ (0,
|
|
10012
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { "data-testid": "paths-panel", className: `flex flex-col gap-2 text-xs ${className}`, onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: [
|
|
10013
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
10014
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
10015
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5 min-h-4", onClick: (e) => e.target === e.currentTarget && attempt(() => controller.setActivePath(null)), children: paths.map((p) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
|
|
9909
10016
|
"li",
|
|
9910
10017
|
{
|
|
9911
10018
|
"data-testid": "path-row",
|
|
@@ -9914,8 +10021,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9914
10021
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
9915
10022
|
onDoubleClick: () => setRenaming(p.id),
|
|
9916
10023
|
children: [
|
|
9917
|
-
/* @__PURE__ */ (0,
|
|
9918
|
-
renaming === p.id ? /* @__PURE__ */ (0,
|
|
10024
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("svg", { "aria-hidden": "true", viewBox: `0 0 ${w || 1} ${h || 1}`, style: { width: thumbnailSize, height: thumbnailSize }, className: "shrink-0 rounded ring-1 ring-border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("path", { d: (0, import_image_editor20.pathSvgData)(p), fill: "currentColor", fillOpacity: 0.25, stroke: "currentColor", strokeWidth: Math.max(w, h) / 64, fillRule: p.fillRule ?? "nonzero" }) }),
|
|
10025
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9919
10026
|
"input",
|
|
9920
10027
|
{
|
|
9921
10028
|
autoFocus: true,
|
|
@@ -9934,13 +10041,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9934
10041
|
if (e.key === "Escape") setRenaming(null);
|
|
9935
10042
|
}
|
|
9936
10043
|
}
|
|
9937
|
-
) : /* @__PURE__ */ (0,
|
|
10044
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
9938
10045
|
]
|
|
9939
10046
|
},
|
|
9940
10047
|
p.id
|
|
9941
10048
|
)) }),
|
|
9942
|
-
/* @__PURE__ */ (0,
|
|
9943
|
-
/* @__PURE__ */ (0,
|
|
10049
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
10050
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9944
10051
|
"button",
|
|
9945
10052
|
{
|
|
9946
10053
|
type: "button",
|
|
@@ -9951,15 +10058,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9951
10058
|
children: "Load as Selection"
|
|
9952
10059
|
}
|
|
9953
10060
|
),
|
|
9954
|
-
/* @__PURE__ */ (0,
|
|
9955
|
-
active?.work && /* @__PURE__ */ (0,
|
|
9956
|
-
/* @__PURE__ */ (0,
|
|
10061
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
10062
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
10063
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
9957
10064
|
] }),
|
|
9958
|
-
/* @__PURE__ */ (0,
|
|
9959
|
-
/* @__PURE__ */ (0,
|
|
9960
|
-
/* @__PURE__ */ (0,
|
|
9961
|
-
/* @__PURE__ */ (0,
|
|
9962
|
-
/* @__PURE__ */ (0,
|
|
10065
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
10066
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("input", { type: "color", "aria-label": "Path paint colour", value: color, onChange: (e) => setColor(e.target.value), className: "h-6 w-8 bg-background border border-border rounded" }),
|
|
10067
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
10068
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
10069
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
9963
10070
|
"input",
|
|
9964
10071
|
{
|
|
9965
10072
|
type: "number",
|
|
@@ -9974,25 +10081,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9974
10081
|
),
|
|
9975
10082
|
"px"
|
|
9976
10083
|
] }),
|
|
9977
|
-
/* @__PURE__ */ (0,
|
|
10084
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
9978
10085
|
] }),
|
|
9979
|
-
/* @__PURE__ */ (0,
|
|
9980
|
-
/* @__PURE__ */ (0,
|
|
9981
|
-
/* @__PURE__ */ (0,
|
|
10086
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
10087
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
10088
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
9982
10089
|
] }),
|
|
9983
|
-
error && /* @__PURE__ */ (0,
|
|
10090
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9984
10091
|
] })
|
|
9985
10092
|
);
|
|
9986
10093
|
};
|
|
9987
10094
|
|
|
9988
10095
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
9989
|
-
var
|
|
10096
|
+
var import_react71 = require("react");
|
|
9990
10097
|
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
9991
|
-
var
|
|
10098
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
9992
10099
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
9993
10100
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
9994
|
-
const [, setTick] = (0,
|
|
9995
|
-
(0,
|
|
10101
|
+
const [, setTick] = (0, import_react71.useState)(0);
|
|
10102
|
+
(0, import_react71.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
9996
10103
|
const bar = tool.bar();
|
|
9997
10104
|
if (!tool.active || !bar) return null;
|
|
9998
10105
|
const warp = tool.warpBar();
|
|
@@ -10004,17 +10111,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10004
10111
|
const v = Number(raw);
|
|
10005
10112
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
10006
10113
|
};
|
|
10007
|
-
return /* @__PURE__ */ (0,
|
|
10008
|
-
/* @__PURE__ */ (0,
|
|
10009
|
-
/* @__PURE__ */ (0,
|
|
10010
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
10011
|
-
/* @__PURE__ */ (0,
|
|
10012
|
-
/* @__PURE__ */ (0,
|
|
10013
|
-
/* @__PURE__ */ (0,
|
|
10114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.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: [
|
|
10115
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "flex gap-1", role: "group", "aria-label": "Transform mode", children: import_image_editor21.FREE_TRANSFORM_MODE_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime51.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)) }),
|
|
10116
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "grid grid-cols-3 gap-px", role: "group", "aria-label": "Reference point", children: import_image_editor21.TRANSFORM_ANCHORS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime51.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)) }),
|
|
10117
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
10118
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10119
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
10120
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("select", { "aria-label": "Warp style", value: warp.style, onChange: (e) => tool.setWarp({ style: e.target.value }), className: imageFieldClass, children: import_image_editor21.WARP_STYLE_OPTIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
10014
10121
|
] }),
|
|
10015
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
10016
|
-
/* @__PURE__ */ (0,
|
|
10017
|
-
/* @__PURE__ */ (0,
|
|
10122
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10123
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
10124
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10018
10125
|
"input",
|
|
10019
10126
|
{
|
|
10020
10127
|
type: "number",
|
|
@@ -10035,9 +10142,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10035
10142
|
},
|
|
10036
10143
|
`${k}:${warp[k]}`
|
|
10037
10144
|
),
|
|
10038
|
-
/* @__PURE__ */ (0,
|
|
10145
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
10039
10146
|
] }, k)),
|
|
10040
|
-
/* @__PURE__ */ (0,
|
|
10147
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10041
10148
|
"button",
|
|
10042
10149
|
{
|
|
10043
10150
|
type: "button",
|
|
@@ -10049,9 +10156,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10049
10156
|
children: "Vertical"
|
|
10050
10157
|
}
|
|
10051
10158
|
),
|
|
10052
|
-
/* @__PURE__ */ (0,
|
|
10053
|
-
/* @__PURE__ */ (0,
|
|
10054
|
-
/* @__PURE__ */ (0,
|
|
10159
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10160
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
10161
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10055
10162
|
"select",
|
|
10056
10163
|
{
|
|
10057
10164
|
"aria-label": "Warp grid",
|
|
@@ -10061,14 +10168,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10061
10168
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
10062
10169
|
},
|
|
10063
10170
|
className: imageFieldClass,
|
|
10064
|
-
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
10171
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
10065
10172
|
}
|
|
10066
10173
|
)
|
|
10067
10174
|
] })
|
|
10068
10175
|
] }),
|
|
10069
|
-
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
10070
|
-
/* @__PURE__ */ (0,
|
|
10071
|
-
/* @__PURE__ */ (0,
|
|
10176
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
10177
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
10178
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10072
10179
|
"input",
|
|
10073
10180
|
{
|
|
10074
10181
|
type: "number",
|
|
@@ -10088,8 +10195,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10088
10195
|
},
|
|
10089
10196
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
10090
10197
|
),
|
|
10091
|
-
/* @__PURE__ */ (0,
|
|
10092
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
10198
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
10199
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10093
10200
|
"button",
|
|
10094
10201
|
{
|
|
10095
10202
|
type: "button",
|
|
@@ -10104,33 +10211,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10104
10211
|
}
|
|
10105
10212
|
)
|
|
10106
10213
|
] }, f.id)),
|
|
10107
|
-
/* @__PURE__ */ (0,
|
|
10108
|
-
/* @__PURE__ */ (0,
|
|
10109
|
-
/* @__PURE__ */ (0,
|
|
10214
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10215
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
10216
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10110
10217
|
"select",
|
|
10111
10218
|
{
|
|
10112
10219
|
"aria-label": "Interpolation",
|
|
10113
10220
|
value: tool.interpolation,
|
|
10114
10221
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
10115
10222
|
className: imageFieldClass,
|
|
10116
|
-
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
10223
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
10117
10224
|
}
|
|
10118
10225
|
)
|
|
10119
10226
|
] }),
|
|
10120
|
-
/* @__PURE__ */ (0,
|
|
10121
|
-
/* @__PURE__ */ (0,
|
|
10122
|
-
tool.error && /* @__PURE__ */ (0,
|
|
10227
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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" }),
|
|
10228
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
10229
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
10123
10230
|
] });
|
|
10124
10231
|
};
|
|
10125
10232
|
|
|
10126
10233
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
10127
|
-
var
|
|
10234
|
+
var import_react72 = require("react");
|
|
10128
10235
|
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
10129
|
-
var
|
|
10236
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10130
10237
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
10131
|
-
const [, setTick] = (0,
|
|
10132
|
-
(0,
|
|
10133
|
-
const [error, setError] = (0,
|
|
10238
|
+
const [, setTick] = (0, import_react72.useState)(0);
|
|
10239
|
+
(0, import_react72.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
10240
|
+
const [error, setError] = (0, import_react72.useState)(null);
|
|
10134
10241
|
const active = controller.getActiveLayer();
|
|
10135
10242
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
10136
10243
|
const set = (change) => {
|
|
@@ -10144,22 +10251,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
10144
10251
|
}
|
|
10145
10252
|
};
|
|
10146
10253
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
10147
|
-
return /* @__PURE__ */ (0,
|
|
10148
|
-
/* @__PURE__ */ (0,
|
|
10149
|
-
/* @__PURE__ */ (0,
|
|
10150
|
-
/* @__PURE__ */ (0,
|
|
10151
|
-
/* @__PURE__ */ (0,
|
|
10254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
10255
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex flex-wrap gap-1", role: "toolbar", "aria-label": "Shape kind", children: import_image_editor22.LIVE_SHAPE_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": options.kind === k, className: imageChipClass(options.kind === k), onClick: () => onChange({ ...options, kind: k }), children: import_image_editor22.SHAPE_KIND_LABELS[k] }, k)) }),
|
|
10256
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
10257
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10258
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
10152
10259
|
"Fill",
|
|
10153
|
-
/* @__PURE__ */ (0,
|
|
10260
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
10154
10261
|
] }),
|
|
10155
|
-
/* @__PURE__ */ (0,
|
|
10156
|
-
/* @__PURE__ */ (0,
|
|
10262
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10263
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
10157
10264
|
"Stroke",
|
|
10158
|
-
/* @__PURE__ */ (0,
|
|
10265
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
10159
10266
|
] }),
|
|
10160
|
-
/* @__PURE__ */ (0,
|
|
10267
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10161
10268
|
"Width",
|
|
10162
|
-
/* @__PURE__ */ (0,
|
|
10269
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10163
10270
|
"input",
|
|
10164
10271
|
{
|
|
10165
10272
|
type: "number",
|
|
@@ -10173,52 +10280,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
10173
10280
|
)
|
|
10174
10281
|
] })
|
|
10175
10282
|
] }),
|
|
10176
|
-
/* @__PURE__ */ (0,
|
|
10177
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
10283
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
10284
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10178
10285
|
"Radius",
|
|
10179
|
-
/* @__PURE__ */ (0,
|
|
10286
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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}` })
|
|
10180
10287
|
] }),
|
|
10181
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
10288
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10182
10289
|
"Sides",
|
|
10183
|
-
/* @__PURE__ */ (0,
|
|
10290
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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}` })
|
|
10184
10291
|
] }),
|
|
10185
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
10186
|
-
/* @__PURE__ */ (0,
|
|
10292
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
10293
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10187
10294
|
"Points",
|
|
10188
|
-
/* @__PURE__ */ (0,
|
|
10295
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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}` })
|
|
10189
10296
|
] }),
|
|
10190
|
-
/* @__PURE__ */ (0,
|
|
10297
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10191
10298
|
"Inner",
|
|
10192
|
-
/* @__PURE__ */ (0,
|
|
10299
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
10193
10300
|
] })
|
|
10194
10301
|
] }),
|
|
10195
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
10196
|
-
/* @__PURE__ */ (0,
|
|
10302
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
10303
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10197
10304
|
"Weight",
|
|
10198
|
-
/* @__PURE__ */ (0,
|
|
10305
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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}` })
|
|
10199
10306
|
] }),
|
|
10200
|
-
/* @__PURE__ */ (0,
|
|
10201
|
-
/* @__PURE__ */ (0,
|
|
10307
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10308
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
10202
10309
|
"Arrowhead"
|
|
10203
10310
|
] })
|
|
10204
10311
|
] })
|
|
10205
10312
|
] }),
|
|
10206
|
-
/* @__PURE__ */ (0,
|
|
10207
|
-
error && /* @__PURE__ */ (0,
|
|
10313
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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." }),
|
|
10314
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
10208
10315
|
] });
|
|
10209
10316
|
};
|
|
10210
10317
|
|
|
10211
10318
|
// src/image-editor/TypeOptionsBar.tsx
|
|
10212
|
-
var
|
|
10319
|
+
var import_react73 = require("react");
|
|
10213
10320
|
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
10214
|
-
var
|
|
10321
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10215
10322
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
10216
10323
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
10217
10324
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
10218
|
-
const [, setTick] = (0,
|
|
10219
|
-
(0,
|
|
10220
|
-
(0,
|
|
10221
|
-
const [error, setError] = (0,
|
|
10325
|
+
const [, setTick] = (0, import_react73.useState)(0);
|
|
10326
|
+
(0, import_react73.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
10327
|
+
(0, import_react73.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
10328
|
+
const [error, setError] = (0, import_react73.useState)(null);
|
|
10222
10329
|
const active = controller.getActiveLayer();
|
|
10223
10330
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
10224
10331
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -10271,11 +10378,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10271
10378
|
setError(e instanceof Error ? e.message : String(e));
|
|
10272
10379
|
}
|
|
10273
10380
|
};
|
|
10274
|
-
return /* @__PURE__ */ (0,
|
|
10275
|
-
/* @__PURE__ */ (0,
|
|
10276
|
-
/* @__PURE__ */ (0,
|
|
10381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
10382
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
10383
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10277
10384
|
"Font",
|
|
10278
|
-
/* @__PURE__ */ (0,
|
|
10385
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10279
10386
|
"input",
|
|
10280
10387
|
{
|
|
10281
10388
|
list: "pixerate-type-fonts",
|
|
@@ -10285,11 +10392,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10285
10392
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
10286
10393
|
}
|
|
10287
10394
|
),
|
|
10288
|
-
/* @__PURE__ */ (0,
|
|
10395
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: f }, f)) })
|
|
10289
10396
|
] }),
|
|
10290
|
-
/* @__PURE__ */ (0,
|
|
10397
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10291
10398
|
"Size",
|
|
10292
|
-
/* @__PURE__ */ (0,
|
|
10399
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10293
10400
|
"input",
|
|
10294
10401
|
{
|
|
10295
10402
|
type: "number",
|
|
@@ -10302,14 +10409,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10302
10409
|
}
|
|
10303
10410
|
)
|
|
10304
10411
|
] }),
|
|
10305
|
-
/* @__PURE__ */ (0,
|
|
10306
|
-
/* @__PURE__ */ (0,
|
|
10307
|
-
/* @__PURE__ */ (0,
|
|
10412
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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" }),
|
|
10413
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
10414
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
10308
10415
|
] }),
|
|
10309
|
-
/* @__PURE__ */ (0,
|
|
10310
|
-
/* @__PURE__ */ (0,
|
|
10311
|
-
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0,
|
|
10312
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
10416
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
10417
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
10418
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
10419
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10313
10420
|
"button",
|
|
10314
10421
|
{
|
|
10315
10422
|
type: "button",
|
|
@@ -10321,19 +10428,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10321
10428
|
}
|
|
10322
10429
|
)
|
|
10323
10430
|
] }),
|
|
10324
|
-
/* @__PURE__ */ (0,
|
|
10325
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
10431
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
|
|
10432
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
10326
10433
|
"Missing ",
|
|
10327
10434
|
missing.length === 1 ? "font" : "fonts",
|
|
10328
10435
|
": ",
|
|
10329
10436
|
missing.join(", ")
|
|
10330
10437
|
] }),
|
|
10331
|
-
error && /* @__PURE__ */ (0,
|
|
10438
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
10332
10439
|
] });
|
|
10333
10440
|
};
|
|
10334
10441
|
|
|
10335
10442
|
// src/image-editor/ImageEditor.tsx
|
|
10336
|
-
var
|
|
10443
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
10337
10444
|
var ImageEditor = ({
|
|
10338
10445
|
editor: externalEditor,
|
|
10339
10446
|
src,
|
|
@@ -10358,32 +10465,32 @@ var ImageEditor = ({
|
|
|
10358
10465
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
10359
10466
|
});
|
|
10360
10467
|
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
10361
|
-
const [activeTab, setActiveTab] = (0,
|
|
10362
|
-
const rootRef = (0,
|
|
10468
|
+
const [activeTab, setActiveTab] = (0, import_react74.useState)("crop");
|
|
10469
|
+
const rootRef = (0, import_react74.useRef)(null);
|
|
10363
10470
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
10364
|
-
const activeTabRef = (0,
|
|
10471
|
+
const activeTabRef = (0, import_react74.useRef)(activeTab);
|
|
10365
10472
|
activeTabRef.current = activeTab;
|
|
10366
10473
|
const openPanel = async (ref) => {
|
|
10367
10474
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
10368
10475
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
10369
10476
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
10370
10477
|
};
|
|
10371
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
10372
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
10373
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
10374
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
10375
|
-
const [typeSession, setTypeSession] = (0,
|
|
10376
|
-
const [selectionError, setSelectionError] = (0,
|
|
10377
|
-
const [paintError, setPaintError] = (0,
|
|
10378
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
10478
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react74.useState)(null);
|
|
10479
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
10480
|
+
const [shapeOptions, setShapeOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
10481
|
+
const [typeOptions, setTypeOptions] = (0, import_react74.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
10482
|
+
const [typeSession, setTypeSession] = (0, import_react74.useState)(null);
|
|
10483
|
+
const [selectionError, setSelectionError] = (0, import_react74.useState)(null);
|
|
10484
|
+
const [paintError, setPaintError] = (0, import_react74.useState)(null);
|
|
10485
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react74.useState)(null);
|
|
10379
10486
|
const handleCanvasError = (source, message2) => {
|
|
10380
10487
|
if (source === "paint") setPaintError(message2);
|
|
10381
10488
|
else if (source === "select") setSelectionError(message2);
|
|
10382
10489
|
else setShapeTypeError(message2);
|
|
10383
10490
|
};
|
|
10384
10491
|
const finishTyping = () => setTypeSession(null);
|
|
10385
|
-
const transformToolRef = (0,
|
|
10386
|
-
const transformControllerRef = (0,
|
|
10492
|
+
const transformToolRef = (0, import_react74.useRef)(null);
|
|
10493
|
+
const transformControllerRef = (0, import_react74.useRef)(controller);
|
|
10387
10494
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
10388
10495
|
transformToolRef.current?.cancel();
|
|
10389
10496
|
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
@@ -10392,16 +10499,16 @@ var ImageEditor = ({
|
|
|
10392
10499
|
transformControllerRef.current = controller;
|
|
10393
10500
|
}
|
|
10394
10501
|
const transformTool = transformToolRef.current;
|
|
10395
|
-
const [, setTransformTick] = (0,
|
|
10396
|
-
(0,
|
|
10397
|
-
(0,
|
|
10398
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
10399
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
10400
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
10401
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
10402
|
-
const [aiError, setAiError] = (0,
|
|
10403
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
10404
|
-
const [aiTarget, setAiTarget] = (0,
|
|
10502
|
+
const [, setTransformTick] = (0, import_react74.useState)(0);
|
|
10503
|
+
(0, import_react74.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
10504
|
+
(0, import_react74.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
10505
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react74.useState)("");
|
|
10506
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react74.useState)("annotations");
|
|
10507
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react74.useState)(false);
|
|
10508
|
+
const [isInpainting, setIsInpainting] = (0, import_react74.useState)(false);
|
|
10509
|
+
const [aiError, setAiError] = (0, import_react74.useState)(null);
|
|
10510
|
+
const [aiSuccess, setAiSuccess] = (0, import_react74.useState)(null);
|
|
10511
|
+
const [aiTarget, setAiTarget] = (0, import_react74.useState)("auto");
|
|
10405
10512
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
10406
10513
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
10407
10514
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -10464,11 +10571,11 @@ var ImageEditor = ({
|
|
|
10464
10571
|
setIsInpainting(false);
|
|
10465
10572
|
}
|
|
10466
10573
|
};
|
|
10467
|
-
const [activeColor, setActiveColor] = (0,
|
|
10468
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
10469
|
-
const [fontSize, setFontSize] = (0,
|
|
10470
|
-
const [textInput, setTextInput] = (0,
|
|
10471
|
-
(0,
|
|
10574
|
+
const [activeColor, setActiveColor] = (0, import_react74.useState)("#ef4444");
|
|
10575
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react74.useState)(3);
|
|
10576
|
+
const [fontSize, setFontSize] = (0, import_react74.useState)(24);
|
|
10577
|
+
const [textInput, setTextInput] = (0, import_react74.useState)("");
|
|
10578
|
+
(0, import_react74.useEffect)(() => {
|
|
10472
10579
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
10473
10580
|
editor.setTool("crop");
|
|
10474
10581
|
}
|
|
@@ -10496,16 +10603,16 @@ var ImageEditor = ({
|
|
|
10496
10603
|
link.click();
|
|
10497
10604
|
}
|
|
10498
10605
|
};
|
|
10499
|
-
return /* @__PURE__ */ (0,
|
|
10606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
10500
10607
|
"div",
|
|
10501
10608
|
{
|
|
10502
10609
|
ref: rootRef,
|
|
10503
10610
|
className: `${imageEditorFrameClass} ${className}`,
|
|
10504
10611
|
style,
|
|
10505
10612
|
children: [
|
|
10506
|
-
/* @__PURE__ */ (0,
|
|
10507
|
-
/* @__PURE__ */ (0,
|
|
10508
|
-
/* @__PURE__ */ (0,
|
|
10613
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
10614
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
10615
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10509
10616
|
"button",
|
|
10510
10617
|
{
|
|
10511
10618
|
type: "button",
|
|
@@ -10520,7 +10627,7 @@ var ImageEditor = ({
|
|
|
10520
10627
|
children: "Transform & Crop"
|
|
10521
10628
|
}
|
|
10522
10629
|
),
|
|
10523
|
-
/* @__PURE__ */ (0,
|
|
10630
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10524
10631
|
"button",
|
|
10525
10632
|
{
|
|
10526
10633
|
type: "button",
|
|
@@ -10535,7 +10642,7 @@ var ImageEditor = ({
|
|
|
10535
10642
|
children: "Adjustments"
|
|
10536
10643
|
}
|
|
10537
10644
|
),
|
|
10538
|
-
/* @__PURE__ */ (0,
|
|
10645
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10539
10646
|
"button",
|
|
10540
10647
|
{
|
|
10541
10648
|
type: "button",
|
|
@@ -10550,7 +10657,7 @@ var ImageEditor = ({
|
|
|
10550
10657
|
children: "Layers"
|
|
10551
10658
|
}
|
|
10552
10659
|
),
|
|
10553
|
-
/* @__PURE__ */ (0,
|
|
10660
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10554
10661
|
"button",
|
|
10555
10662
|
{
|
|
10556
10663
|
type: "button",
|
|
@@ -10565,7 +10672,7 @@ var ImageEditor = ({
|
|
|
10565
10672
|
children: "Paint"
|
|
10566
10673
|
}
|
|
10567
10674
|
),
|
|
10568
|
-
/* @__PURE__ */ (0,
|
|
10675
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10569
10676
|
"button",
|
|
10570
10677
|
{
|
|
10571
10678
|
type: "button",
|
|
@@ -10580,7 +10687,7 @@ var ImageEditor = ({
|
|
|
10580
10687
|
children: "Select & Mask"
|
|
10581
10688
|
}
|
|
10582
10689
|
),
|
|
10583
|
-
/* @__PURE__ */ (0,
|
|
10690
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10584
10691
|
"button",
|
|
10585
10692
|
{
|
|
10586
10693
|
type: "button",
|
|
@@ -10595,7 +10702,7 @@ var ImageEditor = ({
|
|
|
10595
10702
|
children: "Annotations"
|
|
10596
10703
|
}
|
|
10597
10704
|
),
|
|
10598
|
-
/* @__PURE__ */ (0,
|
|
10705
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10599
10706
|
"button",
|
|
10600
10707
|
{
|
|
10601
10708
|
type: "button",
|
|
@@ -10610,7 +10717,7 @@ var ImageEditor = ({
|
|
|
10610
10717
|
children: "Depth Mask"
|
|
10611
10718
|
}
|
|
10612
10719
|
),
|
|
10613
|
-
/* @__PURE__ */ (0,
|
|
10720
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
10614
10721
|
"button",
|
|
10615
10722
|
{
|
|
10616
10723
|
type: "button",
|
|
@@ -10623,14 +10730,14 @@ var ImageEditor = ({
|
|
|
10623
10730
|
"aria-selected": activeTab === "ai",
|
|
10624
10731
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
10625
10732
|
children: [
|
|
10626
|
-
/* @__PURE__ */ (0,
|
|
10733
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
|
|
10627
10734
|
"AI Tools"
|
|
10628
10735
|
]
|
|
10629
10736
|
}
|
|
10630
10737
|
)
|
|
10631
10738
|
] }),
|
|
10632
|
-
/* @__PURE__ */ (0,
|
|
10633
|
-
/* @__PURE__ */ (0,
|
|
10739
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
10740
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10634
10741
|
"button",
|
|
10635
10742
|
{
|
|
10636
10743
|
type: "button",
|
|
@@ -10641,7 +10748,7 @@ var ImageEditor = ({
|
|
|
10641
10748
|
children: "\u21A9"
|
|
10642
10749
|
}
|
|
10643
10750
|
),
|
|
10644
|
-
/* @__PURE__ */ (0,
|
|
10751
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10645
10752
|
"button",
|
|
10646
10753
|
{
|
|
10647
10754
|
type: "button",
|
|
@@ -10652,7 +10759,7 @@ var ImageEditor = ({
|
|
|
10652
10759
|
children: "\u21AA"
|
|
10653
10760
|
}
|
|
10654
10761
|
),
|
|
10655
|
-
/* @__PURE__ */ (0,
|
|
10762
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10656
10763
|
"button",
|
|
10657
10764
|
{
|
|
10658
10765
|
type: "button",
|
|
@@ -10661,8 +10768,8 @@ var ImageEditor = ({
|
|
|
10661
10768
|
children: "Reset"
|
|
10662
10769
|
}
|
|
10663
10770
|
),
|
|
10664
|
-
/* @__PURE__ */ (0,
|
|
10665
|
-
/* @__PURE__ */ (0,
|
|
10771
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
10772
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10666
10773
|
"button",
|
|
10667
10774
|
{
|
|
10668
10775
|
type: "button",
|
|
@@ -10672,11 +10779,11 @@ var ImageEditor = ({
|
|
|
10672
10779
|
children: "-"
|
|
10673
10780
|
}
|
|
10674
10781
|
),
|
|
10675
|
-
/* @__PURE__ */ (0,
|
|
10782
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
10676
10783
|
Math.round(state.zoom * 100),
|
|
10677
10784
|
"%"
|
|
10678
10785
|
] }),
|
|
10679
|
-
/* @__PURE__ */ (0,
|
|
10786
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10680
10787
|
"button",
|
|
10681
10788
|
{
|
|
10682
10789
|
type: "button",
|
|
@@ -10686,8 +10793,8 @@ var ImageEditor = ({
|
|
|
10686
10793
|
children: "+"
|
|
10687
10794
|
}
|
|
10688
10795
|
),
|
|
10689
|
-
/* @__PURE__ */ (0,
|
|
10690
|
-
/* @__PURE__ */ (0,
|
|
10796
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
10797
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10691
10798
|
"button",
|
|
10692
10799
|
{
|
|
10693
10800
|
type: "button",
|
|
@@ -10698,7 +10805,7 @@ var ImageEditor = ({
|
|
|
10698
10805
|
children: "Hold Compare"
|
|
10699
10806
|
}
|
|
10700
10807
|
),
|
|
10701
|
-
/* @__PURE__ */ (0,
|
|
10808
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10702
10809
|
"button",
|
|
10703
10810
|
{
|
|
10704
10811
|
type: "button",
|
|
@@ -10709,10 +10816,10 @@ var ImageEditor = ({
|
|
|
10709
10816
|
)
|
|
10710
10817
|
] })
|
|
10711
10818
|
] }),
|
|
10712
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
10713
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
10714
|
-
/* @__PURE__ */ (0,
|
|
10715
|
-
/* @__PURE__ */ (0,
|
|
10819
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
10820
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
10821
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
10822
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10716
10823
|
ImageEditorCanvas,
|
|
10717
10824
|
{
|
|
10718
10825
|
editor,
|
|
@@ -10736,11 +10843,11 @@ var ImageEditor = ({
|
|
|
10736
10843
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
10737
10844
|
}
|
|
10738
10845
|
),
|
|
10739
|
-
/* @__PURE__ */ (0,
|
|
10740
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
10741
|
-
/* @__PURE__ */ (0,
|
|
10742
|
-
/* @__PURE__ */ (0,
|
|
10743
|
-
/* @__PURE__ */ (0,
|
|
10846
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: imageSidebarClass, children: [
|
|
10847
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
10848
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
10849
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
10850
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10744
10851
|
"button",
|
|
10745
10852
|
{
|
|
10746
10853
|
type: "button",
|
|
@@ -10752,7 +10859,7 @@ var ImageEditor = ({
|
|
|
10752
10859
|
children: "Freeform"
|
|
10753
10860
|
}
|
|
10754
10861
|
),
|
|
10755
|
-
/* @__PURE__ */ (0,
|
|
10862
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10756
10863
|
"button",
|
|
10757
10864
|
{
|
|
10758
10865
|
type: "button",
|
|
@@ -10764,7 +10871,7 @@ var ImageEditor = ({
|
|
|
10764
10871
|
children: "1:1 Square"
|
|
10765
10872
|
}
|
|
10766
10873
|
),
|
|
10767
|
-
/* @__PURE__ */ (0,
|
|
10874
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10768
10875
|
"button",
|
|
10769
10876
|
{
|
|
10770
10877
|
type: "button",
|
|
@@ -10776,7 +10883,7 @@ var ImageEditor = ({
|
|
|
10776
10883
|
children: "4:3 Standard"
|
|
10777
10884
|
}
|
|
10778
10885
|
),
|
|
10779
|
-
/* @__PURE__ */ (0,
|
|
10886
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10780
10887
|
"button",
|
|
10781
10888
|
{
|
|
10782
10889
|
type: "button",
|
|
@@ -10788,7 +10895,7 @@ var ImageEditor = ({
|
|
|
10788
10895
|
children: "16:9 Wide"
|
|
10789
10896
|
}
|
|
10790
10897
|
),
|
|
10791
|
-
/* @__PURE__ */ (0,
|
|
10898
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10792
10899
|
"button",
|
|
10793
10900
|
{
|
|
10794
10901
|
type: "button",
|
|
@@ -10800,7 +10907,7 @@ var ImageEditor = ({
|
|
|
10800
10907
|
children: "3:2 Photo"
|
|
10801
10908
|
}
|
|
10802
10909
|
),
|
|
10803
|
-
/* @__PURE__ */ (0,
|
|
10910
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10804
10911
|
"button",
|
|
10805
10912
|
{
|
|
10806
10913
|
type: "button",
|
|
@@ -10813,10 +10920,10 @@ var ImageEditor = ({
|
|
|
10813
10920
|
}
|
|
10814
10921
|
)
|
|
10815
10922
|
] }),
|
|
10816
|
-
/* @__PURE__ */ (0,
|
|
10817
|
-
/* @__PURE__ */ (0,
|
|
10818
|
-
/* @__PURE__ */ (0,
|
|
10819
|
-
/* @__PURE__ */ (0,
|
|
10923
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
|
|
10924
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
10925
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
10926
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10820
10927
|
"button",
|
|
10821
10928
|
{
|
|
10822
10929
|
type: "button",
|
|
@@ -10825,7 +10932,7 @@ var ImageEditor = ({
|
|
|
10825
10932
|
children: "Rotate -90\xB0"
|
|
10826
10933
|
}
|
|
10827
10934
|
),
|
|
10828
|
-
/* @__PURE__ */ (0,
|
|
10935
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10829
10936
|
"button",
|
|
10830
10937
|
{
|
|
10831
10938
|
type: "button",
|
|
@@ -10834,7 +10941,7 @@ var ImageEditor = ({
|
|
|
10834
10941
|
children: "Rotate +90\xB0"
|
|
10835
10942
|
}
|
|
10836
10943
|
),
|
|
10837
|
-
/* @__PURE__ */ (0,
|
|
10944
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10838
10945
|
"button",
|
|
10839
10946
|
{
|
|
10840
10947
|
type: "button",
|
|
@@ -10843,7 +10950,7 @@ var ImageEditor = ({
|
|
|
10843
10950
|
children: "Flip Horizontal"
|
|
10844
10951
|
}
|
|
10845
10952
|
),
|
|
10846
|
-
/* @__PURE__ */ (0,
|
|
10953
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10847
10954
|
"button",
|
|
10848
10955
|
{
|
|
10849
10956
|
type: "button",
|
|
@@ -10854,10 +10961,10 @@ var ImageEditor = ({
|
|
|
10854
10961
|
)
|
|
10855
10962
|
] })
|
|
10856
10963
|
] }),
|
|
10857
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
10858
|
-
/* @__PURE__ */ (0,
|
|
10859
|
-
/* @__PURE__ */ (0,
|
|
10860
|
-
/* @__PURE__ */ (0,
|
|
10964
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
10965
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10966
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
10967
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10861
10968
|
"button",
|
|
10862
10969
|
{
|
|
10863
10970
|
type: "button",
|
|
@@ -10867,9 +10974,9 @@ var ImageEditor = ({
|
|
|
10867
10974
|
}
|
|
10868
10975
|
)
|
|
10869
10976
|
] }),
|
|
10870
|
-
/* @__PURE__ */ (0,
|
|
10871
|
-
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
10872
|
-
/* @__PURE__ */ (0,
|
|
10977
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Histogram, { histogram: editor.histogram }),
|
|
10978
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react74.default.Fragment, { children: [
|
|
10979
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10873
10980
|
ControlSlider,
|
|
10874
10981
|
{
|
|
10875
10982
|
spec,
|
|
@@ -10878,14 +10985,14 @@ var ImageEditor = ({
|
|
|
10878
10985
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
10879
10986
|
}
|
|
10880
10987
|
),
|
|
10881
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
10988
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
10882
10989
|
"div",
|
|
10883
10990
|
{
|
|
10884
10991
|
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",
|
|
10885
10992
|
"data-testid": "image-editor-process-notice",
|
|
10886
10993
|
children: [
|
|
10887
|
-
/* @__PURE__ */ (0,
|
|
10888
|
-
/* @__PURE__ */ (0,
|
|
10994
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
10995
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10889
10996
|
"button",
|
|
10890
10997
|
{
|
|
10891
10998
|
type: "button",
|
|
@@ -10898,7 +11005,7 @@ var ImageEditor = ({
|
|
|
10898
11005
|
}
|
|
10899
11006
|
)
|
|
10900
11007
|
] }, spec.id)),
|
|
10901
|
-
/* @__PURE__ */ (0,
|
|
11008
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10902
11009
|
AdjustmentLayersPanel,
|
|
10903
11010
|
{
|
|
10904
11011
|
controller,
|
|
@@ -10907,9 +11014,9 @@ var ImageEditor = ({
|
|
|
10907
11014
|
}
|
|
10908
11015
|
) })
|
|
10909
11016
|
] }),
|
|
10910
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
10911
|
-
/* @__PURE__ */ (0,
|
|
10912
|
-
/* @__PURE__ */ (0,
|
|
11017
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
11018
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
11019
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10913
11020
|
"button",
|
|
10914
11021
|
{
|
|
10915
11022
|
type: "button",
|
|
@@ -10920,15 +11027,15 @@ var ImageEditor = ({
|
|
|
10920
11027
|
children: "Free Transform"
|
|
10921
11028
|
}
|
|
10922
11029
|
),
|
|
10923
|
-
/* @__PURE__ */ (0,
|
|
10924
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
10925
|
-
/* @__PURE__ */ (0,
|
|
10926
|
-
/* @__PURE__ */ (0,
|
|
11030
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LayersPanel, { controller }),
|
|
11031
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
11032
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
11033
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ColorProfilePanel, { controller })
|
|
10927
11034
|
] }),
|
|
10928
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
10929
|
-
/* @__PURE__ */ (0,
|
|
10930
|
-
/* @__PURE__ */ (0,
|
|
10931
|
-
/* @__PURE__ */ (0,
|
|
11035
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
11036
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
11037
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(BrushOptionsBar, { controller }),
|
|
11038
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10932
11039
|
"button",
|
|
10933
11040
|
{
|
|
10934
11041
|
type: "button",
|
|
@@ -10939,12 +11046,12 @@ var ImageEditor = ({
|
|
|
10939
11046
|
children: "Free Transform"
|
|
10940
11047
|
}
|
|
10941
11048
|
),
|
|
10942
|
-
paintError && /* @__PURE__ */ (0,
|
|
10943
|
-
/* @__PURE__ */ (0,
|
|
11049
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
11050
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LayersPanel, { controller }) })
|
|
10944
11051
|
] }),
|
|
10945
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
10946
|
-
/* @__PURE__ */ (0,
|
|
10947
|
-
/* @__PURE__ */ (0,
|
|
11052
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
11053
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
11054
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-2 gap-1.5", children: ["shape", "type", "path-pen", "path-select", "direct-select"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10948
11055
|
"button",
|
|
10949
11056
|
{
|
|
10950
11057
|
type: "button",
|
|
@@ -10955,13 +11062,13 @@ var ImageEditor = ({
|
|
|
10955
11062
|
},
|
|
10956
11063
|
t
|
|
10957
11064
|
)) }),
|
|
10958
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
10959
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
10960
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
10961
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
10962
|
-
/* @__PURE__ */ (0,
|
|
10963
|
-
/* @__PURE__ */ (0,
|
|
10964
|
-
/* @__PURE__ */ (0,
|
|
11065
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
11066
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
11067
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime54.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" }),
|
|
11068
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
11069
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
|
|
11070
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
11071
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10965
11072
|
"button",
|
|
10966
11073
|
{
|
|
10967
11074
|
type: "button",
|
|
@@ -10971,18 +11078,18 @@ var ImageEditor = ({
|
|
|
10971
11078
|
},
|
|
10972
11079
|
t
|
|
10973
11080
|
)) }),
|
|
10974
|
-
/* @__PURE__ */ (0,
|
|
10975
|
-
/* @__PURE__ */ (0,
|
|
10976
|
-
/* @__PURE__ */ (0,
|
|
10977
|
-
/* @__PURE__ */ (0,
|
|
10978
|
-
/* @__PURE__ */ (0,
|
|
10979
|
-
/* @__PURE__ */ (0,
|
|
10980
|
-
/* @__PURE__ */ (0,
|
|
11081
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
11082
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
11083
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
11084
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
11085
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
11086
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Width:" }),
|
|
11087
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono", children: [
|
|
10981
11088
|
strokeWidth,
|
|
10982
11089
|
"px"
|
|
10983
11090
|
] })
|
|
10984
11091
|
] }),
|
|
10985
|
-
/* @__PURE__ */ (0,
|
|
11092
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
10986
11093
|
"input",
|
|
10987
11094
|
{
|
|
10988
11095
|
type: "range",
|
|
@@ -10995,10 +11102,10 @@ var ImageEditor = ({
|
|
|
10995
11102
|
)
|
|
10996
11103
|
] })
|
|
10997
11104
|
] }),
|
|
10998
|
-
/* @__PURE__ */ (0,
|
|
10999
|
-
/* @__PURE__ */ (0,
|
|
11000
|
-
/* @__PURE__ */ (0,
|
|
11001
|
-
/* @__PURE__ */ (0,
|
|
11105
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
|
|
11106
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
11107
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-2", children: [
|
|
11108
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11002
11109
|
"input",
|
|
11003
11110
|
{
|
|
11004
11111
|
type: "text",
|
|
@@ -11009,7 +11116,7 @@ var ImageEditor = ({
|
|
|
11009
11116
|
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"
|
|
11010
11117
|
}
|
|
11011
11118
|
),
|
|
11012
|
-
/* @__PURE__ */ (0,
|
|
11119
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11013
11120
|
"button",
|
|
11014
11121
|
{
|
|
11015
11122
|
type: "button",
|
|
@@ -11019,14 +11126,14 @@ var ImageEditor = ({
|
|
|
11019
11126
|
}
|
|
11020
11127
|
)
|
|
11021
11128
|
] }),
|
|
11022
|
-
/* @__PURE__ */ (0,
|
|
11023
|
-
/* @__PURE__ */ (0,
|
|
11024
|
-
/* @__PURE__ */ (0,
|
|
11129
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
11130
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Font Size:" }),
|
|
11131
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-mono", children: [
|
|
11025
11132
|
fontSize,
|
|
11026
11133
|
"px"
|
|
11027
11134
|
] })
|
|
11028
11135
|
] }),
|
|
11029
|
-
/* @__PURE__ */ (0,
|
|
11136
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11030
11137
|
"input",
|
|
11031
11138
|
{
|
|
11032
11139
|
type: "range",
|
|
@@ -11037,14 +11144,14 @@ var ImageEditor = ({
|
|
|
11037
11144
|
className: imageRangeClass
|
|
11038
11145
|
}
|
|
11039
11146
|
),
|
|
11040
|
-
/* @__PURE__ */ (0,
|
|
11041
|
-
/* @__PURE__ */ (0,
|
|
11042
|
-
/* @__PURE__ */ (0,
|
|
11147
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageDividerClass }),
|
|
11148
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11149
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
11043
11150
|
"Layers (",
|
|
11044
11151
|
state.annotations.length,
|
|
11045
11152
|
")"
|
|
11046
11153
|
] }),
|
|
11047
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
11154
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11048
11155
|
"button",
|
|
11049
11156
|
{
|
|
11050
11157
|
type: "button",
|
|
@@ -11053,7 +11160,7 @@ var ImageEditor = ({
|
|
|
11053
11160
|
children: "Delete Selected"
|
|
11054
11161
|
}
|
|
11055
11162
|
),
|
|
11056
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
11163
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11057
11164
|
"button",
|
|
11058
11165
|
{
|
|
11059
11166
|
type: "button",
|
|
@@ -11064,10 +11171,10 @@ var ImageEditor = ({
|
|
|
11064
11171
|
)
|
|
11065
11172
|
] })
|
|
11066
11173
|
] }),
|
|
11067
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
11068
|
-
/* @__PURE__ */ (0,
|
|
11069
|
-
/* @__PURE__ */ (0,
|
|
11070
|
-
/* @__PURE__ */ (0,
|
|
11174
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
11175
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11176
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
11177
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11071
11178
|
"button",
|
|
11072
11179
|
{
|
|
11073
11180
|
type: "button",
|
|
@@ -11077,8 +11184,8 @@ var ImageEditor = ({
|
|
|
11077
11184
|
}
|
|
11078
11185
|
)
|
|
11079
11186
|
] }),
|
|
11080
|
-
/* @__PURE__ */ (0,
|
|
11081
|
-
/* @__PURE__ */ (0,
|
|
11187
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
11188
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11082
11189
|
"input",
|
|
11083
11190
|
{
|
|
11084
11191
|
type: "checkbox",
|
|
@@ -11087,12 +11194,12 @@ var ImageEditor = ({
|
|
|
11087
11194
|
className: "rounded accent-primary"
|
|
11088
11195
|
}
|
|
11089
11196
|
),
|
|
11090
|
-
/* @__PURE__ */ (0,
|
|
11197
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
11091
11198
|
] }),
|
|
11092
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
11093
|
-
/* @__PURE__ */ (0,
|
|
11094
|
-
/* @__PURE__ */ (0,
|
|
11095
|
-
/* @__PURE__ */ (0,
|
|
11199
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11200
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
11201
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
11202
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11096
11203
|
"input",
|
|
11097
11204
|
{
|
|
11098
11205
|
type: "text",
|
|
@@ -11103,8 +11210,8 @@ var ImageEditor = ({
|
|
|
11103
11210
|
}
|
|
11104
11211
|
)
|
|
11105
11212
|
] }),
|
|
11106
|
-
/* @__PURE__ */ (0,
|
|
11107
|
-
/* @__PURE__ */ (0,
|
|
11213
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-2", children: [
|
|
11214
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11108
11215
|
"button",
|
|
11109
11216
|
{
|
|
11110
11217
|
type: "button",
|
|
@@ -11113,7 +11220,7 @@ var ImageEditor = ({
|
|
|
11113
11220
|
children: "Threshold Mode"
|
|
11114
11221
|
}
|
|
11115
11222
|
),
|
|
11116
|
-
/* @__PURE__ */ (0,
|
|
11223
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11117
11224
|
"button",
|
|
11118
11225
|
{
|
|
11119
11226
|
type: "button",
|
|
@@ -11123,12 +11230,12 @@ var ImageEditor = ({
|
|
|
11123
11230
|
}
|
|
11124
11231
|
)
|
|
11125
11232
|
] }),
|
|
11126
|
-
/* @__PURE__ */ (0,
|
|
11127
|
-
/* @__PURE__ */ (0,
|
|
11128
|
-
/* @__PURE__ */ (0,
|
|
11129
|
-
/* @__PURE__ */ (0,
|
|
11233
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
11234
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11235
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
11236
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
11130
11237
|
] }),
|
|
11131
|
-
/* @__PURE__ */ (0,
|
|
11238
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11132
11239
|
"input",
|
|
11133
11240
|
{
|
|
11134
11241
|
type: "range",
|
|
@@ -11142,12 +11249,12 @@ var ImageEditor = ({
|
|
|
11142
11249
|
}
|
|
11143
11250
|
)
|
|
11144
11251
|
] }),
|
|
11145
|
-
/* @__PURE__ */ (0,
|
|
11146
|
-
/* @__PURE__ */ (0,
|
|
11147
|
-
/* @__PURE__ */ (0,
|
|
11148
|
-
/* @__PURE__ */ (0,
|
|
11252
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
11253
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11254
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
11255
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
11149
11256
|
] }),
|
|
11150
|
-
/* @__PURE__ */ (0,
|
|
11257
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11151
11258
|
"input",
|
|
11152
11259
|
{
|
|
11153
11260
|
type: "range",
|
|
@@ -11161,12 +11268,12 @@ var ImageEditor = ({
|
|
|
11161
11268
|
}
|
|
11162
11269
|
)
|
|
11163
11270
|
] }),
|
|
11164
|
-
/* @__PURE__ */ (0,
|
|
11165
|
-
/* @__PURE__ */ (0,
|
|
11166
|
-
/* @__PURE__ */ (0,
|
|
11167
|
-
/* @__PURE__ */ (0,
|
|
11271
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
|
|
11272
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11273
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Softness:" }),
|
|
11274
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
11168
11275
|
] }),
|
|
11169
|
-
/* @__PURE__ */ (0,
|
|
11276
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11170
11277
|
"input",
|
|
11171
11278
|
{
|
|
11172
11279
|
type: "range",
|
|
@@ -11178,8 +11285,8 @@ var ImageEditor = ({
|
|
|
11178
11285
|
}
|
|
11179
11286
|
)
|
|
11180
11287
|
] }),
|
|
11181
|
-
/* @__PURE__ */ (0,
|
|
11182
|
-
/* @__PURE__ */ (0,
|
|
11288
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
11289
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11183
11290
|
"input",
|
|
11184
11291
|
{
|
|
11185
11292
|
type: "checkbox",
|
|
@@ -11188,12 +11295,12 @@ var ImageEditor = ({
|
|
|
11188
11295
|
className: "rounded accent-primary"
|
|
11189
11296
|
}
|
|
11190
11297
|
),
|
|
11191
|
-
/* @__PURE__ */ (0,
|
|
11298
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Invert Mask" })
|
|
11192
11299
|
] })
|
|
11193
11300
|
] })
|
|
11194
11301
|
] }),
|
|
11195
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
11196
|
-
/* @__PURE__ */ (0,
|
|
11302
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
11303
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11197
11304
|
SelectionOptionsBar,
|
|
11198
11305
|
{
|
|
11199
11306
|
controller,
|
|
@@ -11204,9 +11311,9 @@ var ImageEditor = ({
|
|
|
11204
11311
|
selectionDisplay: state.selectionDisplay
|
|
11205
11312
|
}
|
|
11206
11313
|
),
|
|
11207
|
-
selectionError && /* @__PURE__ */ (0,
|
|
11208
|
-
/* @__PURE__ */ (0,
|
|
11209
|
-
/* @__PURE__ */ (0,
|
|
11314
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
11315
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-1", children: [
|
|
11316
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11210
11317
|
"button",
|
|
11211
11318
|
{
|
|
11212
11319
|
type: "button",
|
|
@@ -11217,7 +11324,7 @@ var ImageEditor = ({
|
|
|
11217
11324
|
children: "Transform Selection"
|
|
11218
11325
|
}
|
|
11219
11326
|
),
|
|
11220
|
-
/* @__PURE__ */ (0,
|
|
11327
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11221
11328
|
"button",
|
|
11222
11329
|
{
|
|
11223
11330
|
type: "button",
|
|
@@ -11229,14 +11336,14 @@ var ImageEditor = ({
|
|
|
11229
11336
|
}
|
|
11230
11337
|
)
|
|
11231
11338
|
] }),
|
|
11232
|
-
/* @__PURE__ */ (0,
|
|
11233
|
-
/* @__PURE__ */ (0,
|
|
11234
|
-
/* @__PURE__ */ (0,
|
|
11339
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
11340
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ChannelsPanel, { controller }),
|
|
11341
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(PathsPanel, { controller })
|
|
11235
11342
|
] }),
|
|
11236
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
11237
|
-
/* @__PURE__ */ (0,
|
|
11238
|
-
/* @__PURE__ */ (0,
|
|
11239
|
-
/* @__PURE__ */ (0,
|
|
11343
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
11344
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
11345
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: "Results go to" }),
|
|
11346
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
11240
11347
|
"select",
|
|
11241
11348
|
{
|
|
11242
11349
|
"aria-label": "AI result target",
|
|
@@ -11244,54 +11351,54 @@ var ImageEditor = ({
|
|
|
11244
11351
|
onChange: (e) => setAiTarget(e.target.value),
|
|
11245
11352
|
className: imageSelectClass,
|
|
11246
11353
|
children: [
|
|
11247
|
-
/* @__PURE__ */ (0,
|
|
11248
|
-
/* @__PURE__ */ (0,
|
|
11249
|
-
/* @__PURE__ */ (0,
|
|
11354
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
11355
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
11356
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("option", { value: "replace", children: "Replace image" })
|
|
11250
11357
|
]
|
|
11251
11358
|
}
|
|
11252
11359
|
)
|
|
11253
11360
|
] }),
|
|
11254
|
-
/* @__PURE__ */ (0,
|
|
11255
|
-
/* @__PURE__ */ (0,
|
|
11256
|
-
/* @__PURE__ */ (0,
|
|
11257
|
-
/* @__PURE__ */ (0,
|
|
11361
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
11362
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11363
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
11364
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
|
|
11258
11365
|
"Background Removal"
|
|
11259
11366
|
] }),
|
|
11260
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
11367
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime54.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..." })
|
|
11261
11368
|
] }),
|
|
11262
|
-
/* @__PURE__ */ (0,
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11369
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
11370
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11264
11371
|
"button",
|
|
11265
11372
|
{
|
|
11266
11373
|
type: "button",
|
|
11267
11374
|
onClick: handleRemoveBackground,
|
|
11268
11375
|
disabled: isRemovingBg || isInpainting,
|
|
11269
11376
|
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",
|
|
11270
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
11271
|
-
/* @__PURE__ */ (0,
|
|
11377
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11378
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSpinnerClass }),
|
|
11272
11379
|
"Removing Background..."
|
|
11273
|
-
] }) : /* @__PURE__ */ (0,
|
|
11274
|
-
/* @__PURE__ */ (0,
|
|
11380
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11381
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
|
|
11275
11382
|
"Remove Background"
|
|
11276
11383
|
] })
|
|
11277
11384
|
}
|
|
11278
11385
|
)
|
|
11279
11386
|
] }),
|
|
11280
|
-
/* @__PURE__ */ (0,
|
|
11281
|
-
/* @__PURE__ */ (0,
|
|
11282
|
-
/* @__PURE__ */ (0,
|
|
11283
|
-
/* @__PURE__ */ (0,
|
|
11284
|
-
/* @__PURE__ */ (0,
|
|
11285
|
-
/* @__PURE__ */ (0,
|
|
11387
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
11388
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11389
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
11390
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
11391
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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" }),
|
|
11392
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("path", { d: "m14 7 3 3" })
|
|
11286
11393
|
] }),
|
|
11287
11394
|
"Generative Inpainting"
|
|
11288
11395
|
] }),
|
|
11289
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
11396
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime54.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..." })
|
|
11290
11397
|
] }),
|
|
11291
|
-
/* @__PURE__ */ (0,
|
|
11292
|
-
/* @__PURE__ */ (0,
|
|
11293
|
-
/* @__PURE__ */ (0,
|
|
11294
|
-
/* @__PURE__ */ (0,
|
|
11398
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
11399
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11400
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
11401
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11295
11402
|
"textarea",
|
|
11296
11403
|
{
|
|
11297
11404
|
id: "ai-inpaint-prompt-react",
|
|
@@ -11303,10 +11410,10 @@ var ImageEditor = ({
|
|
|
11303
11410
|
}
|
|
11304
11411
|
)
|
|
11305
11412
|
] }),
|
|
11306
|
-
/* @__PURE__ */ (0,
|
|
11307
|
-
/* @__PURE__ */ (0,
|
|
11308
|
-
/* @__PURE__ */ (0,
|
|
11309
|
-
/* @__PURE__ */ (0,
|
|
11413
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11414
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
11415
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
11416
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
11310
11417
|
"button",
|
|
11311
11418
|
{
|
|
11312
11419
|
type: "button",
|
|
@@ -11319,7 +11426,7 @@ var ImageEditor = ({
|
|
|
11319
11426
|
]
|
|
11320
11427
|
}
|
|
11321
11428
|
),
|
|
11322
|
-
/* @__PURE__ */ (0,
|
|
11429
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
11323
11430
|
"button",
|
|
11324
11431
|
{
|
|
11325
11432
|
type: "button",
|
|
@@ -11334,25 +11441,25 @@ var ImageEditor = ({
|
|
|
11334
11441
|
)
|
|
11335
11442
|
] })
|
|
11336
11443
|
] }),
|
|
11337
|
-
/* @__PURE__ */ (0,
|
|
11444
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11338
11445
|
"button",
|
|
11339
11446
|
{
|
|
11340
11447
|
type: "button",
|
|
11341
11448
|
onClick: handleInpaint,
|
|
11342
11449
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
11343
11450
|
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",
|
|
11344
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
11345
|
-
/* @__PURE__ */ (0,
|
|
11451
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11452
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: imageSpinnerClass }),
|
|
11346
11453
|
"Generating Inpaint..."
|
|
11347
|
-
] }) : /* @__PURE__ */ (0,
|
|
11348
|
-
/* @__PURE__ */ (0,
|
|
11454
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11455
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.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" }) }),
|
|
11349
11456
|
"Apply Inpainting"
|
|
11350
11457
|
] })
|
|
11351
11458
|
}
|
|
11352
11459
|
)
|
|
11353
11460
|
] }),
|
|
11354
|
-
aiError && /* @__PURE__ */ (0,
|
|
11355
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
11461
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
11462
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
11356
11463
|
] })
|
|
11357
11464
|
] })
|
|
11358
11465
|
] })
|
|
@@ -11362,7 +11469,7 @@ var ImageEditor = ({
|
|
|
11362
11469
|
};
|
|
11363
11470
|
|
|
11364
11471
|
// src/review/useReview.ts
|
|
11365
|
-
var
|
|
11472
|
+
var import_react75 = require("react");
|
|
11366
11473
|
var import_editor13 = require("@pixerate/editor");
|
|
11367
11474
|
var EMPTY_COMMENTS = Object.freeze({
|
|
11368
11475
|
threads: [],
|
|
@@ -11381,23 +11488,23 @@ function isCommentStore(value) {
|
|
|
11381
11488
|
}
|
|
11382
11489
|
function useComments(source) {
|
|
11383
11490
|
const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
|
|
11384
|
-
const subscribe = (0,
|
|
11491
|
+
const subscribe = (0, import_react75.useCallback)(
|
|
11385
11492
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
|
|
11386
11493
|
[store]
|
|
11387
11494
|
);
|
|
11388
11495
|
const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
|
|
11389
|
-
const snapshot = (0,
|
|
11390
|
-
return (0,
|
|
11496
|
+
const snapshot = (0, import_react75.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
11497
|
+
return (0, import_react75.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
|
|
11391
11498
|
}
|
|
11392
11499
|
function useTrackChanges(editor) {
|
|
11393
11500
|
const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
|
|
11394
|
-
const subscribe = (0,
|
|
11501
|
+
const subscribe = (0, import_react75.useCallback)(
|
|
11395
11502
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
|
|
11396
11503
|
[store]
|
|
11397
11504
|
);
|
|
11398
11505
|
const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
|
|
11399
|
-
const snapshot = (0,
|
|
11400
|
-
return (0,
|
|
11506
|
+
const snapshot = (0, import_react75.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
11507
|
+
return (0, import_react75.useMemo)(() => {
|
|
11401
11508
|
const run = (fn) => () => {
|
|
11402
11509
|
if (editor && !editor.isDestroyed) fn(editor);
|
|
11403
11510
|
};
|
|
@@ -11420,9 +11527,9 @@ function useTrackChanges(editor) {
|
|
|
11420
11527
|
}
|
|
11421
11528
|
|
|
11422
11529
|
// src/review/CommentsPanel.tsx
|
|
11423
|
-
var
|
|
11530
|
+
var import_react76 = require("react");
|
|
11424
11531
|
var import_editor14 = require("@pixerate/editor");
|
|
11425
|
-
var
|
|
11532
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
11426
11533
|
var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
|
|
11427
11534
|
var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
|
|
11428
11535
|
var textareaClass = "w-full resize-y rounded-md border border-input bg-background p-2 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary";
|
|
@@ -11436,18 +11543,18 @@ var CommentsPanel = ({
|
|
|
11436
11543
|
emptyMessage = "No comments yet. Select text and add a comment."
|
|
11437
11544
|
}) => {
|
|
11438
11545
|
const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
|
|
11439
|
-
const [showResolved, setShowResolved] = (0,
|
|
11546
|
+
const [showResolved, setShowResolved] = (0, import_react76.useState)(showResolvedInitial);
|
|
11440
11547
|
const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
|
|
11441
11548
|
const visible = threads.filter((t) => showResolved || !t.resolved);
|
|
11442
11549
|
const resolvedCount = threads.filter((t) => t.resolved).length;
|
|
11443
|
-
return /* @__PURE__ */ (0,
|
|
11444
|
-
/* @__PURE__ */ (0,
|
|
11445
|
-
/* @__PURE__ */ (0,
|
|
11550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("aside", { className, "aria-label": "Comments", children: [
|
|
11551
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
11552
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
11446
11553
|
threads.length - resolvedCount,
|
|
11447
11554
|
" open",
|
|
11448
11555
|
resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
|
|
11449
11556
|
] }),
|
|
11450
|
-
resolvedCount > 0 && /* @__PURE__ */ (0,
|
|
11557
|
+
resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11451
11558
|
"button",
|
|
11452
11559
|
{
|
|
11453
11560
|
type: "button",
|
|
@@ -11458,7 +11565,7 @@ var CommentsPanel = ({
|
|
|
11458
11565
|
}
|
|
11459
11566
|
)
|
|
11460
11567
|
] }),
|
|
11461
|
-
visible.length === 0 ? /* @__PURE__ */ (0,
|
|
11568
|
+
visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11462
11569
|
CommentThreadCard,
|
|
11463
11570
|
{
|
|
11464
11571
|
thread,
|
|
@@ -11480,7 +11587,7 @@ var CommentThreadCard = ({
|
|
|
11480
11587
|
author,
|
|
11481
11588
|
formatTime
|
|
11482
11589
|
}) => {
|
|
11483
|
-
const [draft, setDraft] = (0,
|
|
11590
|
+
const [draft, setDraft] = (0, import_react76.useState)("");
|
|
11484
11591
|
const isDraft = thread.body === "";
|
|
11485
11592
|
const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
|
|
11486
11593
|
const live = editor && !editor.isDestroyed ? editor : null;
|
|
@@ -11506,7 +11613,7 @@ var CommentThreadCard = ({
|
|
|
11506
11613
|
setDraft("");
|
|
11507
11614
|
};
|
|
11508
11615
|
const stop = (e) => e.stopPropagation();
|
|
11509
|
-
return /* @__PURE__ */ (0,
|
|
11616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
11510
11617
|
"li",
|
|
11511
11618
|
{
|
|
11512
11619
|
className: `flex flex-col gap-2 rounded-md border bg-background p-3 cursor-pointer ${active ? "border-primary ring-1 ring-primary" : "border-border"} ${thread.resolved ? "opacity-70" : ""}`,
|
|
@@ -11522,24 +11629,24 @@ var CommentThreadCard = ({
|
|
|
11522
11629
|
}
|
|
11523
11630
|
},
|
|
11524
11631
|
children: [
|
|
11525
|
-
/* @__PURE__ */ (0,
|
|
11526
|
-
/* @__PURE__ */ (0,
|
|
11527
|
-
/* @__PURE__ */ (0,
|
|
11632
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
11633
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: thread.author.name }),
|
|
11634
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
|
|
11528
11635
|
] }),
|
|
11529
|
-
quote && /* @__PURE__ */ (0,
|
|
11530
|
-
thread.orphaned && /* @__PURE__ */ (0,
|
|
11531
|
-
thread.resolved && /* @__PURE__ */ (0,
|
|
11532
|
-
!isDraft && /* @__PURE__ */ (0,
|
|
11533
|
-
thread.replies.length > 0 && /* @__PURE__ */ (0,
|
|
11534
|
-
/* @__PURE__ */ (0,
|
|
11535
|
-
/* @__PURE__ */ (0,
|
|
11636
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
|
|
11637
|
+
thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
|
|
11638
|
+
thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
|
|
11639
|
+
!isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
|
|
11640
|
+
thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("ul", { className: "flex flex-col gap-2 border-l border-border pl-3", role: "list", children: thread.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
|
|
11641
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs", children: [
|
|
11642
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "font-medium", children: reply.author.name }),
|
|
11536
11643
|
" ",
|
|
11537
|
-
/* @__PURE__ */ (0,
|
|
11644
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
|
|
11538
11645
|
] }),
|
|
11539
|
-
/* @__PURE__ */ (0,
|
|
11646
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
|
|
11540
11647
|
] }, reply.id)) }),
|
|
11541
|
-
(active || isDraft) && !thread.resolved && /* @__PURE__ */ (0,
|
|
11542
|
-
/* @__PURE__ */ (0,
|
|
11648
|
+
(active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
|
|
11649
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11543
11650
|
"textarea",
|
|
11544
11651
|
{
|
|
11545
11652
|
className: textareaClass,
|
|
@@ -11557,9 +11664,9 @@ var CommentThreadCard = ({
|
|
|
11557
11664
|
}
|
|
11558
11665
|
}
|
|
11559
11666
|
),
|
|
11560
|
-
/* @__PURE__ */ (0,
|
|
11561
|
-
isDraft && /* @__PURE__ */ (0,
|
|
11562
|
-
/* @__PURE__ */ (0,
|
|
11667
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex justify-end gap-1", children: [
|
|
11668
|
+
isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
|
|
11669
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11563
11670
|
"button",
|
|
11564
11671
|
{
|
|
11565
11672
|
type: "button",
|
|
@@ -11571,9 +11678,9 @@ var CommentThreadCard = ({
|
|
|
11571
11678
|
)
|
|
11572
11679
|
] })
|
|
11573
11680
|
] }),
|
|
11574
|
-
!isDraft && /* @__PURE__ */ (0,
|
|
11575
|
-
/* @__PURE__ */ (0,
|
|
11576
|
-
/* @__PURE__ */ (0,
|
|
11681
|
+
!isDraft && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
|
|
11682
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
|
|
11683
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11577
11684
|
"button",
|
|
11578
11685
|
{
|
|
11579
11686
|
type: "button",
|
|
@@ -11589,7 +11696,7 @@ var CommentThreadCard = ({
|
|
|
11589
11696
|
};
|
|
11590
11697
|
|
|
11591
11698
|
// src/review/ReviewToolbar.tsx
|
|
11592
|
-
var
|
|
11699
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
11593
11700
|
var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
|
|
11594
11701
|
var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
|
|
11595
11702
|
var ReviewToolbar = ({
|
|
@@ -11602,8 +11709,8 @@ var ReviewToolbar = ({
|
|
|
11602
11709
|
const count = review.changes.length;
|
|
11603
11710
|
const current = review.currentChange;
|
|
11604
11711
|
const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
|
|
11605
|
-
return /* @__PURE__ */ (0,
|
|
11606
|
-
/* @__PURE__ */ (0,
|
|
11712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
|
|
11713
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11607
11714
|
"button",
|
|
11608
11715
|
{
|
|
11609
11716
|
type: "button",
|
|
@@ -11614,8 +11721,8 @@ var ReviewToolbar = ({
|
|
|
11614
11721
|
children: review.enabled ? "Tracking on" : "Track changes"
|
|
11615
11722
|
}
|
|
11616
11723
|
),
|
|
11617
|
-
/* @__PURE__ */ (0,
|
|
11618
|
-
/* @__PURE__ */ (0,
|
|
11724
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
|
|
11725
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11619
11726
|
"button",
|
|
11620
11727
|
{
|
|
11621
11728
|
type: "button",
|
|
@@ -11626,8 +11733,8 @@ var ReviewToolbar = ({
|
|
|
11626
11733
|
children: "\u2039"
|
|
11627
11734
|
}
|
|
11628
11735
|
),
|
|
11629
|
-
/* @__PURE__ */ (0,
|
|
11630
|
-
/* @__PURE__ */ (0,
|
|
11736
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "min-w-[4rem] text-center text-xs text-muted-foreground", "aria-live": "polite", children: count === 0 ? "No changes" : current ? `${index} of ${count}` : `${count} changes` }),
|
|
11737
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11631
11738
|
"button",
|
|
11632
11739
|
{
|
|
11633
11740
|
type: "button",
|
|
@@ -11638,7 +11745,7 @@ var ReviewToolbar = ({
|
|
|
11638
11745
|
children: "\u203A"
|
|
11639
11746
|
}
|
|
11640
11747
|
),
|
|
11641
|
-
showDescription && current && /* @__PURE__ */ (0,
|
|
11748
|
+
showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
11642
11749
|
"span",
|
|
11643
11750
|
{
|
|
11644
11751
|
className: descriptionClassName,
|
|
@@ -11650,8 +11757,8 @@ var ReviewToolbar = ({
|
|
|
11650
11757
|
]
|
|
11651
11758
|
}
|
|
11652
11759
|
),
|
|
11653
|
-
/* @__PURE__ */ (0,
|
|
11654
|
-
/* @__PURE__ */ (0,
|
|
11760
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
|
|
11761
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11655
11762
|
"button",
|
|
11656
11763
|
{
|
|
11657
11764
|
type: "button",
|
|
@@ -11661,7 +11768,7 @@ var ReviewToolbar = ({
|
|
|
11661
11768
|
children: "Accept"
|
|
11662
11769
|
}
|
|
11663
11770
|
),
|
|
11664
|
-
/* @__PURE__ */ (0,
|
|
11771
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11665
11772
|
"button",
|
|
11666
11773
|
{
|
|
11667
11774
|
type: "button",
|
|
@@ -11671,18 +11778,18 @@ var ReviewToolbar = ({
|
|
|
11671
11778
|
children: "Reject"
|
|
11672
11779
|
}
|
|
11673
11780
|
),
|
|
11674
|
-
/* @__PURE__ */ (0,
|
|
11675
|
-
/* @__PURE__ */ (0,
|
|
11781
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
|
|
11782
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
|
|
11676
11783
|
] });
|
|
11677
11784
|
};
|
|
11678
11785
|
|
|
11679
11786
|
// src/review/CommentButton.tsx
|
|
11680
|
-
var
|
|
11787
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
11681
11788
|
var CommentButton = ({
|
|
11682
11789
|
editor,
|
|
11683
11790
|
className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
|
|
11684
11791
|
children = "Comment"
|
|
11685
|
-
}) => /* @__PURE__ */ (0,
|
|
11792
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
11686
11793
|
"button",
|
|
11687
11794
|
{
|
|
11688
11795
|
type: "button",
|
|
@@ -11694,13 +11801,13 @@ var CommentButton = ({
|
|
|
11694
11801
|
);
|
|
11695
11802
|
|
|
11696
11803
|
// src/review/useDocumentCompare.ts
|
|
11697
|
-
var
|
|
11804
|
+
var import_react77 = require("react");
|
|
11698
11805
|
var import_editor15 = require("@pixerate/editor");
|
|
11699
11806
|
function useDocumentCompare(editor, options) {
|
|
11700
|
-
const [summary, setSummary] = (0,
|
|
11701
|
-
const defaults = (0,
|
|
11807
|
+
const [summary, setSummary] = (0, import_react77.useState)(null);
|
|
11808
|
+
const defaults = (0, import_react77.useRef)(options);
|
|
11702
11809
|
defaults.current = options;
|
|
11703
|
-
const compare = (0,
|
|
11810
|
+
const compare = (0, import_react77.useCallback)(
|
|
11704
11811
|
(original, revised, overrides) => {
|
|
11705
11812
|
if (!editor || editor.isDestroyed) return null;
|
|
11706
11813
|
const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
|
|
@@ -11712,13 +11819,13 @@ function useDocumentCompare(editor, options) {
|
|
|
11712
11819
|
},
|
|
11713
11820
|
[editor]
|
|
11714
11821
|
);
|
|
11715
|
-
const clear = (0,
|
|
11716
|
-
return (0,
|
|
11822
|
+
const clear = (0, import_react77.useCallback)(() => setSummary(null), []);
|
|
11823
|
+
return (0, import_react77.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
|
|
11717
11824
|
}
|
|
11718
11825
|
|
|
11719
11826
|
// src/review/TrackedChangesList.tsx
|
|
11720
11827
|
var import_editor16 = require("@pixerate/editor");
|
|
11721
|
-
var
|
|
11828
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
11722
11829
|
var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
|
|
11723
11830
|
var TrackedChangesList = ({
|
|
11724
11831
|
editor,
|
|
@@ -11729,18 +11836,18 @@ var TrackedChangesList = ({
|
|
|
11729
11836
|
}) => {
|
|
11730
11837
|
const review = useTrackChanges(editor);
|
|
11731
11838
|
if (review.changes.length === 0) {
|
|
11732
|
-
return /* @__PURE__ */ (0,
|
|
11839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
|
|
11733
11840
|
}
|
|
11734
|
-
return /* @__PURE__ */ (0,
|
|
11841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
|
|
11735
11842
|
const active = change.id === review.currentChangeId;
|
|
11736
|
-
return /* @__PURE__ */ (0,
|
|
11843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
11737
11844
|
"li",
|
|
11738
11845
|
{
|
|
11739
11846
|
className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
|
|
11740
11847
|
"data-change-type": change.type,
|
|
11741
11848
|
"data-change-id": change.id,
|
|
11742
11849
|
children: [
|
|
11743
|
-
/* @__PURE__ */ (0,
|
|
11850
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
11744
11851
|
"button",
|
|
11745
11852
|
{
|
|
11746
11853
|
type: "button",
|
|
@@ -11748,14 +11855,14 @@ var TrackedChangesList = ({
|
|
|
11748
11855
|
title: `${change.author.name}: ${change.description}`,
|
|
11749
11856
|
onClick: () => review.select(change.id),
|
|
11750
11857
|
children: [
|
|
11751
|
-
/* @__PURE__ */ (0,
|
|
11858
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
|
|
11752
11859
|
change.author.name ? ` \xB7 ${change.author.name}` : "",
|
|
11753
|
-
/* @__PURE__ */ (0,
|
|
11860
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
|
|
11754
11861
|
]
|
|
11755
11862
|
}
|
|
11756
11863
|
),
|
|
11757
|
-
/* @__PURE__ */ (0,
|
|
11758
|
-
/* @__PURE__ */ (0,
|
|
11864
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
|
|
11865
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
|
|
11759
11866
|
]
|
|
11760
11867
|
},
|
|
11761
11868
|
`${change.type}:${change.id}`
|
|
@@ -11764,12 +11871,12 @@ var TrackedChangesList = ({
|
|
|
11764
11871
|
};
|
|
11765
11872
|
|
|
11766
11873
|
// src/commands/useCommandPalette.ts
|
|
11767
|
-
var
|
|
11874
|
+
var import_react78 = require("react");
|
|
11768
11875
|
var import_commands2 = require("@pixerate/editor/commands");
|
|
11769
11876
|
function useCommandPalette(registry, options = {}) {
|
|
11770
|
-
const optionsRef = (0,
|
|
11877
|
+
const optionsRef = (0, import_react78.useRef)(options);
|
|
11771
11878
|
optionsRef.current = options;
|
|
11772
|
-
const controller = (0,
|
|
11879
|
+
const controller = (0, import_react78.useMemo)(
|
|
11773
11880
|
() => (0, import_commands2.createCommandPaletteController)(registry, {
|
|
11774
11881
|
context: () => {
|
|
11775
11882
|
const c = optionsRef.current.context;
|
|
@@ -11790,9 +11897,9 @@ function useCommandPalette(registry, options = {}) {
|
|
|
11790
11897
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11791
11898
|
[registry]
|
|
11792
11899
|
);
|
|
11793
|
-
const state = (0,
|
|
11900
|
+
const state = (0, import_react78.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
|
|
11794
11901
|
const { hotkey, hotkeyTarget } = options;
|
|
11795
|
-
(0,
|
|
11902
|
+
(0, import_react78.useEffect)(() => {
|
|
11796
11903
|
if (!hotkey) return;
|
|
11797
11904
|
const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
|
|
11798
11905
|
if (!target) return;
|
|
@@ -11820,13 +11927,13 @@ function useCommandPalette(registry, options = {}) {
|
|
|
11820
11927
|
}
|
|
11821
11928
|
|
|
11822
11929
|
// src/commands/CommandPalette.tsx
|
|
11823
|
-
var
|
|
11824
|
-
var
|
|
11930
|
+
var import_react79 = __toESM(require("react"), 1);
|
|
11931
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
11825
11932
|
function HighlightedLabel({ item }) {
|
|
11826
|
-
if (item.labelIndices.length === 0) return /* @__PURE__ */ (0,
|
|
11933
|
+
if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: item.label });
|
|
11827
11934
|
const marked = new Set(item.labelIndices);
|
|
11828
|
-
return /* @__PURE__ */ (0,
|
|
11829
|
-
(ch, i) => marked.has(i) ? /* @__PURE__ */ (0,
|
|
11935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: Array.from(item.label).map(
|
|
11936
|
+
(ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react79.default.Fragment, { children: ch }, i)
|
|
11830
11937
|
) });
|
|
11831
11938
|
}
|
|
11832
11939
|
var CommandPalette = ({
|
|
@@ -11835,22 +11942,22 @@ var CommandPalette = ({
|
|
|
11835
11942
|
emptyMessage = "No matching commands",
|
|
11836
11943
|
className = ""
|
|
11837
11944
|
}) => {
|
|
11838
|
-
const inputRef = (0,
|
|
11839
|
-
const listRef = (0,
|
|
11840
|
-
const baseId = (0,
|
|
11945
|
+
const inputRef = (0, import_react79.useRef)(null);
|
|
11946
|
+
const listRef = (0, import_react79.useRef)(null);
|
|
11947
|
+
const baseId = (0, import_react79.useId)();
|
|
11841
11948
|
const listId = `${baseId}-list`;
|
|
11842
11949
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
11843
11950
|
const { open, query, items, activeIndex } = palette;
|
|
11844
|
-
(0,
|
|
11951
|
+
(0, import_react79.useEffect)(() => {
|
|
11845
11952
|
if (open) inputRef.current?.focus();
|
|
11846
11953
|
}, [open]);
|
|
11847
|
-
(0,
|
|
11954
|
+
(0, import_react79.useEffect)(() => {
|
|
11848
11955
|
if (!open) return;
|
|
11849
11956
|
const active = listRef.current?.querySelector('[aria-selected="true"]');
|
|
11850
11957
|
active?.scrollIntoView?.({ block: "nearest" });
|
|
11851
11958
|
}, [open, activeIndex]);
|
|
11852
11959
|
if (!open) return null;
|
|
11853
|
-
return /* @__PURE__ */ (0,
|
|
11960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
11854
11961
|
"div",
|
|
11855
11962
|
{
|
|
11856
11963
|
className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
|
|
@@ -11858,7 +11965,7 @@ var CommandPalette = ({
|
|
|
11858
11965
|
onMouseDown: (e) => {
|
|
11859
11966
|
if (e.target === e.currentTarget) palette.setOpen(false);
|
|
11860
11967
|
},
|
|
11861
|
-
children: /* @__PURE__ */ (0,
|
|
11968
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
11862
11969
|
"div",
|
|
11863
11970
|
{
|
|
11864
11971
|
role: "dialog",
|
|
@@ -11867,7 +11974,7 @@ var CommandPalette = ({
|
|
|
11867
11974
|
className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
|
|
11868
11975
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
11869
11976
|
children: [
|
|
11870
|
-
/* @__PURE__ */ (0,
|
|
11977
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
11871
11978
|
"input",
|
|
11872
11979
|
{
|
|
11873
11980
|
ref: inputRef,
|
|
@@ -11887,7 +11994,7 @@ var CommandPalette = ({
|
|
|
11887
11994
|
className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
|
|
11888
11995
|
}
|
|
11889
11996
|
),
|
|
11890
|
-
items.length === 0 ? /* @__PURE__ */ (0,
|
|
11997
|
+
items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("ul", { ref: listRef, id: listId, role: "listbox", "aria-label": "Commands", className: "max-h-80 overflow-y-auto py-1", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
11891
11998
|
"li",
|
|
11892
11999
|
{
|
|
11893
12000
|
id: optionId(index),
|
|
@@ -11902,12 +12009,12 @@ var CommandPalette = ({
|
|
|
11902
12009
|
onClick: () => palette.run(item.id),
|
|
11903
12010
|
className: `flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm ${index === activeIndex ? "bg-muted" : ""} ${item.enabled ? "" : "cursor-default opacity-50"}`,
|
|
11904
12011
|
children: [
|
|
11905
|
-
/* @__PURE__ */ (0,
|
|
11906
|
-
/* @__PURE__ */ (0,
|
|
11907
|
-
item.disabledReason && /* @__PURE__ */ (0,
|
|
12012
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
12013
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HighlightedLabel, { item }),
|
|
12014
|
+
item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
|
|
11908
12015
|
] }),
|
|
11909
|
-
item.group && /* @__PURE__ */ (0,
|
|
11910
|
-
item.shortcut && /* @__PURE__ */ (0,
|
|
12016
|
+
item.group && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
|
|
12017
|
+
item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
|
|
11911
12018
|
]
|
|
11912
12019
|
},
|
|
11913
12020
|
item.id
|
|
@@ -11920,12 +12027,12 @@ var CommandPalette = ({
|
|
|
11920
12027
|
};
|
|
11921
12028
|
|
|
11922
12029
|
// src/commands/useCommandShortcuts.ts
|
|
11923
|
-
var
|
|
12030
|
+
var import_react80 = require("react");
|
|
11924
12031
|
function useCommandShortcuts(registry, options = {}) {
|
|
11925
|
-
const optionsRef = (0,
|
|
12032
|
+
const optionsRef = (0, import_react80.useRef)(options);
|
|
11926
12033
|
optionsRef.current = options;
|
|
11927
12034
|
const { enabled = true, target } = options;
|
|
11928
|
-
(0,
|
|
12035
|
+
(0, import_react80.useEffect)(() => {
|
|
11929
12036
|
if (!registry || !enabled) return;
|
|
11930
12037
|
const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
|
|
11931
12038
|
if (!eventTarget) return;
|
|
@@ -11943,14 +12050,14 @@ function useCommandShortcuts(registry, options = {}) {
|
|
|
11943
12050
|
}, [registry, enabled, target]);
|
|
11944
12051
|
}
|
|
11945
12052
|
function useRegisterCommands(registry, specs) {
|
|
11946
|
-
(0,
|
|
12053
|
+
(0, import_react80.useEffect)(() => {
|
|
11947
12054
|
if (!registry || !specs || specs.length === 0) return;
|
|
11948
12055
|
return registry.register(specs);
|
|
11949
12056
|
}, [registry, specs]);
|
|
11950
12057
|
}
|
|
11951
12058
|
|
|
11952
12059
|
// src/persistence/useAutosave.ts
|
|
11953
|
-
var
|
|
12060
|
+
var import_react81 = require("react");
|
|
11954
12061
|
var import_persistence = require("@pixerate/editor/persistence");
|
|
11955
12062
|
var IDLE = {
|
|
11956
12063
|
status: "idle",
|
|
@@ -11961,18 +12068,18 @@ var IDLE = {
|
|
|
11961
12068
|
ready: false
|
|
11962
12069
|
};
|
|
11963
12070
|
function useAutosave(options) {
|
|
11964
|
-
const optionsRef = (0,
|
|
12071
|
+
const optionsRef = (0, import_react81.useRef)(options);
|
|
11965
12072
|
optionsRef.current = options;
|
|
11966
12073
|
const { storage, key, history, dirty } = options;
|
|
11967
12074
|
const recover = options.recover !== false;
|
|
11968
12075
|
const flushOnHide = options.flushOnHide !== false;
|
|
11969
12076
|
const ready = options.ready !== false;
|
|
11970
|
-
const [controller, setController] = (0,
|
|
11971
|
-
const [status, setStatus] = (0,
|
|
11972
|
-
const [recovery, setRecovery] = (0,
|
|
11973
|
-
const [pendingRecovery, setPendingRecovery] = (0,
|
|
11974
|
-
const revisionsRef = (0,
|
|
11975
|
-
(0,
|
|
12077
|
+
const [controller, setController] = (0, import_react81.useState)(null);
|
|
12078
|
+
const [status, setStatus] = (0, import_react81.useState)(IDLE);
|
|
12079
|
+
const [recovery, setRecovery] = (0, import_react81.useState)(null);
|
|
12080
|
+
const [pendingRecovery, setPendingRecovery] = (0, import_react81.useState)(recover);
|
|
12081
|
+
const revisionsRef = (0, import_react81.useRef)(null);
|
|
12082
|
+
(0, import_react81.useEffect)(() => {
|
|
11976
12083
|
const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
|
|
11977
12084
|
const o = optionsRef.current;
|
|
11978
12085
|
const instance = (0, import_persistence.createAutosaveController)({
|
|
@@ -12015,10 +12122,10 @@ function useAutosave(options) {
|
|
|
12015
12122
|
if (revisionsRef.current === revisions) revisionsRef.current = null;
|
|
12016
12123
|
};
|
|
12017
12124
|
}, [storage, key, history, dirty, recover]);
|
|
12018
|
-
(0,
|
|
12125
|
+
(0, import_react81.useEffect)(() => {
|
|
12019
12126
|
if (controller && ready && !pendingRecovery) controller.ready();
|
|
12020
12127
|
}, [controller, ready, pendingRecovery]);
|
|
12021
|
-
(0,
|
|
12128
|
+
(0, import_react81.useEffect)(() => {
|
|
12022
12129
|
if (!controller || !flushOnHide || typeof window === "undefined") return;
|
|
12023
12130
|
const flush = () => void controller.flushNow();
|
|
12024
12131
|
const onVisibility = () => {
|
|
@@ -12031,33 +12138,33 @@ function useAutosave(options) {
|
|
|
12031
12138
|
document.removeEventListener("visibilitychange", onVisibility);
|
|
12032
12139
|
};
|
|
12033
12140
|
}, [controller, flushOnHide]);
|
|
12034
|
-
const restore = (0,
|
|
12141
|
+
const restore = (0, import_react81.useCallback)(() => {
|
|
12035
12142
|
const snapshot = recovery?.snapshot;
|
|
12036
12143
|
setRecovery(null);
|
|
12037
12144
|
setPendingRecovery(false);
|
|
12038
12145
|
return snapshot;
|
|
12039
12146
|
}, [recovery]);
|
|
12040
|
-
const discard = (0,
|
|
12147
|
+
const discard = (0, import_react81.useCallback)(async () => {
|
|
12041
12148
|
if (controller) await controller.discardRecovery();
|
|
12042
12149
|
setRecovery(null);
|
|
12043
12150
|
setPendingRecovery(false);
|
|
12044
12151
|
}, [controller]);
|
|
12045
|
-
const flushNow = (0,
|
|
12152
|
+
const flushNow = (0, import_react81.useCallback)(async () => {
|
|
12046
12153
|
await controller?.flushNow();
|
|
12047
12154
|
}, [controller]);
|
|
12048
|
-
const markClean = (0,
|
|
12155
|
+
const markClean = (0, import_react81.useCallback)(async () => {
|
|
12049
12156
|
revisionsRef.current?.markSaved();
|
|
12050
12157
|
await controller?.markClean();
|
|
12051
12158
|
}, [controller]);
|
|
12052
|
-
const notifyChange = (0,
|
|
12159
|
+
const notifyChange = (0, import_react81.useCallback)(() => revisionsRef.current?.bump(), []);
|
|
12053
12160
|
return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
|
|
12054
12161
|
}
|
|
12055
12162
|
|
|
12056
12163
|
// src/persistence/useEditorAutosave.ts
|
|
12057
|
-
var
|
|
12164
|
+
var import_react82 = require("react");
|
|
12058
12165
|
var import_persistence2 = require("@pixerate/editor/persistence");
|
|
12059
12166
|
function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
12060
|
-
const storage = (0,
|
|
12167
|
+
const storage = (0, import_react82.useMemo)(
|
|
12061
12168
|
() => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
|
|
12062
12169
|
[options.storage, doc.assets]
|
|
12063
12170
|
);
|
|
@@ -12070,19 +12177,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
|
12070
12177
|
history: doc
|
|
12071
12178
|
});
|
|
12072
12179
|
const take = autosave.restore;
|
|
12073
|
-
const restore = (0,
|
|
12180
|
+
const restore = (0, import_react82.useCallback)(() => {
|
|
12074
12181
|
const snapshot = take();
|
|
12075
12182
|
return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
|
|
12076
12183
|
}, [take, doc]);
|
|
12077
12184
|
const { markClean: clean, discard: drop } = autosave;
|
|
12078
12185
|
const rawStorage = options.storage;
|
|
12079
|
-
const gcRef = (0,
|
|
12186
|
+
const gcRef = (0, import_react82.useRef)(collectAssetGarbage);
|
|
12080
12187
|
gcRef.current = collectAssetGarbage;
|
|
12081
|
-
const markClean = (0,
|
|
12188
|
+
const markClean = (0, import_react82.useCallback)(async () => {
|
|
12082
12189
|
await clean();
|
|
12083
12190
|
await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
|
|
12084
12191
|
}, [clean, rawStorage, doc]);
|
|
12085
|
-
const discard = (0,
|
|
12192
|
+
const discard = (0, import_react82.useCallback)(async () => {
|
|
12086
12193
|
await drop();
|
|
12087
12194
|
await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
|
|
12088
12195
|
}, [drop, rawStorage, doc]);
|
|
@@ -12091,7 +12198,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
|
12091
12198
|
|
|
12092
12199
|
// src/persistence/RecoveryPrompt.tsx
|
|
12093
12200
|
var import_persistence3 = require("@pixerate/editor/persistence");
|
|
12094
|
-
var
|
|
12201
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12095
12202
|
var RecoveryPrompt = ({
|
|
12096
12203
|
recovery,
|
|
12097
12204
|
onRestore,
|
|
@@ -12103,7 +12210,7 @@ var RecoveryPrompt = ({
|
|
|
12103
12210
|
}) => {
|
|
12104
12211
|
if (!recovery) return null;
|
|
12105
12212
|
const { name } = recovery.meta;
|
|
12106
|
-
return /* @__PURE__ */ (0,
|
|
12213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
12107
12214
|
"div",
|
|
12108
12215
|
{
|
|
12109
12216
|
role: "alertdialog",
|
|
@@ -12111,15 +12218,15 @@ var RecoveryPrompt = ({
|
|
|
12111
12218
|
"data-recovery-prompt": "",
|
|
12112
12219
|
className: `flex flex-wrap items-center gap-3 rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground shadow-sm ${className}`,
|
|
12113
12220
|
children: [
|
|
12114
|
-
/* @__PURE__ */ (0,
|
|
12221
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
12115
12222
|
(0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
|
|
12116
|
-
name ? /* @__PURE__ */ (0,
|
|
12223
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
|
|
12117
12224
|
"(",
|
|
12118
12225
|
name,
|
|
12119
12226
|
")"
|
|
12120
12227
|
] }) : null
|
|
12121
12228
|
] }),
|
|
12122
|
-
/* @__PURE__ */ (0,
|
|
12229
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12123
12230
|
"button",
|
|
12124
12231
|
{
|
|
12125
12232
|
type: "button",
|
|
@@ -12129,7 +12236,7 @@ var RecoveryPrompt = ({
|
|
|
12129
12236
|
children: restoreLabel
|
|
12130
12237
|
}
|
|
12131
12238
|
),
|
|
12132
|
-
/* @__PURE__ */ (0,
|
|
12239
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12133
12240
|
"button",
|
|
12134
12241
|
{
|
|
12135
12242
|
type: "button",
|
|
@@ -12145,17 +12252,17 @@ var RecoveryPrompt = ({
|
|
|
12145
12252
|
};
|
|
12146
12253
|
|
|
12147
12254
|
// src/generation/useGenerationPlan.ts
|
|
12148
|
-
var
|
|
12255
|
+
var import_react83 = require("react");
|
|
12149
12256
|
var import_generation = require("@pixerate/editor/generation");
|
|
12150
12257
|
function useGenerationPlan(request, capabilities, options = {}) {
|
|
12151
12258
|
const key = JSON.stringify([request, capabilities, options]);
|
|
12152
|
-
return (0,
|
|
12259
|
+
return (0, import_react83.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
|
|
12153
12260
|
}
|
|
12154
12261
|
function useJobProgress(options) {
|
|
12155
12262
|
const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
|
|
12156
|
-
const [tick, setTick] = (0,
|
|
12263
|
+
const [tick, setTick] = (0, import_react83.useState)(() => Date.now());
|
|
12157
12264
|
const ticking = !done && now === void 0;
|
|
12158
|
-
(0,
|
|
12265
|
+
(0, import_react83.useEffect)(() => {
|
|
12159
12266
|
if (!ticking) return;
|
|
12160
12267
|
setTick(Date.now());
|
|
12161
12268
|
const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
|
|
@@ -12165,9 +12272,9 @@ function useJobProgress(options) {
|
|
|
12165
12272
|
}
|
|
12166
12273
|
|
|
12167
12274
|
// src/generation/GenerationSettings.tsx
|
|
12168
|
-
var
|
|
12275
|
+
var import_react84 = require("react");
|
|
12169
12276
|
var import_generation2 = require("@pixerate/editor/generation");
|
|
12170
|
-
var
|
|
12277
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12171
12278
|
var inputClass2 = "w-full rounded-md border border-border bg-background px-2 py-1 text-sm outline-none focus:ring-1 focus:ring-ring";
|
|
12172
12279
|
function Control({
|
|
12173
12280
|
control,
|
|
@@ -12177,7 +12284,7 @@ function Control({
|
|
|
12177
12284
|
}) {
|
|
12178
12285
|
const shown = value ?? control.defaultValue;
|
|
12179
12286
|
if (control.kind === "checkbox") {
|
|
12180
|
-
return /* @__PURE__ */ (0,
|
|
12287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12181
12288
|
"input",
|
|
12182
12289
|
{
|
|
12183
12290
|
id,
|
|
@@ -12189,7 +12296,7 @@ function Control({
|
|
|
12189
12296
|
);
|
|
12190
12297
|
}
|
|
12191
12298
|
if (control.kind === "select") {
|
|
12192
|
-
return /* @__PURE__ */ (0,
|
|
12299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
12193
12300
|
"select",
|
|
12194
12301
|
{
|
|
12195
12302
|
id,
|
|
@@ -12198,14 +12305,14 @@ function Control({
|
|
|
12198
12305
|
value: shown === void 0 ? "" : String(shown),
|
|
12199
12306
|
onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
|
|
12200
12307
|
children: [
|
|
12201
|
-
shown === void 0 && /* @__PURE__ */ (0,
|
|
12202
|
-
control.options.map((option) => /* @__PURE__ */ (0,
|
|
12308
|
+
shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("option", { value: "", children: "Default" }),
|
|
12309
|
+
control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
|
|
12203
12310
|
]
|
|
12204
12311
|
}
|
|
12205
12312
|
);
|
|
12206
12313
|
}
|
|
12207
12314
|
if (control.kind === "textarea") {
|
|
12208
|
-
return /* @__PURE__ */ (0,
|
|
12315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12209
12316
|
"textarea",
|
|
12210
12317
|
{
|
|
12211
12318
|
id,
|
|
@@ -12219,8 +12326,8 @@ function Control({
|
|
|
12219
12326
|
);
|
|
12220
12327
|
}
|
|
12221
12328
|
const numeric = typeof shown === "number" ? shown : void 0;
|
|
12222
|
-
return /* @__PURE__ */ (0,
|
|
12223
|
-
/* @__PURE__ */ (0,
|
|
12329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12330
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12224
12331
|
"input",
|
|
12225
12332
|
{
|
|
12226
12333
|
id,
|
|
@@ -12234,7 +12341,7 @@ function Control({
|
|
|
12234
12341
|
onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
|
|
12235
12342
|
}
|
|
12236
12343
|
),
|
|
12237
|
-
control.kind === "range" && /* @__PURE__ */ (0,
|
|
12344
|
+
control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
|
|
12238
12345
|
] });
|
|
12239
12346
|
}
|
|
12240
12347
|
var GenerationSettings = ({
|
|
@@ -12248,17 +12355,17 @@ var GenerationSettings = ({
|
|
|
12248
12355
|
renderReference,
|
|
12249
12356
|
className = ""
|
|
12250
12357
|
}) => {
|
|
12251
|
-
const baseId = (0,
|
|
12252
|
-
const controls = (0,
|
|
12358
|
+
const baseId = (0, import_react84.useId)();
|
|
12359
|
+
const controls = (0, import_react84.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
|
|
12253
12360
|
const computed = useGenerationPlan(value, capabilities, { strategy });
|
|
12254
12361
|
const plan = planProp ?? computed;
|
|
12255
12362
|
const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
|
|
12256
|
-
return /* @__PURE__ */ (0,
|
|
12363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
|
|
12257
12364
|
controls.map((control) => {
|
|
12258
12365
|
const id = `${baseId}-${control.key}`;
|
|
12259
|
-
return /* @__PURE__ */ (0,
|
|
12260
|
-
/* @__PURE__ */ (0,
|
|
12261
|
-
/* @__PURE__ */ (0,
|
|
12366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
|
|
12367
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
|
|
12368
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12262
12369
|
Control,
|
|
12263
12370
|
{
|
|
12264
12371
|
control,
|
|
@@ -12269,23 +12376,23 @@ var GenerationSettings = ({
|
|
|
12269
12376
|
)
|
|
12270
12377
|
] }, control.key);
|
|
12271
12378
|
}),
|
|
12272
|
-
slots.map((slot) => /* @__PURE__ */ (0,
|
|
12273
|
-
/* @__PURE__ */ (0,
|
|
12379
|
+
slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
|
|
12380
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
|
|
12274
12381
|
slot.label,
|
|
12275
12382
|
" ",
|
|
12276
|
-
/* @__PURE__ */ (0,
|
|
12383
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
|
|
12277
12384
|
"(",
|
|
12278
12385
|
slot.references.length,
|
|
12279
12386
|
"/",
|
|
12280
12387
|
slot.max,
|
|
12281
12388
|
")"
|
|
12282
12389
|
] }),
|
|
12283
|
-
slot.min > 0 && /* @__PURE__ */ (0,
|
|
12390
|
+
slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-destructive", children: " *" })
|
|
12284
12391
|
] }),
|
|
12285
|
-
/* @__PURE__ */ (0,
|
|
12286
|
-
slot.references.map((ref) => /* @__PURE__ */ (0,
|
|
12287
|
-
renderReference ? renderReference(ref) : /* @__PURE__ */ (0,
|
|
12288
|
-
/* @__PURE__ */ (0,
|
|
12392
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
|
|
12393
|
+
slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
|
|
12394
|
+
renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
|
|
12395
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12289
12396
|
"button",
|
|
12290
12397
|
{
|
|
12291
12398
|
type: "button",
|
|
@@ -12296,7 +12403,7 @@ var GenerationSettings = ({
|
|
|
12296
12403
|
}
|
|
12297
12404
|
)
|
|
12298
12405
|
] }, ref.id)),
|
|
12299
|
-
onAddReference && slot.canAdd && /* @__PURE__ */ (0,
|
|
12406
|
+
onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12300
12407
|
"button",
|
|
12301
12408
|
{
|
|
12302
12409
|
type: "button",
|
|
@@ -12307,21 +12414,21 @@ var GenerationSettings = ({
|
|
|
12307
12414
|
) })
|
|
12308
12415
|
] })
|
|
12309
12416
|
] }, slot.role)),
|
|
12310
|
-
showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0,
|
|
12311
|
-
showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0,
|
|
12417
|
+
showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { role: "status", className: "flex flex-col gap-0.5 text-xs text-muted-foreground", "data-generation-adjustments": "", children: plan.adjustments.map((adjustment, index) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
|
|
12418
|
+
showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("ul", { role: "alert", className: "flex flex-col gap-0.5 text-xs text-destructive", "data-generation-errors": "", children: plan.errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
|
|
12312
12419
|
] });
|
|
12313
12420
|
};
|
|
12314
12421
|
|
|
12315
12422
|
// src/generation/JobProgress.tsx
|
|
12316
|
-
var
|
|
12423
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
12317
12424
|
var JobProgress = ({ title, className = "", ...options }) => {
|
|
12318
12425
|
const progress = useJobProgress(options);
|
|
12319
|
-
return /* @__PURE__ */ (0,
|
|
12320
|
-
/* @__PURE__ */ (0,
|
|
12321
|
-
title && /* @__PURE__ */ (0,
|
|
12322
|
-
/* @__PURE__ */ (0,
|
|
12426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
|
|
12427
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
|
|
12428
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "truncate text-foreground", children: title }),
|
|
12429
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
|
|
12323
12430
|
] }),
|
|
12324
|
-
/* @__PURE__ */ (0,
|
|
12431
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
12325
12432
|
"div",
|
|
12326
12433
|
{
|
|
12327
12434
|
role: "progressbar",
|
|
@@ -12331,7 +12438,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
|
|
|
12331
12438
|
"aria-valuenow": progress.percent,
|
|
12332
12439
|
"aria-valuetext": `${progress.percent}%, ${progress.label}`,
|
|
12333
12440
|
className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
|
|
12334
|
-
children: /* @__PURE__ */ (0,
|
|
12441
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
12335
12442
|
"div",
|
|
12336
12443
|
{
|
|
12337
12444
|
className: "h-full rounded-full bg-primary transition-[width] duration-500",
|
|
@@ -12344,9 +12451,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
|
|
|
12344
12451
|
};
|
|
12345
12452
|
|
|
12346
12453
|
// src/generation/AssetMentionChips.tsx
|
|
12347
|
-
var
|
|
12454
|
+
var import_react85 = require("react");
|
|
12348
12455
|
var import_generation3 = require("@pixerate/editor/generation");
|
|
12349
|
-
var
|
|
12456
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12350
12457
|
var AssetMentionChips = ({
|
|
12351
12458
|
content,
|
|
12352
12459
|
onChange,
|
|
@@ -12356,14 +12463,14 @@ var AssetMentionChips = ({
|
|
|
12356
12463
|
renderAsset,
|
|
12357
12464
|
className = ""
|
|
12358
12465
|
}) => {
|
|
12359
|
-
const [open, setOpen] = (0,
|
|
12360
|
-
const rootRef = (0,
|
|
12361
|
-
const chips = (0,
|
|
12466
|
+
const [open, setOpen] = (0, import_react85.useState)(null);
|
|
12467
|
+
const rootRef = (0, import_react85.useRef)(null);
|
|
12468
|
+
const chips = (0, import_react85.useMemo)(
|
|
12362
12469
|
() => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
|
|
12363
12470
|
[content, assets, capabilities]
|
|
12364
12471
|
);
|
|
12365
12472
|
const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
|
|
12366
|
-
(0,
|
|
12473
|
+
(0, import_react85.useEffect)(() => {
|
|
12367
12474
|
if (open === null) return;
|
|
12368
12475
|
const onPointer = (event) => {
|
|
12369
12476
|
if (!rootRef.current?.contains(event.target)) setOpen(null);
|
|
@@ -12377,13 +12484,13 @@ var AssetMentionChips = ({
|
|
|
12377
12484
|
onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
|
|
12378
12485
|
};
|
|
12379
12486
|
if (chips.length === 0) return null;
|
|
12380
|
-
return /* @__PURE__ */ (0,
|
|
12487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
|
|
12381
12488
|
const error = chip2.issues.find((issue) => issue.severity === "error");
|
|
12382
12489
|
const warning = chip2.issues.find((issue) => issue.severity === "warning");
|
|
12383
12490
|
const problem = error ?? warning;
|
|
12384
12491
|
const isOpen = open === chip2.index;
|
|
12385
|
-
return /* @__PURE__ */ (0,
|
|
12386
|
-
/* @__PURE__ */ (0,
|
|
12492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
|
|
12493
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
12387
12494
|
"button",
|
|
12388
12495
|
{
|
|
12389
12496
|
type: "button",
|
|
@@ -12397,8 +12504,8 @@ var AssetMentionChips = ({
|
|
|
12397
12504
|
},
|
|
12398
12505
|
className: `inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs ${error ? "border-red-500/60" : warning ? "border-amber-500/60" : "border-border"} bg-muted/40 hover:bg-muted`,
|
|
12399
12506
|
children: [
|
|
12400
|
-
/* @__PURE__ */ (0,
|
|
12401
|
-
/* @__PURE__ */ (0,
|
|
12507
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
|
|
12508
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12402
12509
|
"span",
|
|
12403
12510
|
{
|
|
12404
12511
|
className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
|
|
@@ -12409,7 +12516,7 @@ var AssetMentionChips = ({
|
|
|
12409
12516
|
]
|
|
12410
12517
|
}
|
|
12411
12518
|
),
|
|
12412
|
-
isOpen && /* @__PURE__ */ (0,
|
|
12519
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
12413
12520
|
"div",
|
|
12414
12521
|
{
|
|
12415
12522
|
role: "listbox",
|
|
@@ -12420,7 +12527,7 @@ var AssetMentionChips = ({
|
|
|
12420
12527
|
if (e.key === "Escape") setOpen(null);
|
|
12421
12528
|
},
|
|
12422
12529
|
children: [
|
|
12423
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
12530
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
12424
12531
|
"button",
|
|
12425
12532
|
{
|
|
12426
12533
|
type: "button",
|
|
@@ -12431,13 +12538,13 @@ var AssetMentionChips = ({
|
|
|
12431
12538
|
onClick: () => pick(chip2, option.role),
|
|
12432
12539
|
className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
|
|
12433
12540
|
children: [
|
|
12434
|
-
/* @__PURE__ */ (0,
|
|
12435
|
-
option.accepts?.length ? /* @__PURE__ */ (0,
|
|
12541
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { children: option.label }),
|
|
12542
|
+
option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
|
|
12436
12543
|
]
|
|
12437
12544
|
},
|
|
12438
12545
|
option.role
|
|
12439
12546
|
)),
|
|
12440
|
-
/* @__PURE__ */ (0,
|
|
12547
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12441
12548
|
"button",
|
|
12442
12549
|
{
|
|
12443
12550
|
type: "button",
|
|
@@ -12449,7 +12556,7 @@ var AssetMentionChips = ({
|
|
|
12449
12556
|
children: "No role"
|
|
12450
12557
|
}
|
|
12451
12558
|
),
|
|
12452
|
-
chip2.issues.length > 0 && /* @__PURE__ */ (0,
|
|
12559
|
+
chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: "mt-1 border-t border-border px-2 pt-1 text-[10px]", "data-chip-issues": "", children: chip2.issues.map((issue, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
|
|
12453
12560
|
]
|
|
12454
12561
|
}
|
|
12455
12562
|
)
|
|
@@ -12458,15 +12565,15 @@ var AssetMentionChips = ({
|
|
|
12458
12565
|
};
|
|
12459
12566
|
|
|
12460
12567
|
// src/generation/GenerationHistory.tsx
|
|
12461
|
-
var
|
|
12568
|
+
var import_react86 = require("react");
|
|
12462
12569
|
var import_generation4 = require("@pixerate/editor/generation");
|
|
12463
|
-
var
|
|
12570
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
12464
12571
|
function useGenerationRecords(store, filter) {
|
|
12465
|
-
const [records, setRecords] = (0,
|
|
12466
|
-
const [loading, setLoading] = (0,
|
|
12467
|
-
const [error, setError] = (0,
|
|
12572
|
+
const [records, setRecords] = (0, import_react86.useState)([]);
|
|
12573
|
+
const [loading, setLoading] = (0, import_react86.useState)(!!store);
|
|
12574
|
+
const [error, setError] = (0, import_react86.useState)(null);
|
|
12468
12575
|
const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
|
|
12469
|
-
const refresh = (0,
|
|
12576
|
+
const refresh = (0, import_react86.useCallback)(async () => {
|
|
12470
12577
|
if (!store) {
|
|
12471
12578
|
setRecords([]);
|
|
12472
12579
|
setLoading(false);
|
|
@@ -12483,7 +12590,7 @@ function useGenerationRecords(store, filter) {
|
|
|
12483
12590
|
setLoading(false);
|
|
12484
12591
|
}
|
|
12485
12592
|
}, [store, filterKey]);
|
|
12486
|
-
(0,
|
|
12593
|
+
(0, import_react86.useEffect)(() => {
|
|
12487
12594
|
void refresh();
|
|
12488
12595
|
if (!store) return;
|
|
12489
12596
|
return store.subscribe(() => void refresh());
|
|
@@ -12509,21 +12616,21 @@ var GenerationHistory = ({
|
|
|
12509
12616
|
emptyText = "No generations yet.",
|
|
12510
12617
|
className = ""
|
|
12511
12618
|
}) => {
|
|
12512
|
-
const [innerMode, setInnerMode] = (0,
|
|
12619
|
+
const [innerMode, setInnerMode] = (0, import_react86.useState)("exact");
|
|
12513
12620
|
const mode = modeProp ?? innerMode;
|
|
12514
12621
|
const setMode = (next) => {
|
|
12515
12622
|
if (modeProp === void 0) setInnerMode(next);
|
|
12516
12623
|
onModeChange?.(next);
|
|
12517
12624
|
};
|
|
12518
|
-
const options = (0,
|
|
12519
|
-
const results = (0,
|
|
12520
|
-
const models = (0,
|
|
12625
|
+
const options = (0, import_react86.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
|
|
12626
|
+
const results = (0, import_react86.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
|
|
12627
|
+
const models = (0, import_react86.useMemo)(
|
|
12521
12628
|
() => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
|
|
12522
12629
|
[capabilities]
|
|
12523
12630
|
);
|
|
12524
|
-
return /* @__PURE__ */ (0,
|
|
12525
|
-
/* @__PURE__ */ (0,
|
|
12526
|
-
/* @__PURE__ */ (0,
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
|
|
12632
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "flex items-center gap-2 text-xs", role: "radiogroup", "aria-label": "Recreate mode", children: ["exact", "latest"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
|
|
12633
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12527
12634
|
"input",
|
|
12528
12635
|
{
|
|
12529
12636
|
type: "radio",
|
|
@@ -12536,34 +12643,34 @@ var GenerationHistory = ({
|
|
|
12536
12643
|
),
|
|
12537
12644
|
value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
|
|
12538
12645
|
] }, value)) }),
|
|
12539
|
-
records.length === 0 && /* @__PURE__ */ (0,
|
|
12540
|
-
/* @__PURE__ */ (0,
|
|
12646
|
+
records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
|
|
12647
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
|
|
12541
12648
|
const result = results[i];
|
|
12542
12649
|
const model = models.find((m) => m.id === record.provenance.modelId);
|
|
12543
12650
|
const blocked = !result.ok;
|
|
12544
|
-
return /* @__PURE__ */ (0,
|
|
12651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
12545
12652
|
"li",
|
|
12546
12653
|
{
|
|
12547
12654
|
className: "rounded-md border border-border p-2",
|
|
12548
12655
|
"data-record": record.id,
|
|
12549
12656
|
"data-drift": result.drift.length,
|
|
12550
12657
|
children: [
|
|
12551
|
-
/* @__PURE__ */ (0,
|
|
12552
|
-
/* @__PURE__ */ (0,
|
|
12553
|
-
/* @__PURE__ */ (0,
|
|
12554
|
-
record.kind !== "generate" && /* @__PURE__ */ (0,
|
|
12658
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
|
|
12659
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
|
|
12660
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
12661
|
+
record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { "data-kind": "", children: [
|
|
12555
12662
|
record.kind,
|
|
12556
12663
|
" \xB7 "
|
|
12557
12664
|
] }),
|
|
12558
|
-
/* @__PURE__ */ (0,
|
|
12559
|
-
record.seed !== void 0 && /* @__PURE__ */ (0,
|
|
12665
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
|
|
12666
|
+
record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
12560
12667
|
" \xB7 seed ",
|
|
12561
12668
|
record.seed
|
|
12562
12669
|
] })
|
|
12563
12670
|
] })
|
|
12564
12671
|
] }),
|
|
12565
|
-
/* @__PURE__ */ (0,
|
|
12566
|
-
record.assets.length > 0 && /* @__PURE__ */ (0,
|
|
12672
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
|
|
12673
|
+
record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
12567
12674
|
"span",
|
|
12568
12675
|
{
|
|
12569
12676
|
className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
|
|
@@ -12577,16 +12684,16 @@ var GenerationHistory = ({
|
|
|
12577
12684
|
`${asset.role}:${asset.id}`
|
|
12578
12685
|
)) }),
|
|
12579
12686
|
renderPreview?.(record),
|
|
12580
|
-
result.drift.length > 0 && /* @__PURE__ */ (0,
|
|
12581
|
-
/* @__PURE__ */ (0,
|
|
12687
|
+
result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("ul", { className: "mt-1 flex flex-col gap-0.5 text-[11px]", "data-drift-report": "", children: result.drift.map((item, j) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
|
|
12688
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("strong", { children: [
|
|
12582
12689
|
import_generation4.DRIFT_TYPE_LABELS[item.type],
|
|
12583
12690
|
":"
|
|
12584
12691
|
] }),
|
|
12585
12692
|
" ",
|
|
12586
12693
|
item.message
|
|
12587
12694
|
] }, j)) }),
|
|
12588
|
-
/* @__PURE__ */ (0,
|
|
12589
|
-
onRecreate && /* @__PURE__ */ (0,
|
|
12695
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "mt-2 flex gap-2", children: [
|
|
12696
|
+
onRecreate && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12590
12697
|
"button",
|
|
12591
12698
|
{
|
|
12592
12699
|
type: "button",
|
|
@@ -12598,7 +12705,7 @@ var GenerationHistory = ({
|
|
|
12598
12705
|
children: "Recreate"
|
|
12599
12706
|
}
|
|
12600
12707
|
),
|
|
12601
|
-
onVariation && /* @__PURE__ */ (0,
|
|
12708
|
+
onVariation && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12602
12709
|
"button",
|
|
12603
12710
|
{
|
|
12604
12711
|
type: "button",
|
|
@@ -12608,7 +12715,7 @@ var GenerationHistory = ({
|
|
|
12608
12715
|
children: "Variation"
|
|
12609
12716
|
}
|
|
12610
12717
|
),
|
|
12611
|
-
onRemove && /* @__PURE__ */ (0,
|
|
12718
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12612
12719
|
"button",
|
|
12613
12720
|
{
|
|
12614
12721
|
type: "button",
|
|
@@ -12628,19 +12735,19 @@ var GenerationHistory = ({
|
|
|
12628
12735
|
};
|
|
12629
12736
|
|
|
12630
12737
|
// src/find-replace/useFindReplace.ts
|
|
12631
|
-
var
|
|
12738
|
+
var import_react87 = require("react");
|
|
12632
12739
|
var import_editor17 = require("@pixerate/editor");
|
|
12633
12740
|
var noopUnsubscribe2 = () => {
|
|
12634
12741
|
};
|
|
12635
12742
|
function useFindReplace(editor) {
|
|
12636
12743
|
const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
|
|
12637
|
-
const subscribe = (0,
|
|
12744
|
+
const subscribe = (0, import_react87.useCallback)(
|
|
12638
12745
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
|
|
12639
12746
|
[store]
|
|
12640
12747
|
);
|
|
12641
12748
|
const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
|
|
12642
|
-
const snapshot = (0,
|
|
12643
|
-
return (0,
|
|
12749
|
+
const snapshot = (0, import_react87.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
12750
|
+
return (0, import_react87.useMemo)(() => {
|
|
12644
12751
|
const run = (fn) => {
|
|
12645
12752
|
if (editor && !editor.isDestroyed && store) fn(editor);
|
|
12646
12753
|
};
|
|
@@ -12664,9 +12771,9 @@ function useFindReplace(editor) {
|
|
|
12664
12771
|
}
|
|
12665
12772
|
|
|
12666
12773
|
// src/find-replace/FindReplaceBar.tsx
|
|
12667
|
-
var
|
|
12774
|
+
var import_react88 = require("react");
|
|
12668
12775
|
var import_editor18 = require("@pixerate/editor");
|
|
12669
|
-
var
|
|
12776
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
12670
12777
|
var inputClass3 = "min-w-0 flex-1 rounded border border-input bg-background px-2 py-1 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring";
|
|
12671
12778
|
var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
|
|
12672
12779
|
var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
|
|
@@ -12679,10 +12786,10 @@ var FindReplaceBar = ({
|
|
|
12679
12786
|
onClose
|
|
12680
12787
|
}) => {
|
|
12681
12788
|
const find = useFindReplace(editor);
|
|
12682
|
-
const findInput = (0,
|
|
12683
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
12789
|
+
const findInput = (0, import_react88.useRef)(null);
|
|
12790
|
+
const [moreOpen, setMoreOpen] = (0, import_react88.useState)(false);
|
|
12684
12791
|
const visible = find.available && (alwaysOpen || find.open);
|
|
12685
|
-
(0,
|
|
12792
|
+
(0, import_react88.useEffect)(() => {
|
|
12686
12793
|
if (!visible || find.focusRequest === 0) return;
|
|
12687
12794
|
findInput.current?.focus();
|
|
12688
12795
|
findInput.current?.select();
|
|
@@ -12720,9 +12827,9 @@ var FindReplaceBar = ({
|
|
|
12720
12827
|
if (isMod(e)) find.replaceAll();
|
|
12721
12828
|
else find.replace();
|
|
12722
12829
|
};
|
|
12723
|
-
return /* @__PURE__ */ (0,
|
|
12724
|
-
/* @__PURE__ */ (0,
|
|
12725
|
-
/* @__PURE__ */ (0,
|
|
12830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12832
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12726
12833
|
"button",
|
|
12727
12834
|
{
|
|
12728
12835
|
type: "button",
|
|
@@ -12733,7 +12840,7 @@ var FindReplaceBar = ({
|
|
|
12733
12840
|
children: showReplace ? "\u25BE" : "\u25B8"
|
|
12734
12841
|
}
|
|
12735
12842
|
),
|
|
12736
|
-
/* @__PURE__ */ (0,
|
|
12843
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12737
12844
|
"input",
|
|
12738
12845
|
{
|
|
12739
12846
|
ref: findInput,
|
|
@@ -12747,7 +12854,7 @@ var FindReplaceBar = ({
|
|
|
12747
12854
|
onKeyDown: onFindKeyDown
|
|
12748
12855
|
}
|
|
12749
12856
|
),
|
|
12750
|
-
import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0,
|
|
12857
|
+
import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12751
12858
|
"button",
|
|
12752
12859
|
{
|
|
12753
12860
|
type: "button",
|
|
@@ -12760,7 +12867,7 @@ var FindReplaceBar = ({
|
|
|
12760
12867
|
},
|
|
12761
12868
|
t.key
|
|
12762
12869
|
)),
|
|
12763
|
-
/* @__PURE__ */ (0,
|
|
12870
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12764
12871
|
"span",
|
|
12765
12872
|
{
|
|
12766
12873
|
className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
|
|
@@ -12770,9 +12877,9 @@ var FindReplaceBar = ({
|
|
|
12770
12877
|
children: status
|
|
12771
12878
|
}
|
|
12772
12879
|
),
|
|
12773
|
-
/* @__PURE__ */ (0,
|
|
12774
|
-
/* @__PURE__ */ (0,
|
|
12775
|
-
showMoreOptions && /* @__PURE__ */ (0,
|
|
12880
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
|
|
12881
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
|
|
12882
|
+
showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12776
12883
|
"button",
|
|
12777
12884
|
{
|
|
12778
12885
|
type: "button",
|
|
@@ -12783,10 +12890,10 @@ var FindReplaceBar = ({
|
|
|
12783
12890
|
children: "\u2026"
|
|
12784
12891
|
}
|
|
12785
12892
|
),
|
|
12786
|
-
/* @__PURE__ */ (0,
|
|
12893
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
|
|
12787
12894
|
] }),
|
|
12788
|
-
showReplace && /* @__PURE__ */ (0,
|
|
12789
|
-
/* @__PURE__ */ (0,
|
|
12895
|
+
showReplace && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
|
|
12896
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12790
12897
|
"input",
|
|
12791
12898
|
{
|
|
12792
12899
|
type: "text",
|
|
@@ -12798,7 +12905,7 @@ var FindReplaceBar = ({
|
|
|
12798
12905
|
onKeyDown: onReplaceKeyDown
|
|
12799
12906
|
}
|
|
12800
12907
|
),
|
|
12801
|
-
/* @__PURE__ */ (0,
|
|
12908
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12802
12909
|
"button",
|
|
12803
12910
|
{
|
|
12804
12911
|
type: "button",
|
|
@@ -12808,11 +12915,11 @@ var FindReplaceBar = ({
|
|
|
12808
12915
|
children: "Replace"
|
|
12809
12916
|
}
|
|
12810
12917
|
),
|
|
12811
|
-
/* @__PURE__ */ (0,
|
|
12812
|
-
find.lastReplaceCount !== null && /* @__PURE__ */ (0,
|
|
12918
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
|
|
12919
|
+
find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
|
|
12813
12920
|
] }),
|
|
12814
|
-
showMoreOptions && moreOpen && /* @__PURE__ */ (0,
|
|
12815
|
-
/* @__PURE__ */ (0,
|
|
12921
|
+
showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 pl-7 text-xs text-muted-foreground", children: import_editor18.FIND_OPTION_TOGGLES.filter((t) => t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
12922
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12816
12923
|
"input",
|
|
12817
12924
|
{
|
|
12818
12925
|
type: "checkbox",
|
|
@@ -12826,12 +12933,12 @@ var FindReplaceBar = ({
|
|
|
12826
12933
|
};
|
|
12827
12934
|
|
|
12828
12935
|
// src/tables/useTableMenu.ts
|
|
12829
|
-
var
|
|
12936
|
+
var import_react89 = require("react");
|
|
12830
12937
|
var import_editor19 = require("@pixerate/editor");
|
|
12831
12938
|
function useTableMenu(editor) {
|
|
12832
|
-
const store = (0,
|
|
12833
|
-
const snapshot = (0,
|
|
12834
|
-
return (0,
|
|
12939
|
+
const store = (0, import_react89.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
|
|
12940
|
+
const snapshot = (0, import_react89.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
12941
|
+
return (0, import_react89.useMemo)(
|
|
12835
12942
|
() => ({
|
|
12836
12943
|
...snapshot,
|
|
12837
12944
|
run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
|
|
@@ -12842,9 +12949,9 @@ function useTableMenu(editor) {
|
|
|
12842
12949
|
}
|
|
12843
12950
|
|
|
12844
12951
|
// src/tables/TableToolbar.tsx
|
|
12845
|
-
var
|
|
12952
|
+
var import_react90 = __toESM(require("react"), 1);
|
|
12846
12953
|
var import_editor20 = require("@pixerate/editor");
|
|
12847
|
-
var
|
|
12954
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
12848
12955
|
var keepSelection2 = (event) => event.preventDefault();
|
|
12849
12956
|
var TableToolbar = ({
|
|
12850
12957
|
editor,
|
|
@@ -12858,14 +12965,14 @@ var TableToolbar = ({
|
|
|
12858
12965
|
}) => {
|
|
12859
12966
|
const table = useTableMenu(editor);
|
|
12860
12967
|
if (!editor || !table.inTable && !showWhenOutside) return null;
|
|
12861
|
-
return /* @__PURE__ */ (0,
|
|
12968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
|
|
12862
12969
|
const status = table.check(item.action, item.params);
|
|
12863
12970
|
const enabled = status === true;
|
|
12864
12971
|
const active = item.active?.(table);
|
|
12865
12972
|
const separator = index > 0 && items[index - 1].group !== item.group;
|
|
12866
|
-
return /* @__PURE__ */ (0,
|
|
12867
|
-
separator && /* @__PURE__ */ (0,
|
|
12868
|
-
/* @__PURE__ */ (0,
|
|
12973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_react90.default.Fragment, { children: [
|
|
12974
|
+
separator && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
|
|
12975
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12869
12976
|
"button",
|
|
12870
12977
|
{
|
|
12871
12978
|
type: "button",
|
|
@@ -12887,8 +12994,8 @@ var TableToolbar = ({
|
|
|
12887
12994
|
};
|
|
12888
12995
|
|
|
12889
12996
|
// src/tables/InsertTableGrid.tsx
|
|
12890
|
-
var
|
|
12891
|
-
var
|
|
12997
|
+
var import_react91 = require("react");
|
|
12998
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
12892
12999
|
var keepSelection3 = (event) => event.preventDefault();
|
|
12893
13000
|
var InsertTableGrid = ({
|
|
12894
13001
|
editor,
|
|
@@ -12901,14 +13008,14 @@ var InsertTableGrid = ({
|
|
|
12901
13008
|
onInsert
|
|
12902
13009
|
}) => {
|
|
12903
13010
|
const table = useTableMenu(editor);
|
|
12904
|
-
const [hover, setHover] = (0,
|
|
13011
|
+
const [hover, setHover] = (0, import_react91.useState)(null);
|
|
12905
13012
|
const status = table.actions.insertTable;
|
|
12906
13013
|
const disabled = !editor || !status.enabled;
|
|
12907
13014
|
const insert = (size) => {
|
|
12908
13015
|
if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
|
|
12909
13016
|
setHover(null);
|
|
12910
13017
|
};
|
|
12911
|
-
return /* @__PURE__ */ (0,
|
|
13018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
12912
13019
|
"div",
|
|
12913
13020
|
{
|
|
12914
13021
|
className,
|
|
@@ -12918,7 +13025,7 @@ var InsertTableGrid = ({
|
|
|
12918
13025
|
"data-insert-table-grid": "",
|
|
12919
13026
|
onMouseLeave: () => setHover(null),
|
|
12920
13027
|
children: [
|
|
12921
|
-
/* @__PURE__ */ (0,
|
|
13028
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12922
13029
|
"div",
|
|
12923
13030
|
{
|
|
12924
13031
|
role: "grid",
|
|
@@ -12927,7 +13034,7 @@ var InsertTableGrid = ({
|
|
|
12927
13034
|
children: Array.from({ length: rows * cols }, (_, i) => {
|
|
12928
13035
|
const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
|
|
12929
13036
|
const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
|
|
12930
|
-
return /* @__PURE__ */ (0,
|
|
13037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12931
13038
|
"button",
|
|
12932
13039
|
{
|
|
12933
13040
|
type: "button",
|
|
@@ -12947,7 +13054,7 @@ var InsertTableGrid = ({
|
|
|
12947
13054
|
})
|
|
12948
13055
|
}
|
|
12949
13056
|
),
|
|
12950
|
-
/* @__PURE__ */ (0,
|
|
13057
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
|
|
12951
13058
|
]
|
|
12952
13059
|
}
|
|
12953
13060
|
);
|
|
@@ -12955,31 +13062,31 @@ var InsertTableGrid = ({
|
|
|
12955
13062
|
|
|
12956
13063
|
// src/tables/TableBubbleMenu.tsx
|
|
12957
13064
|
var import_editor21 = require("@pixerate/editor");
|
|
12958
|
-
var
|
|
13065
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12959
13066
|
var TableBubbleMenu = ({
|
|
12960
13067
|
editor,
|
|
12961
13068
|
children,
|
|
12962
13069
|
toolbarProps,
|
|
12963
13070
|
pluginKey = "tableBubbleMenu",
|
|
12964
13071
|
...rest
|
|
12965
|
-
}) => /* @__PURE__ */ (0,
|
|
13072
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TableToolbar, { editor, ...toolbarProps }) });
|
|
12966
13073
|
|
|
12967
13074
|
// src/chart-node/ChartNodeView.tsx
|
|
12968
13075
|
var import_client = require("react-dom/client");
|
|
12969
13076
|
|
|
12970
13077
|
// src/chart/ChartCanvas.tsx
|
|
12971
|
-
var
|
|
13078
|
+
var import_react93 = require("react");
|
|
12972
13079
|
var import_chart2 = require("@pixerate/editor/chart");
|
|
12973
13080
|
|
|
12974
13081
|
// src/chart/useChartEditor.ts
|
|
12975
|
-
var
|
|
13082
|
+
var import_react92 = require("react");
|
|
12976
13083
|
var import_chart = require("@pixerate/editor/chart");
|
|
12977
13084
|
function useChartState(controller) {
|
|
12978
|
-
return (0,
|
|
13085
|
+
return (0, import_react92.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
|
|
12979
13086
|
}
|
|
12980
13087
|
|
|
12981
13088
|
// src/chart/ChartCanvas.tsx
|
|
12982
|
-
var
|
|
13089
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12983
13090
|
function renderChartMark(mark, fontFamily, interactive) {
|
|
12984
13091
|
const common = {
|
|
12985
13092
|
"data-role": mark.role,
|
|
@@ -12991,9 +13098,9 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
12991
13098
|
};
|
|
12992
13099
|
switch (mark.kind) {
|
|
12993
13100
|
case "rect":
|
|
12994
|
-
return /* @__PURE__ */ (0,
|
|
13101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("rect", { ...common, x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.radius, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
|
|
12995
13102
|
case "path":
|
|
12996
|
-
return /* @__PURE__ */ (0,
|
|
13103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
12997
13104
|
"path",
|
|
12998
13105
|
{
|
|
12999
13106
|
...common,
|
|
@@ -13006,11 +13113,11 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
13006
13113
|
mark.key
|
|
13007
13114
|
);
|
|
13008
13115
|
case "circle":
|
|
13009
|
-
return /* @__PURE__ */ (0,
|
|
13116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
|
|
13010
13117
|
case "line":
|
|
13011
|
-
return /* @__PURE__ */ (0,
|
|
13118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("line", { ...common, x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, strokeDasharray: mark.dash, style: { stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
|
|
13012
13119
|
case "text":
|
|
13013
|
-
return /* @__PURE__ */ (0,
|
|
13120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13014
13121
|
"text",
|
|
13015
13122
|
{
|
|
13016
13123
|
...common,
|
|
@@ -13027,36 +13134,36 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
13027
13134
|
}
|
|
13028
13135
|
}
|
|
13029
13136
|
function ChartPresenceLayer({ presence }) {
|
|
13030
|
-
const { actors } = (0,
|
|
13031
|
-
return /* @__PURE__ */ (0,
|
|
13032
|
-
/* @__PURE__ */ (0,
|
|
13033
|
-
/* @__PURE__ */ (0,
|
|
13034
|
-
/* @__PURE__ */ (0,
|
|
13035
|
-
/* @__PURE__ */ (0,
|
|
13137
|
+
const { actors } = (0, import_react93.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
13138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
|
|
13139
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M0,0 L0,14 L4,10.5 L7,17 L9.5,16 L6.5,9.5 L11.5,9.5 Z", style: { fill: a.color, stroke: "#ffffff", strokeWidth: 1 }, transform: a.pressed ? "scale(0.9)" : void 0 }),
|
|
13140
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("g", { transform: "translate(13 16)", children: [
|
|
13141
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("rect", { x: 0, y: 0, rx: 4, height: 18, width: Math.max(28, (a.message ?? a.name).length * 6.4 + 12), style: { fill: a.color } }),
|
|
13142
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
|
|
13036
13143
|
] })
|
|
13037
13144
|
] }, a.id)) });
|
|
13038
13145
|
}
|
|
13039
13146
|
function ChartTooltipContent({ tooltip }) {
|
|
13040
|
-
return /* @__PURE__ */ (0,
|
|
13041
|
-
tooltip.title && /* @__PURE__ */ (0,
|
|
13042
|
-
tooltip.items.map((item) => /* @__PURE__ */ (0,
|
|
13043
|
-
/* @__PURE__ */ (0,
|
|
13044
|
-
/* @__PURE__ */ (0,
|
|
13045
|
-
/* @__PURE__ */ (0,
|
|
13147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
13148
|
+
tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
|
|
13149
|
+
tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13150
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
|
|
13151
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
|
|
13152
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
|
|
13046
13153
|
] }, item.seriesId))
|
|
13047
13154
|
] });
|
|
13048
13155
|
}
|
|
13049
13156
|
function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
|
|
13050
13157
|
const state = useChartState(controller);
|
|
13051
|
-
const wrapper = (0,
|
|
13052
|
-
const svg = (0,
|
|
13053
|
-
const drag = (0,
|
|
13054
|
-
const [measured, setMeasured] = (0,
|
|
13055
|
-
const [frozen, setFrozen] = (0,
|
|
13158
|
+
const wrapper = (0, import_react93.useRef)(null);
|
|
13159
|
+
const svg = (0, import_react93.useRef)(null);
|
|
13160
|
+
const drag = (0, import_react93.useRef)(null);
|
|
13161
|
+
const [measured, setMeasured] = (0, import_react93.useState)(null);
|
|
13162
|
+
const [frozen, setFrozen] = (0, import_react93.useState)(null);
|
|
13056
13163
|
const tooltipMode = tooltip === true ? "point" : tooltip || null;
|
|
13057
|
-
const [tip, setTip] = (0,
|
|
13058
|
-
const [tipAt, setTipAt] = (0,
|
|
13059
|
-
(0,
|
|
13164
|
+
const [tip, setTip] = (0, import_react93.useState)(null);
|
|
13165
|
+
const [tipAt, setTipAt] = (0, import_react93.useState)({ left: 0, top: 0, flip: false });
|
|
13166
|
+
(0, import_react93.useEffect)(() => {
|
|
13060
13167
|
const el = wrapper.current;
|
|
13061
13168
|
if (!responsive || !el || typeof ResizeObserver === "undefined") return;
|
|
13062
13169
|
const observer = new ResizeObserver(([entry]) => {
|
|
@@ -13067,8 +13174,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13067
13174
|
return () => observer.disconnect();
|
|
13068
13175
|
}, [responsive]);
|
|
13069
13176
|
const sceneWidth = responsive && measured || width;
|
|
13070
|
-
const fullTheme = (0,
|
|
13071
|
-
const scene = (0,
|
|
13177
|
+
const fullTheme = (0, import_react93.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
|
|
13178
|
+
const scene = (0, import_react93.useMemo)(
|
|
13072
13179
|
() => (0, import_chart2.layoutChart)(state.spec, {
|
|
13073
13180
|
width: sceneWidth,
|
|
13074
13181
|
height,
|
|
@@ -13085,8 +13192,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13085
13192
|
[state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
13086
13193
|
);
|
|
13087
13194
|
if (sceneRef) sceneRef.current = scene;
|
|
13088
|
-
const byKey = (0,
|
|
13089
|
-
(0,
|
|
13195
|
+
const byKey = (0, import_react93.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
|
|
13196
|
+
(0, import_react93.useEffect)(() => () => drag.current?.end(), []);
|
|
13090
13197
|
const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
|
|
13091
13198
|
const onPointerDown = (e) => {
|
|
13092
13199
|
if (!editable || e.button !== 0) return;
|
|
@@ -13133,8 +13240,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13133
13240
|
if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
|
|
13134
13241
|
};
|
|
13135
13242
|
const label = state.spec.title || "Chart";
|
|
13136
|
-
return /* @__PURE__ */ (0,
|
|
13137
|
-
/* @__PURE__ */ (0,
|
|
13243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
|
|
13244
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
13138
13245
|
"svg",
|
|
13139
13246
|
{
|
|
13140
13247
|
ref: svg,
|
|
@@ -13153,11 +13260,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13153
13260
|
onKeyDown,
|
|
13154
13261
|
children: [
|
|
13155
13262
|
scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
|
|
13156
|
-
presence && /* @__PURE__ */ (0,
|
|
13263
|
+
presence && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartPresenceLayer, { presence })
|
|
13157
13264
|
]
|
|
13158
13265
|
}
|
|
13159
13266
|
),
|
|
13160
|
-
tip && /* @__PURE__ */ (0,
|
|
13267
|
+
tip && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13161
13268
|
"div",
|
|
13162
13269
|
{
|
|
13163
13270
|
role: "tooltip",
|
|
@@ -13172,14 +13279,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13172
13279
|
borderColor: "var(--border, #e2e8f0)",
|
|
13173
13280
|
fontFamily: scene.theme.fontFamily
|
|
13174
13281
|
},
|
|
13175
|
-
children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0,
|
|
13282
|
+
children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartTooltipContent, { tooltip: tip })
|
|
13176
13283
|
}
|
|
13177
13284
|
)
|
|
13178
13285
|
] });
|
|
13179
13286
|
}
|
|
13180
13287
|
|
|
13181
13288
|
// src/chart/ChartDataGrid.tsx
|
|
13182
|
-
var
|
|
13289
|
+
var import_react94 = require("react");
|
|
13183
13290
|
var import_chart3 = require("@pixerate/editor/chart");
|
|
13184
13291
|
|
|
13185
13292
|
// src/chart/styles.ts
|
|
@@ -13192,11 +13299,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
|
|
|
13192
13299
|
var chartCellClass = "h-7 w-full min-w-[4.5rem] bg-transparent px-2 text-right text-xs tabular-nums text-foreground focus-visible:bg-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-primary";
|
|
13193
13300
|
|
|
13194
13301
|
// src/chart/ChartDataGrid.tsx
|
|
13195
|
-
var
|
|
13302
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13196
13303
|
function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
13197
|
-
const [draft, setDraft] = (0,
|
|
13198
|
-
const typing = (0,
|
|
13199
|
-
(0,
|
|
13304
|
+
const [draft, setDraft] = (0, import_react94.useState)(value);
|
|
13305
|
+
const typing = (0, import_react94.useRef)(false);
|
|
13306
|
+
(0, import_react94.useEffect)(() => {
|
|
13200
13307
|
if (!typing.current) setDraft(value);
|
|
13201
13308
|
}, [value]);
|
|
13202
13309
|
const commit = () => {
|
|
@@ -13205,7 +13312,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
|
13205
13312
|
if (draft === value) return;
|
|
13206
13313
|
if (onCommit(draft) === false) setDraft(value);
|
|
13207
13314
|
};
|
|
13208
|
-
return /* @__PURE__ */ (0,
|
|
13315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13209
13316
|
"input",
|
|
13210
13317
|
{
|
|
13211
13318
|
...rest,
|
|
@@ -13234,20 +13341,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
|
13234
13341
|
}
|
|
13235
13342
|
function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
13236
13343
|
const { spec } = useChartState(controller);
|
|
13237
|
-
const [columns, setColumns] = (0,
|
|
13344
|
+
const [columns, setColumns] = (0, import_react94.useState)(1);
|
|
13238
13345
|
const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
|
|
13239
13346
|
const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
|
|
13240
13347
|
const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
|
|
13241
13348
|
const commit = (next) => controller.setTreeRows(next).ok;
|
|
13242
|
-
return /* @__PURE__ */ (0,
|
|
13243
|
-
/* @__PURE__ */ (0,
|
|
13244
|
-
/* @__PURE__ */ (0,
|
|
13245
|
-
labels.map((label) => /* @__PURE__ */ (0,
|
|
13246
|
-
/* @__PURE__ */ (0,
|
|
13247
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
|
|
13350
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13351
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
|
|
13352
|
+
labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
|
|
13353
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
|
|
13354
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border" })
|
|
13248
13355
|
] }) }),
|
|
13249
|
-
/* @__PURE__ */ (0,
|
|
13250
|
-
labels.map((_, k) => /* @__PURE__ */ (0,
|
|
13356
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-tree-row": r, children: [
|
|
13357
|
+
labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13251
13358
|
ChartCommitInput,
|
|
13252
13359
|
{
|
|
13253
13360
|
value: row.path[k] ?? "",
|
|
@@ -13258,7 +13365,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
|
13258
13365
|
className: `${chartCellClass} text-left`
|
|
13259
13366
|
}
|
|
13260
13367
|
) }, k)),
|
|
13261
|
-
/* @__PURE__ */ (0,
|
|
13368
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13262
13369
|
ChartCommitInput,
|
|
13263
13370
|
{
|
|
13264
13371
|
value: String(row.value),
|
|
@@ -13271,14 +13378,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
|
13271
13378
|
className: chartCellClass
|
|
13272
13379
|
}
|
|
13273
13380
|
) }),
|
|
13274
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13381
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete item", "aria-label": `Delete ${row.path.join(" / ")}`, "data-action": "tree-remove-row", onClick: () => commit((0, import_chart3.removeChartTreeRow)(rows, r)), children: "\xD7" }) })
|
|
13275
13382
|
] }, r)) })
|
|
13276
13383
|
] }),
|
|
13277
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13278
|
-
/* @__PURE__ */ (0,
|
|
13279
|
-
/* @__PURE__ */ (0,
|
|
13280
|
-
/* @__PURE__ */ (0,
|
|
13281
|
-
/* @__PURE__ */ (0,
|
|
13384
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
|
|
13385
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-row", onClick: () => commit((0, import_chart3.addChartTreeRow)(rows)), children: "+ Add item" }),
|
|
13386
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
|
|
13387
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
|
|
13388
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "tree-ungroup", title: "Keep the group totals as plain data", onClick: () => controller.setTree([]), children: "Ungroup" })
|
|
13282
13389
|
] })
|
|
13283
13390
|
] });
|
|
13284
13391
|
}
|
|
@@ -13286,30 +13393,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
|
|
|
13286
13393
|
const { spec } = useChartState(controller);
|
|
13287
13394
|
const links = spec.links;
|
|
13288
13395
|
const commit = (next) => controller.setLinks(next).ok;
|
|
13289
|
-
return /* @__PURE__ */ (0,
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
13291
|
-
/* @__PURE__ */ (0,
|
|
13292
|
-
["Source", "Target"].map((label) => /* @__PURE__ */ (0,
|
|
13293
|
-
/* @__PURE__ */ (0,
|
|
13294
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
|
|
13397
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13398
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
|
|
13399
|
+
["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
|
|
13400
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
|
|
13401
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border" })
|
|
13295
13402
|
] }) }),
|
|
13296
|
-
/* @__PURE__ */ (0,
|
|
13297
|
-
["source", "target"].map((field) => /* @__PURE__ */ (0,
|
|
13298
|
-
/* @__PURE__ */ (0,
|
|
13299
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13403
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-link-row": i, children: [
|
|
13404
|
+
["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { value: link[field], "aria-label": `${field === "source" ? "Source" : "Target"} of flow ${i + 1}`, "data-link-cell": `${i}:${field}`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, field, text)), className: `${chartCellClass} text-left` }) }, field)),
|
|
13405
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { value: String(link.value), inputMode: "decimal", "aria-label": `Value of ${link.source} \u2192 ${link.target}`, "data-link-cell": `${i}:value`, readOnly, onCommit: (text) => commit((0, import_chart3.setChartLinkField)(links, i, "value", text)), className: chartCellClass }) }),
|
|
13406
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete flow", "aria-label": `Delete ${link.source} \u2192 ${link.target}`, "data-action": "link-remove", onClick: () => controller.removeLink(i), children: "\xD7" }) })
|
|
13300
13407
|
] }, i)) })
|
|
13301
13408
|
] }),
|
|
13302
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13303
|
-
/* @__PURE__ */ (0,
|
|
13304
|
-
/* @__PURE__ */ (0,
|
|
13305
|
-
links.length > 0 && /* @__PURE__ */ (0,
|
|
13409
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
|
|
13410
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
|
|
13411
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
|
|
13412
|
+
links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6`, "data-action": "links-clear", title: "Keep how much passes through each node as plain data", onClick: () => controller.setLinks([]), children: "Remove flows" })
|
|
13306
13413
|
] })
|
|
13307
13414
|
] });
|
|
13308
13415
|
}
|
|
13309
13416
|
function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
|
|
13310
13417
|
const { spec, selection } = useChartState(controller);
|
|
13311
|
-
if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0,
|
|
13312
|
-
if (spec.tree.length) return /* @__PURE__ */ (0,
|
|
13418
|
+
if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartLinksGrid, { controller, readOnly, className });
|
|
13419
|
+
if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartTreeGrid, { controller, readOnly, className });
|
|
13313
13420
|
const canGroup = spec.type === "treemap" || spec.type === "sunburst";
|
|
13314
13421
|
const paste = (row, column) => (e) => {
|
|
13315
13422
|
const text = e.clipboardData?.getData("text/plain") ?? "";
|
|
@@ -13317,15 +13424,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13317
13424
|
e.preventDefault();
|
|
13318
13425
|
controller.pasteCells(row, column, text);
|
|
13319
13426
|
};
|
|
13320
|
-
return /* @__PURE__ */ (0,
|
|
13321
|
-
/* @__PURE__ */ (0,
|
|
13322
|
-
/* @__PURE__ */ (0,
|
|
13323
|
-
/* @__PURE__ */ (0,
|
|
13427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
|
|
13428
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13429
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { children: [
|
|
13430
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
|
|
13324
13431
|
spec.series.map((s, si) => {
|
|
13325
13432
|
const color = (0, import_chart3.chartSeriesColor)(spec, si);
|
|
13326
13433
|
const selected = selection?.kind === "series" && selection.seriesId === s.id;
|
|
13327
|
-
return /* @__PURE__ */ (0,
|
|
13328
|
-
/* @__PURE__ */ (0,
|
|
13434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { "data-series-id": s.id, className: `border-b border-r border-border px-1 py-1 font-medium ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13435
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13329
13436
|
"input",
|
|
13330
13437
|
{
|
|
13331
13438
|
type: "color",
|
|
@@ -13338,7 +13445,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13338
13445
|
className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
|
|
13339
13446
|
}
|
|
13340
13447
|
),
|
|
13341
|
-
/* @__PURE__ */ (0,
|
|
13448
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13342
13449
|
ChartCommitInput,
|
|
13343
13450
|
{
|
|
13344
13451
|
value: s.name,
|
|
@@ -13348,8 +13455,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13348
13455
|
className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
|
|
13349
13456
|
}
|
|
13350
13457
|
),
|
|
13351
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13352
|
-
/* @__PURE__ */ (0,
|
|
13458
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
13459
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13353
13460
|
"button",
|
|
13354
13461
|
{
|
|
13355
13462
|
type: "button",
|
|
@@ -13362,16 +13469,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13362
13469
|
children: s.hidden ? "\u25CB" : "\u25CF"
|
|
13363
13470
|
}
|
|
13364
13471
|
),
|
|
13365
|
-
/* @__PURE__ */ (0,
|
|
13472
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete series", "aria-label": `Delete ${s.name}`, "data-action": "remove-series", onClick: () => controller.removeSeries(s.id), children: "\xD7" })
|
|
13366
13473
|
] })
|
|
13367
13474
|
] }) }, s.id);
|
|
13368
13475
|
}),
|
|
13369
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13476
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
|
|
13370
13477
|
] }) }),
|
|
13371
|
-
/* @__PURE__ */ (0,
|
|
13478
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("tbody", { children: spec.categories.map((category, i) => {
|
|
13372
13479
|
const rowSelected = selection?.kind === "category" && selection.index === i;
|
|
13373
|
-
return /* @__PURE__ */ (0,
|
|
13374
|
-
/* @__PURE__ */ (0,
|
|
13480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
|
|
13481
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13375
13482
|
ChartCommitInput,
|
|
13376
13483
|
{
|
|
13377
13484
|
value: category,
|
|
@@ -13385,7 +13492,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13385
13492
|
spec.series.map((s) => {
|
|
13386
13493
|
const value = s.values[i];
|
|
13387
13494
|
const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
|
|
13388
|
-
return /* @__PURE__ */ (0,
|
|
13495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13389
13496
|
ChartCommitInput,
|
|
13390
13497
|
{
|
|
13391
13498
|
value: value === null || value === void 0 ? "" : String(value),
|
|
@@ -13400,13 +13507,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13400
13507
|
}
|
|
13401
13508
|
) }, s.id);
|
|
13402
13509
|
}),
|
|
13403
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13510
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
|
|
13404
13511
|
] }, i);
|
|
13405
13512
|
}) })
|
|
13406
13513
|
] }),
|
|
13407
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13408
|
-
/* @__PURE__ */ (0,
|
|
13409
|
-
canGroup && /* @__PURE__ */ (0,
|
|
13514
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "p-1", children: [
|
|
13515
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
|
|
13516
|
+
canGroup && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13410
13517
|
"button",
|
|
13411
13518
|
{
|
|
13412
13519
|
type: "button",
|
|
@@ -13422,29 +13529,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13422
13529
|
}
|
|
13423
13530
|
|
|
13424
13531
|
// src/chart/ChartInspector.tsx
|
|
13425
|
-
var
|
|
13532
|
+
var import_react95 = require("react");
|
|
13426
13533
|
var import_chart4 = require("@pixerate/editor/chart");
|
|
13427
|
-
var
|
|
13534
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13428
13535
|
var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
13429
13536
|
function Field({ label, htmlFor, children }) {
|
|
13430
|
-
return /* @__PURE__ */ (0,
|
|
13431
|
-
/* @__PURE__ */ (0,
|
|
13432
|
-
/* @__PURE__ */ (0,
|
|
13537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13538
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
|
|
13539
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "min-w-0 flex-1", children })
|
|
13433
13540
|
] });
|
|
13434
13541
|
}
|
|
13435
13542
|
function Toggle({ label, checked, onChange, name }) {
|
|
13436
|
-
return /* @__PURE__ */ (0,
|
|
13437
|
-
/* @__PURE__ */ (0,
|
|
13543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
|
|
13438
13545
|
label
|
|
13439
13546
|
] });
|
|
13440
13547
|
}
|
|
13441
13548
|
function Select({ id, value, options, onChange, name, labels }) {
|
|
13442
|
-
return /* @__PURE__ */ (0,
|
|
13549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
|
|
13443
13550
|
}
|
|
13444
13551
|
function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
|
|
13445
13552
|
const set = (patch) => controller.setAxis(axis, patch);
|
|
13446
13553
|
const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
|
|
13447
|
-
const bound = (key2) => /* @__PURE__ */ (0,
|
|
13554
|
+
const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13448
13555
|
ChartCommitInput,
|
|
13449
13556
|
{
|
|
13450
13557
|
id: `${idBase}-${axis}-${key2}`,
|
|
@@ -13459,26 +13566,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13459
13566
|
const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
|
|
13460
13567
|
const valueAxis = axis !== "x" || numeric;
|
|
13461
13568
|
const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
|
|
13462
|
-
return /* @__PURE__ */ (0,
|
|
13463
|
-
/* @__PURE__ */ (0,
|
|
13464
|
-
/* @__PURE__ */ (0,
|
|
13569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
|
|
13570
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13571
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
|
|
13465
13572
|
name,
|
|
13466
|
-
/* @__PURE__ */ (0,
|
|
13573
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
|
|
13467
13574
|
"(",
|
|
13468
13575
|
axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
|
|
13469
13576
|
")"
|
|
13470
13577
|
] })
|
|
13471
13578
|
] }),
|
|
13472
|
-
/* @__PURE__ */ (0,
|
|
13579
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
|
|
13473
13580
|
] }),
|
|
13474
|
-
/* @__PURE__ */ (0,
|
|
13475
|
-
/* @__PURE__ */ (0,
|
|
13476
|
-
/* @__PURE__ */ (0,
|
|
13477
|
-
axis === "x" && !numeric && /* @__PURE__ */ (0,
|
|
13478
|
-
scales && /* @__PURE__ */ (0,
|
|
13479
|
-
scales && valueAxis && /* @__PURE__ */ (0,
|
|
13581
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
|
|
13582
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
13583
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
|
|
13584
|
+
axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
|
|
13585
|
+
scales && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
|
|
13586
|
+
scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
|
|
13480
13587
|
] }),
|
|
13481
|
-
scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0,
|
|
13588
|
+
scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13482
13589
|
ChartCommitInput,
|
|
13483
13590
|
{
|
|
13484
13591
|
id: `${idBase}-${axis}-log-base`,
|
|
@@ -13489,7 +13596,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13489
13596
|
onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
|
|
13490
13597
|
}
|
|
13491
13598
|
) }),
|
|
13492
|
-
valueAxis && value.scale !== "log" && /* @__PURE__ */ (0,
|
|
13599
|
+
valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13493
13600
|
ChartCommitInput,
|
|
13494
13601
|
{
|
|
13495
13602
|
id: `${idBase}-${axis}-step`,
|
|
@@ -13501,14 +13608,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13501
13608
|
onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
|
|
13502
13609
|
}
|
|
13503
13610
|
) }),
|
|
13504
|
-
valueAxis && /* @__PURE__ */ (0,
|
|
13505
|
-
/* @__PURE__ */ (0,
|
|
13611
|
+
valueAxis && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
13612
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
|
|
13506
13613
|
bound("min"),
|
|
13507
13614
|
bound("max")
|
|
13508
13615
|
] }) }),
|
|
13509
|
-
/* @__PURE__ */ (0,
|
|
13510
|
-
/* @__PURE__ */ (0,
|
|
13511
|
-
/* @__PURE__ */ (0,
|
|
13616
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
|
|
13617
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-${axis}-format`, name: `${key}.format.style`, value: value.format.style ?? "number", options: import_chart4.CHART_NUMBER_STYLES, onChange: (style) => setFormat({ style }) }),
|
|
13618
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13512
13619
|
ChartCommitInput,
|
|
13513
13620
|
{
|
|
13514
13621
|
value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
|
|
@@ -13527,8 +13634,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13527
13634
|
}
|
|
13528
13635
|
)
|
|
13529
13636
|
] }) }),
|
|
13530
|
-
value.format.style === "currency" && /* @__PURE__ */ (0,
|
|
13531
|
-
/* @__PURE__ */ (0,
|
|
13637
|
+
value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-currency`, value: value.format.currency ?? "USD", "data-option": `${key}.format.currency`, className: chartInputClass, onCommit: (currency) => void setFormat({ currency: currency.toUpperCase() }) }) }),
|
|
13638
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13532
13639
|
ChartCommitInput,
|
|
13533
13640
|
{
|
|
13534
13641
|
id: `${idBase}-${axis}-code`,
|
|
@@ -13554,15 +13661,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
13554
13661
|
const values = which === "xErrorBars" ? series.x ?? [] : series.values;
|
|
13555
13662
|
const set = (next) => controller.updateSeries(series.id, { [which]: next });
|
|
13556
13663
|
const patch = (p) => bars && set({ ...bars, ...p });
|
|
13557
|
-
return /* @__PURE__ */ (0,
|
|
13558
|
-
/* @__PURE__ */ (0,
|
|
13559
|
-
/* @__PURE__ */ (0,
|
|
13560
|
-
import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
|
|
13665
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("select", { id: `${id}-type`, className: chartInputClass, value: bars?.type ?? "", "data-option": `${key}.type`, onChange: (e) => set((0, import_chart4.chartErrorBarsOfType)(e.currentTarget.value, bars, values)), children: [
|
|
13666
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "None" }),
|
|
13667
|
+
import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
|
|
13561
13668
|
] }) }),
|
|
13562
|
-
bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0,
|
|
13563
|
-
bars?.type === "custom" && /* @__PURE__ */ (0,
|
|
13564
|
-
/* @__PURE__ */ (0,
|
|
13565
|
-
/* @__PURE__ */ (0,
|
|
13669
|
+
bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${id}-value`, value: String(bars.value ?? (0, import_chart4.defaultChartErrorBarValue)(bars.type)), inputMode: "decimal", "data-option": `${key}.value`, className: chartInputClass, onCommit: (text) => !!patch({ value: text.trim() === "" ? void 0 : Number(text) })?.ok }) }),
|
|
13670
|
+
bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
13671
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${id}-plus`, value: (0, import_chart4.formatChartAmountList)(bars.plus), placeholder: "1, 2, -, 0.5", "data-option": `${key}.plus`, className: chartInputClass, onCommit: (text) => !!patch({ plus: (0, import_chart4.parseChartAmountList)(text) })?.ok }) }),
|
|
13672
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13566
13673
|
ChartCommitInput,
|
|
13567
13674
|
{
|
|
13568
13675
|
id: `${id}-minus`,
|
|
@@ -13579,15 +13686,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
13579
13686
|
}
|
|
13580
13687
|
) })
|
|
13581
13688
|
] }),
|
|
13582
|
-
bars && /* @__PURE__ */ (0,
|
|
13583
|
-
/* @__PURE__ */ (0,
|
|
13584
|
-
/* @__PURE__ */ (0,
|
|
13689
|
+
bars && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13690
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("select", { className: `${chartInputClass} flex-1`, "aria-label": "Error bar direction", value: bars.direction ?? "both", "data-option": `${key}.direction`, onChange: (e) => patch({ direction: e.currentTarget.value }), children: import_chart4.CHART_ERROR_BAR_DIRECTIONS.map((d) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
|
|
13691
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
|
|
13585
13692
|
] })
|
|
13586
13693
|
] });
|
|
13587
13694
|
}
|
|
13588
13695
|
function ChartInspector({ controller, sections, className }) {
|
|
13589
13696
|
const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
|
|
13590
|
-
const idBase = (0,
|
|
13697
|
+
const idBase = (0, import_react95.useId)();
|
|
13591
13698
|
const show = (section) => !sections || sections.includes(section);
|
|
13592
13699
|
const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
|
|
13593
13700
|
const family = (0, import_chart4.chartFamily)(spec);
|
|
@@ -13602,30 +13709,30 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13602
13709
|
const annotated = scales;
|
|
13603
13710
|
const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
|
|
13604
13711
|
const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
|
|
13605
|
-
return /* @__PURE__ */ (0,
|
|
13606
|
-
show("type") && /* @__PURE__ */ (0,
|
|
13607
|
-
show("style") && /* @__PURE__ */ (0,
|
|
13608
|
-
/* @__PURE__ */ (0,
|
|
13609
|
-
/* @__PURE__ */ (0,
|
|
13610
|
-
import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0,
|
|
13712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
|
|
13713
|
+
show("type") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "grid grid-cols-3 gap-0.5 rounded-md bg-muted p-0.5", role: "radiogroup", "aria-label": "Chart type", children: import_chart4.CHART_TYPES.map((type) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", role: "radio", "aria-checked": spec.type === type, "data-chart-type": type, className: chartSegmentClass(spec.type === type), onClick: () => controller.setType(type), children: import_chart4.CHART_TYPE_LABELS[type] }, type)) }) }),
|
|
13714
|
+
show("style") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
|
|
13715
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
|
|
13716
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Quick layout\u2026" }),
|
|
13717
|
+
import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
|
|
13611
13718
|
] }) }),
|
|
13612
|
-
/* @__PURE__ */ (0,
|
|
13613
|
-
/* @__PURE__ */ (0,
|
|
13614
|
-
import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0,
|
|
13719
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("select", { id: `${idBase}-colors`, className: chartInputClass, value: import_chart4.CHART_COLOR_SCHEMES.find((c) => c.palette.join() === spec.palette.join())?.id ?? "", "data-option": "preset.colors", onChange: (e) => e.currentTarget.value && controller.applyPreset({ colors: e.currentTarget.value }), children: [
|
|
13720
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Custom" }),
|
|
13721
|
+
import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
|
|
13615
13722
|
] }) }),
|
|
13616
|
-
!colorCheck.ok && /* @__PURE__ */ (0,
|
|
13617
|
-
/* @__PURE__ */ (0,
|
|
13723
|
+
!colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
|
|
13724
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
|
|
13618
13725
|
] }),
|
|
13619
|
-
show("titles") && /* @__PURE__ */ (0,
|
|
13620
|
-
/* @__PURE__ */ (0,
|
|
13621
|
-
/* @__PURE__ */ (0,
|
|
13622
|
-
/* @__PURE__ */ (0,
|
|
13726
|
+
show("titles") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
|
|
13727
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
|
|
13728
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
|
|
13729
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
|
|
13623
13730
|
] }),
|
|
13624
|
-
show("options") && /* @__PURE__ */ (0,
|
|
13625
|
-
cartesian && /* @__PURE__ */ (0,
|
|
13626
|
-
hasBars && /* @__PURE__ */ (0,
|
|
13627
|
-
hasLines && /* @__PURE__ */ (0,
|
|
13628
|
-
spec.type === "donut" && /* @__PURE__ */ (0,
|
|
13731
|
+
show("options") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
|
|
13732
|
+
cartesian && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-stacking`, name: "stacking", value: spec.stacking, options: import_chart4.CHART_STACKINGS, labels: { none: "None", stacked: "Stacked", percent: "100%" }, onChange: (stacking) => controller.update({ stacking }) }) }),
|
|
13733
|
+
hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", "aria-pressed": spec.orientation === o, "data-option": `orientation.${o}`, className: chartSegmentClass(spec.orientation === o), onClick: () => controller.update({ orientation: o }), children: cap(o) }, o)) }) }),
|
|
13734
|
+
hasLines && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
|
|
13735
|
+
spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13629
13736
|
"input",
|
|
13630
13737
|
{
|
|
13631
13738
|
id: `${idBase}-hole`,
|
|
@@ -13641,7 +13748,7 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13641
13748
|
onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
|
|
13642
13749
|
}
|
|
13643
13750
|
) }),
|
|
13644
|
-
hasBars && /* @__PURE__ */ (0,
|
|
13751
|
+
hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13645
13752
|
"input",
|
|
13646
13753
|
{
|
|
13647
13754
|
id: `${idBase}-gap`,
|
|
@@ -13657,9 +13764,9 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13657
13764
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
13658
13765
|
}
|
|
13659
13766
|
) }),
|
|
13660
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13661
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13662
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13767
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("select", { id: `${idBase}-map`, className: chartInputClass, value: spec.map, "data-option": "map", onChange: (e) => controller.update({ map: e.currentTarget.value }), children: [.../* @__PURE__ */ new Set([spec.map, ...(0, import_chart4.listChartMaps)().map((m) => m.id)])].map((id) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
|
|
13768
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-map-steps`, value: String(spec.mapSteps), inputMode: "numeric", "data-option": "mapSteps", disabled: spec.mapThresholds.length > 0, className: chartInputClass, onCommit: (text) => controller.update({ mapSteps: Number(text) }).ok }) }),
|
|
13769
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13663
13770
|
ChartCommitInput,
|
|
13664
13771
|
{
|
|
13665
13772
|
id: `${idBase}-map-breaks`,
|
|
@@ -13670,10 +13777,10 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13670
13777
|
onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
|
|
13671
13778
|
}
|
|
13672
13779
|
) }),
|
|
13673
|
-
spec.type === "barrace" && /* @__PURE__ */ (0,
|
|
13674
|
-
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0,
|
|
13675
|
-
/* @__PURE__ */ (0,
|
|
13676
|
-
/* @__PURE__ */ (0,
|
|
13780
|
+
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-race-top`, value: String(spec.raceTopN), inputMode: "numeric", "data-option": "raceTopN", className: chartInputClass, onCommit: (text) => controller.update({ raceTopN: Number(text) }).ok }) }),
|
|
13781
|
+
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13782
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "race-play", "aria-label": racePlaying ? "Pause the race" : "Play the race", onClick: () => racePlaying ? controller.pauseRace() : controller.playRace(), children: racePlaying ? "Pause" : "Play" }),
|
|
13783
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13677
13784
|
"input",
|
|
13678
13785
|
{
|
|
13679
13786
|
id: `${idBase}-race-frame`,
|
|
@@ -13688,13 +13795,13 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13688
13795
|
onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
|
|
13689
13796
|
}
|
|
13690
13797
|
),
|
|
13691
|
-
/* @__PURE__ */ (0,
|
|
13798
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "w-12 shrink-0 truncate text-right tabular-nums text-muted-foreground", "data-race-time": "", children: spec.categories[Math.round(raceFrame ?? spec.categories.length - 1)] })
|
|
13692
13799
|
] }) }),
|
|
13693
|
-
spec.type === "sankey" && /* @__PURE__ */ (0,
|
|
13694
|
-
spec.type === "sunburst" && /* @__PURE__ */ (0,
|
|
13695
|
-
spec.type === "likert" && /* @__PURE__ */ (0,
|
|
13696
|
-
spec.type === "likert" && /* @__PURE__ */ (0,
|
|
13697
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13800
|
+
spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-sankey-color`, name: "sankeyLinkColor", value: spec.sankeyLinkColor, options: import_chart4.CHART_SANKEY_LINK_COLORS, labels: { source: "Coloured by source", target: "Coloured by target", gray: "Grey" }, onChange: (sankeyLinkColor) => controller.update({ sankeyLinkColor }) }) }),
|
|
13801
|
+
spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
13802
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-likert-neutral`, name: "likertNeutral", value: spec.likertNeutral, options: import_chart4.CHART_LIKERT_NEUTRALS, labels: { split: "Across the centre", separate: "In its own column" }, onChange: (likertNeutral) => controller.update({ likertNeutral }) }) }),
|
|
13803
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-likert-sort`, name: "likertSort", value: spec.likertSort, options: import_chart4.CHART_LIKERT_SORTS, labels: { none: "As entered", positive: "Most agreement first", negative: "Most disagreement first" }, onChange: (likertSort) => controller.update({ likertSort }) }) }),
|
|
13804
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13698
13805
|
"input",
|
|
13699
13806
|
{
|
|
13700
13807
|
id: `${idBase}-parliament-arc`,
|
|
@@ -13710,34 +13817,34 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13710
13817
|
onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
|
|
13711
13818
|
}
|
|
13712
13819
|
) }),
|
|
13713
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13714
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13715
|
-
spec.type === "radar" && /* @__PURE__ */ (0,
|
|
13716
|
-
spec.type === "radar" && /* @__PURE__ */ (0,
|
|
13717
|
-
spec.dataLabels && hasBars && /* @__PURE__ */ (0,
|
|
13718
|
-
spec.type === "histogram" && /* @__PURE__ */ (0,
|
|
13719
|
-
/* @__PURE__ */ (0,
|
|
13720
|
-
spec.type === "waterfall" && /* @__PURE__ */ (0,
|
|
13721
|
-
hasLines && /* @__PURE__ */ (0,
|
|
13722
|
-
oneSeries && /* @__PURE__ */ (0,
|
|
13723
|
-
/* @__PURE__ */ (0,
|
|
13820
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-parliament-majority`, value: spec.parliamentMajority === null ? "" : String(spec.parliamentMajority), placeholder: "Half plus one", inputMode: "numeric", "data-option": "parliamentMajority", className: chartInputClass, onCommit: (text) => controller.update({ parliamentMajority: text.trim() === "" ? null : Number(text) }).ok }) }),
|
|
13821
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
|
|
13822
|
+
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-radar-ticks`, value: spec.radarTicks === null ? "" : String(spec.radarTicks), placeholder: "Auto", inputMode: "numeric", "data-option": "radarTicks", className: chartInputClass, onCommit: (text) => controller.update({ radarTicks: text.trim() === "" ? null : Number(text) }).ok }) }),
|
|
13823
|
+
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-radar-graticule`, name: "radarGraticule", value: spec.radarGraticule, options: import_chart4.CHART_RADAR_GRATICULES, labels: { polygon: "Polygons", circle: "Circles" }, onChange: (radarGraticule) => controller.update({ radarGraticule }) }) }),
|
|
13824
|
+
spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
|
|
13825
|
+
spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-bins`, value: spec.bins === null ? "" : String(spec.bins), placeholder: "Auto", inputMode: "numeric", "data-option": "bins", className: chartInputClass, onCommit: (text) => controller.update({ bins: text.trim() === "" ? null : Number(text) }).ok }) }),
|
|
13826
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
13827
|
+
spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
|
|
13828
|
+
hasLines && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
|
|
13829
|
+
oneSeries && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
|
|
13830
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
|
|
13724
13831
|
] })
|
|
13725
13832
|
] }),
|
|
13726
|
-
show("legend") && /* @__PURE__ */ (0,
|
|
13727
|
-
/* @__PURE__ */ (0,
|
|
13728
|
-
/* @__PURE__ */ (0,
|
|
13729
|
-
/* @__PURE__ */ (0,
|
|
13833
|
+
show("legend") && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
|
|
13834
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13835
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
|
|
13836
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
|
|
13730
13837
|
] }),
|
|
13731
|
-
spec.legend.show && /* @__PURE__ */ (0,
|
|
13838
|
+
spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: import_chart4.CHART_LEGEND_POSITIONS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", "aria-pressed": spec.legend.position === p, "data-option": `legend.${p}`, className: chartSegmentClass(spec.legend.position === p), onClick: () => controller.setLegend({ position: p }), children: cap(p) }, p)) })
|
|
13732
13839
|
] }),
|
|
13733
|
-
show("axes") && hasAxes && /* @__PURE__ */ (0,
|
|
13734
|
-
family !== "box" && family !== "histogram" && /* @__PURE__ */ (0,
|
|
13735
|
-
/* @__PURE__ */ (0,
|
|
13736
|
-
usesSecondary && /* @__PURE__ */ (0,
|
|
13840
|
+
show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
13841
|
+
family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
|
|
13842
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
|
|
13843
|
+
usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
|
|
13737
13844
|
] }),
|
|
13738
|
-
show("annotations") && annotated && /* @__PURE__ */ (0,
|
|
13739
|
-
/* @__PURE__ */ (0,
|
|
13740
|
-
/* @__PURE__ */ (0,
|
|
13845
|
+
show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
|
|
13846
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
|
|
13847
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13741
13848
|
ChartCommitInput,
|
|
13742
13849
|
{
|
|
13743
13850
|
id: `${idBase}-highlight`,
|
|
@@ -13748,27 +13855,27 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13748
13855
|
onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
|
|
13749
13856
|
}
|
|
13750
13857
|
) }),
|
|
13751
|
-
spec.referenceLines.map((line, i) => /* @__PURE__ */ (0,
|
|
13752
|
-
/* @__PURE__ */ (0,
|
|
13753
|
-
/* @__PURE__ */ (0,
|
|
13754
|
-
/* @__PURE__ */ (0,
|
|
13858
|
+
spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
|
|
13859
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { value: String(line.value), "aria-label": "Line value", inputMode: "decimal", "data-option": `referenceLine.${i}.value`, className: `${chartInputClass} w-16 shrink-0`, onCommit: (text) => controller.updateReferenceLine(i, { value: Number(text) }).ok }),
|
|
13860
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { value: line.label ?? "", "aria-label": "Line label", placeholder: "Label", "data-option": `referenceLine.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceLine(i, { label: text || null }).ok }),
|
|
13861
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
|
|
13755
13862
|
] }, `line-${i}`)),
|
|
13756
|
-
spec.referenceBands.map((band, i) => /* @__PURE__ */ (0,
|
|
13757
|
-
/* @__PURE__ */ (0,
|
|
13758
|
-
/* @__PURE__ */ (0,
|
|
13759
|
-
/* @__PURE__ */ (0,
|
|
13760
|
-
/* @__PURE__ */ (0,
|
|
13863
|
+
spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
|
|
13864
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { value: String(band.from), "aria-label": "Band from", inputMode: "decimal", "data-option": `referenceBand.${i}.from`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { from: Number(text) }).ok }),
|
|
13865
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { value: String(band.to), "aria-label": "Band to", inputMode: "decimal", "data-option": `referenceBand.${i}.to`, className: `${chartInputClass} w-14 shrink-0`, onCommit: (text) => controller.updateReferenceBand(i, { to: Number(text) }).ok }),
|
|
13866
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { value: band.label ?? "", "aria-label": "Band label", placeholder: "Label", "data-option": `referenceBand.${i}.label`, className: `${chartInputClass} flex-1`, onCommit: (text) => controller.updateReferenceBand(i, { label: text || null }).ok }),
|
|
13867
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
|
|
13761
13868
|
] }, `band-${i}`)),
|
|
13762
|
-
/* @__PURE__ */ (0,
|
|
13763
|
-
/* @__PURE__ */ (0,
|
|
13764
|
-
/* @__PURE__ */ (0,
|
|
13869
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex gap-1", children: [
|
|
13870
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
|
|
13871
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
|
|
13765
13872
|
] })
|
|
13766
13873
|
] }),
|
|
13767
|
-
show("series") && selectedSeries && /* @__PURE__ */ (0,
|
|
13768
|
-
/* @__PURE__ */ (0,
|
|
13769
|
-
/* @__PURE__ */ (0,
|
|
13770
|
-
/* @__PURE__ */ (0,
|
|
13771
|
-
/* @__PURE__ */ (0,
|
|
13874
|
+
show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
|
|
13875
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
|
|
13876
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
|
|
13877
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13878
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13772
13879
|
"input",
|
|
13773
13880
|
{
|
|
13774
13881
|
id: `${idBase}-series-color`,
|
|
@@ -13781,9 +13888,9 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13781
13888
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
|
|
13782
13889
|
}
|
|
13783
13890
|
),
|
|
13784
|
-
selectedSeries.color && /* @__PURE__ */ (0,
|
|
13891
|
+
selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
|
|
13785
13892
|
] }) }),
|
|
13786
|
-
cartesian && /* @__PURE__ */ (0,
|
|
13893
|
+
cartesian && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13787
13894
|
"select",
|
|
13788
13895
|
{
|
|
13789
13896
|
id: `${idBase}-series-type`,
|
|
@@ -13792,12 +13899,12 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13792
13899
|
"data-option": "series.type",
|
|
13793
13900
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
|
|
13794
13901
|
children: [
|
|
13795
|
-
/* @__PURE__ */ (0,
|
|
13796
|
-
import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13902
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Chart type" }),
|
|
13903
|
+
import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
|
|
13797
13904
|
]
|
|
13798
13905
|
}
|
|
13799
13906
|
) }),
|
|
13800
|
-
(cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0,
|
|
13907
|
+
(cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13801
13908
|
"select",
|
|
13802
13909
|
{
|
|
13803
13910
|
id: `${idBase}-series-marker`,
|
|
@@ -13806,12 +13913,12 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13806
13913
|
"data-option": "series.marker",
|
|
13807
13914
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
|
|
13808
13915
|
children: [
|
|
13809
|
-
/* @__PURE__ */ (0,
|
|
13810
|
-
import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0,
|
|
13916
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Default" }),
|
|
13917
|
+
import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: m, children: cap(m) }, m))
|
|
13811
13918
|
]
|
|
13812
13919
|
}
|
|
13813
13920
|
) }),
|
|
13814
|
-
annotated && calloutIndex !== null && /* @__PURE__ */ (0,
|
|
13921
|
+
annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13815
13922
|
ChartCommitInput,
|
|
13816
13923
|
{
|
|
13817
13924
|
id: `${idBase}-series-callout`,
|
|
@@ -13822,15 +13929,15 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13822
13929
|
onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
|
|
13823
13930
|
}
|
|
13824
13931
|
) }),
|
|
13825
|
-
scales && /* @__PURE__ */ (0,
|
|
13826
|
-
family === "xy" && /* @__PURE__ */ (0,
|
|
13827
|
-
(0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0,
|
|
13828
|
-
(selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0,
|
|
13829
|
-
/* @__PURE__ */ (0,
|
|
13830
|
-
/* @__PURE__ */ (0,
|
|
13831
|
-
/* @__PURE__ */ (0,
|
|
13932
|
+
scales && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
|
|
13933
|
+
family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
|
|
13934
|
+
(0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
|
|
13935
|
+
(selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
|
|
13936
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
|
|
13937
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
|
|
13938
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
|
|
13832
13939
|
] }, i)),
|
|
13833
|
-
/* @__PURE__ */ (0,
|
|
13940
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13834
13941
|
"select",
|
|
13835
13942
|
{
|
|
13836
13943
|
className: chartInputClass,
|
|
@@ -13839,32 +13946,32 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13839
13946
|
"data-option": "trendline.add",
|
|
13840
13947
|
onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
|
|
13841
13948
|
children: [
|
|
13842
|
-
/* @__PURE__ */ (0,
|
|
13843
|
-
import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13949
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: "", children: "Add trendline\u2026" }),
|
|
13950
|
+
import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
|
|
13844
13951
|
]
|
|
13845
13952
|
}
|
|
13846
13953
|
)
|
|
13847
13954
|
] }),
|
|
13848
|
-
/* @__PURE__ */ (0,
|
|
13849
|
-
/* @__PURE__ */ (0,
|
|
13850
|
-
family === "cartesian" && /* @__PURE__ */ (0,
|
|
13851
|
-
/* @__PURE__ */ (0,
|
|
13852
|
-
/* @__PURE__ */ (0,
|
|
13853
|
-
/* @__PURE__ */ (0,
|
|
13854
|
-
/* @__PURE__ */ (0,
|
|
13955
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
13956
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
|
|
13957
|
+
family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
|
|
13958
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "flex-1" }),
|
|
13959
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex <= 0, "aria-label": "Move series earlier", "data-action": "series-up", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex - 1), children: "\u2191" }),
|
|
13960
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, disabled: seriesIndex >= spec.series.length - 1, "aria-label": "Move series later", "data-action": "series-down", onClick: () => controller.moveSeries(selectedSeries.id, seriesIndex + 1), children: "\u2193" }),
|
|
13961
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
|
|
13855
13962
|
] })
|
|
13856
13963
|
] })
|
|
13857
13964
|
] });
|
|
13858
13965
|
}
|
|
13859
13966
|
|
|
13860
13967
|
// src/chart-node/ChartNodeView.tsx
|
|
13861
|
-
var
|
|
13968
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13862
13969
|
function ChartNodeView({ state, theme, showDataGrid = true }) {
|
|
13863
13970
|
const { controller, editing, editable, selected, width, height, setEditing } = state;
|
|
13864
13971
|
const open = () => {
|
|
13865
13972
|
if (editable && !editing) setEditing(true);
|
|
13866
13973
|
};
|
|
13867
|
-
return /* @__PURE__ */ (0,
|
|
13974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
13868
13975
|
"div",
|
|
13869
13976
|
{
|
|
13870
13977
|
className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
|
|
@@ -13877,24 +13984,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
|
|
|
13877
13984
|
}
|
|
13878
13985
|
},
|
|
13879
13986
|
children: [
|
|
13880
|
-
editing && /* @__PURE__ */ (0,
|
|
13881
|
-
/* @__PURE__ */ (0,
|
|
13882
|
-
/* @__PURE__ */ (0,
|
|
13987
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
|
|
13988
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
|
|
13989
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
|
|
13883
13990
|
] }),
|
|
13884
|
-
/* @__PURE__ */ (0,
|
|
13991
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13885
13992
|
"div",
|
|
13886
13993
|
{
|
|
13887
13994
|
className: editable && !editing ? "cursor-pointer" : void 0,
|
|
13888
13995
|
onClick: open,
|
|
13889
13996
|
title: editable && !editing ? "Click to edit the chart" : void 0,
|
|
13890
13997
|
"data-chart-node-canvas": "",
|
|
13891
|
-
children: /* @__PURE__ */ (0,
|
|
13998
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
|
|
13892
13999
|
}
|
|
13893
14000
|
),
|
|
13894
14001
|
editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
|
|
13895
|
-
/* @__PURE__ */ (0,
|
|
13896
|
-
showDataGrid && /* @__PURE__ */ (0,
|
|
13897
|
-
/* @__PURE__ */ (0,
|
|
14002
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
|
|
14003
|
+
showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartDataGrid, { controller }) }),
|
|
14004
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
|
|
13898
14005
|
] })
|
|
13899
14006
|
]
|
|
13900
14007
|
}
|
|
@@ -13912,7 +14019,7 @@ function createReactChartNodeView(options = {}) {
|
|
|
13912
14019
|
scheduled = true;
|
|
13913
14020
|
queueMicrotask(() => {
|
|
13914
14021
|
scheduled = false;
|
|
13915
|
-
if (!destroyed) root.render(/* @__PURE__ */ (0,
|
|
14022
|
+
if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Component, { ...props, state: latest }));
|
|
13916
14023
|
});
|
|
13917
14024
|
};
|
|
13918
14025
|
schedule();
|
|
@@ -13930,10 +14037,10 @@ function createReactChartNodeView(options = {}) {
|
|
|
13930
14037
|
}
|
|
13931
14038
|
|
|
13932
14039
|
// src/style/useStyle.ts
|
|
13933
|
-
var
|
|
14040
|
+
var import_react96 = require("react");
|
|
13934
14041
|
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
13935
14042
|
function useResolverTask(styles, run, deliver, deps) {
|
|
13936
|
-
(0,
|
|
14043
|
+
(0, import_react96.useEffect)(() => {
|
|
13937
14044
|
if (!styles || !run) {
|
|
13938
14045
|
deliver({ value: null, error: null });
|
|
13939
14046
|
return;
|
|
@@ -13960,7 +14067,7 @@ function useResolverTask(styles, run, deliver, deps) {
|
|
|
13960
14067
|
}, [styles, ...deps]);
|
|
13961
14068
|
}
|
|
13962
14069
|
function useStyle(styles, domain) {
|
|
13963
|
-
const [result, setResult] = (0,
|
|
14070
|
+
const [result, setResult] = (0, import_react96.useState)({ style: null, error: null });
|
|
13964
14071
|
useResolverTask(
|
|
13965
14072
|
styles,
|
|
13966
14073
|
(s) => s.resolve(domain),
|
|
@@ -13970,7 +14077,7 @@ function useStyle(styles, domain) {
|
|
|
13970
14077
|
return result;
|
|
13971
14078
|
}
|
|
13972
14079
|
function useStyleFindings(styles, domain, state) {
|
|
13973
|
-
const [result, setResult] = (0,
|
|
14080
|
+
const [result, setResult] = (0, import_react96.useState)({ report: null, style: null, error: null });
|
|
13974
14081
|
useResolverTask(
|
|
13975
14082
|
styles,
|
|
13976
14083
|
(s) => s.check(domain, state),
|
|
@@ -13987,7 +14094,7 @@ function useStyleFindings(styles, domain, state) {
|
|
|
13987
14094
|
}
|
|
13988
14095
|
|
|
13989
14096
|
// src/style/StyleFindings.tsx
|
|
13990
|
-
var
|
|
14097
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13991
14098
|
var SEVERITY_CLASS = {
|
|
13992
14099
|
error: "text-destructive",
|
|
13993
14100
|
warning: "text-amber-600",
|
|
@@ -13996,24 +14103,24 @@ var SEVERITY_CLASS = {
|
|
|
13996
14103
|
function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
|
|
13997
14104
|
if (!report) return null;
|
|
13998
14105
|
const { findings, ran, skipped } = report;
|
|
13999
|
-
return /* @__PURE__ */ (0,
|
|
14000
|
-
/* @__PURE__ */ (0,
|
|
14001
|
-
findings.length > 0 && /* @__PURE__ */ (0,
|
|
14106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
|
|
14107
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
14108
|
+
findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
|
|
14002
14109
|
const selectable = finding.target !== void 0 && !!onSelect;
|
|
14003
|
-
const body = /* @__PURE__ */ (0,
|
|
14004
|
-
/* @__PURE__ */ (0,
|
|
14005
|
-
/* @__PURE__ */ (0,
|
|
14006
|
-
/* @__PURE__ */ (0,
|
|
14007
|
-
/* @__PURE__ */ (0,
|
|
14008
|
-
/* @__PURE__ */ (0,
|
|
14009
|
-
finding.layer && /* @__PURE__ */ (0,
|
|
14110
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
14111
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
|
|
14112
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
|
|
14113
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { "data-style-message": "", children: finding.message }),
|
|
14114
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
14115
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("code", { children: finding.check }),
|
|
14116
|
+
finding.layer && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
14010
14117
|
" \xB7 ",
|
|
14011
14118
|
finding.layer
|
|
14012
14119
|
] })
|
|
14013
14120
|
] })
|
|
14014
14121
|
] })
|
|
14015
14122
|
] });
|
|
14016
|
-
return /* @__PURE__ */ (0,
|
|
14123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
14017
14124
|
"button",
|
|
14018
14125
|
{
|
|
14019
14126
|
type: "button",
|
|
@@ -14021,19 +14128,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
|
|
|
14021
14128
|
onClick: () => onSelect(finding),
|
|
14022
14129
|
children: body
|
|
14023
14130
|
}
|
|
14024
|
-
) : /* @__PURE__ */ (0,
|
|
14131
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
|
|
14025
14132
|
}) }),
|
|
14026
|
-
findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0,
|
|
14133
|
+
findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
|
|
14027
14134
|
"All clear: ",
|
|
14028
14135
|
ran.length,
|
|
14029
14136
|
" ",
|
|
14030
14137
|
ran.length === 1 ? "check" : "checks",
|
|
14031
14138
|
" passed."
|
|
14032
14139
|
] }),
|
|
14033
|
-
findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0,
|
|
14034
|
-
skipped.length > 0 && /* @__PURE__ */ (0,
|
|
14140
|
+
findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
|
|
14141
|
+
skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { "data-style-skipped": "", "aria-label": "Skipped checks", className: "flex flex-col gap-0.5 text-muted-foreground", children: skipped.map((s) => /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("li", { "data-style-skipped-check": s.check, children: [
|
|
14035
14142
|
"Skipped ",
|
|
14036
|
-
/* @__PURE__ */ (0,
|
|
14143
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("code", { children: s.check }),
|
|
14037
14144
|
": ",
|
|
14038
14145
|
s.reason
|
|
14039
14146
|
] }, s.check)) })
|
|
@@ -14091,7 +14198,9 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
|
|
|
14091
14198
|
RefineEdgePanel,
|
|
14092
14199
|
ReviewToolbar,
|
|
14093
14200
|
SelectAndMaskWorkspace,
|
|
14201
|
+
SelectionChangeCheck,
|
|
14094
14202
|
SelectionOptionsBar,
|
|
14203
|
+
SeparateSubjectPanel,
|
|
14095
14204
|
ShapeOptionsBar,
|
|
14096
14205
|
SheetTabs,
|
|
14097
14206
|
SpreadsheetConditionalFormatPanel,
|