@pixerate/editor-react 0.145.0 → 0.147.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-3VQ34CNX.js → chunk-FL5RL6NO.js} +454 -404
- package/dist/image-editor/SelectionChangeCheck.d.cts +14 -0
- package/dist/image-editor/SelectionChangeCheck.d.ts +14 -0
- package/dist/image-editor/index.cjs +471 -420
- package/dist/image-editor/index.d.cts +1 -0
- package/dist/image-editor/index.d.ts +1 -0
- package/dist/image-editor/index.js +3 -1
- package/dist/index.cjs +996 -945
- package/dist/index.js +3 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -81,6 +81,7 @@ __export(src_exports, {
|
|
|
81
81
|
RefineEdgePanel: () => RefineEdgePanel,
|
|
82
82
|
ReviewToolbar: () => ReviewToolbar,
|
|
83
83
|
SelectAndMaskWorkspace: () => SelectAndMaskWorkspace,
|
|
84
|
+
SelectionChangeCheck: () => SelectionChangeCheck,
|
|
84
85
|
SelectionOptionsBar: () => SelectionOptionsBar,
|
|
85
86
|
ShapeOptionsBar: () => ShapeOptionsBar,
|
|
86
87
|
SheetTabs: () => SheetTabs,
|
|
@@ -2212,17 +2213,17 @@ var SpreadsheetValidationDialog = ({ prompt, onResolve }) => {
|
|
|
2212
2213
|
style === "warning" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-2", children: "Continue?" })
|
|
2213
2214
|
] })
|
|
2214
2215
|
] }),
|
|
2215
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mt-4 flex justify-end gap-2", children: buttons.map((button7, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2216
2217
|
"button",
|
|
2217
2218
|
{
|
|
2218
2219
|
ref: i === 0 ? firstButton : void 0,
|
|
2219
2220
|
type: "button",
|
|
2220
|
-
"data-action":
|
|
2221
|
+
"data-action": button7.action,
|
|
2221
2222
|
className: `rounded border border-border px-3 py-1 ${i === 0 ? "bg-primary text-primary-foreground" : "hover:bg-muted"}`,
|
|
2222
|
-
onClick: () => onResolve(
|
|
2223
|
-
children:
|
|
2223
|
+
onClick: () => onResolve(button7.action),
|
|
2224
|
+
children: button7.label
|
|
2224
2225
|
},
|
|
2225
|
-
|
|
2226
|
+
button7.action
|
|
2226
2227
|
)) })
|
|
2227
2228
|
]
|
|
2228
2229
|
}
|
|
@@ -4045,7 +4046,7 @@ function useImageEffectsTools(registry, controller, options = {}) {
|
|
|
4045
4046
|
}
|
|
4046
4047
|
|
|
4047
4048
|
// src/image-editor/ImageEditor.tsx
|
|
4048
|
-
var
|
|
4049
|
+
var import_react73 = __toESM(require("react"), 1);
|
|
4049
4050
|
var import_image_editor24 = require("@pixerate/editor/image-editor");
|
|
4050
4051
|
|
|
4051
4052
|
// src/image-editor/ImageEditorCanvas.tsx
|
|
@@ -9465,7 +9466,7 @@ var SelectionOptionsBar = ({
|
|
|
9465
9466
|
};
|
|
9466
9467
|
|
|
9467
9468
|
// src/image-editor/RefineEdgePanel.tsx
|
|
9468
|
-
var
|
|
9469
|
+
var import_react67 = require("react");
|
|
9469
9470
|
var import_image_editor18 = require("@pixerate/editor/image-editor");
|
|
9470
9471
|
|
|
9471
9472
|
// src/image-editor/MaskEdgeCheck.tsx
|
|
@@ -9515,19 +9516,60 @@ var MaskEdgeCheck = ({ controller, selection, target = "selection", layerId, cla
|
|
|
9515
9516
|
] });
|
|
9516
9517
|
};
|
|
9517
9518
|
|
|
9518
|
-
// src/image-editor/
|
|
9519
|
+
// src/image-editor/SelectionChangeCheck.tsx
|
|
9520
|
+
var import_react66 = require("react");
|
|
9519
9521
|
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
9522
|
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 [
|
|
9523
|
+
var SelectionChangeCheck = ({ controller, selection, className = "" }) => {
|
|
9524
|
+
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
9525
|
+
const [result, setResult] = (0, import_react66.useState)(null);
|
|
9525
9526
|
const [error, setError] = (0, import_react66.useState)(null);
|
|
9526
|
-
const
|
|
9527
|
-
const
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9527
|
+
const diff = result && result.for === sel ? result.diff : null;
|
|
9528
|
+
const show = () => {
|
|
9529
|
+
setError(null);
|
|
9530
|
+
try {
|
|
9531
|
+
setResult({ diff: controller.compareSelections(), for: sel });
|
|
9532
|
+
} catch (err) {
|
|
9533
|
+
setResult(null);
|
|
9534
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
9535
|
+
}
|
|
9536
|
+
};
|
|
9537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { "data-testid": "selection-change-check", className: `flex flex-col gap-1 text-xs ${className}`, children: [
|
|
9538
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", className: `${button5} self-start`, onClick: show, children: "Show Last Change" }),
|
|
9539
|
+
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: [
|
|
9540
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "text-green-600", children: [
|
|
9541
|
+
"+",
|
|
9542
|
+
diff.added.area,
|
|
9543
|
+
" px"
|
|
9544
|
+
] }),
|
|
9545
|
+
" ",
|
|
9546
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "text-destructive", children: [
|
|
9547
|
+
"\u2212",
|
|
9548
|
+
diff.removed.area,
|
|
9549
|
+
" px"
|
|
9550
|
+
] }),
|
|
9551
|
+
", overlap ",
|
|
9552
|
+
Math.round(diff.iou * 100),
|
|
9553
|
+
"%"
|
|
9554
|
+
] }) }),
|
|
9555
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9556
|
+
] });
|
|
9557
|
+
};
|
|
9558
|
+
|
|
9559
|
+
// src/image-editor/RefineEdgePanel.tsx
|
|
9560
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
9561
|
+
var DEFAULT_PARAMS = { radius: 8, smartRadius: false, smooth: 0, feather: 0, contrast: 0, shiftEdge: 0 };
|
|
9562
|
+
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";
|
|
9563
|
+
var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
9564
|
+
const [params, setParams] = (0, import_react67.useState)(DEFAULT_PARAMS);
|
|
9565
|
+
const [busy, setBusy] = (0, import_react67.useState)(false);
|
|
9566
|
+
const [error, setError] = (0, import_react67.useState)(null);
|
|
9567
|
+
const [layerId, setLayerId] = (0, import_react67.useState)("");
|
|
9568
|
+
const [newKind, setNewKind] = (0, import_react67.useState)("hueSaturation");
|
|
9569
|
+
const [output, setOutput] = (0, import_react67.useState)("selection");
|
|
9570
|
+
const [decontaminate, setDecontaminate] = (0, import_react67.useState)(0);
|
|
9571
|
+
const [objectAware, setObjectAware] = (0, import_react67.useState)(false);
|
|
9572
|
+
const [onlyUncertain, setOnlyUncertain] = (0, import_react67.useState)(false);
|
|
9531
9573
|
const canObject = Boolean(controller.segmentationProvider);
|
|
9532
9574
|
const toLayer = output !== "selection" && output !== "layer-mask";
|
|
9533
9575
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
@@ -9537,9 +9579,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9537
9579
|
setBusy(true);
|
|
9538
9580
|
setError(null);
|
|
9539
9581
|
try {
|
|
9582
|
+
const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
|
|
9583
|
+
if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
|
|
9540
9584
|
await controller.refineSelectionTo(params, output, {
|
|
9541
9585
|
decontaminate: toLayer ? decontaminate : 0,
|
|
9542
|
-
refineMode: canObject && objectAware ? "object" : "color"
|
|
9586
|
+
refineMode: canObject && objectAware ? "object" : "color",
|
|
9587
|
+
...regions ? { regions } : {}
|
|
9543
9588
|
});
|
|
9544
9589
|
} catch (err) {
|
|
9545
9590
|
setError(err instanceof Error ? err.message : String(err));
|
|
@@ -9547,17 +9592,17 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9547
9592
|
setBusy(false);
|
|
9548
9593
|
}
|
|
9549
9594
|
};
|
|
9550
|
-
return /* @__PURE__ */ (0,
|
|
9551
|
-
/* @__PURE__ */ (0,
|
|
9552
|
-
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0,
|
|
9553
|
-
/* @__PURE__ */ (0,
|
|
9554
|
-
/* @__PURE__ */ (0,
|
|
9555
|
-
/* @__PURE__ */ (0,
|
|
9595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { "data-testid": "refine-edge-panel", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
9596
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: imageSectionTitleClass, children: "Refine Edge" }),
|
|
9597
|
+
import_image_editor18.REFINE_EDGE_CONTROLS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9598
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9599
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: c.label }),
|
|
9600
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
|
|
9556
9601
|
params[c.id],
|
|
9557
9602
|
c.unit
|
|
9558
9603
|
] })
|
|
9559
9604
|
] }),
|
|
9560
|
-
/* @__PURE__ */ (0,
|
|
9605
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9561
9606
|
"input",
|
|
9562
9607
|
{
|
|
9563
9608
|
type: "range",
|
|
@@ -9571,39 +9616,43 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9571
9616
|
}
|
|
9572
9617
|
)
|
|
9573
9618
|
] }, c.id)),
|
|
9574
|
-
/* @__PURE__ */ (0,
|
|
9575
|
-
/* @__PURE__ */ (0,
|
|
9619
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
9620
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
9576
9621
|
"Smart Radius"
|
|
9577
9622
|
] }),
|
|
9578
|
-
|
|
9579
|
-
/* @__PURE__ */ (0,
|
|
9623
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
|
|
9624
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
|
|
9625
|
+
"Only uncertain areas"
|
|
9626
|
+
] }),
|
|
9627
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
9628
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
9580
9629
|
"Object aware (segmentation model)"
|
|
9581
9630
|
] }),
|
|
9582
|
-
/* @__PURE__ */ (0,
|
|
9631
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
9583
9632
|
"Output to",
|
|
9584
|
-
/* @__PURE__ */ (0,
|
|
9633
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9585
9634
|
"select",
|
|
9586
9635
|
{
|
|
9587
9636
|
"aria-label": "Refine output",
|
|
9588
9637
|
value: output,
|
|
9589
9638
|
onChange: (e) => setOutput(e.target.value),
|
|
9590
9639
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9591
|
-
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0,
|
|
9640
|
+
children: import_image_editor18.REFINE_OUTPUTS.filter((o) => !o.needsDocuments || controller.canOpenDocuments).map((o) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
9592
9641
|
}
|
|
9593
9642
|
)
|
|
9594
9643
|
] }),
|
|
9595
|
-
/* @__PURE__ */ (0,
|
|
9596
|
-
/* @__PURE__ */ (0,
|
|
9597
|
-
/* @__PURE__ */ (0,
|
|
9644
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9645
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9646
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { children: [
|
|
9598
9647
|
"Decontaminate colors",
|
|
9599
9648
|
toLayer ? "" : " (new layer or document outputs)"
|
|
9600
9649
|
] }),
|
|
9601
|
-
/* @__PURE__ */ (0,
|
|
9650
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
|
|
9602
9651
|
decontaminate,
|
|
9603
9652
|
"%"
|
|
9604
9653
|
] })
|
|
9605
9654
|
] }),
|
|
9606
|
-
/* @__PURE__ */ (0,
|
|
9655
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9607
9656
|
"input",
|
|
9608
9657
|
{
|
|
9609
9658
|
type: "range",
|
|
@@ -9618,64 +9667,65 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9618
9667
|
}
|
|
9619
9668
|
)
|
|
9620
9669
|
] }),
|
|
9621
|
-
/* @__PURE__ */ (0,
|
|
9622
|
-
/* @__PURE__ */ (0,
|
|
9623
|
-
/* @__PURE__ */ (0,
|
|
9670
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1", children: [
|
|
9671
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
9672
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
9624
9673
|
] }),
|
|
9625
|
-
error && /* @__PURE__ */ (0,
|
|
9626
|
-
/* @__PURE__ */ (0,
|
|
9627
|
-
/* @__PURE__ */ (0,
|
|
9628
|
-
/* @__PURE__ */ (0,
|
|
9629
|
-
|
|
9674
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("p", { role: "alert", className: "text-destructive", children: error }),
|
|
9675
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MaskEdgeCheck, { controller, selection: sel }),
|
|
9676
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectionChangeCheck, { controller, selection: sel }),
|
|
9677
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] mt-2", children: "Layer Mask" }),
|
|
9678
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
9679
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9630
9680
|
"select",
|
|
9631
9681
|
{
|
|
9632
9682
|
"aria-label": "New masked layer kind",
|
|
9633
9683
|
value: newKind,
|
|
9634
9684
|
onChange: (e) => setNewKind(e.target.value),
|
|
9635
9685
|
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9636
|
-
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0,
|
|
9686
|
+
children: import_image_editor18.ADJUSTMENT_KINDS.map((k) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("option", { value: k.kind, children: k.label }, k.kind))
|
|
9637
9687
|
}
|
|
9638
9688
|
),
|
|
9639
|
-
/* @__PURE__ */ (0,
|
|
9689
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9640
9690
|
"button",
|
|
9641
9691
|
{
|
|
9642
9692
|
type: "button",
|
|
9643
|
-
className:
|
|
9693
|
+
className: button6,
|
|
9644
9694
|
disabled: !sel,
|
|
9645
9695
|
onClick: () => sel && setLayerId(controller.addAdjustmentLayer({ kind: newKind, mask: (0, import_image_editor18.layerMaskFromSelection)(sel) })),
|
|
9646
9696
|
children: "New Masked Layer"
|
|
9647
9697
|
}
|
|
9648
9698
|
)
|
|
9649
9699
|
] }),
|
|
9650
|
-
list.length > 0 && target && /* @__PURE__ */ (0,
|
|
9651
|
-
/* @__PURE__ */ (0,
|
|
9700
|
+
list.length > 0 && target && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
9701
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9652
9702
|
"select",
|
|
9653
9703
|
{
|
|
9654
9704
|
"aria-label": "Mask layer",
|
|
9655
9705
|
value: target.id,
|
|
9656
9706
|
onChange: (e) => setLayerId(e.target.value),
|
|
9657
9707
|
className: "bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
9658
|
-
children: list.map((l) => /* @__PURE__ */ (0,
|
|
9708
|
+
children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("option", { value: l.id, children: [
|
|
9659
9709
|
l.name || (0, import_image_editor18.adjustmentKindLabel)(l.kind),
|
|
9660
9710
|
l.mask ? " (masked)" : ""
|
|
9661
9711
|
] }, l.id))
|
|
9662
9712
|
}
|
|
9663
9713
|
),
|
|
9664
|
-
/* @__PURE__ */ (0,
|
|
9665
|
-
/* @__PURE__ */ (0,
|
|
9666
|
-
/* @__PURE__ */ (0,
|
|
9667
|
-
/* @__PURE__ */ (0,
|
|
9714
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
9715
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !sel, onClick: () => controller.applySelectionAsLayerMask(target.id), children: "Mask with Selection" }),
|
|
9716
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.selectionFromLayerMask(target.id), children: "Load as Selection" }),
|
|
9717
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("button", { type: "button", className: button6, disabled: !target.mask, onClick: () => controller.setAdjustmentLayerMask(target.id, null), children: "Remove Mask" })
|
|
9668
9718
|
] }),
|
|
9669
|
-
target.mask && /* @__PURE__ */ (0,
|
|
9670
|
-
/* @__PURE__ */ (0,
|
|
9671
|
-
/* @__PURE__ */ (0,
|
|
9672
|
-
/* @__PURE__ */ (0,
|
|
9673
|
-
/* @__PURE__ */ (0,
|
|
9719
|
+
target.mask && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
9720
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9721
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9722
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Density" }),
|
|
9723
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
|
|
9674
9724
|
Math.round((target.mask.density ?? 1) * 100),
|
|
9675
9725
|
"%"
|
|
9676
9726
|
] })
|
|
9677
9727
|
] }),
|
|
9678
|
-
/* @__PURE__ */ (0,
|
|
9728
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9679
9729
|
"input",
|
|
9680
9730
|
{
|
|
9681
9731
|
type: "range",
|
|
@@ -9689,15 +9739,15 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9689
9739
|
}
|
|
9690
9740
|
)
|
|
9691
9741
|
] }),
|
|
9692
|
-
/* @__PURE__ */ (0,
|
|
9693
|
-
/* @__PURE__ */ (0,
|
|
9694
|
-
/* @__PURE__ */ (0,
|
|
9695
|
-
/* @__PURE__ */ (0,
|
|
9742
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
9743
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
9744
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { children: "Mask Feather" }),
|
|
9745
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "font-mono", children: [
|
|
9696
9746
|
target.mask.feather ?? 0,
|
|
9697
9747
|
"px"
|
|
9698
9748
|
] })
|
|
9699
9749
|
] }),
|
|
9700
|
-
/* @__PURE__ */ (0,
|
|
9750
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
9701
9751
|
"input",
|
|
9702
9752
|
{
|
|
9703
9753
|
type: "range",
|
|
@@ -9717,13 +9767,13 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
9717
9767
|
};
|
|
9718
9768
|
|
|
9719
9769
|
// src/image-editor/ChannelsPanel.tsx
|
|
9720
|
-
var
|
|
9770
|
+
var import_react68 = require("react");
|
|
9721
9771
|
var import_image_editor19 = require("@pixerate/editor/image-editor");
|
|
9722
|
-
var
|
|
9772
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
9723
9773
|
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"}`;
|
|
9724
9774
|
var ChannelThumb = ({ channel, size }) => {
|
|
9725
|
-
const ref = (0,
|
|
9726
|
-
(0,
|
|
9775
|
+
const ref = (0, import_react68.useRef)(null);
|
|
9776
|
+
(0, import_react68.useEffect)(() => {
|
|
9727
9777
|
const canvas = ref.current;
|
|
9728
9778
|
const ctx = canvas?.getContext("2d");
|
|
9729
9779
|
if (!canvas || !ctx || typeof ctx.createImageData !== "function") return;
|
|
@@ -9734,15 +9784,15 @@ var ChannelThumb = ({ channel, size }) => {
|
|
|
9734
9784
|
img.data.set(px.data);
|
|
9735
9785
|
ctx.putImageData(img, 0, 0);
|
|
9736
9786
|
}, [channel.mask]);
|
|
9737
|
-
return /* @__PURE__ */ (0,
|
|
9787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("canvas", { ref, "aria-hidden": "true", style: { width: size, height: size }, className: "shrink-0 rounded object-contain ring-1 ring-border bg-black" });
|
|
9738
9788
|
};
|
|
9739
9789
|
var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
9740
|
-
const [, setTick] = (0,
|
|
9741
|
-
(0,
|
|
9742
|
-
const [activeId, setActiveId] = (0,
|
|
9743
|
-
const [renaming, setRenaming] = (0,
|
|
9744
|
-
const [error, setError] = (0,
|
|
9745
|
-
const fileInput = (0,
|
|
9790
|
+
const [, setTick] = (0, import_react68.useState)(0);
|
|
9791
|
+
(0, import_react68.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
9792
|
+
const [activeId, setActiveId] = (0, import_react68.useState)(null);
|
|
9793
|
+
const [renaming, setRenaming] = (0, import_react68.useState)(null);
|
|
9794
|
+
const [error, setError] = (0, import_react68.useState)(null);
|
|
9795
|
+
const fileInput = (0, import_react68.useRef)(null);
|
|
9746
9796
|
const channels = controller.getChannels();
|
|
9747
9797
|
const active = channels.find((c) => c.id === activeId) ?? null;
|
|
9748
9798
|
const hasSelection = Boolean(controller.getSelection());
|
|
@@ -9764,13 +9814,13 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9764
9814
|
setError(err instanceof Error ? err.message : String(err));
|
|
9765
9815
|
}
|
|
9766
9816
|
};
|
|
9767
|
-
return /* @__PURE__ */ (0,
|
|
9768
|
-
/* @__PURE__ */ (0,
|
|
9769
|
-
/* @__PURE__ */ (0,
|
|
9770
|
-
/* @__PURE__ */ (0,
|
|
9817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { "data-testid": "channels-panel", className: `flex flex-col gap-2 text-xs ${className}`, children: [
|
|
9818
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
9819
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: imageSectionTitleClass, children: "Channels" }),
|
|
9820
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.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" })
|
|
9771
9821
|
] }),
|
|
9772
|
-
channels.length === 0 && /* @__PURE__ */ (0,
|
|
9773
|
-
/* @__PURE__ */ (0,
|
|
9822
|
+
channels.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-muted-foreground", children: "No channels. Save a selection to keep it." }),
|
|
9823
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("ul", { role: "list", className: "flex flex-col gap-0.5", children: channels.map((c) => /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
9774
9824
|
"li",
|
|
9775
9825
|
{
|
|
9776
9826
|
"data-testid": "channel-row",
|
|
@@ -9782,7 +9832,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9782
9832
|
},
|
|
9783
9833
|
onDoubleClick: () => setRenaming(c.id),
|
|
9784
9834
|
children: [
|
|
9785
|
-
/* @__PURE__ */ (0,
|
|
9835
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9786
9836
|
"button",
|
|
9787
9837
|
{
|
|
9788
9838
|
type: "button",
|
|
@@ -9796,8 +9846,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9796
9846
|
children: c.visible ? "\u25CF" : "\u25CB"
|
|
9797
9847
|
}
|
|
9798
9848
|
),
|
|
9799
|
-
/* @__PURE__ */ (0,
|
|
9800
|
-
renaming === c.id ? /* @__PURE__ */ (0,
|
|
9849
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ChannelThumb, { channel: c, size: thumbnailSize }),
|
|
9850
|
+
renaming === c.id ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9801
9851
|
"input",
|
|
9802
9852
|
{
|
|
9803
9853
|
autoFocus: true,
|
|
@@ -9814,16 +9864,16 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9814
9864
|
if (e.key === "Escape") setRenaming(null);
|
|
9815
9865
|
}
|
|
9816
9866
|
}
|
|
9817
|
-
) : /* @__PURE__ */ (0,
|
|
9867
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "min-w-0 flex-1 truncate", children: c.name })
|
|
9818
9868
|
]
|
|
9819
9869
|
},
|
|
9820
9870
|
c.id
|
|
9821
9871
|
)) }),
|
|
9822
|
-
/* @__PURE__ */ (0,
|
|
9823
|
-
/* @__PURE__ */ (0,
|
|
9824
|
-
/* @__PURE__ */ (0,
|
|
9825
|
-
/* @__PURE__ */ (0,
|
|
9826
|
-
/* @__PURE__ */ (0,
|
|
9872
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
9873
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), disabled: !hasSelection, onClick: () => attempt(() => setActiveId(controller.saveSelection().id)), children: "Save Selection" }),
|
|
9874
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.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" }),
|
|
9875
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), disabled: !active, onClick: () => attempt(() => setActiveId(controller.duplicateChannel(active.id).id)), children: "Duplicate" }),
|
|
9876
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9827
9877
|
"button",
|
|
9828
9878
|
{
|
|
9829
9879
|
type: "button",
|
|
@@ -9836,8 +9886,8 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9836
9886
|
children: "Delete"
|
|
9837
9887
|
}
|
|
9838
9888
|
),
|
|
9839
|
-
/* @__PURE__ */ (0,
|
|
9840
|
-
/* @__PURE__ */ (0,
|
|
9889
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("button", { type: "button", className: btn2(), title: "Load a mask image (white = selected) into a new channel", onClick: () => fileInput.current?.click(), children: "Import\u2026" }),
|
|
9890
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9841
9891
|
"button",
|
|
9842
9892
|
{
|
|
9843
9893
|
type: "button",
|
|
@@ -9848,7 +9898,7 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9848
9898
|
children: "Export PNG"
|
|
9849
9899
|
}
|
|
9850
9900
|
),
|
|
9851
|
-
/* @__PURE__ */ (0,
|
|
9901
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9852
9902
|
"input",
|
|
9853
9903
|
{
|
|
9854
9904
|
ref: fileInput,
|
|
@@ -9863,22 +9913,22 @@ var ChannelsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9863
9913
|
}
|
|
9864
9914
|
)
|
|
9865
9915
|
] }),
|
|
9866
|
-
error && /* @__PURE__ */ (0,
|
|
9916
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9867
9917
|
] });
|
|
9868
9918
|
};
|
|
9869
9919
|
|
|
9870
9920
|
// src/image-editor/PathsPanel.tsx
|
|
9871
|
-
var
|
|
9921
|
+
var import_react69 = require("react");
|
|
9872
9922
|
var import_image_editor20 = require("@pixerate/editor/image-editor");
|
|
9873
|
-
var
|
|
9923
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9874
9924
|
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"}`;
|
|
9875
9925
|
var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
9876
|
-
const [, setTick] = (0,
|
|
9877
|
-
(0,
|
|
9878
|
-
const [renaming, setRenaming] = (0,
|
|
9879
|
-
const [color, setColor] = (0,
|
|
9880
|
-
const [width, setWidth] = (0,
|
|
9881
|
-
const [error, setError] = (0,
|
|
9926
|
+
const [, setTick] = (0, import_react69.useState)(0);
|
|
9927
|
+
(0, import_react69.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
9928
|
+
const [renaming, setRenaming] = (0, import_react69.useState)(null);
|
|
9929
|
+
const [color, setColor] = (0, import_react69.useState)("#000000");
|
|
9930
|
+
const [width, setWidth] = (0, import_react69.useState)(2);
|
|
9931
|
+
const [error, setError] = (0, import_react69.useState)(null);
|
|
9882
9932
|
const paths = controller.getPaths();
|
|
9883
9933
|
const activeId = controller.getState().activePathId ?? null;
|
|
9884
9934
|
const active = paths.find((p) => p.id === activeId) ?? null;
|
|
@@ -9894,10 +9944,10 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9894
9944
|
};
|
|
9895
9945
|
return (
|
|
9896
9946
|
// Clicking the panel's empty space deselects the path (the path tools then edit the active layer).
|
|
9897
|
-
/* @__PURE__ */ (0,
|
|
9898
|
-
/* @__PURE__ */ (0,
|
|
9899
|
-
paths.length === 0 && /* @__PURE__ */ (0,
|
|
9900
|
-
/* @__PURE__ */ (0,
|
|
9947
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.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: [
|
|
9948
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: imageSectionTitleClass, children: "Paths" }),
|
|
9949
|
+
paths.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-muted-foreground", children: "No paths. Make a work path from a selection." }),
|
|
9950
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.jsxs)(
|
|
9901
9951
|
"li",
|
|
9902
9952
|
{
|
|
9903
9953
|
"data-testid": "path-row",
|
|
@@ -9906,8 +9956,8 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9906
9956
|
onClick: () => attempt(() => controller.setActivePath(p.id)),
|
|
9907
9957
|
onDoubleClick: () => setRenaming(p.id),
|
|
9908
9958
|
children: [
|
|
9909
|
-
/* @__PURE__ */ (0,
|
|
9910
|
-
renaming === p.id ? /* @__PURE__ */ (0,
|
|
9959
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.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_runtime49.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" }) }),
|
|
9960
|
+
renaming === p.id ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9911
9961
|
"input",
|
|
9912
9962
|
{
|
|
9913
9963
|
autoFocus: true,
|
|
@@ -9926,13 +9976,13 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9926
9976
|
if (e.key === "Escape") setRenaming(null);
|
|
9927
9977
|
}
|
|
9928
9978
|
}
|
|
9929
|
-
) : /* @__PURE__ */ (0,
|
|
9979
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: `min-w-0 flex-1 truncate ${p.work ? "italic" : ""}`, children: p.name })
|
|
9930
9980
|
]
|
|
9931
9981
|
},
|
|
9932
9982
|
p.id
|
|
9933
9983
|
)) }),
|
|
9934
|
-
/* @__PURE__ */ (0,
|
|
9935
|
-
/* @__PURE__ */ (0,
|
|
9984
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
9985
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9936
9986
|
"button",
|
|
9937
9987
|
{
|
|
9938
9988
|
type: "button",
|
|
@@ -9943,15 +9993,15 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9943
9993
|
children: "Load as Selection"
|
|
9944
9994
|
}
|
|
9945
9995
|
),
|
|
9946
|
-
/* @__PURE__ */ (0,
|
|
9947
|
-
active?.work && /* @__PURE__ */ (0,
|
|
9948
|
-
/* @__PURE__ */ (0,
|
|
9996
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !hasSelection, onClick: () => attempt(() => controller.makeWorkPath()), children: "Make Work Path" }),
|
|
9997
|
+
active?.work && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), onClick: () => setRenaming(active.id), children: "Save Path" }),
|
|
9998
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.addVectorMaskFromPath(active.id)), children: "Add Vector Mask" })
|
|
9949
9999
|
] }),
|
|
9950
|
-
/* @__PURE__ */ (0,
|
|
9951
|
-
/* @__PURE__ */ (0,
|
|
9952
|
-
/* @__PURE__ */ (0,
|
|
9953
|
-
/* @__PURE__ */ (0,
|
|
9954
|
-
/* @__PURE__ */ (0,
|
|
10000
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
10001
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.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" }),
|
|
10002
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.fillPath(active.id, { color })), children: "Fill Path" }),
|
|
10003
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
|
|
10004
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9955
10005
|
"input",
|
|
9956
10006
|
{
|
|
9957
10007
|
type: "number",
|
|
@@ -9966,25 +10016,25 @@ var PathsPanel = ({ controller, thumbnailSize = 32, className = "" }) => {
|
|
|
9966
10016
|
),
|
|
9967
10017
|
"px"
|
|
9968
10018
|
] }),
|
|
9969
|
-
/* @__PURE__ */ (0,
|
|
10019
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.strokePath(active.id, { width, color })), children: "Stroke Path" })
|
|
9970
10020
|
] }),
|
|
9971
|
-
/* @__PURE__ */ (0,
|
|
9972
|
-
/* @__PURE__ */ (0,
|
|
9973
|
-
/* @__PURE__ */ (0,
|
|
10021
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex flex-wrap gap-1", children: [
|
|
10022
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.duplicatePath(active.id)), children: "Duplicate" }),
|
|
10023
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("button", { type: "button", className: btn3(), disabled: !active, onClick: () => attempt(() => controller.deletePath(active.id)), children: "Delete" })
|
|
9974
10024
|
] }),
|
|
9975
|
-
error && /* @__PURE__ */ (0,
|
|
10025
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
9976
10026
|
] })
|
|
9977
10027
|
);
|
|
9978
10028
|
};
|
|
9979
10029
|
|
|
9980
10030
|
// src/image-editor/FreeTransformOptionsBar.tsx
|
|
9981
|
-
var
|
|
10031
|
+
var import_react70 = require("react");
|
|
9982
10032
|
var import_image_editor21 = require("@pixerate/editor/image-editor");
|
|
9983
|
-
var
|
|
10033
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9984
10034
|
var round = (v, unit) => unit === "px" ? Math.round(v * 10) / 10 : Math.round(v * 100) / 100;
|
|
9985
10035
|
var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
9986
|
-
const [, setTick] = (0,
|
|
9987
|
-
(0,
|
|
10036
|
+
const [, setTick] = (0, import_react70.useState)(0);
|
|
10037
|
+
(0, import_react70.useEffect)(() => tool.subscribe(() => setTick((n) => n + 1)), [tool]);
|
|
9988
10038
|
const bar = tool.bar();
|
|
9989
10039
|
if (!tool.active || !bar) return null;
|
|
9990
10040
|
const warp = tool.warpBar();
|
|
@@ -9996,17 +10046,17 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
9996
10046
|
const v = Number(raw);
|
|
9997
10047
|
if (raw.trim() !== "" && Number.isFinite(v) && Math.abs(v - bar[field]) > 1e-9) tool.setField(field, v);
|
|
9998
10048
|
};
|
|
9999
|
-
return /* @__PURE__ */ (0,
|
|
10000
|
-
/* @__PURE__ */ (0,
|
|
10001
|
-
/* @__PURE__ */ (0,
|
|
10002
|
-
tool.mode === "warp" && /* @__PURE__ */ (0,
|
|
10003
|
-
/* @__PURE__ */ (0,
|
|
10004
|
-
/* @__PURE__ */ (0,
|
|
10005
|
-
/* @__PURE__ */ (0,
|
|
10049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.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: [
|
|
10050
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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)) }),
|
|
10051
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.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)) }),
|
|
10052
|
+
tool.mode === "warp" && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-wrap items-center gap-2", role: "group", "aria-label": "Warp options", children: [
|
|
10053
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10054
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Warp" }),
|
|
10055
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.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_runtime50.jsx)("option", { value: o.id, children: o.label }, o.id)) })
|
|
10006
10056
|
] }),
|
|
10007
|
-
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0,
|
|
10008
|
-
/* @__PURE__ */ (0,
|
|
10009
|
-
/* @__PURE__ */ (0,
|
|
10057
|
+
["bend", "horizontal", "vertical"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10058
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: k === "bend" ? "Bend" : k === "horizontal" ? "H" : "V" }),
|
|
10059
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10010
10060
|
"input",
|
|
10011
10061
|
{
|
|
10012
10062
|
type: "number",
|
|
@@ -10027,9 +10077,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10027
10077
|
},
|
|
10028
10078
|
`${k}:${warp[k]}`
|
|
10029
10079
|
),
|
|
10030
|
-
/* @__PURE__ */ (0,
|
|
10080
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "%" })
|
|
10031
10081
|
] }, k)),
|
|
10032
|
-
/* @__PURE__ */ (0,
|
|
10082
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10033
10083
|
"button",
|
|
10034
10084
|
{
|
|
10035
10085
|
type: "button",
|
|
@@ -10041,9 +10091,9 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10041
10091
|
children: "Vertical"
|
|
10042
10092
|
}
|
|
10043
10093
|
),
|
|
10044
|
-
/* @__PURE__ */ (0,
|
|
10045
|
-
/* @__PURE__ */ (0,
|
|
10046
|
-
/* @__PURE__ */ (0,
|
|
10094
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10095
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Grid" }),
|
|
10096
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10047
10097
|
"select",
|
|
10048
10098
|
{
|
|
10049
10099
|
"aria-label": "Warp grid",
|
|
@@ -10053,14 +10103,14 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10053
10103
|
tool.setWarp({ columns: g.columns, rows: g.rows });
|
|
10054
10104
|
},
|
|
10055
10105
|
className: imageFieldClass,
|
|
10056
|
-
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0,
|
|
10106
|
+
children: import_image_editor21.WARP_GRID_OPTIONS.map((g) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: g.id, children: g.label }, g.id))
|
|
10057
10107
|
}
|
|
10058
10108
|
)
|
|
10059
10109
|
] })
|
|
10060
10110
|
] }),
|
|
10061
|
-
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0,
|
|
10062
|
-
/* @__PURE__ */ (0,
|
|
10063
|
-
/* @__PURE__ */ (0,
|
|
10111
|
+
tool.mode !== "warp" && import_image_editor21.FREE_TRANSFORM_FIELDS.map((f) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", title: f.title, children: [
|
|
10112
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: f.label }),
|
|
10113
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10064
10114
|
"input",
|
|
10065
10115
|
{
|
|
10066
10116
|
type: "number",
|
|
@@ -10080,8 +10130,8 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10080
10130
|
},
|
|
10081
10131
|
`${f.id}:${round(bar[f.id], f.unit)}`
|
|
10082
10132
|
),
|
|
10083
|
-
/* @__PURE__ */ (0,
|
|
10084
|
-
f.id === "scaleX" && /* @__PURE__ */ (0,
|
|
10133
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: f.unit }),
|
|
10134
|
+
f.id === "scaleX" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10085
10135
|
"button",
|
|
10086
10136
|
{
|
|
10087
10137
|
type: "button",
|
|
@@ -10096,33 +10146,33 @@ var FreeTransformOptionsBar = ({ tool, className }) => {
|
|
|
10096
10146
|
}
|
|
10097
10147
|
)
|
|
10098
10148
|
] }, f.id)),
|
|
10099
|
-
/* @__PURE__ */ (0,
|
|
10100
|
-
/* @__PURE__ */ (0,
|
|
10101
|
-
/* @__PURE__ */ (0,
|
|
10149
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10150
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "text-muted-foreground", children: "Interpolation" }),
|
|
10151
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
10102
10152
|
"select",
|
|
10103
10153
|
{
|
|
10104
10154
|
"aria-label": "Interpolation",
|
|
10105
10155
|
value: tool.interpolation,
|
|
10106
10156
|
onChange: (e) => tool.setInterpolation(e.target.value),
|
|
10107
10157
|
className: imageFieldClass,
|
|
10108
|
-
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0,
|
|
10158
|
+
children: import_image_editor21.INTERPOLATIONS.map((i) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("option", { value: i, children: i[0].toUpperCase() + i.slice(1) }, i))
|
|
10109
10159
|
}
|
|
10110
10160
|
)
|
|
10111
10161
|
] }),
|
|
10112
|
-
/* @__PURE__ */ (0,
|
|
10113
|
-
/* @__PURE__ */ (0,
|
|
10114
|
-
tool.error && /* @__PURE__ */ (0,
|
|
10162
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.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" }),
|
|
10163
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("button", { type: "button", title: "Cancel (Esc)", className: imageChipClass(false), onClick: () => tool.cancel(), children: "Cancel" }),
|
|
10164
|
+
tool.error && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { role: "alert", className: "text-destructive", children: tool.error })
|
|
10115
10165
|
] });
|
|
10116
10166
|
};
|
|
10117
10167
|
|
|
10118
10168
|
// src/image-editor/ShapeOptionsBar.tsx
|
|
10119
|
-
var
|
|
10169
|
+
var import_react71 = require("react");
|
|
10120
10170
|
var import_image_editor22 = require("@pixerate/editor/image-editor");
|
|
10121
|
-
var
|
|
10171
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
10122
10172
|
var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
10123
|
-
const [, setTick] = (0,
|
|
10124
|
-
(0,
|
|
10125
|
-
const [error, setError] = (0,
|
|
10173
|
+
const [, setTick] = (0, import_react71.useState)(0);
|
|
10174
|
+
(0, import_react71.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
10175
|
+
const [error, setError] = (0, import_react71.useState)(null);
|
|
10126
10176
|
const active = controller.getActiveLayer();
|
|
10127
10177
|
const shapeId = active?.type === "shape" ? active.id : null;
|
|
10128
10178
|
const set = (change) => {
|
|
@@ -10136,22 +10186,22 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
10136
10186
|
}
|
|
10137
10187
|
};
|
|
10138
10188
|
const num = (v, min, max) => Math.max(min, Math.min(max, Number(v) || min));
|
|
10139
|
-
return /* @__PURE__ */ (0,
|
|
10140
|
-
/* @__PURE__ */ (0,
|
|
10141
|
-
/* @__PURE__ */ (0,
|
|
10142
|
-
/* @__PURE__ */ (0,
|
|
10143
|
-
/* @__PURE__ */ (0,
|
|
10189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "shape-options", children: [
|
|
10190
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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_runtime51.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)) }),
|
|
10191
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
10192
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10193
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Fill", checked: options.fill !== null, onChange: (on) => set({ fill: on ? "#4f46e5" : null }) }),
|
|
10144
10194
|
"Fill",
|
|
10145
|
-
/* @__PURE__ */ (0,
|
|
10195
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageColor, { label: "Fill colour", disabled: options.fill === null, value: options.fill ?? "#4f46e5", onChange: (fill) => set({ fill }) })
|
|
10146
10196
|
] }),
|
|
10147
|
-
/* @__PURE__ */ (0,
|
|
10148
|
-
/* @__PURE__ */ (0,
|
|
10197
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10198
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Stroke", checked: options.stroke !== null, onChange: (on) => set({ stroke: on ? "#000000" : null }) }),
|
|
10149
10199
|
"Stroke",
|
|
10150
|
-
/* @__PURE__ */ (0,
|
|
10200
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageColor, { label: "Stroke colour", disabled: options.stroke === null, value: options.stroke ?? "#000000", onChange: (stroke) => set({ stroke }) })
|
|
10151
10201
|
] }),
|
|
10152
|
-
/* @__PURE__ */ (0,
|
|
10202
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10153
10203
|
"Width",
|
|
10154
|
-
/* @__PURE__ */ (0,
|
|
10204
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
10155
10205
|
"input",
|
|
10156
10206
|
{
|
|
10157
10207
|
type: "number",
|
|
@@ -10165,52 +10215,52 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
|
|
|
10165
10215
|
)
|
|
10166
10216
|
] })
|
|
10167
10217
|
] }),
|
|
10168
|
-
/* @__PURE__ */ (0,
|
|
10169
|
-
options.kind === "rect" && /* @__PURE__ */ (0,
|
|
10218
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
10219
|
+
options.kind === "rect" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10170
10220
|
"Radius",
|
|
10171
|
-
/* @__PURE__ */ (0,
|
|
10221
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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}` })
|
|
10172
10222
|
] }),
|
|
10173
|
-
options.kind === "polygon" && /* @__PURE__ */ (0,
|
|
10223
|
+
options.kind === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10174
10224
|
"Sides",
|
|
10175
|
-
/* @__PURE__ */ (0,
|
|
10225
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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}` })
|
|
10176
10226
|
] }),
|
|
10177
|
-
options.kind === "star" && /* @__PURE__ */ (0,
|
|
10178
|
-
/* @__PURE__ */ (0,
|
|
10227
|
+
options.kind === "star" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
10228
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10179
10229
|
"Points",
|
|
10180
|
-
/* @__PURE__ */ (0,
|
|
10230
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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}` })
|
|
10181
10231
|
] }),
|
|
10182
|
-
/* @__PURE__ */ (0,
|
|
10232
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10183
10233
|
"Inner",
|
|
10184
|
-
/* @__PURE__ */ (0,
|
|
10234
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageRange, { label: "Inner radius", min: 0.05, max: 1, step: 0.05, value: options.innerRatio, onChange: (v) => set({ innerRatio: v }) })
|
|
10185
10235
|
] })
|
|
10186
10236
|
] }),
|
|
10187
|
-
options.kind === "line" && /* @__PURE__ */ (0,
|
|
10188
|
-
/* @__PURE__ */ (0,
|
|
10237
|
+
options.kind === "line" && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
10238
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10189
10239
|
"Weight",
|
|
10190
|
-
/* @__PURE__ */ (0,
|
|
10240
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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}` })
|
|
10191
10241
|
] }),
|
|
10192
|
-
/* @__PURE__ */ (0,
|
|
10193
|
-
/* @__PURE__ */ (0,
|
|
10242
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10243
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ImageCheckbox, { label: "Arrowhead", checked: options.arrow, onChange: (on) => set({ arrow: on }) }),
|
|
10194
10244
|
"Arrowhead"
|
|
10195
10245
|
] })
|
|
10196
10246
|
] })
|
|
10197
10247
|
] }),
|
|
10198
|
-
/* @__PURE__ */ (0,
|
|
10199
|
-
error && /* @__PURE__ */ (0,
|
|
10248
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.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." }),
|
|
10249
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
10200
10250
|
] });
|
|
10201
10251
|
};
|
|
10202
10252
|
|
|
10203
10253
|
// src/image-editor/TypeOptionsBar.tsx
|
|
10204
|
-
var
|
|
10254
|
+
var import_react72 = require("react");
|
|
10205
10255
|
var import_image_editor23 = require("@pixerate/editor/image-editor");
|
|
10206
|
-
var
|
|
10256
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
10207
10257
|
var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
|
|
10208
10258
|
var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
|
|
10209
10259
|
var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
|
|
10210
|
-
const [, setTick] = (0,
|
|
10211
|
-
(0,
|
|
10212
|
-
(0,
|
|
10213
|
-
const [error, setError] = (0,
|
|
10260
|
+
const [, setTick] = (0, import_react72.useState)(0);
|
|
10261
|
+
(0, import_react72.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
|
|
10262
|
+
(0, import_react72.useEffect)(() => session?.subscribe(() => setTick((n) => n + 1)), [session]);
|
|
10263
|
+
const [error, setError] = (0, import_react72.useState)(null);
|
|
10214
10264
|
const active = controller.getActiveLayer();
|
|
10215
10265
|
const typeId = !session && active?.type === "type" ? active.id : null;
|
|
10216
10266
|
const here = session?.alive ? session.styleHere() : {};
|
|
@@ -10263,11 +10313,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10263
10313
|
setError(e instanceof Error ? e.message : String(e));
|
|
10264
10314
|
}
|
|
10265
10315
|
};
|
|
10266
|
-
return /* @__PURE__ */ (0,
|
|
10267
|
-
/* @__PURE__ */ (0,
|
|
10268
|
-
/* @__PURE__ */ (0,
|
|
10316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: `flex flex-col gap-2 text-xs text-foreground ${className ?? ""}`, "data-testid": "type-options", children: [
|
|
10317
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
10318
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10269
10319
|
"Font",
|
|
10270
|
-
/* @__PURE__ */ (0,
|
|
10320
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10271
10321
|
"input",
|
|
10272
10322
|
{
|
|
10273
10323
|
list: "pixerate-type-fonts",
|
|
@@ -10277,11 +10327,11 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10277
10327
|
className: "w-32 rounded border border-border bg-background px-1 py-0.5"
|
|
10278
10328
|
}
|
|
10279
10329
|
),
|
|
10280
|
-
/* @__PURE__ */ (0,
|
|
10330
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("datalist", { id: "pixerate-type-fonts", children: fonts.map((f) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("option", { value: f }, f)) })
|
|
10281
10331
|
] }),
|
|
10282
|
-
/* @__PURE__ */ (0,
|
|
10332
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
10283
10333
|
"Size",
|
|
10284
|
-
/* @__PURE__ */ (0,
|
|
10334
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10285
10335
|
"input",
|
|
10286
10336
|
{
|
|
10287
10337
|
type: "number",
|
|
@@ -10294,14 +10344,14 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10294
10344
|
}
|
|
10295
10345
|
)
|
|
10296
10346
|
] }),
|
|
10297
|
-
/* @__PURE__ */ (0,
|
|
10298
|
-
/* @__PURE__ */ (0,
|
|
10299
|
-
/* @__PURE__ */ (0,
|
|
10347
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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" }),
|
|
10348
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": shown.italic, className: `${imageChipClass(shown.italic)} italic`, onClick: () => style({ italic: !shown.italic }), children: "I" }),
|
|
10349
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
|
|
10300
10350
|
] }),
|
|
10301
|
-
/* @__PURE__ */ (0,
|
|
10302
|
-
/* @__PURE__ */ (0,
|
|
10303
|
-
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0,
|
|
10304
|
-
orientation === "vertical" && editedId && /* @__PURE__ */ (0,
|
|
10351
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor23.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
|
|
10352
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
|
|
10353
|
+
import_image_editor23.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
|
|
10354
|
+
orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
10305
10355
|
"button",
|
|
10306
10356
|
{
|
|
10307
10357
|
type: "button",
|
|
@@ -10313,19 +10363,19 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
|
|
|
10313
10363
|
}
|
|
10314
10364
|
)
|
|
10315
10365
|
] }),
|
|
10316
|
-
/* @__PURE__ */ (0,
|
|
10317
|
-
missing.length > 0 && /* @__PURE__ */ (0,
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.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." }),
|
|
10367
|
+
missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
|
|
10318
10368
|
"Missing ",
|
|
10319
10369
|
missing.length === 1 ? "font" : "fonts",
|
|
10320
10370
|
": ",
|
|
10321
10371
|
missing.join(", ")
|
|
10322
10372
|
] }),
|
|
10323
|
-
error && /* @__PURE__ */ (0,
|
|
10373
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { role: "alert", className: "text-destructive", children: error })
|
|
10324
10374
|
] });
|
|
10325
10375
|
};
|
|
10326
10376
|
|
|
10327
10377
|
// src/image-editor/ImageEditor.tsx
|
|
10328
|
-
var
|
|
10378
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
10329
10379
|
var ImageEditor = ({
|
|
10330
10380
|
editor: externalEditor,
|
|
10331
10381
|
src,
|
|
@@ -10350,32 +10400,32 @@ var ImageEditor = ({
|
|
|
10350
10400
|
return l.type === "pixel" && !!l.generator || l.type === "smart" && !!l.smartFilters?.filters.some((f) => f.kind === "effect") || l.type === "group" && l.children.some(has);
|
|
10351
10401
|
});
|
|
10352
10402
|
const legacyProcess = (0, import_image_editor24.normalizeProcessVersion)(state.adjustments.process) < import_image_editor24.LATEST_PROCESS_VERSION;
|
|
10353
|
-
const [activeTab, setActiveTab] = (0,
|
|
10354
|
-
const rootRef = (0,
|
|
10403
|
+
const [activeTab, setActiveTab] = (0, import_react73.useState)("crop");
|
|
10404
|
+
const rootRef = (0, import_react73.useRef)(null);
|
|
10355
10405
|
const canvasMode = activeTab === "crop" || activeTab === "select" || activeTab === "paint" || activeTab === "annotate" ? activeTab : "none";
|
|
10356
|
-
const activeTabRef = (0,
|
|
10406
|
+
const activeTabRef = (0, import_react73.useRef)(activeTab);
|
|
10357
10407
|
activeTabRef.current = activeTab;
|
|
10358
10408
|
const openPanel = async (ref) => {
|
|
10359
10409
|
if (ref.kind !== "panel" || activeTabRef.current === ref.id) return;
|
|
10360
10410
|
rootRef.current?.querySelector(`[data-image-tab="${CSS.escape(ref.id)}"]`)?.click();
|
|
10361
10411
|
await new Promise((resolve) => setTimeout(resolve, 60));
|
|
10362
10412
|
};
|
|
10363
|
-
const [activeCropRatio, setActiveCropRatio] = (0,
|
|
10364
|
-
const [selectionOptions, setSelectionOptions] = (0,
|
|
10365
|
-
const [shapeOptions, setShapeOptions] = (0,
|
|
10366
|
-
const [typeOptions, setTypeOptions] = (0,
|
|
10367
|
-
const [typeSession, setTypeSession] = (0,
|
|
10368
|
-
const [selectionError, setSelectionError] = (0,
|
|
10369
|
-
const [paintError, setPaintError] = (0,
|
|
10370
|
-
const [shapeTypeError, setShapeTypeError] = (0,
|
|
10413
|
+
const [activeCropRatio, setActiveCropRatio] = (0, import_react73.useState)(null);
|
|
10414
|
+
const [selectionOptions, setSelectionOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_SELECTION_TOOL_OPTIONS);
|
|
10415
|
+
const [shapeOptions, setShapeOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_SHAPE_TOOL_OPTIONS);
|
|
10416
|
+
const [typeOptions, setTypeOptions] = (0, import_react73.useState)(import_image_editor24.DEFAULT_TYPE_TOOL_OPTIONS);
|
|
10417
|
+
const [typeSession, setTypeSession] = (0, import_react73.useState)(null);
|
|
10418
|
+
const [selectionError, setSelectionError] = (0, import_react73.useState)(null);
|
|
10419
|
+
const [paintError, setPaintError] = (0, import_react73.useState)(null);
|
|
10420
|
+
const [shapeTypeError, setShapeTypeError] = (0, import_react73.useState)(null);
|
|
10371
10421
|
const handleCanvasError = (source, message2) => {
|
|
10372
10422
|
if (source === "paint") setPaintError(message2);
|
|
10373
10423
|
else if (source === "select") setSelectionError(message2);
|
|
10374
10424
|
else setShapeTypeError(message2);
|
|
10375
10425
|
};
|
|
10376
10426
|
const finishTyping = () => setTypeSession(null);
|
|
10377
|
-
const transformToolRef = (0,
|
|
10378
|
-
const transformControllerRef = (0,
|
|
10427
|
+
const transformToolRef = (0, import_react73.useRef)(null);
|
|
10428
|
+
const transformControllerRef = (0, import_react73.useRef)(controller);
|
|
10379
10429
|
if (!transformToolRef.current || transformControllerRef.current !== controller) {
|
|
10380
10430
|
transformToolRef.current?.cancel();
|
|
10381
10431
|
transformToolRef.current = new import_image_editor24.FreeTransformTool(controller, {
|
|
@@ -10384,16 +10434,16 @@ var ImageEditor = ({
|
|
|
10384
10434
|
transformControllerRef.current = controller;
|
|
10385
10435
|
}
|
|
10386
10436
|
const transformTool = transformToolRef.current;
|
|
10387
|
-
const [, setTransformTick] = (0,
|
|
10388
|
-
(0,
|
|
10389
|
-
(0,
|
|
10390
|
-
const [inpaintPrompt, setInpaintPrompt] = (0,
|
|
10391
|
-
const [inpaintMaskMode, setInpaintMaskMode] = (0,
|
|
10392
|
-
const [isRemovingBg, setIsRemovingBg] = (0,
|
|
10393
|
-
const [isInpainting, setIsInpainting] = (0,
|
|
10394
|
-
const [aiError, setAiError] = (0,
|
|
10395
|
-
const [aiSuccess, setAiSuccess] = (0,
|
|
10396
|
-
const [aiTarget, setAiTarget] = (0,
|
|
10437
|
+
const [, setTransformTick] = (0, import_react73.useState)(0);
|
|
10438
|
+
(0, import_react73.useEffect)(() => transformTool.subscribe(() => setTransformTick((n) => n + 1)), [transformTool]);
|
|
10439
|
+
(0, import_react73.useEffect)(() => () => transformToolRef.current?.cancel(), []);
|
|
10440
|
+
const [inpaintPrompt, setInpaintPrompt] = (0, import_react73.useState)("");
|
|
10441
|
+
const [inpaintMaskMode, setInpaintMaskMode] = (0, import_react73.useState)("annotations");
|
|
10442
|
+
const [isRemovingBg, setIsRemovingBg] = (0, import_react73.useState)(false);
|
|
10443
|
+
const [isInpainting, setIsInpainting] = (0, import_react73.useState)(false);
|
|
10444
|
+
const [aiError, setAiError] = (0, import_react73.useState)(null);
|
|
10445
|
+
const [aiSuccess, setAiSuccess] = (0, import_react73.useState)(null);
|
|
10446
|
+
const [aiTarget, setAiTarget] = (0, import_react73.useState)("auto");
|
|
10397
10447
|
const aiOptions = aiTarget === "auto" ? {} : { target: aiTarget };
|
|
10398
10448
|
const effectiveOnInpaint = onInpaint || aiHooks?.onInpaint;
|
|
10399
10449
|
const effectiveOnRemoveBg = onRemoveBackground || aiHooks?.onRemoveBackground;
|
|
@@ -10456,11 +10506,11 @@ var ImageEditor = ({
|
|
|
10456
10506
|
setIsInpainting(false);
|
|
10457
10507
|
}
|
|
10458
10508
|
};
|
|
10459
|
-
const [activeColor, setActiveColor] = (0,
|
|
10460
|
-
const [strokeWidth, setStrokeWidth] = (0,
|
|
10461
|
-
const [fontSize, setFontSize] = (0,
|
|
10462
|
-
const [textInput, setTextInput] = (0,
|
|
10463
|
-
(0,
|
|
10509
|
+
const [activeColor, setActiveColor] = (0, import_react73.useState)("#ef4444");
|
|
10510
|
+
const [strokeWidth, setStrokeWidth] = (0, import_react73.useState)(3);
|
|
10511
|
+
const [fontSize, setFontSize] = (0, import_react73.useState)(24);
|
|
10512
|
+
const [textInput, setTextInput] = (0, import_react73.useState)("");
|
|
10513
|
+
(0, import_react73.useEffect)(() => {
|
|
10464
10514
|
if (activeTab === "crop" && editor.state.activeTool !== "crop") {
|
|
10465
10515
|
editor.setTool("crop");
|
|
10466
10516
|
}
|
|
@@ -10488,16 +10538,16 @@ var ImageEditor = ({
|
|
|
10488
10538
|
link.click();
|
|
10489
10539
|
}
|
|
10490
10540
|
};
|
|
10491
|
-
return /* @__PURE__ */ (0,
|
|
10541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
10492
10542
|
"div",
|
|
10493
10543
|
{
|
|
10494
10544
|
ref: rootRef,
|
|
10495
10545
|
className: `${imageEditorFrameClass} ${className}`,
|
|
10496
10546
|
style,
|
|
10497
10547
|
children: [
|
|
10498
|
-
/* @__PURE__ */ (0,
|
|
10499
|
-
/* @__PURE__ */ (0,
|
|
10500
|
-
/* @__PURE__ */ (0,
|
|
10548
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: imageEditorHeaderClass, children: [
|
|
10549
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { role: "tablist", className: imageTabListClass, children: [
|
|
10550
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10501
10551
|
"button",
|
|
10502
10552
|
{
|
|
10503
10553
|
type: "button",
|
|
@@ -10512,7 +10562,7 @@ var ImageEditor = ({
|
|
|
10512
10562
|
children: "Transform & Crop"
|
|
10513
10563
|
}
|
|
10514
10564
|
),
|
|
10515
|
-
/* @__PURE__ */ (0,
|
|
10565
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10516
10566
|
"button",
|
|
10517
10567
|
{
|
|
10518
10568
|
type: "button",
|
|
@@ -10527,7 +10577,7 @@ var ImageEditor = ({
|
|
|
10527
10577
|
children: "Adjustments"
|
|
10528
10578
|
}
|
|
10529
10579
|
),
|
|
10530
|
-
/* @__PURE__ */ (0,
|
|
10580
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10531
10581
|
"button",
|
|
10532
10582
|
{
|
|
10533
10583
|
type: "button",
|
|
@@ -10542,7 +10592,7 @@ var ImageEditor = ({
|
|
|
10542
10592
|
children: "Layers"
|
|
10543
10593
|
}
|
|
10544
10594
|
),
|
|
10545
|
-
/* @__PURE__ */ (0,
|
|
10595
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10546
10596
|
"button",
|
|
10547
10597
|
{
|
|
10548
10598
|
type: "button",
|
|
@@ -10557,7 +10607,7 @@ var ImageEditor = ({
|
|
|
10557
10607
|
children: "Paint"
|
|
10558
10608
|
}
|
|
10559
10609
|
),
|
|
10560
|
-
/* @__PURE__ */ (0,
|
|
10610
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10561
10611
|
"button",
|
|
10562
10612
|
{
|
|
10563
10613
|
type: "button",
|
|
@@ -10572,7 +10622,7 @@ var ImageEditor = ({
|
|
|
10572
10622
|
children: "Select & Mask"
|
|
10573
10623
|
}
|
|
10574
10624
|
),
|
|
10575
|
-
/* @__PURE__ */ (0,
|
|
10625
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10576
10626
|
"button",
|
|
10577
10627
|
{
|
|
10578
10628
|
type: "button",
|
|
@@ -10587,7 +10637,7 @@ var ImageEditor = ({
|
|
|
10587
10637
|
children: "Annotations"
|
|
10588
10638
|
}
|
|
10589
10639
|
),
|
|
10590
|
-
/* @__PURE__ */ (0,
|
|
10640
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10591
10641
|
"button",
|
|
10592
10642
|
{
|
|
10593
10643
|
type: "button",
|
|
@@ -10602,7 +10652,7 @@ var ImageEditor = ({
|
|
|
10602
10652
|
children: "Depth Mask"
|
|
10603
10653
|
}
|
|
10604
10654
|
),
|
|
10605
|
-
/* @__PURE__ */ (0,
|
|
10655
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
10606
10656
|
"button",
|
|
10607
10657
|
{
|
|
10608
10658
|
type: "button",
|
|
@@ -10615,14 +10665,14 @@ var ImageEditor = ({
|
|
|
10615
10665
|
"aria-selected": activeTab === "ai",
|
|
10616
10666
|
className: `${imageTabClass(activeTab === "ai")} flex items-center gap-1.5`,
|
|
10617
10667
|
children: [
|
|
10618
|
-
/* @__PURE__ */ (0,
|
|
10668
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
|
|
10619
10669
|
"AI Tools"
|
|
10620
10670
|
]
|
|
10621
10671
|
}
|
|
10622
10672
|
)
|
|
10623
10673
|
] }),
|
|
10624
|
-
/* @__PURE__ */ (0,
|
|
10625
|
-
/* @__PURE__ */ (0,
|
|
10674
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 text-xs", children: [
|
|
10675
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10626
10676
|
"button",
|
|
10627
10677
|
{
|
|
10628
10678
|
type: "button",
|
|
@@ -10633,7 +10683,7 @@ var ImageEditor = ({
|
|
|
10633
10683
|
children: "\u21A9"
|
|
10634
10684
|
}
|
|
10635
10685
|
),
|
|
10636
|
-
/* @__PURE__ */ (0,
|
|
10686
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10637
10687
|
"button",
|
|
10638
10688
|
{
|
|
10639
10689
|
type: "button",
|
|
@@ -10644,7 +10694,7 @@ var ImageEditor = ({
|
|
|
10644
10694
|
children: "\u21AA"
|
|
10645
10695
|
}
|
|
10646
10696
|
),
|
|
10647
|
-
/* @__PURE__ */ (0,
|
|
10697
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10648
10698
|
"button",
|
|
10649
10699
|
{
|
|
10650
10700
|
type: "button",
|
|
@@ -10653,8 +10703,8 @@ var ImageEditor = ({
|
|
|
10653
10703
|
children: "Reset"
|
|
10654
10704
|
}
|
|
10655
10705
|
),
|
|
10656
|
-
/* @__PURE__ */ (0,
|
|
10657
|
-
/* @__PURE__ */ (0,
|
|
10706
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
10707
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10658
10708
|
"button",
|
|
10659
10709
|
{
|
|
10660
10710
|
type: "button",
|
|
@@ -10664,11 +10714,11 @@ var ImageEditor = ({
|
|
|
10664
10714
|
children: "-"
|
|
10665
10715
|
}
|
|
10666
10716
|
),
|
|
10667
|
-
/* @__PURE__ */ (0,
|
|
10717
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono text-muted-foreground w-10 text-center", children: [
|
|
10668
10718
|
Math.round(state.zoom * 100),
|
|
10669
10719
|
"%"
|
|
10670
10720
|
] }),
|
|
10671
|
-
/* @__PURE__ */ (0,
|
|
10721
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10672
10722
|
"button",
|
|
10673
10723
|
{
|
|
10674
10724
|
type: "button",
|
|
@@ -10678,8 +10728,8 @@ var ImageEditor = ({
|
|
|
10678
10728
|
children: "+"
|
|
10679
10729
|
}
|
|
10680
10730
|
),
|
|
10681
|
-
/* @__PURE__ */ (0,
|
|
10682
|
-
/* @__PURE__ */ (0,
|
|
10731
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "h-4 w-px bg-muted mx-1" }),
|
|
10732
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10683
10733
|
"button",
|
|
10684
10734
|
{
|
|
10685
10735
|
type: "button",
|
|
@@ -10690,7 +10740,7 @@ var ImageEditor = ({
|
|
|
10690
10740
|
children: "Hold Compare"
|
|
10691
10741
|
}
|
|
10692
10742
|
),
|
|
10693
|
-
/* @__PURE__ */ (0,
|
|
10743
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10694
10744
|
"button",
|
|
10695
10745
|
{
|
|
10696
10746
|
type: "button",
|
|
@@ -10701,10 +10751,10 @@ var ImageEditor = ({
|
|
|
10701
10751
|
)
|
|
10702
10752
|
] })
|
|
10703
10753
|
] }),
|
|
10704
|
-
transformTool.active && /* @__PURE__ */ (0,
|
|
10705
|
-
!transformTool.active && transformTool.error && /* @__PURE__ */ (0,
|
|
10706
|
-
/* @__PURE__ */ (0,
|
|
10707
|
-
/* @__PURE__ */ (0,
|
|
10754
|
+
transformTool.active && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FreeTransformOptionsBar, { tool: transformTool, className: "border-b border-border bg-background/95 px-4 py-2" }),
|
|
10755
|
+
!transformTool.active && transformTool.error && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { role: "alert", className: imageErrorBannerClass, children: transformTool.error }),
|
|
10756
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col md:flex-row flex-1 min-h-[520px] md:h-[560px]", children: [
|
|
10757
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10708
10758
|
ImageEditorCanvas,
|
|
10709
10759
|
{
|
|
10710
10760
|
editor,
|
|
@@ -10728,11 +10778,11 @@ var ImageEditor = ({
|
|
|
10728
10778
|
className: "flex-1 h-[360px] md:h-full min-h-[320px] bg-muted"
|
|
10729
10779
|
}
|
|
10730
10780
|
),
|
|
10731
|
-
/* @__PURE__ */ (0,
|
|
10732
|
-
activeTab === "crop" && /* @__PURE__ */ (0,
|
|
10733
|
-
/* @__PURE__ */ (0,
|
|
10734
|
-
/* @__PURE__ */ (0,
|
|
10735
|
-
/* @__PURE__ */ (0,
|
|
10781
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: imageSidebarClass, children: [
|
|
10782
|
+
activeTab === "crop" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
10783
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Aspect Ratio Presets" }),
|
|
10784
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-3 gap-2", children: [
|
|
10785
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10736
10786
|
"button",
|
|
10737
10787
|
{
|
|
10738
10788
|
type: "button",
|
|
@@ -10744,7 +10794,7 @@ var ImageEditor = ({
|
|
|
10744
10794
|
children: "Freeform"
|
|
10745
10795
|
}
|
|
10746
10796
|
),
|
|
10747
|
-
/* @__PURE__ */ (0,
|
|
10797
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10748
10798
|
"button",
|
|
10749
10799
|
{
|
|
10750
10800
|
type: "button",
|
|
@@ -10756,7 +10806,7 @@ var ImageEditor = ({
|
|
|
10756
10806
|
children: "1:1 Square"
|
|
10757
10807
|
}
|
|
10758
10808
|
),
|
|
10759
|
-
/* @__PURE__ */ (0,
|
|
10809
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10760
10810
|
"button",
|
|
10761
10811
|
{
|
|
10762
10812
|
type: "button",
|
|
@@ -10768,7 +10818,7 @@ var ImageEditor = ({
|
|
|
10768
10818
|
children: "4:3 Standard"
|
|
10769
10819
|
}
|
|
10770
10820
|
),
|
|
10771
|
-
/* @__PURE__ */ (0,
|
|
10821
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10772
10822
|
"button",
|
|
10773
10823
|
{
|
|
10774
10824
|
type: "button",
|
|
@@ -10780,7 +10830,7 @@ var ImageEditor = ({
|
|
|
10780
10830
|
children: "16:9 Wide"
|
|
10781
10831
|
}
|
|
10782
10832
|
),
|
|
10783
|
-
/* @__PURE__ */ (0,
|
|
10833
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10784
10834
|
"button",
|
|
10785
10835
|
{
|
|
10786
10836
|
type: "button",
|
|
@@ -10792,7 +10842,7 @@ var ImageEditor = ({
|
|
|
10792
10842
|
children: "3:2 Photo"
|
|
10793
10843
|
}
|
|
10794
10844
|
),
|
|
10795
|
-
/* @__PURE__ */ (0,
|
|
10845
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10796
10846
|
"button",
|
|
10797
10847
|
{
|
|
10798
10848
|
type: "button",
|
|
@@ -10805,10 +10855,10 @@ var ImageEditor = ({
|
|
|
10805
10855
|
}
|
|
10806
10856
|
)
|
|
10807
10857
|
] }),
|
|
10808
|
-
/* @__PURE__ */ (0,
|
|
10809
|
-
/* @__PURE__ */ (0,
|
|
10810
|
-
/* @__PURE__ */ (0,
|
|
10811
|
-
/* @__PURE__ */ (0,
|
|
10858
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
|
|
10859
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Orientation & Flips" }),
|
|
10860
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
10861
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10812
10862
|
"button",
|
|
10813
10863
|
{
|
|
10814
10864
|
type: "button",
|
|
@@ -10817,7 +10867,7 @@ var ImageEditor = ({
|
|
|
10817
10867
|
children: "Rotate -90\xB0"
|
|
10818
10868
|
}
|
|
10819
10869
|
),
|
|
10820
|
-
/* @__PURE__ */ (0,
|
|
10870
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10821
10871
|
"button",
|
|
10822
10872
|
{
|
|
10823
10873
|
type: "button",
|
|
@@ -10826,7 +10876,7 @@ var ImageEditor = ({
|
|
|
10826
10876
|
children: "Rotate +90\xB0"
|
|
10827
10877
|
}
|
|
10828
10878
|
),
|
|
10829
|
-
/* @__PURE__ */ (0,
|
|
10879
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10830
10880
|
"button",
|
|
10831
10881
|
{
|
|
10832
10882
|
type: "button",
|
|
@@ -10835,7 +10885,7 @@ var ImageEditor = ({
|
|
|
10835
10885
|
children: "Flip Horizontal"
|
|
10836
10886
|
}
|
|
10837
10887
|
),
|
|
10838
|
-
/* @__PURE__ */ (0,
|
|
10888
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10839
10889
|
"button",
|
|
10840
10890
|
{
|
|
10841
10891
|
type: "button",
|
|
@@ -10846,10 +10896,10 @@ var ImageEditor = ({
|
|
|
10846
10896
|
)
|
|
10847
10897
|
] })
|
|
10848
10898
|
] }),
|
|
10849
|
-
activeTab === "adjust" && /* @__PURE__ */ (0,
|
|
10850
|
-
/* @__PURE__ */ (0,
|
|
10851
|
-
/* @__PURE__ */ (0,
|
|
10852
|
-
/* @__PURE__ */ (0,
|
|
10899
|
+
activeTab === "adjust" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
10900
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
10901
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Color Adjustments" }),
|
|
10902
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10853
10903
|
"button",
|
|
10854
10904
|
{
|
|
10855
10905
|
type: "button",
|
|
@@ -10859,9 +10909,9 @@ var ImageEditor = ({
|
|
|
10859
10909
|
}
|
|
10860
10910
|
)
|
|
10861
10911
|
] }),
|
|
10862
|
-
/* @__PURE__ */ (0,
|
|
10863
|
-
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0,
|
|
10864
|
-
/* @__PURE__ */ (0,
|
|
10912
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Histogram, { histogram: editor.histogram }),
|
|
10913
|
+
import_image_editor24.IMAGE_ADJUSTMENT_CONTROLS.map((spec) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_react73.default.Fragment, { children: [
|
|
10914
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10865
10915
|
ControlSlider,
|
|
10866
10916
|
{
|
|
10867
10917
|
spec,
|
|
@@ -10870,14 +10920,14 @@ var ImageEditor = ({
|
|
|
10870
10920
|
onChange: (v) => editor.setAdjustments({ [spec.id]: v })
|
|
10871
10921
|
}
|
|
10872
10922
|
),
|
|
10873
|
-
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0,
|
|
10923
|
+
spec.id === "tint" && legacyProcess && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
10874
10924
|
"div",
|
|
10875
10925
|
{
|
|
10876
10926
|
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",
|
|
10877
10927
|
"data-testid": "image-editor-process-notice",
|
|
10878
10928
|
children: [
|
|
10879
|
-
/* @__PURE__ */ (0,
|
|
10880
|
-
/* @__PURE__ */ (0,
|
|
10929
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Legacy rendering (process 1). Tint needs the current process." }),
|
|
10930
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10881
10931
|
"button",
|
|
10882
10932
|
{
|
|
10883
10933
|
type: "button",
|
|
@@ -10890,7 +10940,7 @@ var ImageEditor = ({
|
|
|
10890
10940
|
}
|
|
10891
10941
|
)
|
|
10892
10942
|
] }, spec.id)),
|
|
10893
|
-
/* @__PURE__ */ (0,
|
|
10943
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10894
10944
|
AdjustmentLayersPanel,
|
|
10895
10945
|
{
|
|
10896
10946
|
controller,
|
|
@@ -10899,9 +10949,9 @@ var ImageEditor = ({
|
|
|
10899
10949
|
}
|
|
10900
10950
|
) })
|
|
10901
10951
|
] }),
|
|
10902
|
-
activeTab === "layers" && /* @__PURE__ */ (0,
|
|
10903
|
-
/* @__PURE__ */ (0,
|
|
10904
|
-
/* @__PURE__ */ (0,
|
|
10952
|
+
activeTab === "layers" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
10953
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Layers" }),
|
|
10954
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10905
10955
|
"button",
|
|
10906
10956
|
{
|
|
10907
10957
|
type: "button",
|
|
@@ -10912,15 +10962,15 @@ var ImageEditor = ({
|
|
|
10912
10962
|
children: "Free Transform"
|
|
10913
10963
|
}
|
|
10914
10964
|
),
|
|
10915
|
-
/* @__PURE__ */ (0,
|
|
10916
|
-
effectsShown && /* @__PURE__ */ (0,
|
|
10917
|
-
/* @__PURE__ */ (0,
|
|
10918
|
-
/* @__PURE__ */ (0,
|
|
10965
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayersPanel, { controller }),
|
|
10966
|
+
effectsShown && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageProviderEffectsPanel, { controller, className: imageSectionClass }),
|
|
10967
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Colour" }),
|
|
10968
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ColorProfilePanel, { controller })
|
|
10919
10969
|
] }),
|
|
10920
|
-
activeTab === "paint" && /* @__PURE__ */ (0,
|
|
10921
|
-
/* @__PURE__ */ (0,
|
|
10922
|
-
/* @__PURE__ */ (0,
|
|
10923
|
-
/* @__PURE__ */ (0,
|
|
10970
|
+
activeTab === "paint" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
10971
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Paint" }),
|
|
10972
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BrushOptionsBar, { controller }),
|
|
10973
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10924
10974
|
"button",
|
|
10925
10975
|
{
|
|
10926
10976
|
type: "button",
|
|
@@ -10931,12 +10981,12 @@ var ImageEditor = ({
|
|
|
10931
10981
|
children: "Free Transform"
|
|
10932
10982
|
}
|
|
10933
10983
|
),
|
|
10934
|
-
paintError && /* @__PURE__ */ (0,
|
|
10935
|
-
/* @__PURE__ */ (0,
|
|
10984
|
+
paintError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "paint-error", children: paintError }),
|
|
10985
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSectionClass, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(LayersPanel, { controller }) })
|
|
10936
10986
|
] }),
|
|
10937
|
-
activeTab === "annotate" && /* @__PURE__ */ (0,
|
|
10938
|
-
/* @__PURE__ */ (0,
|
|
10939
|
-
/* @__PURE__ */ (0,
|
|
10987
|
+
activeTab === "annotate" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
10988
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Shape & Type Layers, Paths" }),
|
|
10989
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.jsx)(
|
|
10940
10990
|
"button",
|
|
10941
10991
|
{
|
|
10942
10992
|
type: "button",
|
|
@@ -10947,13 +10997,13 @@ var ImageEditor = ({
|
|
|
10947
10997
|
},
|
|
10948
10998
|
t
|
|
10949
10999
|
)) }),
|
|
10950
|
-
state.activeTool === "shape" && /* @__PURE__ */ (0,
|
|
10951
|
-
state.activeTool === "type" && /* @__PURE__ */ (0,
|
|
10952
|
-
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0,
|
|
10953
|
-
shapeTypeError && /* @__PURE__ */ (0,
|
|
10954
|
-
/* @__PURE__ */ (0,
|
|
10955
|
-
/* @__PURE__ */ (0,
|
|
10956
|
-
/* @__PURE__ */ (0,
|
|
11000
|
+
state.activeTool === "shape" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ShapeOptionsBar, { controller, options: shapeOptions, onChange: setShapeOptions }),
|
|
11001
|
+
state.activeTool === "type" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TypeOptionsBar, { controller, options: typeOptions, onChange: setTypeOptions, session: typeSession }),
|
|
11002
|
+
state.activeTool === "type" && typeSession && /* @__PURE__ */ (0, import_jsx_runtime53.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" }),
|
|
11003
|
+
shapeTypeError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", "data-testid": "shape-type-error", children: shapeTypeError }),
|
|
11004
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
|
|
11005
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Draw & Annotate" }),
|
|
11006
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "grid grid-cols-3 gap-1.5", children: ["pen", "rect", "circle", "arrow", "line"].map((t) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10957
11007
|
"button",
|
|
10958
11008
|
{
|
|
10959
11009
|
type: "button",
|
|
@@ -10963,18 +11013,18 @@ var ImageEditor = ({
|
|
|
10963
11013
|
},
|
|
10964
11014
|
t
|
|
10965
11015
|
)) }),
|
|
10966
|
-
/* @__PURE__ */ (0,
|
|
10967
|
-
/* @__PURE__ */ (0,
|
|
10968
|
-
/* @__PURE__ */ (0,
|
|
10969
|
-
/* @__PURE__ */ (0,
|
|
10970
|
-
/* @__PURE__ */ (0,
|
|
10971
|
-
/* @__PURE__ */ (0,
|
|
10972
|
-
/* @__PURE__ */ (0,
|
|
11016
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 mt-2", children: [
|
|
11017
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-muted-foreground", children: "Color:" }),
|
|
11018
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ImageColor, { label: "Annotation colour", value: activeColor, onChange: setActiveColor }),
|
|
11019
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex-1 ml-2", children: [
|
|
11020
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-0.5", children: [
|
|
11021
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Width:" }),
|
|
11022
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono", children: [
|
|
10973
11023
|
strokeWidth,
|
|
10974
11024
|
"px"
|
|
10975
11025
|
] })
|
|
10976
11026
|
] }),
|
|
10977
|
-
/* @__PURE__ */ (0,
|
|
11027
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10978
11028
|
"input",
|
|
10979
11029
|
{
|
|
10980
11030
|
type: "range",
|
|
@@ -10987,10 +11037,10 @@ var ImageEditor = ({
|
|
|
10987
11037
|
)
|
|
10988
11038
|
] })
|
|
10989
11039
|
] }),
|
|
10990
|
-
/* @__PURE__ */ (0,
|
|
10991
|
-
/* @__PURE__ */ (0,
|
|
10992
|
-
/* @__PURE__ */ (0,
|
|
10993
|
-
/* @__PURE__ */ (0,
|
|
11040
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
|
|
11041
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Add Text" }),
|
|
11042
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-2", children: [
|
|
11043
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
10994
11044
|
"input",
|
|
10995
11045
|
{
|
|
10996
11046
|
type: "text",
|
|
@@ -11001,7 +11051,7 @@ var ImageEditor = ({
|
|
|
11001
11051
|
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"
|
|
11002
11052
|
}
|
|
11003
11053
|
),
|
|
11004
|
-
/* @__PURE__ */ (0,
|
|
11054
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11005
11055
|
"button",
|
|
11006
11056
|
{
|
|
11007
11057
|
type: "button",
|
|
@@ -11011,14 +11061,14 @@ var ImageEditor = ({
|
|
|
11011
11061
|
}
|
|
11012
11062
|
)
|
|
11013
11063
|
] }),
|
|
11014
|
-
/* @__PURE__ */ (0,
|
|
11015
|
-
/* @__PURE__ */ (0,
|
|
11016
|
-
/* @__PURE__ */ (0,
|
|
11064
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between text-muted-foreground", children: [
|
|
11065
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Font Size:" }),
|
|
11066
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-mono", children: [
|
|
11017
11067
|
fontSize,
|
|
11018
11068
|
"px"
|
|
11019
11069
|
] })
|
|
11020
11070
|
] }),
|
|
11021
|
-
/* @__PURE__ */ (0,
|
|
11071
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11022
11072
|
"input",
|
|
11023
11073
|
{
|
|
11024
11074
|
type: "range",
|
|
@@ -11029,14 +11079,14 @@ var ImageEditor = ({
|
|
|
11029
11079
|
className: imageRangeClass
|
|
11030
11080
|
}
|
|
11031
11081
|
),
|
|
11032
|
-
/* @__PURE__ */ (0,
|
|
11033
|
-
/* @__PURE__ */ (0,
|
|
11034
|
-
/* @__PURE__ */ (0,
|
|
11082
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageDividerClass }),
|
|
11083
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11084
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
11035
11085
|
"Layers (",
|
|
11036
11086
|
state.annotations.length,
|
|
11037
11087
|
")"
|
|
11038
11088
|
] }),
|
|
11039
|
-
state.selectedAnnotationId && /* @__PURE__ */ (0,
|
|
11089
|
+
state.selectedAnnotationId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11040
11090
|
"button",
|
|
11041
11091
|
{
|
|
11042
11092
|
type: "button",
|
|
@@ -11045,7 +11095,7 @@ var ImageEditor = ({
|
|
|
11045
11095
|
children: "Delete Selected"
|
|
11046
11096
|
}
|
|
11047
11097
|
),
|
|
11048
|
-
state.annotations.length > 0 && /* @__PURE__ */ (0,
|
|
11098
|
+
state.annotations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11049
11099
|
"button",
|
|
11050
11100
|
{
|
|
11051
11101
|
type: "button",
|
|
@@ -11056,10 +11106,10 @@ var ImageEditor = ({
|
|
|
11056
11106
|
)
|
|
11057
11107
|
] })
|
|
11058
11108
|
] }),
|
|
11059
|
-
activeTab === "depth" && /* @__PURE__ */ (0,
|
|
11060
|
-
/* @__PURE__ */ (0,
|
|
11061
|
-
/* @__PURE__ */ (0,
|
|
11062
|
-
/* @__PURE__ */ (0,
|
|
11109
|
+
activeTab === "depth" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-3 text-xs", children: [
|
|
11110
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11111
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: imageSectionTitleClass, children: "Depth Masking" }),
|
|
11112
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11063
11113
|
"button",
|
|
11064
11114
|
{
|
|
11065
11115
|
type: "button",
|
|
@@ -11069,8 +11119,8 @@ var ImageEditor = ({
|
|
|
11069
11119
|
}
|
|
11070
11120
|
)
|
|
11071
11121
|
] }),
|
|
11072
|
-
/* @__PURE__ */ (0,
|
|
11073
|
-
/* @__PURE__ */ (0,
|
|
11122
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground", children: [
|
|
11123
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11074
11124
|
"input",
|
|
11075
11125
|
{
|
|
11076
11126
|
type: "checkbox",
|
|
@@ -11079,12 +11129,12 @@ var ImageEditor = ({
|
|
|
11079
11129
|
className: "rounded accent-primary"
|
|
11080
11130
|
}
|
|
11081
11131
|
),
|
|
11082
|
-
/* @__PURE__ */ (0,
|
|
11132
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Enable Depth / Alpha Mask" })
|
|
11083
11133
|
] }),
|
|
11084
|
-
state.depthMask.enabled && /* @__PURE__ */ (0,
|
|
11085
|
-
/* @__PURE__ */ (0,
|
|
11086
|
-
/* @__PURE__ */ (0,
|
|
11087
|
-
/* @__PURE__ */ (0,
|
|
11134
|
+
state.depthMask.enabled && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
11135
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
11136
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { className: "text-muted-foreground block mb-1", children: "Mask Image URL:" }),
|
|
11137
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11088
11138
|
"input",
|
|
11089
11139
|
{
|
|
11090
11140
|
type: "text",
|
|
@@ -11095,8 +11145,8 @@ var ImageEditor = ({
|
|
|
11095
11145
|
}
|
|
11096
11146
|
)
|
|
11097
11147
|
] }),
|
|
11098
|
-
/* @__PURE__ */ (0,
|
|
11099
|
-
/* @__PURE__ */ (0,
|
|
11148
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-2", children: [
|
|
11149
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11100
11150
|
"button",
|
|
11101
11151
|
{
|
|
11102
11152
|
type: "button",
|
|
@@ -11105,7 +11155,7 @@ var ImageEditor = ({
|
|
|
11105
11155
|
children: "Threshold Mode"
|
|
11106
11156
|
}
|
|
11107
11157
|
),
|
|
11108
|
-
/* @__PURE__ */ (0,
|
|
11158
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11109
11159
|
"button",
|
|
11110
11160
|
{
|
|
11111
11161
|
type: "button",
|
|
@@ -11115,12 +11165,12 @@ var ImageEditor = ({
|
|
|
11115
11165
|
}
|
|
11116
11166
|
)
|
|
11117
11167
|
] }),
|
|
11118
|
-
/* @__PURE__ */ (0,
|
|
11119
|
-
/* @__PURE__ */ (0,
|
|
11120
|
-
/* @__PURE__ */ (0,
|
|
11121
|
-
/* @__PURE__ */ (0,
|
|
11168
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
11169
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11170
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Depth Start (Lower):" }),
|
|
11171
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[0] })
|
|
11122
11172
|
] }),
|
|
11123
|
-
/* @__PURE__ */ (0,
|
|
11173
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11124
11174
|
"input",
|
|
11125
11175
|
{
|
|
11126
11176
|
type: "range",
|
|
@@ -11134,12 +11184,12 @@ var ImageEditor = ({
|
|
|
11134
11184
|
}
|
|
11135
11185
|
)
|
|
11136
11186
|
] }),
|
|
11137
|
-
/* @__PURE__ */ (0,
|
|
11138
|
-
/* @__PURE__ */ (0,
|
|
11139
|
-
/* @__PURE__ */ (0,
|
|
11140
|
-
/* @__PURE__ */ (0,
|
|
11187
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
11188
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11189
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Depth Stop (Upper):" }),
|
|
11190
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.depthRange[1] })
|
|
11141
11191
|
] }),
|
|
11142
|
-
/* @__PURE__ */ (0,
|
|
11192
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11143
11193
|
"input",
|
|
11144
11194
|
{
|
|
11145
11195
|
type: "range",
|
|
@@ -11153,12 +11203,12 @@ var ImageEditor = ({
|
|
|
11153
11203
|
}
|
|
11154
11204
|
)
|
|
11155
11205
|
] }),
|
|
11156
|
-
/* @__PURE__ */ (0,
|
|
11157
|
-
/* @__PURE__ */ (0,
|
|
11158
|
-
/* @__PURE__ */ (0,
|
|
11159
|
-
/* @__PURE__ */ (0,
|
|
11206
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
11207
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between text-muted-foreground mb-1", children: [
|
|
11208
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Softness:" }),
|
|
11209
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "font-mono", children: state.depthMask.softness })
|
|
11160
11210
|
] }),
|
|
11161
|
-
/* @__PURE__ */ (0,
|
|
11211
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11162
11212
|
"input",
|
|
11163
11213
|
{
|
|
11164
11214
|
type: "range",
|
|
@@ -11170,8 +11220,8 @@ var ImageEditor = ({
|
|
|
11170
11220
|
}
|
|
11171
11221
|
)
|
|
11172
11222
|
] }),
|
|
11173
|
-
/* @__PURE__ */ (0,
|
|
11174
|
-
/* @__PURE__ */ (0,
|
|
11223
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center gap-2 cursor-pointer text-foreground mt-1", children: [
|
|
11224
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11175
11225
|
"input",
|
|
11176
11226
|
{
|
|
11177
11227
|
type: "checkbox",
|
|
@@ -11180,12 +11230,12 @@ var ImageEditor = ({
|
|
|
11180
11230
|
className: "rounded accent-primary"
|
|
11181
11231
|
}
|
|
11182
11232
|
),
|
|
11183
|
-
/* @__PURE__ */ (0,
|
|
11233
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Invert Mask" })
|
|
11184
11234
|
] })
|
|
11185
11235
|
] })
|
|
11186
11236
|
] }),
|
|
11187
|
-
activeTab === "select" && /* @__PURE__ */ (0,
|
|
11188
|
-
/* @__PURE__ */ (0,
|
|
11237
|
+
activeTab === "select" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
11238
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11189
11239
|
SelectionOptionsBar,
|
|
11190
11240
|
{
|
|
11191
11241
|
controller,
|
|
@@ -11196,9 +11246,9 @@ var ImageEditor = ({
|
|
|
11196
11246
|
selectionDisplay: state.selectionDisplay
|
|
11197
11247
|
}
|
|
11198
11248
|
),
|
|
11199
|
-
selectionError && /* @__PURE__ */ (0,
|
|
11200
|
-
/* @__PURE__ */ (0,
|
|
11201
|
-
/* @__PURE__ */ (0,
|
|
11249
|
+
selectionError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { role: "alert", className: "text-destructive", children: selectionError }),
|
|
11250
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex gap-1", children: [
|
|
11251
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11202
11252
|
"button",
|
|
11203
11253
|
{
|
|
11204
11254
|
type: "button",
|
|
@@ -11209,7 +11259,7 @@ var ImageEditor = ({
|
|
|
11209
11259
|
children: "Transform Selection"
|
|
11210
11260
|
}
|
|
11211
11261
|
),
|
|
11212
|
-
/* @__PURE__ */ (0,
|
|
11262
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11213
11263
|
"button",
|
|
11214
11264
|
{
|
|
11215
11265
|
type: "button",
|
|
@@ -11221,14 +11271,14 @@ var ImageEditor = ({
|
|
|
11221
11271
|
}
|
|
11222
11272
|
)
|
|
11223
11273
|
] }),
|
|
11224
|
-
/* @__PURE__ */ (0,
|
|
11225
|
-
/* @__PURE__ */ (0,
|
|
11226
|
-
/* @__PURE__ */ (0,
|
|
11274
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(RefineEdgePanel, { controller, selection: state.selection ?? null, layers: state.adjustments.layers }),
|
|
11275
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ChannelsPanel, { controller }),
|
|
11276
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PathsPanel, { controller })
|
|
11227
11277
|
] }),
|
|
11228
|
-
activeTab === "ai" && /* @__PURE__ */ (0,
|
|
11229
|
-
/* @__PURE__ */ (0,
|
|
11230
|
-
/* @__PURE__ */ (0,
|
|
11231
|
-
/* @__PURE__ */ (0,
|
|
11278
|
+
activeTab === "ai" && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-4 text-xs", children: [
|
|
11279
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("label", { className: "flex items-center justify-between gap-2 text-foreground", children: [
|
|
11280
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Results go to" }),
|
|
11281
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
11232
11282
|
"select",
|
|
11233
11283
|
{
|
|
11234
11284
|
"aria-label": "AI result target",
|
|
@@ -11236,54 +11286,54 @@ var ImageEditor = ({
|
|
|
11236
11286
|
onChange: (e) => setAiTarget(e.target.value),
|
|
11237
11287
|
className: imageSelectClass,
|
|
11238
11288
|
children: [
|
|
11239
|
-
/* @__PURE__ */ (0,
|
|
11240
|
-
/* @__PURE__ */ (0,
|
|
11241
|
-
/* @__PURE__ */ (0,
|
|
11289
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "auto", children: controller.isMultiLayer ? "Auto (new layer)" : "Auto (replace image)" }),
|
|
11290
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "new-layer", children: "New layer / mask" }),
|
|
11291
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("option", { value: "replace", children: "Replace image" })
|
|
11242
11292
|
]
|
|
11243
11293
|
}
|
|
11244
11294
|
)
|
|
11245
11295
|
] }),
|
|
11246
|
-
/* @__PURE__ */ (0,
|
|
11247
|
-
/* @__PURE__ */ (0,
|
|
11248
|
-
/* @__PURE__ */ (0,
|
|
11249
|
-
/* @__PURE__ */ (0,
|
|
11296
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
11297
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11298
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
11299
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
|
|
11250
11300
|
"Background Removal"
|
|
11251
11301
|
] }),
|
|
11252
|
-
isRemovingBg && /* @__PURE__ */ (0,
|
|
11302
|
+
isRemovingBg && /* @__PURE__ */ (0, import_jsx_runtime53.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..." })
|
|
11253
11303
|
] }),
|
|
11254
|
-
/* @__PURE__ */ (0,
|
|
11255
|
-
/* @__PURE__ */ (0,
|
|
11304
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Isolate foreground subject with AI alpha transparency segmentation." }),
|
|
11305
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11256
11306
|
"button",
|
|
11257
11307
|
{
|
|
11258
11308
|
type: "button",
|
|
11259
11309
|
onClick: handleRemoveBackground,
|
|
11260
11310
|
disabled: isRemovingBg || isInpainting,
|
|
11261
11311
|
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",
|
|
11262
|
-
children: isRemovingBg ? /* @__PURE__ */ (0,
|
|
11263
|
-
/* @__PURE__ */ (0,
|
|
11312
|
+
children: isRemovingBg ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
11313
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSpinnerClass }),
|
|
11264
11314
|
"Removing Background..."
|
|
11265
|
-
] }) : /* @__PURE__ */ (0,
|
|
11266
|
-
/* @__PURE__ */ (0,
|
|
11315
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
11316
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
|
|
11267
11317
|
"Remove Background"
|
|
11268
11318
|
] })
|
|
11269
11319
|
}
|
|
11270
11320
|
)
|
|
11271
11321
|
] }),
|
|
11272
|
-
/* @__PURE__ */ (0,
|
|
11273
|
-
/* @__PURE__ */ (0,
|
|
11274
|
-
/* @__PURE__ */ (0,
|
|
11275
|
-
/* @__PURE__ */ (0,
|
|
11276
|
-
/* @__PURE__ */ (0,
|
|
11277
|
-
/* @__PURE__ */ (0,
|
|
11322
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-3 rounded-lg bg-muted/40 border border-border flex flex-col gap-2.5", children: [
|
|
11323
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
11324
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("span", { className: "font-semibold text-foreground uppercase tracking-wider text-[11px] flex items-center gap-1.5", children: [
|
|
11325
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("svg", { className: "w-3.5 h-3.5 text-primary", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
11326
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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" }),
|
|
11327
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("path", { d: "m14 7 3 3" })
|
|
11278
11328
|
] }),
|
|
11279
11329
|
"Generative Inpainting"
|
|
11280
11330
|
] }),
|
|
11281
|
-
isInpainting && /* @__PURE__ */ (0,
|
|
11331
|
+
isInpainting && /* @__PURE__ */ (0, import_jsx_runtime53.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..." })
|
|
11282
11332
|
] }),
|
|
11283
|
-
/* @__PURE__ */ (0,
|
|
11284
|
-
/* @__PURE__ */ (0,
|
|
11285
|
-
/* @__PURE__ */ (0,
|
|
11286
|
-
/* @__PURE__ */ (0,
|
|
11333
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-muted-foreground text-[11px] leading-relaxed", children: "Replace, modify, or fill selected regions using prompt-guided generative inpainting." }),
|
|
11334
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11335
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: "ai-inpaint-prompt-react", className: "text-foreground text-[11px] font-medium", children: "Prompt" }),
|
|
11336
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11287
11337
|
"textarea",
|
|
11288
11338
|
{
|
|
11289
11339
|
id: "ai-inpaint-prompt-react",
|
|
@@ -11295,10 +11345,10 @@ var ImageEditor = ({
|
|
|
11295
11345
|
}
|
|
11296
11346
|
)
|
|
11297
11347
|
] }),
|
|
11298
|
-
/* @__PURE__ */ (0,
|
|
11299
|
-
/* @__PURE__ */ (0,
|
|
11300
|
-
/* @__PURE__ */ (0,
|
|
11301
|
-
/* @__PURE__ */ (0,
|
|
11348
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
11349
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "text-foreground text-[11px] font-medium", children: "Target Mask Region" }),
|
|
11350
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "grid grid-cols-2 gap-1.5", children: [
|
|
11351
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
11302
11352
|
"button",
|
|
11303
11353
|
{
|
|
11304
11354
|
type: "button",
|
|
@@ -11311,7 +11361,7 @@ var ImageEditor = ({
|
|
|
11311
11361
|
]
|
|
11312
11362
|
}
|
|
11313
11363
|
),
|
|
11314
|
-
/* @__PURE__ */ (0,
|
|
11364
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
11315
11365
|
"button",
|
|
11316
11366
|
{
|
|
11317
11367
|
type: "button",
|
|
@@ -11326,25 +11376,25 @@ var ImageEditor = ({
|
|
|
11326
11376
|
)
|
|
11327
11377
|
] })
|
|
11328
11378
|
] }),
|
|
11329
|
-
/* @__PURE__ */ (0,
|
|
11379
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11330
11380
|
"button",
|
|
11331
11381
|
{
|
|
11332
11382
|
type: "button",
|
|
11333
11383
|
onClick: handleInpaint,
|
|
11334
11384
|
disabled: isInpainting || isRemovingBg || !inpaintPrompt.trim(),
|
|
11335
11385
|
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",
|
|
11336
|
-
children: isInpainting ? /* @__PURE__ */ (0,
|
|
11337
|
-
/* @__PURE__ */ (0,
|
|
11386
|
+
children: isInpainting ? /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
11387
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: imageSpinnerClass }),
|
|
11338
11388
|
"Generating Inpaint..."
|
|
11339
|
-
] }) : /* @__PURE__ */ (0,
|
|
11340
|
-
/* @__PURE__ */ (0,
|
|
11389
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
11390
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.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_runtime53.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" }) }),
|
|
11341
11391
|
"Apply Inpainting"
|
|
11342
11392
|
] })
|
|
11343
11393
|
}
|
|
11344
11394
|
)
|
|
11345
11395
|
] }),
|
|
11346
|
-
aiError && /* @__PURE__ */ (0,
|
|
11347
|
-
aiSuccess && /* @__PURE__ */ (0,
|
|
11396
|
+
aiError && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "p-2.5 rounded-lg bg-destructive/10 border border-destructive/40 text-destructive text-[11px]", children: aiError }),
|
|
11397
|
+
aiSuccess && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "p-2.5 rounded-lg bg-emerald-500/10 border border-emerald-500/30 text-emerald-600 text-[11px]", children: aiSuccess })
|
|
11348
11398
|
] })
|
|
11349
11399
|
] })
|
|
11350
11400
|
] })
|
|
@@ -11354,7 +11404,7 @@ var ImageEditor = ({
|
|
|
11354
11404
|
};
|
|
11355
11405
|
|
|
11356
11406
|
// src/review/useReview.ts
|
|
11357
|
-
var
|
|
11407
|
+
var import_react74 = require("react");
|
|
11358
11408
|
var import_editor13 = require("@pixerate/editor");
|
|
11359
11409
|
var EMPTY_COMMENTS = Object.freeze({
|
|
11360
11410
|
threads: [],
|
|
@@ -11373,23 +11423,23 @@ function isCommentStore(value) {
|
|
|
11373
11423
|
}
|
|
11374
11424
|
function useComments(source) {
|
|
11375
11425
|
const store = isCommentStore(source) ? source : (0, import_editor13.getCommentStore)(source);
|
|
11376
|
-
const subscribe = (0,
|
|
11426
|
+
const subscribe = (0, import_react74.useCallback)(
|
|
11377
11427
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
|
|
11378
11428
|
[store]
|
|
11379
11429
|
);
|
|
11380
11430
|
const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_COMMENTS;
|
|
11381
|
-
const snapshot = (0,
|
|
11382
|
-
return (0,
|
|
11431
|
+
const snapshot = (0, import_react74.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
11432
|
+
return (0, import_react74.useMemo)(() => ({ ...snapshot, store }), [snapshot, store]);
|
|
11383
11433
|
}
|
|
11384
11434
|
function useTrackChanges(editor) {
|
|
11385
11435
|
const store = (0, import_editor13.getTrackChangesStore)(editor ?? null);
|
|
11386
|
-
const subscribe = (0,
|
|
11436
|
+
const subscribe = (0, import_react74.useCallback)(
|
|
11387
11437
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe,
|
|
11388
11438
|
[store]
|
|
11389
11439
|
);
|
|
11390
11440
|
const getSnapshot2 = () => store?.getSnapshot() ?? EMPTY_TRACK_CHANGES;
|
|
11391
|
-
const snapshot = (0,
|
|
11392
|
-
return (0,
|
|
11441
|
+
const snapshot = (0, import_react74.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
11442
|
+
return (0, import_react74.useMemo)(() => {
|
|
11393
11443
|
const run = (fn) => () => {
|
|
11394
11444
|
if (editor && !editor.isDestroyed) fn(editor);
|
|
11395
11445
|
};
|
|
@@ -11412,9 +11462,9 @@ function useTrackChanges(editor) {
|
|
|
11412
11462
|
}
|
|
11413
11463
|
|
|
11414
11464
|
// src/review/CommentsPanel.tsx
|
|
11415
|
-
var
|
|
11465
|
+
var import_react75 = require("react");
|
|
11416
11466
|
var import_editor14 = require("@pixerate/editor");
|
|
11417
|
-
var
|
|
11467
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
11418
11468
|
var buttonClass2 = "rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50";
|
|
11419
11469
|
var primaryButtonClass = "rounded px-2 py-1 text-xs bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50";
|
|
11420
11470
|
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";
|
|
@@ -11428,18 +11478,18 @@ var CommentsPanel = ({
|
|
|
11428
11478
|
emptyMessage = "No comments yet. Select text and add a comment."
|
|
11429
11479
|
}) => {
|
|
11430
11480
|
const { threads, activeThreadId, store } = useComments(storeProp ?? editor);
|
|
11431
|
-
const [showResolved, setShowResolved] = (0,
|
|
11481
|
+
const [showResolved, setShowResolved] = (0, import_react75.useState)(showResolvedInitial);
|
|
11432
11482
|
const author = authorProp ?? (0, import_editor14.getCommentAuthor)(editor) ?? { id: "anonymous", name: "Anonymous" };
|
|
11433
11483
|
const visible = threads.filter((t) => showResolved || !t.resolved);
|
|
11434
11484
|
const resolvedCount = threads.filter((t) => t.resolved).length;
|
|
11435
|
-
return /* @__PURE__ */ (0,
|
|
11436
|
-
/* @__PURE__ */ (0,
|
|
11437
|
-
/* @__PURE__ */ (0,
|
|
11485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("aside", { className, "aria-label": "Comments", children: [
|
|
11486
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
11487
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
11438
11488
|
threads.length - resolvedCount,
|
|
11439
11489
|
" open",
|
|
11440
11490
|
resolvedCount > 0 ? ` \xB7 ${resolvedCount} resolved` : ""
|
|
11441
11491
|
] }),
|
|
11442
|
-
resolvedCount > 0 && /* @__PURE__ */ (0,
|
|
11492
|
+
resolvedCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11443
11493
|
"button",
|
|
11444
11494
|
{
|
|
11445
11495
|
type: "button",
|
|
@@ -11450,7 +11500,7 @@ var CommentsPanel = ({
|
|
|
11450
11500
|
}
|
|
11451
11501
|
)
|
|
11452
11502
|
] }),
|
|
11453
|
-
visible.length === 0 ? /* @__PURE__ */ (0,
|
|
11503
|
+
visible.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("ul", { className: "flex flex-col gap-2", role: "list", children: visible.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11454
11504
|
CommentThreadCard,
|
|
11455
11505
|
{
|
|
11456
11506
|
thread,
|
|
@@ -11472,7 +11522,7 @@ var CommentThreadCard = ({
|
|
|
11472
11522
|
author,
|
|
11473
11523
|
formatTime
|
|
11474
11524
|
}) => {
|
|
11475
|
-
const [draft, setDraft] = (0,
|
|
11525
|
+
const [draft, setDraft] = (0, import_react75.useState)("");
|
|
11476
11526
|
const isDraft = thread.body === "";
|
|
11477
11527
|
const quote = thread.anchor?.quote ?? thread.lastQuote ?? "";
|
|
11478
11528
|
const live = editor && !editor.isDestroyed ? editor : null;
|
|
@@ -11498,7 +11548,7 @@ var CommentThreadCard = ({
|
|
|
11498
11548
|
setDraft("");
|
|
11499
11549
|
};
|
|
11500
11550
|
const stop = (e) => e.stopPropagation();
|
|
11501
|
-
return /* @__PURE__ */ (0,
|
|
11551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
11502
11552
|
"li",
|
|
11503
11553
|
{
|
|
11504
11554
|
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" : ""}`,
|
|
@@ -11514,24 +11564,24 @@ var CommentThreadCard = ({
|
|
|
11514
11564
|
}
|
|
11515
11565
|
},
|
|
11516
11566
|
children: [
|
|
11517
|
-
/* @__PURE__ */ (0,
|
|
11518
|
-
/* @__PURE__ */ (0,
|
|
11519
|
-
/* @__PURE__ */ (0,
|
|
11567
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
11568
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: thread.author.name }),
|
|
11569
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(thread.createdAt) })
|
|
11520
11570
|
] }),
|
|
11521
|
-
quote && /* @__PURE__ */ (0,
|
|
11522
|
-
thread.orphaned && /* @__PURE__ */ (0,
|
|
11523
|
-
thread.resolved && /* @__PURE__ */ (0,
|
|
11524
|
-
!isDraft && /* @__PURE__ */ (0,
|
|
11525
|
-
thread.replies.length > 0 && /* @__PURE__ */ (0,
|
|
11526
|
-
/* @__PURE__ */ (0,
|
|
11527
|
-
/* @__PURE__ */ (0,
|
|
11571
|
+
quote && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("blockquote", { className: "border-l-2 border-border pl-2 text-xs text-muted-foreground line-clamp-2", children: quote }),
|
|
11572
|
+
thread.orphaned && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-destructive", children: "The commented text was deleted." }),
|
|
11573
|
+
thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-xs text-muted-foreground", children: "Resolved" }),
|
|
11574
|
+
!isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "whitespace-pre-wrap break-words", children: thread.body }),
|
|
11575
|
+
thread.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.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_runtime54.jsxs)("li", { className: "flex flex-col gap-0.5", "data-reply-id": reply.id, children: [
|
|
11576
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "text-xs", children: [
|
|
11577
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "font-medium", children: reply.author.name }),
|
|
11528
11578
|
" ",
|
|
11529
|
-
/* @__PURE__ */ (0,
|
|
11579
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-muted-foreground", children: formatTime(reply.createdAt) })
|
|
11530
11580
|
] }),
|
|
11531
|
-
/* @__PURE__ */ (0,
|
|
11581
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "whitespace-pre-wrap break-words", children: reply.body })
|
|
11532
11582
|
] }, reply.id)) }),
|
|
11533
|
-
(active || isDraft) && !thread.resolved && /* @__PURE__ */ (0,
|
|
11534
|
-
/* @__PURE__ */ (0,
|
|
11583
|
+
(active || isDraft) && !thread.resolved && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-1", onClick: stop, children: [
|
|
11584
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11535
11585
|
"textarea",
|
|
11536
11586
|
{
|
|
11537
11587
|
className: textareaClass,
|
|
@@ -11549,9 +11599,9 @@ var CommentThreadCard = ({
|
|
|
11549
11599
|
}
|
|
11550
11600
|
}
|
|
11551
11601
|
),
|
|
11552
|
-
/* @__PURE__ */ (0,
|
|
11553
|
-
isDraft && /* @__PURE__ */ (0,
|
|
11554
|
-
/* @__PURE__ */ (0,
|
|
11602
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-end gap-1", children: [
|
|
11603
|
+
isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass2, onClick: remove, children: "Cancel" }),
|
|
11604
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11555
11605
|
"button",
|
|
11556
11606
|
{
|
|
11557
11607
|
type: "button",
|
|
@@ -11563,9 +11613,9 @@ var CommentThreadCard = ({
|
|
|
11563
11613
|
)
|
|
11564
11614
|
] })
|
|
11565
11615
|
] }),
|
|
11566
|
-
!isDraft && /* @__PURE__ */ (0,
|
|
11567
|
-
/* @__PURE__ */ (0,
|
|
11568
|
-
/* @__PURE__ */ (0,
|
|
11616
|
+
!isDraft && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex justify-end gap-1", onClick: stop, children: [
|
|
11617
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("button", { type: "button", className: buttonClass2, onClick: () => setResolved(!thread.resolved), children: thread.resolved ? "Reopen" : "Resolve" }),
|
|
11618
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
11569
11619
|
"button",
|
|
11570
11620
|
{
|
|
11571
11621
|
type: "button",
|
|
@@ -11581,7 +11631,7 @@ var CommentThreadCard = ({
|
|
|
11581
11631
|
};
|
|
11582
11632
|
|
|
11583
11633
|
// src/review/ReviewToolbar.tsx
|
|
11584
|
-
var
|
|
11634
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
11585
11635
|
var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
|
|
11586
11636
|
var buttonClass3 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
|
|
11587
11637
|
var ReviewToolbar = ({
|
|
@@ -11594,8 +11644,8 @@ var ReviewToolbar = ({
|
|
|
11594
11644
|
const count = review.changes.length;
|
|
11595
11645
|
const current = review.currentChange;
|
|
11596
11646
|
const index = current ? review.changes.findIndex((c) => c.id === current.id) + 1 : 0;
|
|
11597
|
-
return /* @__PURE__ */ (0,
|
|
11598
|
-
/* @__PURE__ */ (0,
|
|
11647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className, role: "toolbar", "aria-label": "Review", children: [
|
|
11648
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11599
11649
|
"button",
|
|
11600
11650
|
{
|
|
11601
11651
|
type: "button",
|
|
@@ -11606,8 +11656,8 @@ var ReviewToolbar = ({
|
|
|
11606
11656
|
children: review.enabled ? "Tracking on" : "Track changes"
|
|
11607
11657
|
}
|
|
11608
11658
|
),
|
|
11609
|
-
/* @__PURE__ */ (0,
|
|
11610
|
-
/* @__PURE__ */ (0,
|
|
11659
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
|
|
11660
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11611
11661
|
"button",
|
|
11612
11662
|
{
|
|
11613
11663
|
type: "button",
|
|
@@ -11618,8 +11668,8 @@ var ReviewToolbar = ({
|
|
|
11618
11668
|
children: "\u2039"
|
|
11619
11669
|
}
|
|
11620
11670
|
),
|
|
11621
|
-
/* @__PURE__ */ (0,
|
|
11622
|
-
/* @__PURE__ */ (0,
|
|
11671
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.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` }),
|
|
11672
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11623
11673
|
"button",
|
|
11624
11674
|
{
|
|
11625
11675
|
type: "button",
|
|
@@ -11630,7 +11680,7 @@ var ReviewToolbar = ({
|
|
|
11630
11680
|
children: "\u203A"
|
|
11631
11681
|
}
|
|
11632
11682
|
),
|
|
11633
|
-
showDescription && current && /* @__PURE__ */ (0,
|
|
11683
|
+
showDescription && current && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
11634
11684
|
"span",
|
|
11635
11685
|
{
|
|
11636
11686
|
className: descriptionClassName,
|
|
@@ -11642,8 +11692,8 @@ var ReviewToolbar = ({
|
|
|
11642
11692
|
]
|
|
11643
11693
|
}
|
|
11644
11694
|
),
|
|
11645
|
-
/* @__PURE__ */ (0,
|
|
11646
|
-
/* @__PURE__ */ (0,
|
|
11695
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
|
|
11696
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11647
11697
|
"button",
|
|
11648
11698
|
{
|
|
11649
11699
|
type: "button",
|
|
@@ -11653,7 +11703,7 @@ var ReviewToolbar = ({
|
|
|
11653
11703
|
children: "Accept"
|
|
11654
11704
|
}
|
|
11655
11705
|
),
|
|
11656
|
-
/* @__PURE__ */ (0,
|
|
11706
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
11657
11707
|
"button",
|
|
11658
11708
|
{
|
|
11659
11709
|
type: "button",
|
|
@@ -11663,18 +11713,18 @@ var ReviewToolbar = ({
|
|
|
11663
11713
|
children: "Reject"
|
|
11664
11714
|
}
|
|
11665
11715
|
),
|
|
11666
|
-
/* @__PURE__ */ (0,
|
|
11667
|
-
/* @__PURE__ */ (0,
|
|
11716
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.acceptAll, children: "Accept all" }),
|
|
11717
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("button", { type: "button", className: buttonClass3, disabled: count === 0, onClick: review.rejectAll, children: "Reject all" })
|
|
11668
11718
|
] });
|
|
11669
11719
|
};
|
|
11670
11720
|
|
|
11671
11721
|
// src/review/CommentButton.tsx
|
|
11672
|
-
var
|
|
11722
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
11673
11723
|
var CommentButton = ({
|
|
11674
11724
|
editor,
|
|
11675
11725
|
className = "rounded px-2 py-1 text-xs text-popover-foreground hover:bg-muted",
|
|
11676
11726
|
children = "Comment"
|
|
11677
|
-
}) => /* @__PURE__ */ (0,
|
|
11727
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
11678
11728
|
"button",
|
|
11679
11729
|
{
|
|
11680
11730
|
type: "button",
|
|
@@ -11686,13 +11736,13 @@ var CommentButton = ({
|
|
|
11686
11736
|
);
|
|
11687
11737
|
|
|
11688
11738
|
// src/review/useDocumentCompare.ts
|
|
11689
|
-
var
|
|
11739
|
+
var import_react76 = require("react");
|
|
11690
11740
|
var import_editor15 = require("@pixerate/editor");
|
|
11691
11741
|
function useDocumentCompare(editor, options) {
|
|
11692
|
-
const [summary, setSummary] = (0,
|
|
11693
|
-
const defaults = (0,
|
|
11742
|
+
const [summary, setSummary] = (0, import_react76.useState)(null);
|
|
11743
|
+
const defaults = (0, import_react76.useRef)(options);
|
|
11694
11744
|
defaults.current = options;
|
|
11695
|
-
const compare = (0,
|
|
11745
|
+
const compare = (0, import_react76.useCallback)(
|
|
11696
11746
|
(original, revised, overrides) => {
|
|
11697
11747
|
if (!editor || editor.isDestroyed) return null;
|
|
11698
11748
|
const result = (0, import_editor15.applyDocumentComparison)(editor, original, revised, {
|
|
@@ -11704,13 +11754,13 @@ function useDocumentCompare(editor, options) {
|
|
|
11704
11754
|
},
|
|
11705
11755
|
[editor]
|
|
11706
11756
|
);
|
|
11707
|
-
const clear = (0,
|
|
11708
|
-
return (0,
|
|
11757
|
+
const clear = (0, import_react76.useCallback)(() => setSummary(null), []);
|
|
11758
|
+
return (0, import_react76.useMemo)(() => ({ summary, compare, clear }), [summary, compare, clear]);
|
|
11709
11759
|
}
|
|
11710
11760
|
|
|
11711
11761
|
// src/review/TrackedChangesList.tsx
|
|
11712
11762
|
var import_editor16 = require("@pixerate/editor");
|
|
11713
|
-
var
|
|
11763
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
11714
11764
|
var buttonClass4 = "rounded px-1.5 py-0.5 text-xs text-foreground hover:bg-muted disabled:opacity-40";
|
|
11715
11765
|
var TrackedChangesList = ({
|
|
11716
11766
|
editor,
|
|
@@ -11721,18 +11771,18 @@ var TrackedChangesList = ({
|
|
|
11721
11771
|
}) => {
|
|
11722
11772
|
const review = useTrackChanges(editor);
|
|
11723
11773
|
if (review.changes.length === 0) {
|
|
11724
|
-
return /* @__PURE__ */ (0,
|
|
11774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className, "data-tracked-changes-list": "", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "pixerate-changes-empty text-xs text-muted-foreground", children: emptyState }) });
|
|
11725
11775
|
}
|
|
11726
|
-
return /* @__PURE__ */ (0,
|
|
11776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("ul", { className, role: "list", "aria-label": "Tracked changes", "data-tracked-changes-list": "", children: review.changes.map((change) => {
|
|
11727
11777
|
const active = change.id === review.currentChangeId;
|
|
11728
|
-
return /* @__PURE__ */ (0,
|
|
11778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
11729
11779
|
"li",
|
|
11730
11780
|
{
|
|
11731
11781
|
className: active ? `${itemClassName} ${activeItemClassName}` : itemClassName,
|
|
11732
11782
|
"data-change-type": change.type,
|
|
11733
11783
|
"data-change-id": change.id,
|
|
11734
11784
|
children: [
|
|
11735
|
-
/* @__PURE__ */ (0,
|
|
11785
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
11736
11786
|
"button",
|
|
11737
11787
|
{
|
|
11738
11788
|
type: "button",
|
|
@@ -11740,14 +11790,14 @@ var TrackedChangesList = ({
|
|
|
11740
11790
|
title: `${change.author.name}: ${change.description}`,
|
|
11741
11791
|
onClick: () => review.select(change.id),
|
|
11742
11792
|
children: [
|
|
11743
|
-
/* @__PURE__ */ (0,
|
|
11793
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "font-medium", children: (0, import_editor16.trackedChangeLabel)(change) }),
|
|
11744
11794
|
change.author.name ? ` \xB7 ${change.author.name}` : "",
|
|
11745
|
-
/* @__PURE__ */ (0,
|
|
11795
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "block truncate text-muted-foreground", children: change.description })
|
|
11746
11796
|
]
|
|
11747
11797
|
}
|
|
11748
11798
|
),
|
|
11749
|
-
/* @__PURE__ */ (0,
|
|
11750
|
-
/* @__PURE__ */ (0,
|
|
11799
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.accept(change.id), children: "Accept" }),
|
|
11800
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("button", { type: "button", className: buttonClass4, onClick: () => review.reject(change.id), children: "Reject" })
|
|
11751
11801
|
]
|
|
11752
11802
|
},
|
|
11753
11803
|
`${change.type}:${change.id}`
|
|
@@ -11756,12 +11806,12 @@ var TrackedChangesList = ({
|
|
|
11756
11806
|
};
|
|
11757
11807
|
|
|
11758
11808
|
// src/commands/useCommandPalette.ts
|
|
11759
|
-
var
|
|
11809
|
+
var import_react77 = require("react");
|
|
11760
11810
|
var import_commands2 = require("@pixerate/editor/commands");
|
|
11761
11811
|
function useCommandPalette(registry, options = {}) {
|
|
11762
|
-
const optionsRef = (0,
|
|
11812
|
+
const optionsRef = (0, import_react77.useRef)(options);
|
|
11763
11813
|
optionsRef.current = options;
|
|
11764
|
-
const controller = (0,
|
|
11814
|
+
const controller = (0, import_react77.useMemo)(
|
|
11765
11815
|
() => (0, import_commands2.createCommandPaletteController)(registry, {
|
|
11766
11816
|
context: () => {
|
|
11767
11817
|
const c = optionsRef.current.context;
|
|
@@ -11782,9 +11832,9 @@ function useCommandPalette(registry, options = {}) {
|
|
|
11782
11832
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11783
11833
|
[registry]
|
|
11784
11834
|
);
|
|
11785
|
-
const state = (0,
|
|
11835
|
+
const state = (0, import_react77.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
|
|
11786
11836
|
const { hotkey, hotkeyTarget } = options;
|
|
11787
|
-
(0,
|
|
11837
|
+
(0, import_react77.useEffect)(() => {
|
|
11788
11838
|
if (!hotkey) return;
|
|
11789
11839
|
const target = hotkeyTarget ?? (typeof window !== "undefined" ? window : null);
|
|
11790
11840
|
if (!target) return;
|
|
@@ -11812,13 +11862,13 @@ function useCommandPalette(registry, options = {}) {
|
|
|
11812
11862
|
}
|
|
11813
11863
|
|
|
11814
11864
|
// src/commands/CommandPalette.tsx
|
|
11815
|
-
var
|
|
11816
|
-
var
|
|
11865
|
+
var import_react78 = __toESM(require("react"), 1);
|
|
11866
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
11817
11867
|
function HighlightedLabel({ item }) {
|
|
11818
|
-
if (item.labelIndices.length === 0) return /* @__PURE__ */ (0,
|
|
11868
|
+
if (item.labelIndices.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: item.label });
|
|
11819
11869
|
const marked = new Set(item.labelIndices);
|
|
11820
|
-
return /* @__PURE__ */ (0,
|
|
11821
|
-
(ch, i) => marked.has(i) ? /* @__PURE__ */ (0,
|
|
11870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: Array.from(item.label).map(
|
|
11871
|
+
(ch, i) => marked.has(i) ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "font-semibold text-foreground", "data-match": "", children: ch }, i) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react78.default.Fragment, { children: ch }, i)
|
|
11822
11872
|
) });
|
|
11823
11873
|
}
|
|
11824
11874
|
var CommandPalette = ({
|
|
@@ -11827,22 +11877,22 @@ var CommandPalette = ({
|
|
|
11827
11877
|
emptyMessage = "No matching commands",
|
|
11828
11878
|
className = ""
|
|
11829
11879
|
}) => {
|
|
11830
|
-
const inputRef = (0,
|
|
11831
|
-
const listRef = (0,
|
|
11832
|
-
const baseId = (0,
|
|
11880
|
+
const inputRef = (0, import_react78.useRef)(null);
|
|
11881
|
+
const listRef = (0, import_react78.useRef)(null);
|
|
11882
|
+
const baseId = (0, import_react78.useId)();
|
|
11833
11883
|
const listId = `${baseId}-list`;
|
|
11834
11884
|
const optionId = (index) => `${baseId}-option-${index}`;
|
|
11835
11885
|
const { open, query, items, activeIndex } = palette;
|
|
11836
|
-
(0,
|
|
11886
|
+
(0, import_react78.useEffect)(() => {
|
|
11837
11887
|
if (open) inputRef.current?.focus();
|
|
11838
11888
|
}, [open]);
|
|
11839
|
-
(0,
|
|
11889
|
+
(0, import_react78.useEffect)(() => {
|
|
11840
11890
|
if (!open) return;
|
|
11841
11891
|
const active = listRef.current?.querySelector('[aria-selected="true"]');
|
|
11842
11892
|
active?.scrollIntoView?.({ block: "nearest" });
|
|
11843
11893
|
}, [open, activeIndex]);
|
|
11844
11894
|
if (!open) return null;
|
|
11845
|
-
return /* @__PURE__ */ (0,
|
|
11895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
11846
11896
|
"div",
|
|
11847
11897
|
{
|
|
11848
11898
|
className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 px-4 pt-[15vh]",
|
|
@@ -11850,7 +11900,7 @@ var CommandPalette = ({
|
|
|
11850
11900
|
onMouseDown: (e) => {
|
|
11851
11901
|
if (e.target === e.currentTarget) palette.setOpen(false);
|
|
11852
11902
|
},
|
|
11853
|
-
children: /* @__PURE__ */ (0,
|
|
11903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
11854
11904
|
"div",
|
|
11855
11905
|
{
|
|
11856
11906
|
role: "dialog",
|
|
@@ -11859,7 +11909,7 @@ var CommandPalette = ({
|
|
|
11859
11909
|
className: `w-full max-w-lg overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-xl ${className}`,
|
|
11860
11910
|
style: { background: "var(--popover, var(--background, #fff))" },
|
|
11861
11911
|
children: [
|
|
11862
|
-
/* @__PURE__ */ (0,
|
|
11912
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
11863
11913
|
"input",
|
|
11864
11914
|
{
|
|
11865
11915
|
ref: inputRef,
|
|
@@ -11879,7 +11929,7 @@ var CommandPalette = ({
|
|
|
11879
11929
|
className: "w-full border-b border-border bg-transparent px-3 py-2 text-sm outline-none placeholder:text-muted-foreground"
|
|
11880
11930
|
}
|
|
11881
11931
|
),
|
|
11882
|
-
items.length === 0 ? /* @__PURE__ */ (0,
|
|
11932
|
+
items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "px-3 py-6 text-center text-sm text-muted-foreground", children: emptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime58.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_runtime58.jsxs)(
|
|
11883
11933
|
"li",
|
|
11884
11934
|
{
|
|
11885
11935
|
id: optionId(index),
|
|
@@ -11894,12 +11944,12 @@ var CommandPalette = ({
|
|
|
11894
11944
|
onClick: () => palette.run(item.id),
|
|
11895
11945
|
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"}`,
|
|
11896
11946
|
children: [
|
|
11897
|
-
/* @__PURE__ */ (0,
|
|
11898
|
-
/* @__PURE__ */ (0,
|
|
11899
|
-
item.disabledReason && /* @__PURE__ */ (0,
|
|
11947
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
11948
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HighlightedLabel, { item }),
|
|
11949
|
+
item.disabledReason && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ml-2 text-xs text-muted-foreground", "data-disabled-reason": "", children: item.disabledReason })
|
|
11900
11950
|
] }),
|
|
11901
|
-
item.group && /* @__PURE__ */ (0,
|
|
11902
|
-
item.shortcut && /* @__PURE__ */ (0,
|
|
11951
|
+
item.group && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: item.group }),
|
|
11952
|
+
item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("kbd", { className: "shrink-0 rounded border border-border px-1.5 font-mono text-[10px] text-muted-foreground", children: item.shortcut })
|
|
11903
11953
|
]
|
|
11904
11954
|
},
|
|
11905
11955
|
item.id
|
|
@@ -11912,12 +11962,12 @@ var CommandPalette = ({
|
|
|
11912
11962
|
};
|
|
11913
11963
|
|
|
11914
11964
|
// src/commands/useCommandShortcuts.ts
|
|
11915
|
-
var
|
|
11965
|
+
var import_react79 = require("react");
|
|
11916
11966
|
function useCommandShortcuts(registry, options = {}) {
|
|
11917
|
-
const optionsRef = (0,
|
|
11967
|
+
const optionsRef = (0, import_react79.useRef)(options);
|
|
11918
11968
|
optionsRef.current = options;
|
|
11919
11969
|
const { enabled = true, target } = options;
|
|
11920
|
-
(0,
|
|
11970
|
+
(0, import_react79.useEffect)(() => {
|
|
11921
11971
|
if (!registry || !enabled) return;
|
|
11922
11972
|
const eventTarget = target ?? (typeof window !== "undefined" ? window : null);
|
|
11923
11973
|
if (!eventTarget) return;
|
|
@@ -11935,14 +11985,14 @@ function useCommandShortcuts(registry, options = {}) {
|
|
|
11935
11985
|
}, [registry, enabled, target]);
|
|
11936
11986
|
}
|
|
11937
11987
|
function useRegisterCommands(registry, specs) {
|
|
11938
|
-
(0,
|
|
11988
|
+
(0, import_react79.useEffect)(() => {
|
|
11939
11989
|
if (!registry || !specs || specs.length === 0) return;
|
|
11940
11990
|
return registry.register(specs);
|
|
11941
11991
|
}, [registry, specs]);
|
|
11942
11992
|
}
|
|
11943
11993
|
|
|
11944
11994
|
// src/persistence/useAutosave.ts
|
|
11945
|
-
var
|
|
11995
|
+
var import_react80 = require("react");
|
|
11946
11996
|
var import_persistence = require("@pixerate/editor/persistence");
|
|
11947
11997
|
var IDLE = {
|
|
11948
11998
|
status: "idle",
|
|
@@ -11953,18 +12003,18 @@ var IDLE = {
|
|
|
11953
12003
|
ready: false
|
|
11954
12004
|
};
|
|
11955
12005
|
function useAutosave(options) {
|
|
11956
|
-
const optionsRef = (0,
|
|
12006
|
+
const optionsRef = (0, import_react80.useRef)(options);
|
|
11957
12007
|
optionsRef.current = options;
|
|
11958
12008
|
const { storage, key, history, dirty } = options;
|
|
11959
12009
|
const recover = options.recover !== false;
|
|
11960
12010
|
const flushOnHide = options.flushOnHide !== false;
|
|
11961
12011
|
const ready = options.ready !== false;
|
|
11962
|
-
const [controller, setController] = (0,
|
|
11963
|
-
const [status, setStatus] = (0,
|
|
11964
|
-
const [recovery, setRecovery] = (0,
|
|
11965
|
-
const [pendingRecovery, setPendingRecovery] = (0,
|
|
11966
|
-
const revisionsRef = (0,
|
|
11967
|
-
(0,
|
|
12012
|
+
const [controller, setController] = (0, import_react80.useState)(null);
|
|
12013
|
+
const [status, setStatus] = (0, import_react80.useState)(IDLE);
|
|
12014
|
+
const [recovery, setRecovery] = (0, import_react80.useState)(null);
|
|
12015
|
+
const [pendingRecovery, setPendingRecovery] = (0, import_react80.useState)(recover);
|
|
12016
|
+
const revisionsRef = (0, import_react80.useRef)(null);
|
|
12017
|
+
(0, import_react80.useEffect)(() => {
|
|
11968
12018
|
const revisions = (0, import_persistence.createRevisionTracker)({ history, dirty });
|
|
11969
12019
|
const o = optionsRef.current;
|
|
11970
12020
|
const instance = (0, import_persistence.createAutosaveController)({
|
|
@@ -12007,10 +12057,10 @@ function useAutosave(options) {
|
|
|
12007
12057
|
if (revisionsRef.current === revisions) revisionsRef.current = null;
|
|
12008
12058
|
};
|
|
12009
12059
|
}, [storage, key, history, dirty, recover]);
|
|
12010
|
-
(0,
|
|
12060
|
+
(0, import_react80.useEffect)(() => {
|
|
12011
12061
|
if (controller && ready && !pendingRecovery) controller.ready();
|
|
12012
12062
|
}, [controller, ready, pendingRecovery]);
|
|
12013
|
-
(0,
|
|
12063
|
+
(0, import_react80.useEffect)(() => {
|
|
12014
12064
|
if (!controller || !flushOnHide || typeof window === "undefined") return;
|
|
12015
12065
|
const flush = () => void controller.flushNow();
|
|
12016
12066
|
const onVisibility = () => {
|
|
@@ -12023,33 +12073,33 @@ function useAutosave(options) {
|
|
|
12023
12073
|
document.removeEventListener("visibilitychange", onVisibility);
|
|
12024
12074
|
};
|
|
12025
12075
|
}, [controller, flushOnHide]);
|
|
12026
|
-
const restore = (0,
|
|
12076
|
+
const restore = (0, import_react80.useCallback)(() => {
|
|
12027
12077
|
const snapshot = recovery?.snapshot;
|
|
12028
12078
|
setRecovery(null);
|
|
12029
12079
|
setPendingRecovery(false);
|
|
12030
12080
|
return snapshot;
|
|
12031
12081
|
}, [recovery]);
|
|
12032
|
-
const discard = (0,
|
|
12082
|
+
const discard = (0, import_react80.useCallback)(async () => {
|
|
12033
12083
|
if (controller) await controller.discardRecovery();
|
|
12034
12084
|
setRecovery(null);
|
|
12035
12085
|
setPendingRecovery(false);
|
|
12036
12086
|
}, [controller]);
|
|
12037
|
-
const flushNow = (0,
|
|
12087
|
+
const flushNow = (0, import_react80.useCallback)(async () => {
|
|
12038
12088
|
await controller?.flushNow();
|
|
12039
12089
|
}, [controller]);
|
|
12040
|
-
const markClean = (0,
|
|
12090
|
+
const markClean = (0, import_react80.useCallback)(async () => {
|
|
12041
12091
|
revisionsRef.current?.markSaved();
|
|
12042
12092
|
await controller?.markClean();
|
|
12043
12093
|
}, [controller]);
|
|
12044
|
-
const notifyChange = (0,
|
|
12094
|
+
const notifyChange = (0, import_react80.useCallback)(() => revisionsRef.current?.bump(), []);
|
|
12045
12095
|
return { status, recovery, pendingRecovery, restore, discard, flushNow, markClean, notifyChange, controller };
|
|
12046
12096
|
}
|
|
12047
12097
|
|
|
12048
12098
|
// src/persistence/useEditorAutosave.ts
|
|
12049
|
-
var
|
|
12099
|
+
var import_react81 = require("react");
|
|
12050
12100
|
var import_persistence2 = require("@pixerate/editor/persistence");
|
|
12051
12101
|
function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
12052
|
-
const storage = (0,
|
|
12102
|
+
const storage = (0, import_react81.useMemo)(
|
|
12053
12103
|
() => doc.assets ? (0, import_persistence2.withEditorAssets)(options.storage, doc.assets) : options.storage,
|
|
12054
12104
|
[options.storage, doc.assets]
|
|
12055
12105
|
);
|
|
@@ -12062,19 +12112,19 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
|
12062
12112
|
history: doc
|
|
12063
12113
|
});
|
|
12064
12114
|
const take = autosave.restore;
|
|
12065
|
-
const restore = (0,
|
|
12115
|
+
const restore = (0, import_react81.useCallback)(() => {
|
|
12066
12116
|
const snapshot = take();
|
|
12067
12117
|
return snapshot ? doc.loadDocument(snapshot, { history: "reset" }) : void 0;
|
|
12068
12118
|
}, [take, doc]);
|
|
12069
12119
|
const { markClean: clean, discard: drop } = autosave;
|
|
12070
12120
|
const rawStorage = options.storage;
|
|
12071
|
-
const gcRef = (0,
|
|
12121
|
+
const gcRef = (0, import_react81.useRef)(collectAssetGarbage);
|
|
12072
12122
|
gcRef.current = collectAssetGarbage;
|
|
12073
|
-
const markClean = (0,
|
|
12123
|
+
const markClean = (0, import_react81.useCallback)(async () => {
|
|
12074
12124
|
await clean();
|
|
12075
12125
|
await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
|
|
12076
12126
|
}, [clean, rawStorage, doc]);
|
|
12077
|
-
const discard = (0,
|
|
12127
|
+
const discard = (0, import_react81.useCallback)(async () => {
|
|
12078
12128
|
await drop();
|
|
12079
12129
|
await (0, import_persistence2.collectRetiredEditorAssets)(rawStorage, doc, gcRef.current);
|
|
12080
12130
|
}, [drop, rawStorage, doc]);
|
|
@@ -12083,7 +12133,7 @@ function useEditorAutosave(doc, { collectAssetGarbage, ...options }) {
|
|
|
12083
12133
|
|
|
12084
12134
|
// src/persistence/RecoveryPrompt.tsx
|
|
12085
12135
|
var import_persistence3 = require("@pixerate/editor/persistence");
|
|
12086
|
-
var
|
|
12136
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12087
12137
|
var RecoveryPrompt = ({
|
|
12088
12138
|
recovery,
|
|
12089
12139
|
onRestore,
|
|
@@ -12095,7 +12145,7 @@ var RecoveryPrompt = ({
|
|
|
12095
12145
|
}) => {
|
|
12096
12146
|
if (!recovery) return null;
|
|
12097
12147
|
const { name } = recovery.meta;
|
|
12098
|
-
return /* @__PURE__ */ (0,
|
|
12148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
12099
12149
|
"div",
|
|
12100
12150
|
{
|
|
12101
12151
|
role: "alertdialog",
|
|
@@ -12103,15 +12153,15 @@ var RecoveryPrompt = ({
|
|
|
12103
12153
|
"data-recovery-prompt": "",
|
|
12104
12154
|
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}`,
|
|
12105
12155
|
children: [
|
|
12106
|
-
/* @__PURE__ */ (0,
|
|
12156
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
12107
12157
|
(0, import_persistence3.formatRecoveryMessage)(recovery.meta, formatTime),
|
|
12108
|
-
name ? /* @__PURE__ */ (0,
|
|
12158
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("span", { className: "ml-1 text-xs text-muted-foreground", children: [
|
|
12109
12159
|
"(",
|
|
12110
12160
|
name,
|
|
12111
12161
|
")"
|
|
12112
12162
|
] }) : null
|
|
12113
12163
|
] }),
|
|
12114
|
-
/* @__PURE__ */ (0,
|
|
12164
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
12115
12165
|
"button",
|
|
12116
12166
|
{
|
|
12117
12167
|
type: "button",
|
|
@@ -12121,7 +12171,7 @@ var RecoveryPrompt = ({
|
|
|
12121
12171
|
children: restoreLabel
|
|
12122
12172
|
}
|
|
12123
12173
|
),
|
|
12124
|
-
/* @__PURE__ */ (0,
|
|
12174
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
12125
12175
|
"button",
|
|
12126
12176
|
{
|
|
12127
12177
|
type: "button",
|
|
@@ -12137,17 +12187,17 @@ var RecoveryPrompt = ({
|
|
|
12137
12187
|
};
|
|
12138
12188
|
|
|
12139
12189
|
// src/generation/useGenerationPlan.ts
|
|
12140
|
-
var
|
|
12190
|
+
var import_react82 = require("react");
|
|
12141
12191
|
var import_generation = require("@pixerate/editor/generation");
|
|
12142
12192
|
function useGenerationPlan(request, capabilities, options = {}) {
|
|
12143
12193
|
const key = JSON.stringify([request, capabilities, options]);
|
|
12144
|
-
return (0,
|
|
12194
|
+
return (0, import_react82.useMemo)(() => (0, import_generation.planGenerationRequest)(request, capabilities, options), [key]);
|
|
12145
12195
|
}
|
|
12146
12196
|
function useJobProgress(options) {
|
|
12147
12197
|
const { startedAt, expectedMs, done, now, intervalMs = 1e3 } = options;
|
|
12148
|
-
const [tick, setTick] = (0,
|
|
12198
|
+
const [tick, setTick] = (0, import_react82.useState)(() => Date.now());
|
|
12149
12199
|
const ticking = !done && now === void 0;
|
|
12150
|
-
(0,
|
|
12200
|
+
(0, import_react82.useEffect)(() => {
|
|
12151
12201
|
if (!ticking) return;
|
|
12152
12202
|
setTick(Date.now());
|
|
12153
12203
|
const id = setInterval(() => setTick(Date.now()), Math.max(16, intervalMs));
|
|
@@ -12157,9 +12207,9 @@ function useJobProgress(options) {
|
|
|
12157
12207
|
}
|
|
12158
12208
|
|
|
12159
12209
|
// src/generation/GenerationSettings.tsx
|
|
12160
|
-
var
|
|
12210
|
+
var import_react83 = require("react");
|
|
12161
12211
|
var import_generation2 = require("@pixerate/editor/generation");
|
|
12162
|
-
var
|
|
12212
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12163
12213
|
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";
|
|
12164
12214
|
function Control({
|
|
12165
12215
|
control,
|
|
@@ -12169,7 +12219,7 @@ function Control({
|
|
|
12169
12219
|
}) {
|
|
12170
12220
|
const shown = value ?? control.defaultValue;
|
|
12171
12221
|
if (control.kind === "checkbox") {
|
|
12172
|
-
return /* @__PURE__ */ (0,
|
|
12222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12173
12223
|
"input",
|
|
12174
12224
|
{
|
|
12175
12225
|
id,
|
|
@@ -12181,7 +12231,7 @@ function Control({
|
|
|
12181
12231
|
);
|
|
12182
12232
|
}
|
|
12183
12233
|
if (control.kind === "select") {
|
|
12184
|
-
return /* @__PURE__ */ (0,
|
|
12234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
12185
12235
|
"select",
|
|
12186
12236
|
{
|
|
12187
12237
|
id,
|
|
@@ -12190,14 +12240,14 @@ function Control({
|
|
|
12190
12240
|
value: shown === void 0 ? "" : String(shown),
|
|
12191
12241
|
onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value)),
|
|
12192
12242
|
children: [
|
|
12193
|
-
shown === void 0 && /* @__PURE__ */ (0,
|
|
12194
|
-
control.options.map((option) => /* @__PURE__ */ (0,
|
|
12243
|
+
shown === void 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("option", { value: "", children: "Default" }),
|
|
12244
|
+
control.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("option", { value: String(option.value), children: option.label }, String(option.value)))
|
|
12195
12245
|
]
|
|
12196
12246
|
}
|
|
12197
12247
|
);
|
|
12198
12248
|
}
|
|
12199
12249
|
if (control.kind === "textarea") {
|
|
12200
|
-
return /* @__PURE__ */ (0,
|
|
12250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12201
12251
|
"textarea",
|
|
12202
12252
|
{
|
|
12203
12253
|
id,
|
|
@@ -12211,8 +12261,8 @@ function Control({
|
|
|
12211
12261
|
);
|
|
12212
12262
|
}
|
|
12213
12263
|
const numeric = typeof shown === "number" ? shown : void 0;
|
|
12214
|
-
return /* @__PURE__ */ (0,
|
|
12215
|
-
/* @__PURE__ */ (0,
|
|
12264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
12265
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12216
12266
|
"input",
|
|
12217
12267
|
{
|
|
12218
12268
|
id,
|
|
@@ -12226,7 +12276,7 @@ function Control({
|
|
|
12226
12276
|
onChange: (e) => onValue((0, import_generation2.parseControlValue)(control, e.target.value))
|
|
12227
12277
|
}
|
|
12228
12278
|
),
|
|
12229
|
-
control.kind === "range" && /* @__PURE__ */ (0,
|
|
12279
|
+
control.kind === "range" && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "w-10 text-right tabular-nums text-muted-foreground", "data-field-value": "", children: numeric ?? "\u2013" })
|
|
12230
12280
|
] });
|
|
12231
12281
|
}
|
|
12232
12282
|
var GenerationSettings = ({
|
|
@@ -12240,17 +12290,17 @@ var GenerationSettings = ({
|
|
|
12240
12290
|
renderReference,
|
|
12241
12291
|
className = ""
|
|
12242
12292
|
}) => {
|
|
12243
|
-
const baseId = (0,
|
|
12244
|
-
const controls = (0,
|
|
12293
|
+
const baseId = (0, import_react83.useId)();
|
|
12294
|
+
const controls = (0, import_react83.useMemo)(() => (0, import_generation2.getGenerationControls)(capabilities), [capabilities]);
|
|
12245
12295
|
const computed = useGenerationPlan(value, capabilities, { strategy });
|
|
12246
12296
|
const plan = planProp ?? computed;
|
|
12247
12297
|
const slots = (0, import_generation2.getReferenceSlots)(capabilities, value);
|
|
12248
|
-
return /* @__PURE__ */ (0,
|
|
12298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: `flex flex-col gap-3 text-sm ${className}`, "data-generation-settings": "", "data-model": capabilities.id, children: [
|
|
12249
12299
|
controls.map((control) => {
|
|
12250
12300
|
const id = `${baseId}-${control.key}`;
|
|
12251
|
-
return /* @__PURE__ */ (0,
|
|
12252
|
-
/* @__PURE__ */ (0,
|
|
12253
|
-
/* @__PURE__ */ (0,
|
|
12301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-col gap-1", "data-control": control.key, children: [
|
|
12302
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("label", { htmlFor: id, className: "text-xs font-medium text-muted-foreground", title: control.description, children: control.label }),
|
|
12303
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12254
12304
|
Control,
|
|
12255
12305
|
{
|
|
12256
12306
|
control,
|
|
@@ -12261,23 +12311,23 @@ var GenerationSettings = ({
|
|
|
12261
12311
|
)
|
|
12262
12312
|
] }, control.key);
|
|
12263
12313
|
}),
|
|
12264
|
-
slots.map((slot) => /* @__PURE__ */ (0,
|
|
12265
|
-
/* @__PURE__ */ (0,
|
|
12314
|
+
slots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("fieldset", { className: "flex flex-col gap-1", "data-reference-role": slot.role, children: [
|
|
12315
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("legend", { className: "text-xs font-medium text-muted-foreground", title: slot.description, children: [
|
|
12266
12316
|
slot.label,
|
|
12267
12317
|
" ",
|
|
12268
|
-
/* @__PURE__ */ (0,
|
|
12318
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "tabular-nums", "data-reference-count": "", children: [
|
|
12269
12319
|
"(",
|
|
12270
12320
|
slot.references.length,
|
|
12271
12321
|
"/",
|
|
12272
12322
|
slot.max,
|
|
12273
12323
|
")"
|
|
12274
12324
|
] }),
|
|
12275
|
-
slot.min > 0 && /* @__PURE__ */ (0,
|
|
12325
|
+
slot.min > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-destructive", children: " *" })
|
|
12276
12326
|
] }),
|
|
12277
|
-
/* @__PURE__ */ (0,
|
|
12278
|
-
slot.references.map((ref) => /* @__PURE__ */ (0,
|
|
12279
|
-
renderReference ? renderReference(ref) : /* @__PURE__ */ (0,
|
|
12280
|
-
/* @__PURE__ */ (0,
|
|
12327
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("ul", { className: "flex flex-wrap gap-1", children: [
|
|
12328
|
+
slot.references.map((ref) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("li", { className: "flex items-center gap-1 rounded border border-border px-1.5 py-0.5", "data-reference-id": ref.id, children: [
|
|
12329
|
+
renderReference ? renderReference(ref) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "max-w-[10rem] truncate", children: ref.id }),
|
|
12330
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12281
12331
|
"button",
|
|
12282
12332
|
{
|
|
12283
12333
|
type: "button",
|
|
@@ -12288,7 +12338,7 @@ var GenerationSettings = ({
|
|
|
12288
12338
|
}
|
|
12289
12339
|
)
|
|
12290
12340
|
] }, ref.id)),
|
|
12291
|
-
onAddReference && slot.canAdd && /* @__PURE__ */ (0,
|
|
12341
|
+
onAddReference && slot.canAdd && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
12292
12342
|
"button",
|
|
12293
12343
|
{
|
|
12294
12344
|
type: "button",
|
|
@@ -12299,21 +12349,21 @@ var GenerationSettings = ({
|
|
|
12299
12349
|
) })
|
|
12300
12350
|
] })
|
|
12301
12351
|
] }, slot.role)),
|
|
12302
|
-
showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0,
|
|
12303
|
-
showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0,
|
|
12352
|
+
showAdjustments && plan.adjustments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.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_runtime60.jsx)("li", { "data-adjustment-field": adjustment.field, "data-adjustment-kind": adjustment.kind, children: adjustment.reason }, index)) }),
|
|
12353
|
+
showAdjustments && plan.errors.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.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_runtime60.jsx)("li", { "data-error-field": error.field, children: error.message }, index)) })
|
|
12304
12354
|
] });
|
|
12305
12355
|
};
|
|
12306
12356
|
|
|
12307
12357
|
// src/generation/JobProgress.tsx
|
|
12308
|
-
var
|
|
12358
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12309
12359
|
var JobProgress = ({ title, className = "", ...options }) => {
|
|
12310
12360
|
const progress = useJobProgress(options);
|
|
12311
|
-
return /* @__PURE__ */ (0,
|
|
12312
|
-
/* @__PURE__ */ (0,
|
|
12313
|
-
title && /* @__PURE__ */ (0,
|
|
12314
|
-
/* @__PURE__ */ (0,
|
|
12361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: `flex flex-col gap-1 text-sm ${className}`, "data-job-progress": "", "data-done": options.done ? "" : void 0, children: [
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center justify-between gap-2 text-muted-foreground", children: [
|
|
12363
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "truncate text-foreground", children: title }),
|
|
12364
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { "data-job-progress-label": "", "aria-live": "polite", children: progress.label })
|
|
12315
12365
|
] }),
|
|
12316
|
-
/* @__PURE__ */ (0,
|
|
12366
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12317
12367
|
"div",
|
|
12318
12368
|
{
|
|
12319
12369
|
role: "progressbar",
|
|
@@ -12323,7 +12373,7 @@ var JobProgress = ({ title, className = "", ...options }) => {
|
|
|
12323
12373
|
"aria-valuenow": progress.percent,
|
|
12324
12374
|
"aria-valuetext": `${progress.percent}%, ${progress.label}`,
|
|
12325
12375
|
className: "h-1.5 w-full overflow-hidden rounded-full bg-muted",
|
|
12326
|
-
children: /* @__PURE__ */ (0,
|
|
12376
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
12327
12377
|
"div",
|
|
12328
12378
|
{
|
|
12329
12379
|
className: "h-full rounded-full bg-primary transition-[width] duration-500",
|
|
@@ -12336,9 +12386,9 @@ var JobProgress = ({ title, className = "", ...options }) => {
|
|
|
12336
12386
|
};
|
|
12337
12387
|
|
|
12338
12388
|
// src/generation/AssetMentionChips.tsx
|
|
12339
|
-
var
|
|
12389
|
+
var import_react84 = require("react");
|
|
12340
12390
|
var import_generation3 = require("@pixerate/editor/generation");
|
|
12341
|
-
var
|
|
12391
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
12342
12392
|
var AssetMentionChips = ({
|
|
12343
12393
|
content,
|
|
12344
12394
|
onChange,
|
|
@@ -12348,14 +12398,14 @@ var AssetMentionChips = ({
|
|
|
12348
12398
|
renderAsset,
|
|
12349
12399
|
className = ""
|
|
12350
12400
|
}) => {
|
|
12351
|
-
const [open, setOpen] = (0,
|
|
12352
|
-
const rootRef = (0,
|
|
12353
|
-
const chips = (0,
|
|
12401
|
+
const [open, setOpen] = (0, import_react84.useState)(null);
|
|
12402
|
+
const rootRef = (0, import_react84.useRef)(null);
|
|
12403
|
+
const chips = (0, import_react84.useMemo)(
|
|
12354
12404
|
() => (0, import_generation3.describeAssetMentions)((0, import_generation3.findTextMentions)(content), assets, capabilities),
|
|
12355
12405
|
[content, assets, capabilities]
|
|
12356
12406
|
);
|
|
12357
12407
|
const options = roles ?? (capabilities ? (0, import_generation3.getAssetRoleOptions)(capabilities) : (0, import_generation3.defaultAssetRoleOptions)());
|
|
12358
|
-
(0,
|
|
12408
|
+
(0, import_react84.useEffect)(() => {
|
|
12359
12409
|
if (open === null) return;
|
|
12360
12410
|
const onPointer = (event) => {
|
|
12361
12411
|
if (!rootRef.current?.contains(event.target)) setOpen(null);
|
|
@@ -12369,13 +12419,13 @@ var AssetMentionChips = ({
|
|
|
12369
12419
|
onChange((0, import_generation3.setMentionRoleInText)(content, chip2.start, role));
|
|
12370
12420
|
};
|
|
12371
12421
|
if (chips.length === 0) return null;
|
|
12372
|
-
return /* @__PURE__ */ (0,
|
|
12422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { ref: rootRef, className: `flex flex-wrap gap-1.5 ${className}`, "data-asset-mention-chips": "", children: chips.map((chip2) => {
|
|
12373
12423
|
const error = chip2.issues.find((issue) => issue.severity === "error");
|
|
12374
12424
|
const warning = chip2.issues.find((issue) => issue.severity === "warning");
|
|
12375
12425
|
const problem = error ?? warning;
|
|
12376
12426
|
const isOpen = open === chip2.index;
|
|
12377
|
-
return /* @__PURE__ */ (0,
|
|
12378
|
-
/* @__PURE__ */ (0,
|
|
12427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("span", { className: "relative inline-flex", "data-asset-chip": chip2.asset.id, children: [
|
|
12428
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
12379
12429
|
"button",
|
|
12380
12430
|
{
|
|
12381
12431
|
type: "button",
|
|
@@ -12389,8 +12439,8 @@ var AssetMentionChips = ({
|
|
|
12389
12439
|
},
|
|
12390
12440
|
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`,
|
|
12391
12441
|
children: [
|
|
12392
|
-
/* @__PURE__ */ (0,
|
|
12393
|
-
/* @__PURE__ */ (0,
|
|
12442
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: renderAsset ? renderAsset(chip2) : `@${chip2.asset.label ?? chip2.handle}` }),
|
|
12443
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
12394
12444
|
"span",
|
|
12395
12445
|
{
|
|
12396
12446
|
className: `rounded px-1 text-[10px] uppercase tracking-wide ${chip2.role ? "bg-primary/15" : "opacity-60"}`,
|
|
@@ -12401,7 +12451,7 @@ var AssetMentionChips = ({
|
|
|
12401
12451
|
]
|
|
12402
12452
|
}
|
|
12403
12453
|
),
|
|
12404
|
-
isOpen && /* @__PURE__ */ (0,
|
|
12454
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
12405
12455
|
"div",
|
|
12406
12456
|
{
|
|
12407
12457
|
role: "listbox",
|
|
@@ -12412,7 +12462,7 @@ var AssetMentionChips = ({
|
|
|
12412
12462
|
if (e.key === "Escape") setOpen(null);
|
|
12413
12463
|
},
|
|
12414
12464
|
children: [
|
|
12415
|
-
options.map((option) => /* @__PURE__ */ (0,
|
|
12465
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
12416
12466
|
"button",
|
|
12417
12467
|
{
|
|
12418
12468
|
type: "button",
|
|
@@ -12423,13 +12473,13 @@ var AssetMentionChips = ({
|
|
|
12423
12473
|
onClick: () => pick(chip2, option.role),
|
|
12424
12474
|
className: "flex items-center justify-between gap-2 rounded px-2 py-1 text-left hover:bg-muted",
|
|
12425
12475
|
children: [
|
|
12426
|
-
/* @__PURE__ */ (0,
|
|
12427
|
-
option.accepts?.length ? /* @__PURE__ */ (0,
|
|
12476
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: option.label }),
|
|
12477
|
+
option.accepts?.length ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "text-[10px] opacity-60", children: option.accepts.join(", ") }) : null
|
|
12428
12478
|
]
|
|
12429
12479
|
},
|
|
12430
12480
|
option.role
|
|
12431
12481
|
)),
|
|
12432
|
-
/* @__PURE__ */ (0,
|
|
12482
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
12433
12483
|
"button",
|
|
12434
12484
|
{
|
|
12435
12485
|
type: "button",
|
|
@@ -12441,7 +12491,7 @@ var AssetMentionChips = ({
|
|
|
12441
12491
|
children: "No role"
|
|
12442
12492
|
}
|
|
12443
12493
|
),
|
|
12444
|
-
chip2.issues.length > 0 && /* @__PURE__ */ (0,
|
|
12494
|
+
chip2.issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.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_runtime62.jsx)("li", { className: issue.severity === "error" ? "text-red-500" : "text-amber-500", children: issue.message }, i)) })
|
|
12445
12495
|
]
|
|
12446
12496
|
}
|
|
12447
12497
|
)
|
|
@@ -12450,15 +12500,15 @@ var AssetMentionChips = ({
|
|
|
12450
12500
|
};
|
|
12451
12501
|
|
|
12452
12502
|
// src/generation/GenerationHistory.tsx
|
|
12453
|
-
var
|
|
12503
|
+
var import_react85 = require("react");
|
|
12454
12504
|
var import_generation4 = require("@pixerate/editor/generation");
|
|
12455
|
-
var
|
|
12505
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12456
12506
|
function useGenerationRecords(store, filter) {
|
|
12457
|
-
const [records, setRecords] = (0,
|
|
12458
|
-
const [loading, setLoading] = (0,
|
|
12459
|
-
const [error, setError] = (0,
|
|
12507
|
+
const [records, setRecords] = (0, import_react85.useState)([]);
|
|
12508
|
+
const [loading, setLoading] = (0, import_react85.useState)(!!store);
|
|
12509
|
+
const [error, setError] = (0, import_react85.useState)(null);
|
|
12460
12510
|
const filterKey = (0, import_generation4.stableStringify)(filter ?? {});
|
|
12461
|
-
const refresh = (0,
|
|
12511
|
+
const refresh = (0, import_react85.useCallback)(async () => {
|
|
12462
12512
|
if (!store) {
|
|
12463
12513
|
setRecords([]);
|
|
12464
12514
|
setLoading(false);
|
|
@@ -12475,7 +12525,7 @@ function useGenerationRecords(store, filter) {
|
|
|
12475
12525
|
setLoading(false);
|
|
12476
12526
|
}
|
|
12477
12527
|
}, [store, filterKey]);
|
|
12478
|
-
(0,
|
|
12528
|
+
(0, import_react85.useEffect)(() => {
|
|
12479
12529
|
void refresh();
|
|
12480
12530
|
if (!store) return;
|
|
12481
12531
|
return store.subscribe(() => void refresh());
|
|
@@ -12501,21 +12551,21 @@ var GenerationHistory = ({
|
|
|
12501
12551
|
emptyText = "No generations yet.",
|
|
12502
12552
|
className = ""
|
|
12503
12553
|
}) => {
|
|
12504
|
-
const [innerMode, setInnerMode] = (0,
|
|
12554
|
+
const [innerMode, setInnerMode] = (0, import_react85.useState)("exact");
|
|
12505
12555
|
const mode = modeProp ?? innerMode;
|
|
12506
12556
|
const setMode = (next) => {
|
|
12507
12557
|
if (modeProp === void 0) setInnerMode(next);
|
|
12508
12558
|
onModeChange?.(next);
|
|
12509
12559
|
};
|
|
12510
|
-
const options = (0,
|
|
12511
|
-
const results = (0,
|
|
12512
|
-
const models = (0,
|
|
12560
|
+
const options = (0, import_react85.useMemo)(() => ({ templates, capabilities, assets, mode }), [templates, capabilities, assets, mode]);
|
|
12561
|
+
const results = (0, import_react85.useMemo)(() => records.map((record) => (0, import_generation4.recreateRequest)(record, options)), [records, options]);
|
|
12562
|
+
const models = (0, import_react85.useMemo)(
|
|
12513
12563
|
() => capabilities ? Array.isArray(capabilities) ? capabilities : [capabilities] : [],
|
|
12514
12564
|
[capabilities]
|
|
12515
12565
|
);
|
|
12516
|
-
return /* @__PURE__ */ (0,
|
|
12517
|
-
/* @__PURE__ */ (0,
|
|
12518
|
-
/* @__PURE__ */ (0,
|
|
12566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: `flex flex-col gap-2 text-sm ${className}`, "data-generation-history": "", children: [
|
|
12567
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsxs)("label", { className: "inline-flex items-center gap-1", children: [
|
|
12568
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12519
12569
|
"input",
|
|
12520
12570
|
{
|
|
12521
12571
|
type: "radio",
|
|
@@ -12528,34 +12578,34 @@ var GenerationHistory = ({
|
|
|
12528
12578
|
),
|
|
12529
12579
|
value === "exact" ? "Exact (recorded versions)" : "Latest templates & settings"
|
|
12530
12580
|
] }, value)) }),
|
|
12531
|
-
records.length === 0 && /* @__PURE__ */ (0,
|
|
12532
|
-
/* @__PURE__ */ (0,
|
|
12581
|
+
records.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs text-muted-foreground", children: emptyText }),
|
|
12582
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("ul", { className: "flex flex-col gap-2", children: records.map((record, i) => {
|
|
12533
12583
|
const result = results[i];
|
|
12534
12584
|
const model = models.find((m) => m.id === record.provenance.modelId);
|
|
12535
12585
|
const blocked = !result.ok;
|
|
12536
|
-
return /* @__PURE__ */ (0,
|
|
12586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
12537
12587
|
"li",
|
|
12538
12588
|
{
|
|
12539
12589
|
className: "rounded-md border border-border p-2",
|
|
12540
12590
|
"data-record": record.id,
|
|
12541
12591
|
"data-drift": result.drift.length,
|
|
12542
12592
|
children: [
|
|
12543
|
-
/* @__PURE__ */ (0,
|
|
12544
|
-
/* @__PURE__ */ (0,
|
|
12545
|
-
/* @__PURE__ */ (0,
|
|
12546
|
-
record.kind !== "generate" && /* @__PURE__ */ (0,
|
|
12593
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs", children: [
|
|
12594
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "font-medium", children: model?.name ?? record.provenance.modelId }),
|
|
12595
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
12596
|
+
record.kind !== "generate" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("span", { "data-kind": "", children: [
|
|
12547
12597
|
record.kind,
|
|
12548
12598
|
" \xB7 "
|
|
12549
12599
|
] }),
|
|
12550
|
-
/* @__PURE__ */ (0,
|
|
12551
|
-
record.seed !== void 0 && /* @__PURE__ */ (0,
|
|
12600
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("time", { dateTime: record.createdAt, children: record.createdAt.replace("T", " ").slice(0, 16) }),
|
|
12601
|
+
record.seed !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
12552
12602
|
" \xB7 seed ",
|
|
12553
12603
|
record.seed
|
|
12554
12604
|
] })
|
|
12555
12605
|
] })
|
|
12556
12606
|
] }),
|
|
12557
|
-
/* @__PURE__ */ (0,
|
|
12558
|
-
record.assets.length > 0 && /* @__PURE__ */ (0,
|
|
12607
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "mt-1 line-clamp-3 break-words text-xs", "data-record-prompt": "", children: record.provenance.resolvedPrompt }),
|
|
12608
|
+
record.assets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-1 flex flex-wrap gap-1", children: record.assets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
12559
12609
|
"span",
|
|
12560
12610
|
{
|
|
12561
12611
|
className: "rounded-full bg-muted px-2 py-0.5 text-[10px]",
|
|
@@ -12569,16 +12619,16 @@ var GenerationHistory = ({
|
|
|
12569
12619
|
`${asset.role}:${asset.id}`
|
|
12570
12620
|
)) }),
|
|
12571
12621
|
renderPreview?.(record),
|
|
12572
|
-
result.drift.length > 0 && /* @__PURE__ */ (0,
|
|
12573
|
-
/* @__PURE__ */ (0,
|
|
12622
|
+
result.drift.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.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_runtime63.jsxs)("li", { className: severityClass[item.severity], "data-drift-type": item.type, children: [
|
|
12623
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("strong", { children: [
|
|
12574
12624
|
import_generation4.DRIFT_TYPE_LABELS[item.type],
|
|
12575
12625
|
":"
|
|
12576
12626
|
] }),
|
|
12577
12627
|
" ",
|
|
12578
12628
|
item.message
|
|
12579
12629
|
] }, j)) }),
|
|
12580
|
-
/* @__PURE__ */ (0,
|
|
12581
|
-
onRecreate && /* @__PURE__ */ (0,
|
|
12630
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "mt-2 flex gap-2", children: [
|
|
12631
|
+
onRecreate && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12582
12632
|
"button",
|
|
12583
12633
|
{
|
|
12584
12634
|
type: "button",
|
|
@@ -12590,7 +12640,7 @@ var GenerationHistory = ({
|
|
|
12590
12640
|
children: "Recreate"
|
|
12591
12641
|
}
|
|
12592
12642
|
),
|
|
12593
|
-
onVariation && /* @__PURE__ */ (0,
|
|
12643
|
+
onVariation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12594
12644
|
"button",
|
|
12595
12645
|
{
|
|
12596
12646
|
type: "button",
|
|
@@ -12600,7 +12650,7 @@ var GenerationHistory = ({
|
|
|
12600
12650
|
children: "Variation"
|
|
12601
12651
|
}
|
|
12602
12652
|
),
|
|
12603
|
-
onRemove && /* @__PURE__ */ (0,
|
|
12653
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
12604
12654
|
"button",
|
|
12605
12655
|
{
|
|
12606
12656
|
type: "button",
|
|
@@ -12620,19 +12670,19 @@ var GenerationHistory = ({
|
|
|
12620
12670
|
};
|
|
12621
12671
|
|
|
12622
12672
|
// src/find-replace/useFindReplace.ts
|
|
12623
|
-
var
|
|
12673
|
+
var import_react86 = require("react");
|
|
12624
12674
|
var import_editor17 = require("@pixerate/editor");
|
|
12625
12675
|
var noopUnsubscribe2 = () => {
|
|
12626
12676
|
};
|
|
12627
12677
|
function useFindReplace(editor) {
|
|
12628
12678
|
const store = (0, import_editor17.getFindReplaceStore)(editor ?? null);
|
|
12629
|
-
const subscribe = (0,
|
|
12679
|
+
const subscribe = (0, import_react86.useCallback)(
|
|
12630
12680
|
(onChange) => store ? store.subscribe(() => onChange()) : noopUnsubscribe2,
|
|
12631
12681
|
[store]
|
|
12632
12682
|
);
|
|
12633
12683
|
const getSnapshot2 = () => store?.getSnapshot() ?? import_editor17.EMPTY_FIND_REPLACE_SNAPSHOT;
|
|
12634
|
-
const snapshot = (0,
|
|
12635
|
-
return (0,
|
|
12684
|
+
const snapshot = (0, import_react86.useSyncExternalStore)(subscribe, getSnapshot2, getSnapshot2);
|
|
12685
|
+
return (0, import_react86.useMemo)(() => {
|
|
12636
12686
|
const run = (fn) => {
|
|
12637
12687
|
if (editor && !editor.isDestroyed && store) fn(editor);
|
|
12638
12688
|
};
|
|
@@ -12656,9 +12706,9 @@ function useFindReplace(editor) {
|
|
|
12656
12706
|
}
|
|
12657
12707
|
|
|
12658
12708
|
// src/find-replace/FindReplaceBar.tsx
|
|
12659
|
-
var
|
|
12709
|
+
var import_react87 = require("react");
|
|
12660
12710
|
var import_editor18 = require("@pixerate/editor");
|
|
12661
|
-
var
|
|
12711
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
12662
12712
|
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";
|
|
12663
12713
|
var buttonClass5 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
|
|
12664
12714
|
var toggleClass = (on) => `${buttonClass5} font-mono ${on ? "bg-primary/10 text-primary" : "text-muted-foreground"}`;
|
|
@@ -12671,10 +12721,10 @@ var FindReplaceBar = ({
|
|
|
12671
12721
|
onClose
|
|
12672
12722
|
}) => {
|
|
12673
12723
|
const find = useFindReplace(editor);
|
|
12674
|
-
const findInput = (0,
|
|
12675
|
-
const [moreOpen, setMoreOpen] = (0,
|
|
12724
|
+
const findInput = (0, import_react87.useRef)(null);
|
|
12725
|
+
const [moreOpen, setMoreOpen] = (0, import_react87.useState)(false);
|
|
12676
12726
|
const visible = find.available && (alwaysOpen || find.open);
|
|
12677
|
-
(0,
|
|
12727
|
+
(0, import_react87.useEffect)(() => {
|
|
12678
12728
|
if (!visible || find.focusRequest === 0) return;
|
|
12679
12729
|
findInput.current?.focus();
|
|
12680
12730
|
findInput.current?.select();
|
|
@@ -12712,9 +12762,9 @@ var FindReplaceBar = ({
|
|
|
12712
12762
|
if (isMod(e)) find.replaceAll();
|
|
12713
12763
|
else find.replace();
|
|
12714
12764
|
};
|
|
12715
|
-
return /* @__PURE__ */ (0,
|
|
12716
|
-
/* @__PURE__ */ (0,
|
|
12717
|
-
/* @__PURE__ */ (0,
|
|
12765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className, role: "search", "aria-label": "Find and replace", onKeyDown: onBarKeyDown, children: [
|
|
12766
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
12767
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12718
12768
|
"button",
|
|
12719
12769
|
{
|
|
12720
12770
|
type: "button",
|
|
@@ -12725,7 +12775,7 @@ var FindReplaceBar = ({
|
|
|
12725
12775
|
children: showReplace ? "\u25BE" : "\u25B8"
|
|
12726
12776
|
}
|
|
12727
12777
|
),
|
|
12728
|
-
/* @__PURE__ */ (0,
|
|
12778
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12729
12779
|
"input",
|
|
12730
12780
|
{
|
|
12731
12781
|
ref: findInput,
|
|
@@ -12739,7 +12789,7 @@ var FindReplaceBar = ({
|
|
|
12739
12789
|
onKeyDown: onFindKeyDown
|
|
12740
12790
|
}
|
|
12741
12791
|
),
|
|
12742
|
-
import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0,
|
|
12792
|
+
import_editor18.FIND_OPTION_TOGGLES.filter((t) => !t.advanced).map((t) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12743
12793
|
"button",
|
|
12744
12794
|
{
|
|
12745
12795
|
type: "button",
|
|
@@ -12752,7 +12802,7 @@ var FindReplaceBar = ({
|
|
|
12752
12802
|
},
|
|
12753
12803
|
t.key
|
|
12754
12804
|
)),
|
|
12755
|
-
/* @__PURE__ */ (0,
|
|
12805
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12756
12806
|
"span",
|
|
12757
12807
|
{
|
|
12758
12808
|
className: `min-w-[5rem] px-1 text-center text-xs ${find.error ? "text-destructive" : "text-muted-foreground"}`,
|
|
@@ -12762,9 +12812,9 @@ var FindReplaceBar = ({
|
|
|
12762
12812
|
children: status
|
|
12763
12813
|
}
|
|
12764
12814
|
),
|
|
12765
|
-
/* @__PURE__ */ (0,
|
|
12766
|
-
/* @__PURE__ */ (0,
|
|
12767
|
-
showMoreOptions && /* @__PURE__ */ (0,
|
|
12815
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Previous match", disabled: !hasMatches, onClick: find.previous, children: "\u2191" }),
|
|
12816
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Next match", disabled: !hasMatches, onClick: find.next, children: "\u2193" }),
|
|
12817
|
+
showMoreOptions && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12768
12818
|
"button",
|
|
12769
12819
|
{
|
|
12770
12820
|
type: "button",
|
|
@@ -12775,10 +12825,10 @@ var FindReplaceBar = ({
|
|
|
12775
12825
|
children: "\u2026"
|
|
12776
12826
|
}
|
|
12777
12827
|
),
|
|
12778
|
-
/* @__PURE__ */ (0,
|
|
12828
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Close find", onClick: close, children: "\xD7" })
|
|
12779
12829
|
] }),
|
|
12780
|
-
showReplace && /* @__PURE__ */ (0,
|
|
12781
|
-
/* @__PURE__ */ (0,
|
|
12830
|
+
showReplace && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-1 pl-7", children: [
|
|
12831
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12782
12832
|
"input",
|
|
12783
12833
|
{
|
|
12784
12834
|
type: "text",
|
|
@@ -12790,7 +12840,7 @@ var FindReplaceBar = ({
|
|
|
12790
12840
|
onKeyDown: onReplaceKeyDown
|
|
12791
12841
|
}
|
|
12792
12842
|
),
|
|
12793
|
-
/* @__PURE__ */ (0,
|
|
12843
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12794
12844
|
"button",
|
|
12795
12845
|
{
|
|
12796
12846
|
type: "button",
|
|
@@ -12800,11 +12850,11 @@ var FindReplaceBar = ({
|
|
|
12800
12850
|
children: "Replace"
|
|
12801
12851
|
}
|
|
12802
12852
|
),
|
|
12803
|
-
/* @__PURE__ */ (0,
|
|
12804
|
-
find.lastReplaceCount !== null && /* @__PURE__ */ (0,
|
|
12853
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("button", { type: "button", className: buttonClass5, disabled: !hasMatches, onClick: find.replaceAll, children: "Replace all" }),
|
|
12854
|
+
find.lastReplaceCount !== null && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "px-1 text-xs text-muted-foreground", "aria-live": "polite", children: find.lastReplaceCount === 1 ? "1 replaced" : `${find.lastReplaceCount} replaced` })
|
|
12805
12855
|
] }),
|
|
12806
|
-
showMoreOptions && moreOpen && /* @__PURE__ */ (0,
|
|
12807
|
-
/* @__PURE__ */ (0,
|
|
12856
|
+
showMoreOptions && moreOpen && /* @__PURE__ */ (0, import_jsx_runtime64.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_runtime64.jsxs)("label", { className: "flex items-center gap-1", children: [
|
|
12857
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
12808
12858
|
"input",
|
|
12809
12859
|
{
|
|
12810
12860
|
type: "checkbox",
|
|
@@ -12818,12 +12868,12 @@ var FindReplaceBar = ({
|
|
|
12818
12868
|
};
|
|
12819
12869
|
|
|
12820
12870
|
// src/tables/useTableMenu.ts
|
|
12821
|
-
var
|
|
12871
|
+
var import_react88 = require("react");
|
|
12822
12872
|
var import_editor19 = require("@pixerate/editor");
|
|
12823
12873
|
function useTableMenu(editor) {
|
|
12824
|
-
const store = (0,
|
|
12825
|
-
const snapshot = (0,
|
|
12826
|
-
return (0,
|
|
12874
|
+
const store = (0, import_react88.useMemo)(() => (0, import_editor19.createTableStore)(editor), [editor]);
|
|
12875
|
+
const snapshot = (0, import_react88.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
12876
|
+
return (0, import_react88.useMemo)(
|
|
12827
12877
|
() => ({
|
|
12828
12878
|
...snapshot,
|
|
12829
12879
|
run: (action, params) => (0, import_editor19.runTableAction)(editor, action, params, { focus: true }),
|
|
@@ -12834,9 +12884,9 @@ function useTableMenu(editor) {
|
|
|
12834
12884
|
}
|
|
12835
12885
|
|
|
12836
12886
|
// src/tables/TableToolbar.tsx
|
|
12837
|
-
var
|
|
12887
|
+
var import_react89 = __toESM(require("react"), 1);
|
|
12838
12888
|
var import_editor20 = require("@pixerate/editor");
|
|
12839
|
-
var
|
|
12889
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
12840
12890
|
var keepSelection2 = (event) => event.preventDefault();
|
|
12841
12891
|
var TableToolbar = ({
|
|
12842
12892
|
editor,
|
|
@@ -12850,14 +12900,14 @@ var TableToolbar = ({
|
|
|
12850
12900
|
}) => {
|
|
12851
12901
|
const table = useTableMenu(editor);
|
|
12852
12902
|
if (!editor || !table.inTable && !showWhenOutside) return null;
|
|
12853
|
-
return /* @__PURE__ */ (0,
|
|
12903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className, role: "toolbar", "aria-label": "Table", "data-table-toolbar": "", children: items.map((item, index) => {
|
|
12854
12904
|
const status = table.check(item.action, item.params);
|
|
12855
12905
|
const enabled = status === true;
|
|
12856
12906
|
const active = item.active?.(table);
|
|
12857
12907
|
const separator = index > 0 && items[index - 1].group !== item.group;
|
|
12858
|
-
return /* @__PURE__ */ (0,
|
|
12859
|
-
separator && /* @__PURE__ */ (0,
|
|
12860
|
-
/* @__PURE__ */ (0,
|
|
12908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_react89.default.Fragment, { children: [
|
|
12909
|
+
separator && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: separatorClassName, "aria-hidden": "true" }),
|
|
12910
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
12861
12911
|
"button",
|
|
12862
12912
|
{
|
|
12863
12913
|
type: "button",
|
|
@@ -12879,8 +12929,8 @@ var TableToolbar = ({
|
|
|
12879
12929
|
};
|
|
12880
12930
|
|
|
12881
12931
|
// src/tables/InsertTableGrid.tsx
|
|
12882
|
-
var
|
|
12883
|
-
var
|
|
12932
|
+
var import_react90 = require("react");
|
|
12933
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
12884
12934
|
var keepSelection3 = (event) => event.preventDefault();
|
|
12885
12935
|
var InsertTableGrid = ({
|
|
12886
12936
|
editor,
|
|
@@ -12893,14 +12943,14 @@ var InsertTableGrid = ({
|
|
|
12893
12943
|
onInsert
|
|
12894
12944
|
}) => {
|
|
12895
12945
|
const table = useTableMenu(editor);
|
|
12896
|
-
const [hover, setHover] = (0,
|
|
12946
|
+
const [hover, setHover] = (0, import_react90.useState)(null);
|
|
12897
12947
|
const status = table.actions.insertTable;
|
|
12898
12948
|
const disabled = !editor || !status.enabled;
|
|
12899
12949
|
const insert = (size) => {
|
|
12900
12950
|
if (table.run("insertTable", { ...size, withHeaderRow })) onInsert?.(size);
|
|
12901
12951
|
setHover(null);
|
|
12902
12952
|
};
|
|
12903
|
-
return /* @__PURE__ */ (0,
|
|
12953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
12904
12954
|
"div",
|
|
12905
12955
|
{
|
|
12906
12956
|
className,
|
|
@@ -12910,7 +12960,7 @@ var InsertTableGrid = ({
|
|
|
12910
12960
|
"data-insert-table-grid": "",
|
|
12911
12961
|
onMouseLeave: () => setHover(null),
|
|
12912
12962
|
children: [
|
|
12913
|
-
/* @__PURE__ */ (0,
|
|
12963
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12914
12964
|
"div",
|
|
12915
12965
|
{
|
|
12916
12966
|
role: "grid",
|
|
@@ -12919,7 +12969,7 @@ var InsertTableGrid = ({
|
|
|
12919
12969
|
children: Array.from({ length: rows * cols }, (_, i) => {
|
|
12920
12970
|
const size = { rows: Math.floor(i / cols) + 1, cols: i % cols + 1 };
|
|
12921
12971
|
const active = !!hover && size.rows <= hover.rows && size.cols <= hover.cols;
|
|
12922
|
-
return /* @__PURE__ */ (0,
|
|
12972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12923
12973
|
"button",
|
|
12924
12974
|
{
|
|
12925
12975
|
type: "button",
|
|
@@ -12939,7 +12989,7 @@ var InsertTableGrid = ({
|
|
|
12939
12989
|
})
|
|
12940
12990
|
}
|
|
12941
12991
|
),
|
|
12942
|
-
/* @__PURE__ */ (0,
|
|
12992
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { "aria-live": "polite", "data-testid": "insert-table-size", children: disabled ? status.reason : hover ? `${hover.rows} \xD7 ${hover.cols}` : "Insert table" })
|
|
12943
12993
|
]
|
|
12944
12994
|
}
|
|
12945
12995
|
);
|
|
@@ -12947,31 +12997,31 @@ var InsertTableGrid = ({
|
|
|
12947
12997
|
|
|
12948
12998
|
// src/tables/TableBubbleMenu.tsx
|
|
12949
12999
|
var import_editor21 = require("@pixerate/editor");
|
|
12950
|
-
var
|
|
13000
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
12951
13001
|
var TableBubbleMenu = ({
|
|
12952
13002
|
editor,
|
|
12953
13003
|
children,
|
|
12954
13004
|
toolbarProps,
|
|
12955
13005
|
pluginKey = "tableBubbleMenu",
|
|
12956
13006
|
...rest
|
|
12957
|
-
}) => /* @__PURE__ */ (0,
|
|
13007
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BubbleMenu, { editor, pluginKey, shouldShow: import_editor21.shouldShowTableBubbleMenu, ...rest, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TableToolbar, { editor, ...toolbarProps }) });
|
|
12958
13008
|
|
|
12959
13009
|
// src/chart-node/ChartNodeView.tsx
|
|
12960
13010
|
var import_client = require("react-dom/client");
|
|
12961
13011
|
|
|
12962
13012
|
// src/chart/ChartCanvas.tsx
|
|
12963
|
-
var
|
|
13013
|
+
var import_react92 = require("react");
|
|
12964
13014
|
var import_chart2 = require("@pixerate/editor/chart");
|
|
12965
13015
|
|
|
12966
13016
|
// src/chart/useChartEditor.ts
|
|
12967
|
-
var
|
|
13017
|
+
var import_react91 = require("react");
|
|
12968
13018
|
var import_chart = require("@pixerate/editor/chart");
|
|
12969
13019
|
function useChartState(controller) {
|
|
12970
|
-
return (0,
|
|
13020
|
+
return (0, import_react91.useSyncExternalStore)(controller.subscribe, controller.getState, controller.getState);
|
|
12971
13021
|
}
|
|
12972
13022
|
|
|
12973
13023
|
// src/chart/ChartCanvas.tsx
|
|
12974
|
-
var
|
|
13024
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12975
13025
|
function renderChartMark(mark, fontFamily, interactive) {
|
|
12976
13026
|
const common = {
|
|
12977
13027
|
"data-role": mark.role,
|
|
@@ -12983,9 +13033,9 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
12983
13033
|
};
|
|
12984
13034
|
switch (mark.kind) {
|
|
12985
13035
|
case "rect":
|
|
12986
|
-
return /* @__PURE__ */ (0,
|
|
13036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.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);
|
|
12987
13037
|
case "path":
|
|
12988
|
-
return /* @__PURE__ */ (0,
|
|
13038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12989
13039
|
"path",
|
|
12990
13040
|
{
|
|
12991
13041
|
...common,
|
|
@@ -12998,11 +13048,11 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
12998
13048
|
mark.key
|
|
12999
13049
|
);
|
|
13000
13050
|
case "circle":
|
|
13001
|
-
return /* @__PURE__ */ (0,
|
|
13051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("circle", { ...common, cx: mark.cx, cy: mark.cy, r: mark.r, style: { fill: mark.fill, stroke: mark.stroke, strokeWidth: mark.strokeWidth } }, mark.key);
|
|
13002
13052
|
case "line":
|
|
13003
|
-
return /* @__PURE__ */ (0,
|
|
13053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.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);
|
|
13004
13054
|
case "text":
|
|
13005
|
-
return /* @__PURE__ */ (0,
|
|
13055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
13006
13056
|
"text",
|
|
13007
13057
|
{
|
|
13008
13058
|
...common,
|
|
@@ -13019,36 +13069,36 @@ function renderChartMark(mark, fontFamily, interactive) {
|
|
|
13019
13069
|
}
|
|
13020
13070
|
}
|
|
13021
13071
|
function ChartPresenceLayer({ presence }) {
|
|
13022
|
-
const { actors } = (0,
|
|
13023
|
-
return /* @__PURE__ */ (0,
|
|
13024
|
-
/* @__PURE__ */ (0,
|
|
13025
|
-
/* @__PURE__ */ (0,
|
|
13026
|
-
/* @__PURE__ */ (0,
|
|
13027
|
-
/* @__PURE__ */ (0,
|
|
13072
|
+
const { actors } = (0, import_react92.useSyncExternalStore)(presence.subscribe, presence.getState, presence.getState);
|
|
13073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("g", { "data-chart-presence": "", pointerEvents: "none", children: actors.map((a) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("g", { transform: `translate(${a.x} ${a.y})`, "data-actor": a.id, children: [
|
|
13074
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.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 }),
|
|
13075
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("g", { transform: "translate(13 16)", children: [
|
|
13076
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.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 } }),
|
|
13077
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("text", { x: 6, y: 9, dominantBaseline: "central", style: { fill: "#ffffff", fontSize: 11, fontWeight: 600, fontFamily: "inherit" }, children: a.message ?? a.name })
|
|
13028
13078
|
] })
|
|
13029
13079
|
] }, a.id)) });
|
|
13030
13080
|
}
|
|
13031
13081
|
function ChartTooltipContent({ tooltip }) {
|
|
13032
|
-
return /* @__PURE__ */ (0,
|
|
13033
|
-
tooltip.title && /* @__PURE__ */ (0,
|
|
13034
|
-
tooltip.items.map((item) => /* @__PURE__ */ (0,
|
|
13035
|
-
/* @__PURE__ */ (0,
|
|
13036
|
-
/* @__PURE__ */ (0,
|
|
13037
|
-
/* @__PURE__ */ (0,
|
|
13082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
13083
|
+
tooltip.title && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "mb-1 font-medium", children: tooltip.title }),
|
|
13084
|
+
tooltip.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13085
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "h-2 w-2 shrink-0 rounded-full", style: { background: item.color } }),
|
|
13086
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { style: { color: "var(--muted-foreground, #64748b)" }, children: item.name }),
|
|
13087
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ml-auto pl-3 font-medium tabular-nums", children: item.text })
|
|
13038
13088
|
] }, item.seriesId))
|
|
13039
13089
|
] });
|
|
13040
13090
|
}
|
|
13041
13091
|
function ChartCanvas({ controller, width = 640, height = 400, responsive = true, theme, editable = true, measureText, emptyMessage, className, presence, sceneRef, tooltip = false, renderTooltip }) {
|
|
13042
13092
|
const state = useChartState(controller);
|
|
13043
|
-
const wrapper = (0,
|
|
13044
|
-
const svg = (0,
|
|
13045
|
-
const drag = (0,
|
|
13046
|
-
const [measured, setMeasured] = (0,
|
|
13047
|
-
const [frozen, setFrozen] = (0,
|
|
13093
|
+
const wrapper = (0, import_react92.useRef)(null);
|
|
13094
|
+
const svg = (0, import_react92.useRef)(null);
|
|
13095
|
+
const drag = (0, import_react92.useRef)(null);
|
|
13096
|
+
const [measured, setMeasured] = (0, import_react92.useState)(null);
|
|
13097
|
+
const [frozen, setFrozen] = (0, import_react92.useState)(null);
|
|
13048
13098
|
const tooltipMode = tooltip === true ? "point" : tooltip || null;
|
|
13049
|
-
const [tip, setTip] = (0,
|
|
13050
|
-
const [tipAt, setTipAt] = (0,
|
|
13051
|
-
(0,
|
|
13099
|
+
const [tip, setTip] = (0, import_react92.useState)(null);
|
|
13100
|
+
const [tipAt, setTipAt] = (0, import_react92.useState)({ left: 0, top: 0, flip: false });
|
|
13101
|
+
(0, import_react92.useEffect)(() => {
|
|
13052
13102
|
const el = wrapper.current;
|
|
13053
13103
|
if (!responsive || !el || typeof ResizeObserver === "undefined") return;
|
|
13054
13104
|
const observer = new ResizeObserver(([entry]) => {
|
|
@@ -13059,8 +13109,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13059
13109
|
return () => observer.disconnect();
|
|
13060
13110
|
}, [responsive]);
|
|
13061
13111
|
const sceneWidth = responsive && measured || width;
|
|
13062
|
-
const fullTheme = (0,
|
|
13063
|
-
const scene = (0,
|
|
13112
|
+
const fullTheme = (0, import_react92.useMemo)(() => ({ ...import_chart2.CSS_VARIABLE_CHART_THEME, ...theme }), [theme]);
|
|
13113
|
+
const scene = (0, import_react92.useMemo)(
|
|
13064
13114
|
() => (0, import_chart2.layoutChart)(state.spec, {
|
|
13065
13115
|
width: sceneWidth,
|
|
13066
13116
|
height,
|
|
@@ -13077,8 +13127,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13077
13127
|
[state.spec, state.selection, state.raceFrame, sceneWidth, height, fullTheme, editable, measureText, emptyMessage, frozen]
|
|
13078
13128
|
);
|
|
13079
13129
|
if (sceneRef) sceneRef.current = scene;
|
|
13080
|
-
const byKey = (0,
|
|
13081
|
-
(0,
|
|
13130
|
+
const byKey = (0, import_react92.useMemo)(() => new Map(scene.marks.map((m) => [m.key, m])), [scene]);
|
|
13131
|
+
(0, import_react92.useEffect)(() => () => drag.current?.end(), []);
|
|
13082
13132
|
const scenePoint = (e) => (0, import_chart2.chartClientToScene)(scene, svg.current.getBoundingClientRect(), e.clientX, e.clientY);
|
|
13083
13133
|
const onPointerDown = (e) => {
|
|
13084
13134
|
if (!editable || e.button !== 0) return;
|
|
@@ -13125,8 +13175,8 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13125
13175
|
if (editable && (0, import_chart2.handleChartKey)(controller, scene, e)) e.preventDefault();
|
|
13126
13176
|
};
|
|
13127
13177
|
const label = state.spec.title || "Chart";
|
|
13128
|
-
return /* @__PURE__ */ (0,
|
|
13129
|
-
/* @__PURE__ */ (0,
|
|
13178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { ref: wrapper, className: `relative w-full ${className ?? ""}`, "data-chart-canvas": "", children: [
|
|
13179
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
13130
13180
|
"svg",
|
|
13131
13181
|
{
|
|
13132
13182
|
ref: svg,
|
|
@@ -13145,11 +13195,11 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13145
13195
|
onKeyDown,
|
|
13146
13196
|
children: [
|
|
13147
13197
|
scene.marks.map((m) => renderChartMark(m, scene.theme.fontFamily, editable)),
|
|
13148
|
-
presence && /* @__PURE__ */ (0,
|
|
13198
|
+
presence && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartPresenceLayer, { presence })
|
|
13149
13199
|
]
|
|
13150
13200
|
}
|
|
13151
13201
|
),
|
|
13152
|
-
tip && /* @__PURE__ */ (0,
|
|
13202
|
+
tip && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
13153
13203
|
"div",
|
|
13154
13204
|
{
|
|
13155
13205
|
role: "tooltip",
|
|
@@ -13164,14 +13214,14 @@ function ChartCanvas({ controller, width = 640, height = 400, responsive = true,
|
|
|
13164
13214
|
borderColor: "var(--border, #e2e8f0)",
|
|
13165
13215
|
fontFamily: scene.theme.fontFamily
|
|
13166
13216
|
},
|
|
13167
|
-
children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0,
|
|
13217
|
+
children: renderTooltip ? renderTooltip(tip) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChartTooltipContent, { tooltip: tip })
|
|
13168
13218
|
}
|
|
13169
13219
|
)
|
|
13170
13220
|
] });
|
|
13171
13221
|
}
|
|
13172
13222
|
|
|
13173
13223
|
// src/chart/ChartDataGrid.tsx
|
|
13174
|
-
var
|
|
13224
|
+
var import_react93 = require("react");
|
|
13175
13225
|
var import_chart3 = require("@pixerate/editor/chart");
|
|
13176
13226
|
|
|
13177
13227
|
// src/chart/styles.ts
|
|
@@ -13184,11 +13234,11 @@ var chartSectionClass = "space-y-2 border-b border-border pb-3 last:border-b-0";
|
|
|
13184
13234
|
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";
|
|
13185
13235
|
|
|
13186
13236
|
// src/chart/ChartDataGrid.tsx
|
|
13187
|
-
var
|
|
13237
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
13188
13238
|
function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
13189
|
-
const [draft, setDraft] = (0,
|
|
13190
|
-
const typing = (0,
|
|
13191
|
-
(0,
|
|
13239
|
+
const [draft, setDraft] = (0, import_react93.useState)(value);
|
|
13240
|
+
const typing = (0, import_react93.useRef)(false);
|
|
13241
|
+
(0, import_react93.useEffect)(() => {
|
|
13192
13242
|
if (!typing.current) setDraft(value);
|
|
13193
13243
|
}, [value]);
|
|
13194
13244
|
const commit = () => {
|
|
@@ -13197,7 +13247,7 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
|
13197
13247
|
if (draft === value) return;
|
|
13198
13248
|
if (onCommit(draft) === false) setDraft(value);
|
|
13199
13249
|
};
|
|
13200
|
-
return /* @__PURE__ */ (0,
|
|
13250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13201
13251
|
"input",
|
|
13202
13252
|
{
|
|
13203
13253
|
...rest,
|
|
@@ -13226,20 +13276,20 @@ function ChartCommitInput({ value, onCommit, onKeyDown, onBlur, ...rest }) {
|
|
|
13226
13276
|
}
|
|
13227
13277
|
function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
13228
13278
|
const { spec } = useChartState(controller);
|
|
13229
|
-
const [columns, setColumns] = (0,
|
|
13279
|
+
const [columns, setColumns] = (0, import_react93.useState)(1);
|
|
13230
13280
|
const rows = (0, import_chart3.chartTreeToRows)(spec.tree);
|
|
13231
13281
|
const depth = Math.max(columns, (0, import_chart3.chartTreeDepth)(spec.tree));
|
|
13232
13282
|
const labels = (0, import_chart3.chartTreeColumnLabels)(depth);
|
|
13233
13283
|
const commit = (next) => controller.setTreeRows(next).ok;
|
|
13234
|
-
return /* @__PURE__ */ (0,
|
|
13235
|
-
/* @__PURE__ */ (0,
|
|
13236
|
-
/* @__PURE__ */ (0,
|
|
13237
|
-
labels.map((label) => /* @__PURE__ */ (0,
|
|
13238
|
-
/* @__PURE__ */ (0,
|
|
13239
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-tree-grid": "", children: [
|
|
13285
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13286
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
|
|
13287
|
+
labels.map((label) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
|
|
13288
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
|
|
13289
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border" })
|
|
13240
13290
|
] }) }),
|
|
13241
|
-
/* @__PURE__ */ (0,
|
|
13242
|
-
labels.map((_, k) => /* @__PURE__ */ (0,
|
|
13291
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: rows.map((row, r) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-tree-row": r, children: [
|
|
13292
|
+
labels.map((_, k) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13243
13293
|
ChartCommitInput,
|
|
13244
13294
|
{
|
|
13245
13295
|
value: row.path[k] ?? "",
|
|
@@ -13250,7 +13300,7 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
|
13250
13300
|
className: `${chartCellClass} text-left`
|
|
13251
13301
|
}
|
|
13252
13302
|
) }, k)),
|
|
13253
|
-
/* @__PURE__ */ (0,
|
|
13303
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13254
13304
|
ChartCommitInput,
|
|
13255
13305
|
{
|
|
13256
13306
|
value: String(row.value),
|
|
@@ -13263,14 +13313,14 @@ function ChartTreeGrid({ controller, readOnly = false, className }) {
|
|
|
13263
13313
|
className: chartCellClass
|
|
13264
13314
|
}
|
|
13265
13315
|
) }),
|
|
13266
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13316
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.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" }) })
|
|
13267
13317
|
] }, r)) })
|
|
13268
13318
|
] }),
|
|
13269
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13270
|
-
/* @__PURE__ */ (0,
|
|
13271
|
-
/* @__PURE__ */ (0,
|
|
13272
|
-
/* @__PURE__ */ (0,
|
|
13273
|
-
/* @__PURE__ */ (0,
|
|
13319
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
|
|
13320
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.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" }),
|
|
13321
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "tree-add-level", disabled: depth >= 6, onClick: () => setColumns(depth + 1), children: "+ Level" }),
|
|
13322
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "flex-1" }),
|
|
13323
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.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" })
|
|
13274
13324
|
] })
|
|
13275
13325
|
] });
|
|
13276
13326
|
}
|
|
@@ -13278,30 +13328,30 @@ function ChartLinksGrid({ controller, readOnly = false, className }) {
|
|
|
13278
13328
|
const { spec } = useChartState(controller);
|
|
13279
13329
|
const links = spec.links;
|
|
13280
13330
|
const commit = (next) => controller.setLinks(next).ok;
|
|
13281
|
-
return /* @__PURE__ */ (0,
|
|
13282
|
-
/* @__PURE__ */ (0,
|
|
13283
|
-
/* @__PURE__ */ (0,
|
|
13284
|
-
["Source", "Target"].map((label) => /* @__PURE__ */ (0,
|
|
13285
|
-
/* @__PURE__ */ (0,
|
|
13286
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", "data-chart-links-grid": "", children: [
|
|
13332
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13333
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
|
|
13334
|
+
["Source", "Target"].map((label) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: label }, label)),
|
|
13335
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-right font-medium text-muted-foreground", children: "Value" }),
|
|
13336
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border" })
|
|
13287
13337
|
] }) }),
|
|
13288
|
-
/* @__PURE__ */ (0,
|
|
13289
|
-
["source", "target"].map((field) => /* @__PURE__ */ (0,
|
|
13290
|
-
/* @__PURE__ */ (0,
|
|
13291
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13338
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: links.map((link, i) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-link-row": i, children: [
|
|
13339
|
+
["source", "target"].map((field) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.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)),
|
|
13340
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-r border-border p-0", children: /* @__PURE__ */ (0, import_jsx_runtime69.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 }) }),
|
|
13341
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.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" }) })
|
|
13292
13342
|
] }, i)) })
|
|
13293
13343
|
] }),
|
|
13294
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13295
|
-
/* @__PURE__ */ (0,
|
|
13296
|
-
/* @__PURE__ */ (0,
|
|
13297
|
-
links.length > 0 && /* @__PURE__ */ (0,
|
|
13344
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "flex flex-wrap gap-1 p-1", children: [
|
|
13345
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "link-add", onClick: () => commit((0, import_chart3.addChartLink)(links)), children: "+ Add flow" }),
|
|
13346
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "flex-1" }),
|
|
13347
|
+
links.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.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" })
|
|
13298
13348
|
] })
|
|
13299
13349
|
] });
|
|
13300
13350
|
}
|
|
13301
13351
|
function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = false, className }) {
|
|
13302
13352
|
const { spec, selection } = useChartState(controller);
|
|
13303
|
-
if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0,
|
|
13304
|
-
if (spec.tree.length) return /* @__PURE__ */ (0,
|
|
13353
|
+
if (spec.links.length || spec.type === "sankey") return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartLinksGrid, { controller, readOnly, className });
|
|
13354
|
+
if (spec.tree.length) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChartTreeGrid, { controller, readOnly, className });
|
|
13305
13355
|
const canGroup = spec.type === "treemap" || spec.type === "sunburst";
|
|
13306
13356
|
const paste = (row, column) => (e) => {
|
|
13307
13357
|
const text = e.clipboardData?.getData("text/plain") ?? "";
|
|
@@ -13309,15 +13359,15 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13309
13359
|
e.preventDefault();
|
|
13310
13360
|
controller.pasteCells(row, column, text);
|
|
13311
13361
|
};
|
|
13312
|
-
return /* @__PURE__ */ (0,
|
|
13313
|
-
/* @__PURE__ */ (0,
|
|
13314
|
-
/* @__PURE__ */ (0,
|
|
13315
|
-
/* @__PURE__ */ (0,
|
|
13362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: `overflow-auto rounded-md border border-border ${className ?? ""}`, "data-chart-grid": "", children: [
|
|
13363
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("table", { className: "w-full border-collapse text-xs", children: [
|
|
13364
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("thead", { className: "bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { children: [
|
|
13365
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border px-2 py-1 text-left font-medium text-muted-foreground", children: categoryHeader }),
|
|
13316
13366
|
spec.series.map((s, si) => {
|
|
13317
13367
|
const color = (0, import_chart3.chartSeriesColor)(spec, si);
|
|
13318
13368
|
const selected = selection?.kind === "series" && selection.seriesId === s.id;
|
|
13319
|
-
return /* @__PURE__ */ (0,
|
|
13320
|
-
/* @__PURE__ */ (0,
|
|
13369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.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_runtime69.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13370
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13321
13371
|
"input",
|
|
13322
13372
|
{
|
|
13323
13373
|
type: "color",
|
|
@@ -13330,7 +13380,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13330
13380
|
className: "h-5 w-5 shrink-0 cursor-pointer rounded border-0 bg-transparent p-0"
|
|
13331
13381
|
}
|
|
13332
13382
|
),
|
|
13333
|
-
/* @__PURE__ */ (0,
|
|
13383
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13334
13384
|
ChartCommitInput,
|
|
13335
13385
|
{
|
|
13336
13386
|
value: s.name,
|
|
@@ -13340,8 +13390,8 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13340
13390
|
className: `${chartInputClass} h-6 min-w-[5rem] border-transparent bg-transparent font-medium ${s.hidden ? "text-muted-foreground line-through" : ""}`
|
|
13341
13391
|
}
|
|
13342
13392
|
),
|
|
13343
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13344
|
-
/* @__PURE__ */ (0,
|
|
13393
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
13394
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13345
13395
|
"button",
|
|
13346
13396
|
{
|
|
13347
13397
|
type: "button",
|
|
@@ -13354,16 +13404,16 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13354
13404
|
children: s.hidden ? "\u25CB" : "\u25CF"
|
|
13355
13405
|
}
|
|
13356
13406
|
),
|
|
13357
|
-
/* @__PURE__ */ (0,
|
|
13407
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.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" })
|
|
13358
13408
|
] })
|
|
13359
13409
|
] }) }, s.id);
|
|
13360
13410
|
}),
|
|
13361
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13411
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "w-8 border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Add series", "aria-label": "Add series", "data-action": "add-series", onClick: () => controller.addSeries(), children: "+" }) })
|
|
13362
13412
|
] }) }),
|
|
13363
|
-
/* @__PURE__ */ (0,
|
|
13413
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("tbody", { children: spec.categories.map((category, i) => {
|
|
13364
13414
|
const rowSelected = selection?.kind === "category" && selection.index === i;
|
|
13365
|
-
return /* @__PURE__ */ (0,
|
|
13366
|
-
/* @__PURE__ */ (0,
|
|
13415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("tr", { "data-category-index": i, className: rowSelected ? "bg-primary/10" : void 0, children: [
|
|
13416
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("th", { className: "border-b border-r border-border p-0 text-left font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13367
13417
|
ChartCommitInput,
|
|
13368
13418
|
{
|
|
13369
13419
|
value: category,
|
|
@@ -13377,7 +13427,7 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13377
13427
|
spec.series.map((s) => {
|
|
13378
13428
|
const value = s.values[i];
|
|
13379
13429
|
const selected = selection?.kind === "point" && selection.seriesId === s.id && selection.index === i;
|
|
13380
|
-
return /* @__PURE__ */ (0,
|
|
13430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: `border-b border-r border-border p-0 ${selected ? "bg-primary/10" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13381
13431
|
ChartCommitInput,
|
|
13382
13432
|
{
|
|
13383
13433
|
value: value === null || value === void 0 ? "" : String(value),
|
|
@@ -13392,13 +13442,13 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13392
13442
|
}
|
|
13393
13443
|
) }, s.id);
|
|
13394
13444
|
}),
|
|
13395
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13445
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("td", { className: "border-b border-border px-1", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: chartIconButtonClass, title: "Delete category", "aria-label": `Delete ${category}`, "data-action": "remove-category", onClick: () => controller.removeCategory(i), children: "\xD7" }) })
|
|
13396
13446
|
] }, i);
|
|
13397
13447
|
}) })
|
|
13398
13448
|
] }),
|
|
13399
|
-
!readOnly && /* @__PURE__ */ (0,
|
|
13400
|
-
/* @__PURE__ */ (0,
|
|
13401
|
-
canGroup && /* @__PURE__ */ (0,
|
|
13449
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "p-1", children: [
|
|
13450
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("button", { type: "button", className: `${chartButtonClass} h-6 border-dashed`, "data-action": "add-category", onClick: () => controller.addCategory(), children: "+ Add category" }),
|
|
13451
|
+
canGroup && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13402
13452
|
"button",
|
|
13403
13453
|
{
|
|
13404
13454
|
type: "button",
|
|
@@ -13414,29 +13464,29 @@ function ChartDataGrid({ controller, categoryHeader = "Category", readOnly = fal
|
|
|
13414
13464
|
}
|
|
13415
13465
|
|
|
13416
13466
|
// src/chart/ChartInspector.tsx
|
|
13417
|
-
var
|
|
13467
|
+
var import_react94 = require("react");
|
|
13418
13468
|
var import_chart4 = require("@pixerate/editor/chart");
|
|
13419
|
-
var
|
|
13469
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13420
13470
|
var cap = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
13421
13471
|
function Field({ label, htmlFor, children }) {
|
|
13422
|
-
return /* @__PURE__ */ (0,
|
|
13423
|
-
/* @__PURE__ */ (0,
|
|
13424
|
-
/* @__PURE__ */ (0,
|
|
13472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13473
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor, className: `${chartLabelClass} w-20 shrink-0`, children: label }),
|
|
13474
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "min-w-0 flex-1", children })
|
|
13425
13475
|
] });
|
|
13426
13476
|
}
|
|
13427
13477
|
function Toggle({ label, checked, onChange, name }) {
|
|
13428
|
-
return /* @__PURE__ */ (0,
|
|
13429
|
-
/* @__PURE__ */ (0,
|
|
13478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-foreground", children: [
|
|
13479
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("input", { type: "checkbox", className: "h-3.5 w-3.5 accent-primary", checked, "data-option": name, onChange: (e) => onChange(e.currentTarget.checked) }),
|
|
13430
13480
|
label
|
|
13431
13481
|
] });
|
|
13432
13482
|
}
|
|
13433
13483
|
function Select({ id, value, options, onChange, name, labels }) {
|
|
13434
|
-
return /* @__PURE__ */ (0,
|
|
13484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("select", { id, className: chartInputClass, value, "data-option": name, onChange: (e) => onChange(e.currentTarget.value), children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: o, children: labels?.[o] ?? cap(o) }, o)) });
|
|
13435
13485
|
}
|
|
13436
13486
|
function AxisSection({ controller, axis, value, idBase, horizontal, numeric = false, scales = false }) {
|
|
13437
13487
|
const set = (patch) => controller.setAxis(axis, patch);
|
|
13438
13488
|
const setFormat = (patch) => set({ format: { ...value.format, ...patch } });
|
|
13439
|
-
const bound = (key2) => /* @__PURE__ */ (0,
|
|
13489
|
+
const bound = (key2) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13440
13490
|
ChartCommitInput,
|
|
13441
13491
|
{
|
|
13442
13492
|
id: `${idBase}-${axis}-${key2}`,
|
|
@@ -13451,26 +13501,26 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13451
13501
|
const name = axis === "x" ? numeric ? "X axis" : "Category axis" : axis === "y" ? "Value axis" : "Secondary axis";
|
|
13452
13502
|
const valueAxis = axis !== "x" || numeric;
|
|
13453
13503
|
const key = axis === "y2" ? "yAxis2" : `${axis}Axis`;
|
|
13454
|
-
return /* @__PURE__ */ (0,
|
|
13455
|
-
/* @__PURE__ */ (0,
|
|
13456
|
-
/* @__PURE__ */ (0,
|
|
13504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": `axis-${axis}`, children: [
|
|
13505
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13506
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("h4", { className: "text-xs font-semibold text-foreground", children: [
|
|
13457
13507
|
name,
|
|
13458
|
-
/* @__PURE__ */ (0,
|
|
13508
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ml-1 font-normal text-muted-foreground", children: [
|
|
13459
13509
|
"(",
|
|
13460
13510
|
axis === "x" ? horizontal ? "left" : "bottom" : axis === "y2" ? horizontal ? "top" : "right" : horizontal ? "bottom" : "left",
|
|
13461
13511
|
")"
|
|
13462
13512
|
] })
|
|
13463
13513
|
] }),
|
|
13464
|
-
/* @__PURE__ */ (0,
|
|
13514
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Show", name: `${axis}Axis.show`, checked: value.show, onChange: (show) => set({ show }) })
|
|
13465
13515
|
] }),
|
|
13466
|
-
/* @__PURE__ */ (0,
|
|
13467
|
-
/* @__PURE__ */ (0,
|
|
13468
|
-
/* @__PURE__ */ (0,
|
|
13469
|
-
axis === "x" && !numeric && /* @__PURE__ */ (0,
|
|
13470
|
-
scales && /* @__PURE__ */ (0,
|
|
13471
|
-
scales && valueAxis && /* @__PURE__ */ (0,
|
|
13516
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Title", htmlFor: `${idBase}-${axis}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-${axis}-title`, value: value.title, "data-option": `${axis}Axis.title`, className: chartInputClass, onCommit: (title) => void set({ title }) }) }),
|
|
13517
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
13518
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Grid lines", name: `${key}.gridlines`, checked: value.gridlines, onChange: (gridlines) => set({ gridlines }) }),
|
|
13519
|
+
axis === "x" && !numeric && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Dates", name: "xAxis.kind", checked: value.kind === "date", onChange: (dates) => set({ kind: dates ? "date" : void 0 }) }),
|
|
13520
|
+
scales && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Reverse", name: `${key}.reverse`, checked: !!value.reverse, onChange: (reverse) => set({ reverse }) }),
|
|
13521
|
+
scales && valueAxis && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Log scale", name: `${key}.scale`, checked: value.scale === "log", onChange: (log) => set({ scale: log ? "log" : "linear" }) })
|
|
13472
13522
|
] }),
|
|
13473
|
-
scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0,
|
|
13523
|
+
scales && valueAxis && value.scale === "log" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Log base", htmlFor: `${idBase}-${axis}-log-base`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13474
13524
|
ChartCommitInput,
|
|
13475
13525
|
{
|
|
13476
13526
|
id: `${idBase}-${axis}-log-base`,
|
|
@@ -13481,7 +13531,7 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13481
13531
|
onCommit: (text) => set({ logBase: text.trim() === "" ? void 0 : Number(text) }).ok
|
|
13482
13532
|
}
|
|
13483
13533
|
) }),
|
|
13484
|
-
valueAxis && value.scale !== "log" && /* @__PURE__ */ (0,
|
|
13534
|
+
valueAxis && value.scale !== "log" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Step", htmlFor: `${idBase}-${axis}-step`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13485
13535
|
ChartCommitInput,
|
|
13486
13536
|
{
|
|
13487
13537
|
id: `${idBase}-${axis}-step`,
|
|
@@ -13493,14 +13543,14 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13493
13543
|
onCommit: (text) => set({ step: text.trim() === "" ? null : Number(text) }).ok
|
|
13494
13544
|
}
|
|
13495
13545
|
) }),
|
|
13496
|
-
valueAxis && /* @__PURE__ */ (0,
|
|
13497
|
-
/* @__PURE__ */ (0,
|
|
13546
|
+
valueAxis && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
13547
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Min / max", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
|
|
13498
13548
|
bound("min"),
|
|
13499
13549
|
bound("max")
|
|
13500
13550
|
] }) }),
|
|
13501
|
-
/* @__PURE__ */ (0,
|
|
13502
|
-
/* @__PURE__ */ (0,
|
|
13503
|
-
/* @__PURE__ */ (0,
|
|
13551
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Format", htmlFor: `${idBase}-${axis}-format`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
|
|
13552
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13553
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13504
13554
|
ChartCommitInput,
|
|
13505
13555
|
{
|
|
13506
13556
|
value: value.format.decimals === void 0 ? "" : String(value.format.decimals),
|
|
@@ -13519,8 +13569,8 @@ function AxisSection({ controller, axis, value, idBase, horizontal, numeric = fa
|
|
|
13519
13569
|
}
|
|
13520
13570
|
)
|
|
13521
13571
|
] }) }),
|
|
13522
|
-
value.format.style === "currency" && /* @__PURE__ */ (0,
|
|
13523
|
-
/* @__PURE__ */ (0,
|
|
13572
|
+
value.format.style === "currency" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Currency", htmlFor: `${idBase}-${axis}-currency`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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() }) }) }),
|
|
13573
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Code", htmlFor: `${idBase}-${axis}-code`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13524
13574
|
ChartCommitInput,
|
|
13525
13575
|
{
|
|
13526
13576
|
id: `${idBase}-${axis}-code`,
|
|
@@ -13546,15 +13596,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
13546
13596
|
const values = which === "xErrorBars" ? series.x ?? [] : series.values;
|
|
13547
13597
|
const set = (next) => controller.updateSeries(series.id, { [which]: next });
|
|
13548
13598
|
const patch = (p) => bars && set({ ...bars, ...p });
|
|
13549
|
-
return /* @__PURE__ */ (0,
|
|
13550
|
-
/* @__PURE__ */ (0,
|
|
13551
|
-
/* @__PURE__ */ (0,
|
|
13552
|
-
import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-1.5", "data-section": which === "errorBars" ? "error-bars" : "x-error-bars", children: [
|
|
13600
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: which === "errorBars" ? "Error bars" : "X error bars", htmlFor: `${id}-type`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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: [
|
|
13601
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "None" }),
|
|
13602
|
+
import_chart4.CHART_ERROR_BAR_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: import_chart4.CHART_ERROR_BAR_LABELS[t] }, t))
|
|
13553
13603
|
] }) }),
|
|
13554
|
-
bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0,
|
|
13555
|
-
bars?.type === "custom" && /* @__PURE__ */ (0,
|
|
13556
|
-
/* @__PURE__ */ (0,
|
|
13557
|
-
/* @__PURE__ */ (0,
|
|
13604
|
+
bars && (bars.type === "fixed" || bars.type === "percent" || bars.type === "stddev") && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: bars.type === "percent" ? "Percent" : bars.type === "stddev" ? "Deviations" : "Amount", htmlFor: `${id}-value`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13605
|
+
bars?.type === "custom" && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
13606
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Plus", htmlFor: `${id}-plus`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13607
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Minus", htmlFor: `${id}-minus`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13558
13608
|
ChartCommitInput,
|
|
13559
13609
|
{
|
|
13560
13610
|
id: `${id}-minus`,
|
|
@@ -13571,15 +13621,15 @@ function ErrorBarFields({ controller, series, which, idBase }) {
|
|
|
13571
13621
|
}
|
|
13572
13622
|
) })
|
|
13573
13623
|
] }),
|
|
13574
|
-
bars && /* @__PURE__ */ (0,
|
|
13575
|
-
/* @__PURE__ */ (0,
|
|
13576
|
-
/* @__PURE__ */ (0,
|
|
13624
|
+
bars && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
13625
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsx)("option", { value: d, children: d === "both" ? "Both ways" : d === "plus" ? "Plus only" : "Minus only" }, d)) }),
|
|
13626
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Caps", name: `${key}.cap`, checked: bars.cap !== false, onChange: (cap2) => patch({ cap: cap2 }) })
|
|
13577
13627
|
] })
|
|
13578
13628
|
] });
|
|
13579
13629
|
}
|
|
13580
13630
|
function ChartInspector({ controller, sections, className }) {
|
|
13581
13631
|
const { spec, selectedSeries, selection, raceFrame, racePlaying } = useChartState(controller);
|
|
13582
|
-
const idBase = (0,
|
|
13632
|
+
const idBase = (0, import_react94.useId)();
|
|
13583
13633
|
const show = (section) => !sections || sections.includes(section);
|
|
13584
13634
|
const cartesian = (0, import_chart4.isCartesianChart)(spec.type);
|
|
13585
13635
|
const family = (0, import_chart4.chartFamily)(spec);
|
|
@@ -13594,30 +13644,30 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13594
13644
|
const annotated = scales;
|
|
13595
13645
|
const oneSeries = cartesian && spec.series.filter((s) => !s.hidden).length === 1;
|
|
13596
13646
|
const calloutIndex = selection?.kind === "point" && selection.seriesId === selectedSeries?.id ? selection.index : null;
|
|
13597
|
-
return /* @__PURE__ */ (0,
|
|
13598
|
-
show("type") && /* @__PURE__ */ (0,
|
|
13599
|
-
show("style") && /* @__PURE__ */ (0,
|
|
13600
|
-
/* @__PURE__ */ (0,
|
|
13601
|
-
/* @__PURE__ */ (0,
|
|
13602
|
-
import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0,
|
|
13647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: `space-y-3 text-xs ${className ?? ""}`, "data-chart-inspector": "", children: [
|
|
13648
|
+
show("type") && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: chartSectionClass, "data-section": "type", children: /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.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)) }) }),
|
|
13649
|
+
show("style") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "style", children: [
|
|
13650
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Layout", htmlFor: `${idBase}-layout`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("select", { id: `${idBase}-layout`, className: chartInputClass, value: "", "data-option": "preset.layout", onChange: (e) => e.currentTarget.value && controller.applyPreset({ layout: e.currentTarget.value }), children: [
|
|
13651
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Quick layout\u2026" }),
|
|
13652
|
+
import_chart4.CHART_LAYOUT_PRESETS.map((p) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: p.id, title: p.description, children: p.label }, p.id))
|
|
13603
13653
|
] }) }),
|
|
13604
|
-
/* @__PURE__ */ (0,
|
|
13605
|
-
/* @__PURE__ */ (0,
|
|
13606
|
-
import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0,
|
|
13654
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Colours", htmlFor: `${idBase}-colors`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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: [
|
|
13655
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Custom" }),
|
|
13656
|
+
import_chart4.CHART_COLOR_SCHEMES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: c.id, title: c.description, children: c.label }, c.id))
|
|
13607
13657
|
] }) }),
|
|
13608
|
-
!colorCheck.ok && /* @__PURE__ */ (0,
|
|
13609
|
-
/* @__PURE__ */ (0,
|
|
13658
|
+
!colorCheck.ok && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { className: "text-[11px] leading-snug text-amber-600 dark:text-amber-400", "data-chart-color-warning": "", children: colorCheck.issues[0] }),
|
|
13659
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "transpose", onClick: () => controller.transpose(), children: "Switch rows and columns" })
|
|
13610
13660
|
] }),
|
|
13611
|
-
show("titles") && /* @__PURE__ */ (0,
|
|
13612
|
-
/* @__PURE__ */ (0,
|
|
13613
|
-
/* @__PURE__ */ (0,
|
|
13614
|
-
/* @__PURE__ */ (0,
|
|
13661
|
+
show("titles") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "titles", children: [
|
|
13662
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Title", htmlFor: `${idBase}-title`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-title`, value: spec.title, "data-option": "title", className: chartInputClass, onCommit: (title) => void controller.setTitle(title) }) }),
|
|
13663
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Subtitle", htmlFor: `${idBase}-subtitle`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-subtitle`, value: spec.subtitle, "data-option": "subtitle", className: chartInputClass, onCommit: (subtitle) => void controller.setSubtitle(subtitle) }) }),
|
|
13664
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Note", htmlFor: `${idBase}-note`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-note`, value: spec.note, placeholder: "Source or footnote", "data-option": "note", className: chartInputClass, onCommit: (note) => void controller.setNote(note) }) })
|
|
13615
13665
|
] }),
|
|
13616
|
-
show("options") && /* @__PURE__ */ (0,
|
|
13617
|
-
cartesian && /* @__PURE__ */ (0,
|
|
13618
|
-
hasBars && /* @__PURE__ */ (0,
|
|
13619
|
-
hasLines && /* @__PURE__ */ (0,
|
|
13620
|
-
spec.type === "donut" && /* @__PURE__ */ (0,
|
|
13666
|
+
show("options") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "options", children: [
|
|
13667
|
+
cartesian && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Stacking", htmlFor: `${idBase}-stacking`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
|
|
13668
|
+
hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bars", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex gap-0.5 rounded-md bg-muted p-0.5", children: ["vertical", "horizontal"].map((o) => /* @__PURE__ */ (0, import_jsx_runtime70.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)) }) }),
|
|
13669
|
+
hasLines && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Lines", htmlFor: `${idBase}-curve`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Select, { id: `${idBase}-curve`, name: "curve", value: spec.curve, options: import_chart4.CHART_CURVES, onChange: (curve) => controller.update({ curve }) }) }),
|
|
13670
|
+
spec.type === "donut" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Hole", htmlFor: `${idBase}-hole`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13621
13671
|
"input",
|
|
13622
13672
|
{
|
|
13623
13673
|
id: `${idBase}-hole`,
|
|
@@ -13633,7 +13683,7 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13633
13683
|
onChange: (e) => controller.update({ innerRadius: Number(e.currentTarget.value) })
|
|
13634
13684
|
}
|
|
13635
13685
|
) }),
|
|
13636
|
-
hasBars && /* @__PURE__ */ (0,
|
|
13686
|
+
hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Spacing", htmlFor: `${idBase}-gap`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13637
13687
|
"input",
|
|
13638
13688
|
{
|
|
13639
13689
|
id: `${idBase}-gap`,
|
|
@@ -13649,9 +13699,9 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13649
13699
|
onChange: (e) => controller.update({ gapWidth: Number(e.currentTarget.value) })
|
|
13650
13700
|
}
|
|
13651
13701
|
) }),
|
|
13652
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13653
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13654
|
-
spec.type === "choropleth" && /* @__PURE__ */ (0,
|
|
13702
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Map", htmlFor: `${idBase}-map`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.jsx)("option", { value: id, children: (0, import_chart4.listChartMaps)().find((m) => m.id === id)?.name ?? `${id} (not loaded)` }, id)) }) }),
|
|
13703
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Classes", htmlFor: `${idBase}-map-steps`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13704
|
+
spec.type === "choropleth" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Breaks", htmlFor: `${idBase}-map-breaks`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13655
13705
|
ChartCommitInput,
|
|
13656
13706
|
{
|
|
13657
13707
|
id: `${idBase}-map-breaks`,
|
|
@@ -13662,10 +13712,10 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13662
13712
|
onCommit: (text) => controller.update({ mapThresholds: text.trim() ? text.split(",").map((t) => Number(t.trim())) : [] }).ok
|
|
13663
13713
|
}
|
|
13664
13714
|
) }),
|
|
13665
|
-
spec.type === "barrace" && /* @__PURE__ */ (0,
|
|
13666
|
-
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0,
|
|
13667
|
-
/* @__PURE__ */ (0,
|
|
13668
|
-
/* @__PURE__ */ (0,
|
|
13715
|
+
spec.type === "barrace" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bars", htmlFor: `${idBase}-race-top`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13716
|
+
spec.type === "barrace" && spec.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Time", htmlFor: `${idBase}-race-frame`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13717
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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" }),
|
|
13718
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13669
13719
|
"input",
|
|
13670
13720
|
{
|
|
13671
13721
|
id: `${idBase}-race-frame`,
|
|
@@ -13680,13 +13730,13 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13680
13730
|
onChange: (e) => controller.setRaceFrame(Number(e.currentTarget.value))
|
|
13681
13731
|
}
|
|
13682
13732
|
),
|
|
13683
|
-
/* @__PURE__ */ (0,
|
|
13733
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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)] })
|
|
13684
13734
|
] }) }),
|
|
13685
|
-
spec.type === "sankey" && /* @__PURE__ */ (0,
|
|
13686
|
-
spec.type === "sunburst" && /* @__PURE__ */ (0,
|
|
13687
|
-
spec.type === "likert" && /* @__PURE__ */ (0,
|
|
13688
|
-
spec.type === "likert" && /* @__PURE__ */ (0,
|
|
13689
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13735
|
+
spec.type === "sankey" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Flows", htmlFor: `${idBase}-sankey-color`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
|
|
13736
|
+
spec.type === "sunburst" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-sunburst-label`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-sunburst-label`, value: spec.sunburstLabel, placeholder: "Under the total", "data-option": "sunburstLabel", className: chartInputClass, onCommit: (sunburstLabel) => controller.update({ sunburstLabel }).ok }) }),
|
|
13737
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Neutral", htmlFor: `${idBase}-likert-neutral`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
|
|
13738
|
+
spec.type === "likert" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Order", htmlFor: `${idBase}-likert-sort`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
|
|
13739
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Sweep", htmlFor: `${idBase}-parliament-arc`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13690
13740
|
"input",
|
|
13691
13741
|
{
|
|
13692
13742
|
id: `${idBase}-parliament-arc`,
|
|
@@ -13702,34 +13752,34 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13702
13752
|
onChange: (e) => controller.update({ parliamentArc: Number(e.currentTarget.value) })
|
|
13703
13753
|
}
|
|
13704
13754
|
) }),
|
|
13705
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13706
|
-
spec.type === "parliament" && /* @__PURE__ */ (0,
|
|
13707
|
-
spec.type === "radar" && /* @__PURE__ */ (0,
|
|
13708
|
-
spec.type === "radar" && /* @__PURE__ */ (0,
|
|
13709
|
-
spec.dataLabels && hasBars && /* @__PURE__ */ (0,
|
|
13710
|
-
spec.type === "histogram" && /* @__PURE__ */ (0,
|
|
13711
|
-
/* @__PURE__ */ (0,
|
|
13712
|
-
spec.type === "waterfall" && /* @__PURE__ */ (0,
|
|
13713
|
-
hasLines && /* @__PURE__ */ (0,
|
|
13714
|
-
oneSeries && /* @__PURE__ */ (0,
|
|
13715
|
-
/* @__PURE__ */ (0,
|
|
13755
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Majority", htmlFor: `${idBase}-parliament-majority`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13756
|
+
spec.type === "parliament" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Caption", htmlFor: `${idBase}-parliament-label`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-parliament-label`, value: spec.parliamentLabel, placeholder: "seats", "data-option": "parliamentLabel", className: chartInputClass, onCommit: (parliamentLabel) => controller.update({ parliamentLabel }).ok }) }),
|
|
13757
|
+
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Rings", htmlFor: `${idBase}-radar-ticks`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13758
|
+
spec.type === "radar" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Grid", htmlFor: `${idBase}-radar-graticule`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }) }),
|
|
13759
|
+
spec.dataLabels && hasBars && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Labels", htmlFor: `${idBase}-label-position`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Select, { id: `${idBase}-label-position`, name: "labelPosition", value: spec.labelPosition, options: import_chart4.CHART_LABEL_POSITIONS, onChange: (labelPosition) => controller.update({ labelPosition }) }) }),
|
|
13760
|
+
spec.type === "histogram" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Bins", htmlFor: `${idBase}-bins`, children: /* @__PURE__ */ (0, import_jsx_runtime70.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 }) }),
|
|
13761
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
13762
|
+
spec.type === "waterfall" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Total bar", name: "showTotal", checked: spec.showTotal, onChange: (showTotal) => controller.update({ showTotal }) }),
|
|
13763
|
+
hasLines && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Points", name: "points", checked: spec.points, onChange: (points) => controller.update({ points }) }),
|
|
13764
|
+
oneSeries && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Colour by category", name: "varyColors", checked: spec.varyColors, onChange: (varyColors) => controller.update({ varyColors }) }),
|
|
13765
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Data labels", name: "dataLabels", checked: spec.dataLabels, onChange: (dataLabels) => controller.update({ dataLabels }) })
|
|
13716
13766
|
] })
|
|
13717
13767
|
] }),
|
|
13718
|
-
show("legend") && /* @__PURE__ */ (0,
|
|
13719
|
-
/* @__PURE__ */ (0,
|
|
13720
|
-
/* @__PURE__ */ (0,
|
|
13721
|
-
/* @__PURE__ */ (0,
|
|
13768
|
+
show("legend") && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "legend", children: [
|
|
13769
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
13770
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Legend" }),
|
|
13771
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Show", name: "legend.show", checked: spec.legend.show, onChange: (v) => controller.setLegend({ show: v }) })
|
|
13722
13772
|
] }),
|
|
13723
|
-
spec.legend.show && /* @__PURE__ */ (0,
|
|
13773
|
+
spec.legend.show && /* @__PURE__ */ (0, import_jsx_runtime70.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_runtime70.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)) })
|
|
13724
13774
|
] }),
|
|
13725
|
-
show("axes") && hasAxes && /* @__PURE__ */ (0,
|
|
13726
|
-
family !== "box" && family !== "histogram" && /* @__PURE__ */ (0,
|
|
13727
|
-
/* @__PURE__ */ (0,
|
|
13728
|
-
usesSecondary && /* @__PURE__ */ (0,
|
|
13775
|
+
show("axes") && hasAxes && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
13776
|
+
family !== "box" && family !== "histogram" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "x", value: spec.xAxis, idBase, horizontal: spec.orientation === "horizontal", numeric: family === "xy", scales }),
|
|
13777
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "y", value: spec.yAxis, idBase, horizontal: spec.orientation === "horizontal", scales }),
|
|
13778
|
+
usesSecondary && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AxisSection, { controller, axis: "y2", value: spec.yAxis2, idBase, horizontal: spec.orientation === "horizontal", scales })
|
|
13729
13779
|
] }),
|
|
13730
|
-
show("annotations") && annotated && /* @__PURE__ */ (0,
|
|
13731
|
-
/* @__PURE__ */ (0,
|
|
13732
|
-
/* @__PURE__ */ (0,
|
|
13780
|
+
show("annotations") && annotated && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "annotations", children: [
|
|
13781
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Annotations" }),
|
|
13782
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Highlight", htmlFor: `${idBase}-highlight`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13733
13783
|
ChartCommitInput,
|
|
13734
13784
|
{
|
|
13735
13785
|
id: `${idBase}-highlight`,
|
|
@@ -13740,27 +13790,27 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13740
13790
|
onCommit: (text) => controller.setHighlight(text.split(",").map((n) => n.trim()).filter(Boolean)).ok
|
|
13741
13791
|
}
|
|
13742
13792
|
) }),
|
|
13743
|
-
spec.referenceLines.map((line, i) => /* @__PURE__ */ (0,
|
|
13744
|
-
/* @__PURE__ */ (0,
|
|
13745
|
-
/* @__PURE__ */ (0,
|
|
13746
|
-
/* @__PURE__ */ (0,
|
|
13793
|
+
spec.referenceLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-reference-line": i, children: [
|
|
13794
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }),
|
|
13795
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }),
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference line", "data-action": "reference-line-delete", onClick: () => controller.removeReferenceLine(i), children: "\xD7" })
|
|
13747
13797
|
] }, `line-${i}`)),
|
|
13748
|
-
spec.referenceBands.map((band, i) => /* @__PURE__ */ (0,
|
|
13749
|
-
/* @__PURE__ */ (0,
|
|
13750
|
-
/* @__PURE__ */ (0,
|
|
13751
|
-
/* @__PURE__ */ (0,
|
|
13752
|
-
/* @__PURE__ */ (0,
|
|
13798
|
+
spec.referenceBands.map((band, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-reference-band": i, children: [
|
|
13799
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }),
|
|
13800
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }),
|
|
13801
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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 }),
|
|
13802
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete reference band", "data-action": "reference-band-delete", onClick: () => controller.removeReferenceBand(i), children: "\xD7" })
|
|
13753
13803
|
] }, `band-${i}`)),
|
|
13754
|
-
/* @__PURE__ */ (0,
|
|
13755
|
-
/* @__PURE__ */ (0,
|
|
13756
|
-
/* @__PURE__ */ (0,
|
|
13804
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex gap-1", children: [
|
|
13805
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceLine.add", onClick: () => controller.addReferenceLine((0, import_chart4.suggestChartReferences)(spec).line), children: "Add line" }),
|
|
13806
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-option": "referenceBand.add", onClick: () => controller.addReferenceBand((0, import_chart4.suggestChartReferences)(spec).band), children: "Add band" })
|
|
13757
13807
|
] })
|
|
13758
13808
|
] }),
|
|
13759
|
-
show("series") && selectedSeries && /* @__PURE__ */ (0,
|
|
13760
|
-
/* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
13762
|
-
/* @__PURE__ */ (0,
|
|
13763
|
-
/* @__PURE__ */ (0,
|
|
13809
|
+
show("series") && selectedSeries && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: chartSectionClass, "data-section": "series", "data-series-id": selectedSeries.id, children: [
|
|
13810
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h4", { className: "text-xs font-semibold text-foreground", children: "Series" }),
|
|
13811
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Name", htmlFor: `${idBase}-series-name`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChartCommitInput, { id: `${idBase}-series-name`, value: selectedSeries.name, "data-option": "series.name", className: chartInputClass, onCommit: (name) => void controller.updateSeries(selectedSeries.id, { name }) }) }),
|
|
13812
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Colour", htmlFor: `${idBase}-series-color`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
13813
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13764
13814
|
"input",
|
|
13765
13815
|
{
|
|
13766
13816
|
id: `${idBase}-series-color`,
|
|
@@ -13773,9 +13823,9 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13773
13823
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { color: e.currentTarget.value })
|
|
13774
13824
|
}
|
|
13775
13825
|
),
|
|
13776
|
-
selectedSeries.color && /* @__PURE__ */ (0,
|
|
13826
|
+
selectedSeries.color && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "reset-color", onClick: () => controller.updateSeries(selectedSeries.id, { color: null }), children: "Palette" })
|
|
13777
13827
|
] }) }),
|
|
13778
|
-
cartesian && /* @__PURE__ */ (0,
|
|
13828
|
+
cartesian && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Draw as", htmlFor: `${idBase}-series-type`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
13779
13829
|
"select",
|
|
13780
13830
|
{
|
|
13781
13831
|
id: `${idBase}-series-type`,
|
|
@@ -13784,12 +13834,12 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13784
13834
|
"data-option": "series.type",
|
|
13785
13835
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { type: e.currentTarget.value || null }),
|
|
13786
13836
|
children: [
|
|
13787
|
-
/* @__PURE__ */ (0,
|
|
13788
|
-
import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13837
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Chart type" }),
|
|
13838
|
+
import_chart4.CHART_SERIES_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: import_chart4.CHART_TYPE_LABELS[t] }, t))
|
|
13789
13839
|
]
|
|
13790
13840
|
}
|
|
13791
13841
|
) }),
|
|
13792
|
-
(cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0,
|
|
13842
|
+
(cartesian || family === "xy") && ["line", "area", "scatter"].includes((0, import_chart4.chartSeriesType)(spec, selectedSeries)) && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Marker", htmlFor: `${idBase}-series-marker`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
13793
13843
|
"select",
|
|
13794
13844
|
{
|
|
13795
13845
|
id: `${idBase}-series-marker`,
|
|
@@ -13798,12 +13848,12 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13798
13848
|
"data-option": "series.marker",
|
|
13799
13849
|
onChange: (e) => controller.updateSeries(selectedSeries.id, { marker: e.currentTarget.value || null }),
|
|
13800
13850
|
children: [
|
|
13801
|
-
/* @__PURE__ */ (0,
|
|
13802
|
-
import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0,
|
|
13851
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Default" }),
|
|
13852
|
+
import_chart4.CHART_MARKERS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: m, children: cap(m) }, m))
|
|
13803
13853
|
]
|
|
13804
13854
|
}
|
|
13805
13855
|
) }),
|
|
13806
|
-
annotated && calloutIndex !== null && /* @__PURE__ */ (0,
|
|
13856
|
+
annotated && calloutIndex !== null && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Field, { label: "Callout", htmlFor: `${idBase}-series-callout`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13807
13857
|
ChartCommitInput,
|
|
13808
13858
|
{
|
|
13809
13859
|
id: `${idBase}-series-callout`,
|
|
@@ -13814,15 +13864,15 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13814
13864
|
onCommit: (text) => controller.setCallout(selectedSeries.id, calloutIndex, text || null).ok
|
|
13815
13865
|
}
|
|
13816
13866
|
) }),
|
|
13817
|
-
scales && /* @__PURE__ */ (0,
|
|
13818
|
-
family === "xy" && /* @__PURE__ */ (0,
|
|
13819
|
-
(0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0,
|
|
13820
|
-
(selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0,
|
|
13821
|
-
/* @__PURE__ */ (0,
|
|
13822
|
-
/* @__PURE__ */ (0,
|
|
13823
|
-
/* @__PURE__ */ (0,
|
|
13867
|
+
scales && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "errorBars", idBase }),
|
|
13868
|
+
family === "xy" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBarFields, { controller, series: selectedSeries, which: "xErrorBars", idBase }),
|
|
13869
|
+
(0, import_chart4.chartSupportsTrendlines)(spec.type, spec.stacking) && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-1", "data-section": "trendlines", children: [
|
|
13870
|
+
(selectedSeries.trendlines ?? []).map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1", "data-trendline": i, children: [
|
|
13871
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1 truncate text-muted-foreground", children: (0, import_chart4.chartTrendlineName)(t, selectedSeries.name) }),
|
|
13872
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "R\xB2", name: `trendline.${i}.showR2`, checked: !!t.showR2, onChange: (showR2) => controller.updateTrendline(selectedSeries.id, i, { showR2 }) }),
|
|
13873
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: chartButtonClass, "aria-label": "Delete trendline", "data-action": "trendline-delete", onClick: () => controller.removeTrendline(selectedSeries.id, i), children: "\xD7" })
|
|
13824
13874
|
] }, i)),
|
|
13825
|
-
/* @__PURE__ */ (0,
|
|
13875
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
13826
13876
|
"select",
|
|
13827
13877
|
{
|
|
13828
13878
|
className: chartInputClass,
|
|
@@ -13831,32 +13881,32 @@ function ChartInspector({ controller, sections, className }) {
|
|
|
13831
13881
|
"data-option": "trendline.add",
|
|
13832
13882
|
onChange: (e) => e.currentTarget.value && controller.addTrendline(selectedSeries.id, { type: e.currentTarget.value }),
|
|
13833
13883
|
children: [
|
|
13834
|
-
/* @__PURE__ */ (0,
|
|
13835
|
-
import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0,
|
|
13884
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: "", children: "Add trendline\u2026" }),
|
|
13885
|
+
import_chart4.CHART_TRENDLINE_TYPES.map((t) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("option", { value: t, children: cap(t.replace("-", " ")) }, t))
|
|
13836
13886
|
]
|
|
13837
13887
|
}
|
|
13838
13888
|
)
|
|
13839
13889
|
] }),
|
|
13840
|
-
/* @__PURE__ */ (0,
|
|
13841
|
-
/* @__PURE__ */ (0,
|
|
13842
|
-
family === "cartesian" && /* @__PURE__ */ (0,
|
|
13843
|
-
/* @__PURE__ */ (0,
|
|
13844
|
-
/* @__PURE__ */ (0,
|
|
13845
|
-
/* @__PURE__ */ (0,
|
|
13846
|
-
/* @__PURE__ */ (0,
|
|
13890
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
13891
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Hidden", name: "series.hidden", checked: !!selectedSeries.hidden, onChange: (hidden) => controller.updateSeries(selectedSeries.id, { hidden }) }),
|
|
13892
|
+
family === "cartesian" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Toggle, { label: "Secondary axis", name: "series.axis", checked: selectedSeries.axis === "secondary", onChange: (secondary) => controller.updateSeries(selectedSeries.id, { axis: secondary ? "secondary" : null }) }),
|
|
13893
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "flex-1" }),
|
|
13894
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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" }),
|
|
13895
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.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" }),
|
|
13896
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("button", { type: "button", className: `${chartButtonClass} text-destructive`, "data-action": "series-delete", onClick: () => controller.removeSeries(selectedSeries.id), children: "Delete" })
|
|
13847
13897
|
] })
|
|
13848
13898
|
] })
|
|
13849
13899
|
] });
|
|
13850
13900
|
}
|
|
13851
13901
|
|
|
13852
13902
|
// src/chart-node/ChartNodeView.tsx
|
|
13853
|
-
var
|
|
13903
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13854
13904
|
function ChartNodeView({ state, theme, showDataGrid = true }) {
|
|
13855
13905
|
const { controller, editing, editable, selected, width, height, setEditing } = state;
|
|
13856
13906
|
const open = () => {
|
|
13857
13907
|
if (editable && !editing) setEditing(true);
|
|
13858
13908
|
};
|
|
13859
|
-
return /* @__PURE__ */ (0,
|
|
13909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
13860
13910
|
"div",
|
|
13861
13911
|
{
|
|
13862
13912
|
className: `not-prose my-2 rounded-md border bg-background p-1 ${selected ? "border-primary ring-1 ring-primary" : "border-border"}`,
|
|
@@ -13869,24 +13919,24 @@ function ChartNodeView({ state, theme, showDataGrid = true }) {
|
|
|
13869
13919
|
}
|
|
13870
13920
|
},
|
|
13871
13921
|
children: [
|
|
13872
|
-
editing && /* @__PURE__ */ (0,
|
|
13873
|
-
/* @__PURE__ */ (0,
|
|
13874
|
-
/* @__PURE__ */ (0,
|
|
13922
|
+
editing && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "mb-1 flex items-center justify-between gap-2 px-1", "data-chart-node-toolbar": "", children: [
|
|
13923
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-xs text-muted-foreground", children: "Editing chart" }),
|
|
13924
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("button", { type: "button", className: chartButtonClass, "data-action": "done", onClick: () => setEditing(false), children: "Done" })
|
|
13875
13925
|
] }),
|
|
13876
|
-
/* @__PURE__ */ (0,
|
|
13926
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13877
13927
|
"div",
|
|
13878
13928
|
{
|
|
13879
13929
|
className: editable && !editing ? "cursor-pointer" : void 0,
|
|
13880
13930
|
onClick: open,
|
|
13881
13931
|
title: editable && !editing ? "Click to edit the chart" : void 0,
|
|
13882
13932
|
"data-chart-node-canvas": "",
|
|
13883
|
-
children: /* @__PURE__ */ (0,
|
|
13933
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartCanvas, { controller, width: width ?? 640, height, responsive: width === null, editable: editing, theme })
|
|
13884
13934
|
}
|
|
13885
13935
|
),
|
|
13886
13936
|
editing && // Wraps by the document's width, not the viewport's: side by side when there is room.
|
|
13887
|
-
/* @__PURE__ */ (0,
|
|
13888
|
-
showDataGrid && /* @__PURE__ */ (0,
|
|
13889
|
-
/* @__PURE__ */ (0,
|
|
13937
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "mt-2 flex flex-wrap items-start gap-2", "data-chart-node-panel": "", children: [
|
|
13938
|
+
showDataGrid && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "min-w-0 flex-[1_1_20rem] overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartDataGrid, { controller }) }),
|
|
13939
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChartInspector, { controller, className: "max-h-96 min-w-0 flex-[1_1_16rem] overflow-y-auto rounded-md border border-border p-3" })
|
|
13890
13940
|
] })
|
|
13891
13941
|
]
|
|
13892
13942
|
}
|
|
@@ -13904,7 +13954,7 @@ function createReactChartNodeView(options = {}) {
|
|
|
13904
13954
|
scheduled = true;
|
|
13905
13955
|
queueMicrotask(() => {
|
|
13906
13956
|
scheduled = false;
|
|
13907
|
-
if (!destroyed) root.render(/* @__PURE__ */ (0,
|
|
13957
|
+
if (!destroyed) root.render(/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Component, { ...props, state: latest }));
|
|
13908
13958
|
});
|
|
13909
13959
|
};
|
|
13910
13960
|
schedule();
|
|
@@ -13922,10 +13972,10 @@ function createReactChartNodeView(options = {}) {
|
|
|
13922
13972
|
}
|
|
13923
13973
|
|
|
13924
13974
|
// src/style/useStyle.ts
|
|
13925
|
-
var
|
|
13975
|
+
var import_react95 = require("react");
|
|
13926
13976
|
var message = (error) => error instanceof Error ? error.message : String(error);
|
|
13927
13977
|
function useResolverTask(styles, run, deliver, deps) {
|
|
13928
|
-
(0,
|
|
13978
|
+
(0, import_react95.useEffect)(() => {
|
|
13929
13979
|
if (!styles || !run) {
|
|
13930
13980
|
deliver({ value: null, error: null });
|
|
13931
13981
|
return;
|
|
@@ -13952,7 +14002,7 @@ function useResolverTask(styles, run, deliver, deps) {
|
|
|
13952
14002
|
}, [styles, ...deps]);
|
|
13953
14003
|
}
|
|
13954
14004
|
function useStyle(styles, domain) {
|
|
13955
|
-
const [result, setResult] = (0,
|
|
14005
|
+
const [result, setResult] = (0, import_react95.useState)({ style: null, error: null });
|
|
13956
14006
|
useResolverTask(
|
|
13957
14007
|
styles,
|
|
13958
14008
|
(s) => s.resolve(domain),
|
|
@@ -13962,7 +14012,7 @@ function useStyle(styles, domain) {
|
|
|
13962
14012
|
return result;
|
|
13963
14013
|
}
|
|
13964
14014
|
function useStyleFindings(styles, domain, state) {
|
|
13965
|
-
const [result, setResult] = (0,
|
|
14015
|
+
const [result, setResult] = (0, import_react95.useState)({ report: null, style: null, error: null });
|
|
13966
14016
|
useResolverTask(
|
|
13967
14017
|
styles,
|
|
13968
14018
|
(s) => s.check(domain, state),
|
|
@@ -13979,7 +14029,7 @@ function useStyleFindings(styles, domain, state) {
|
|
|
13979
14029
|
}
|
|
13980
14030
|
|
|
13981
14031
|
// src/style/StyleFindings.tsx
|
|
13982
|
-
var
|
|
14032
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13983
14033
|
var SEVERITY_CLASS = {
|
|
13984
14034
|
error: "text-destructive",
|
|
13985
14035
|
warning: "text-amber-600",
|
|
@@ -13988,24 +14038,24 @@ var SEVERITY_CLASS = {
|
|
|
13988
14038
|
function StyleFindings({ report, onSelect, title = "House style", className = "" }) {
|
|
13989
14039
|
if (!report) return null;
|
|
13990
14040
|
const { findings, ran, skipped } = report;
|
|
13991
|
-
return /* @__PURE__ */ (0,
|
|
13992
|
-
/* @__PURE__ */ (0,
|
|
13993
|
-
findings.length > 0 && /* @__PURE__ */ (0,
|
|
14041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("section", { "data-style-findings": "", "aria-label": title, className: `flex flex-col gap-1.5 text-xs text-foreground ${className}`, children: [
|
|
14042
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("h3", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
14043
|
+
findings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("ul", { className: "flex flex-col gap-1", children: findings.map((finding, i) => {
|
|
13994
14044
|
const selectable = finding.target !== void 0 && !!onSelect;
|
|
13995
|
-
const body = /* @__PURE__ */ (0,
|
|
13996
|
-
/* @__PURE__ */ (0,
|
|
13997
|
-
/* @__PURE__ */ (0,
|
|
13998
|
-
/* @__PURE__ */ (0,
|
|
13999
|
-
/* @__PURE__ */ (0,
|
|
14000
|
-
/* @__PURE__ */ (0,
|
|
14001
|
-
finding.layer && /* @__PURE__ */ (0,
|
|
14045
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
14046
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "data-style-severity": finding.severity, className: `shrink-0 font-semibold uppercase text-[10px] ${SEVERITY_CLASS[finding.severity]}`, children: finding.severity }),
|
|
14047
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "flex min-w-0 flex-col", children: [
|
|
14048
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "data-style-message": "", children: finding.message }),
|
|
14049
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
14050
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("code", { children: finding.check }),
|
|
14051
|
+
finding.layer && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
14002
14052
|
" \xB7 ",
|
|
14003
14053
|
finding.layer
|
|
14004
14054
|
] })
|
|
14005
14055
|
] })
|
|
14006
14056
|
] })
|
|
14007
14057
|
] });
|
|
14008
|
-
return /* @__PURE__ */ (0,
|
|
14058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("li", { "data-style-finding": finding.check, children: selectable ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
14009
14059
|
"button",
|
|
14010
14060
|
{
|
|
14011
14061
|
type: "button",
|
|
@@ -14013,19 +14063,19 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
|
|
|
14013
14063
|
onClick: () => onSelect(finding),
|
|
14014
14064
|
children: body
|
|
14015
14065
|
}
|
|
14016
|
-
) : /* @__PURE__ */ (0,
|
|
14066
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "flex items-start gap-2 rounded border border-border px-2 py-1", children: body }) }, `${finding.check}-${i}`);
|
|
14017
14067
|
}) }),
|
|
14018
|
-
findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0,
|
|
14068
|
+
findings.length === 0 && ran.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("p", { "data-style-clear": "", className: "text-emerald-600", children: [
|
|
14019
14069
|
"All clear: ",
|
|
14020
14070
|
ran.length,
|
|
14021
14071
|
" ",
|
|
14022
14072
|
ran.length === 1 ? "check" : "checks",
|
|
14023
14073
|
" passed."
|
|
14024
14074
|
] }),
|
|
14025
|
-
findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0,
|
|
14026
|
-
skipped.length > 0 && /* @__PURE__ */ (0,
|
|
14075
|
+
findings.length === 0 && ran.length === 0 && skipped.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("p", { className: "text-muted-foreground", children: "No house-style checks apply." }),
|
|
14076
|
+
skipped.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.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_runtime72.jsxs)("li", { "data-style-skipped-check": s.check, children: [
|
|
14027
14077
|
"Skipped ",
|
|
14028
|
-
/* @__PURE__ */ (0,
|
|
14078
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("code", { children: s.check }),
|
|
14029
14079
|
": ",
|
|
14030
14080
|
s.reason
|
|
14031
14081
|
] }, s.check)) })
|
|
@@ -14083,6 +14133,7 @@ function StyleFindings({ report, onSelect, title = "House style", className = ""
|
|
|
14083
14133
|
RefineEdgePanel,
|
|
14084
14134
|
ReviewToolbar,
|
|
14085
14135
|
SelectAndMaskWorkspace,
|
|
14136
|
+
SelectionChangeCheck,
|
|
14086
14137
|
SelectionOptionsBar,
|
|
14087
14138
|
ShapeOptionsBar,
|
|
14088
14139
|
SheetTabs,
|