@ai-matrx/design-system 0.21.6 → 0.21.7
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/CHANGELOG.md +4 -0
- package/dist/content-transfer.cjs +149 -108
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.d.cts +2 -0
- package/dist/content-transfer.d.ts +2 -0
- package/dist/content-transfer.js +149 -108
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/data-row-inspector.cjs +149 -108
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +149 -108
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +149 -108
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +149 -108
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/host.cjs.map +1 -1
- package/dist/data-table/host.d.cts +2 -0
- package/dist/data-table/host.d.ts +2 -0
- package/dist/data-table/host.js.map +1 -1
- package/dist/data-table/index.cjs +161 -114
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +180 -133
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js.map +1 -1
- package/package.json +1 -1
|
@@ -1426,6 +1426,10 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1426
1426
|
const [notice, setNotice] = React9.useState(null);
|
|
1427
1427
|
const [receiptTarget, setReceiptTarget] = React9.useState();
|
|
1428
1428
|
const [paletteOpen, setPaletteOpen] = React9.useState(false);
|
|
1429
|
+
const [paletteTarget, setPaletteTarget] = React9.useState(null);
|
|
1430
|
+
const externalPaletteClose = React9.useRef(null);
|
|
1431
|
+
const externalPaletteRestoreFocus = React9.useRef(null);
|
|
1432
|
+
const feedbackDocument = React9.useRef(null);
|
|
1429
1433
|
const [mode, setMode] = React9.useState("copy");
|
|
1430
1434
|
const scopes = React9.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
1431
1435
|
const [requestedScope, setRequestedScope] = React9.useState(table?.initialScope ?? "target");
|
|
@@ -1522,6 +1526,40 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1522
1526
|
fence.finish(controller);
|
|
1523
1527
|
}
|
|
1524
1528
|
}, [captureOne, fence, initialScope, primary]);
|
|
1529
|
+
const closePalette = React9.useCallback(() => {
|
|
1530
|
+
const onClose = externalPaletteClose.current;
|
|
1531
|
+
const restoreFocus = externalPaletteRestoreFocus.current;
|
|
1532
|
+
externalPaletteClose.current = null;
|
|
1533
|
+
externalPaletteRestoreFocus.current = null;
|
|
1534
|
+
onClose?.();
|
|
1535
|
+
restoreFocus?.();
|
|
1536
|
+
setPaletteTarget(null);
|
|
1537
|
+
setPaletteOpen(false);
|
|
1538
|
+
}, []);
|
|
1539
|
+
const mountPalette = React9.useCallback((target, onClose, restoreFocus) => {
|
|
1540
|
+
if (!target) {
|
|
1541
|
+
externalPaletteClose.current = null;
|
|
1542
|
+
externalPaletteRestoreFocus.current = null;
|
|
1543
|
+
setPaletteTarget(null);
|
|
1544
|
+
setPaletteOpen(false);
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
1548
|
+
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
1549
|
+
externalPaletteClose.current = onClose ?? null;
|
|
1550
|
+
externalPaletteRestoreFocus.current = restoreFocus ?? null;
|
|
1551
|
+
feedbackDocument.current = target.ownerDocument;
|
|
1552
|
+
restoreFocusRef.current = restoreFocus ?? (() => target.focus());
|
|
1553
|
+
setPaletteTarget(target);
|
|
1554
|
+
setPaletteOpen(true);
|
|
1555
|
+
setMode("copy");
|
|
1556
|
+
void preflight();
|
|
1557
|
+
}, [closePalette, disabled, enabled, preflight]);
|
|
1558
|
+
React9.useEffect(() => {
|
|
1559
|
+
if (!paletteTarget || !paletteOpen) return;
|
|
1560
|
+
const firstControl = paletteTarget.querySelector("button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [href]");
|
|
1561
|
+
firstControl?.focus();
|
|
1562
|
+
}, [paletteOpen, paletteTarget]);
|
|
1525
1563
|
const transfer = React9.useCallback(async (format, download, alternate) => {
|
|
1526
1564
|
const { controller, id } = fence.begin();
|
|
1527
1565
|
try {
|
|
@@ -1662,6 +1700,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1662
1700
|
);
|
|
1663
1701
|
React9.useImperativeHandle(controllerRef, () => ({
|
|
1664
1702
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
1703
|
+
mountPalette,
|
|
1665
1704
|
preparePrimary: async (options) => {
|
|
1666
1705
|
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
1667
1706
|
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
@@ -1676,7 +1715,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1676
1715
|
externalWorkspaceKeys.current.add(requestedKey);
|
|
1677
1716
|
await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
|
|
1678
1717
|
}
|
|
1679
|
-
}), [disabled, enabled, hide, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
1718
|
+
}), [disabled, enabled, hide, mountPalette, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
1680
1719
|
const runAction = React9.useCallback(async (action) => {
|
|
1681
1720
|
const { controller, id } = fence.begin();
|
|
1682
1721
|
try {
|
|
@@ -1742,7 +1781,6 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1742
1781
|
return (0, import_content_transfer2.sealTransferArtifact)({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: (0, import_content_transfer2.buildAgentPayload)({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
|
|
1743
1782
|
}
|
|
1744
1783
|
};
|
|
1745
|
-
const closePalette = () => setPaletteOpen(false);
|
|
1746
1784
|
const tile = (id, label2, onClick, options = {}) => {
|
|
1747
1785
|
const presentation = options.action;
|
|
1748
1786
|
const Icon2 = presentation?.icon;
|
|
@@ -1758,122 +1796,125 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1758
1796
|
] })
|
|
1759
1797
|
] }, id);
|
|
1760
1798
|
};
|
|
1799
|
+
const palette = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1800
|
+
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1801
|
+
table && scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "matrx-alchemy-scope", children: [
|
|
1802
|
+
"Content scope",
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
1804
|
+
const next = scopes.find((scope) => scope === event.target.value);
|
|
1805
|
+
if (next) {
|
|
1806
|
+
setRequestedScope(next);
|
|
1807
|
+
void preflight(next);
|
|
1808
|
+
}
|
|
1809
|
+
}, children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
1810
|
+
] }) : null,
|
|
1811
|
+
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "matrx-alchemy-output", children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
1813
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
1816
|
+
] }) : null,
|
|
1817
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1819
|
+
visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
|
|
1820
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
1821
|
+
] }),
|
|
1822
|
+
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
1823
|
+
closePalette();
|
|
1824
|
+
void transfer("markdown", false, variant);
|
|
1825
|
+
} }) : null
|
|
1826
|
+
] }) : null,
|
|
1827
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1828
|
+
visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
|
|
1829
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
1830
|
+
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
1831
|
+
] }) }) : null
|
|
1832
|
+
] }) : null,
|
|
1833
|
+
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1835
|
+
closePalette();
|
|
1836
|
+
void transfer(nativeAiFormat, false);
|
|
1837
|
+
}, children: [
|
|
1838
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "ai-copy" }),
|
|
1839
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
1840
|
+
"Copy with AI context",
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
1842
|
+
] })
|
|
1843
|
+
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
1844
|
+
closePalette();
|
|
1845
|
+
void transfer("markdown", false, variant);
|
|
1846
|
+
} }),
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
1848
|
+
closePalette();
|
|
1849
|
+
void openWorkspace();
|
|
1850
|
+
}, children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "sliders" }),
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
1853
|
+
"Prepare for AI",
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
1855
|
+
] })
|
|
1856
|
+
] }) })
|
|
1857
|
+
] }) : null,
|
|
1858
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1859
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1860
|
+
closePalette();
|
|
1861
|
+
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
1862
|
+
}, children: [
|
|
1863
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "surface" }),
|
|
1864
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Prepare this page" })
|
|
1865
|
+
] }) : null,
|
|
1866
|
+
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
1867
|
+
closePalette();
|
|
1868
|
+
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
1869
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
1870
|
+
] }) }) : null,
|
|
1871
|
+
references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1872
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { children: "References" }),
|
|
1873
|
+
referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "link" }),
|
|
1875
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: action.label }),
|
|
1876
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
1877
|
+
] }, action.id)),
|
|
1878
|
+
references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "link" }),
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: reference.label })
|
|
1881
|
+
] }, reference.id))
|
|
1882
|
+
] }) : null,
|
|
1883
|
+
["save", "chat", "email", "other"].map((group) => {
|
|
1884
|
+
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
1885
|
+
return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
1886
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("summary", { children: [
|
|
1887
|
+
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
1888
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: entries.length }),
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
1891
|
+
] })
|
|
1892
|
+
] }),
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1894
|
+
closePalette();
|
|
1895
|
+
void runAction(action);
|
|
1896
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
1897
|
+
] }, group) : null;
|
|
1898
|
+
})
|
|
1899
|
+
] });
|
|
1900
|
+
const feedbackOwner = paletteTarget ?? triggerRef.current ?? feedbackDocument.current?.body ?? null;
|
|
1761
1901
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
1762
|
-
!triggerHidden ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
1763
|
-
setPaletteOpen(open);
|
|
1902
|
+
!triggerHidden && !paletteTarget ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
1764
1903
|
if (open) {
|
|
1904
|
+
setPaletteOpen(true);
|
|
1765
1905
|
setMode("copy");
|
|
1766
1906
|
void preflight();
|
|
1767
|
-
}
|
|
1907
|
+
} else closePalette();
|
|
1768
1908
|
}, children: [
|
|
1769
1909
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PopoverTrigger, { asChild: true, children: triggerVariant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { ref: triggerRef, variant: "outline", size: "icon-sm", "aria-label": `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "outline", disabled, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlchemyGlyph, { icon }) }) : triggerVariant === "glass" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass", "data-alchemy-size": triggerSize, disabled }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent", "data-alchemy-size": triggerSize, disabled }) }),
|
|
1770
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.
|
|
1771
|
-
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1772
|
-
table && scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: "matrx-alchemy-scope", children: [
|
|
1773
|
-
"Content scope",
|
|
1774
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
1775
|
-
const next = scopes.find((scope) => scope === event.target.value);
|
|
1776
|
-
if (next) {
|
|
1777
|
-
setRequestedScope(next);
|
|
1778
|
-
void preflight(next);
|
|
1779
|
-
}
|
|
1780
|
-
}, children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
1781
|
-
] }) : null,
|
|
1782
|
-
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "matrx-alchemy-output", children: [
|
|
1783
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
1784
|
-
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1785
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1786
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
1787
|
-
] }) : null,
|
|
1788
|
-
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1789
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1790
|
-
visibleCopies.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets" }[format], () => void transfer(format, false), { ariaLabel: `Copy ${LABEL[format]}` })),
|
|
1791
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
1792
|
-
] }),
|
|
1793
|
-
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
1794
|
-
closePalette();
|
|
1795
|
-
void transfer("markdown", false, variant);
|
|
1796
|
-
} }) : null
|
|
1797
|
-
] }) : null,
|
|
1798
|
-
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1799
|
-
visibleDownloads.map((format) => tile(format, { plain: "Text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact", csv: "CSV", tsv: "Sheets", xlsx: "Excel" }[format], () => void transfer(format, true), { ariaLabel: `Download ${LABEL[format]}` })),
|
|
1800
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
1801
|
-
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
1802
|
-
] }) }) : null
|
|
1803
|
-
] }) : null,
|
|
1804
|
-
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1805
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1806
|
-
closePalette();
|
|
1807
|
-
void transfer(nativeAiFormat, false);
|
|
1808
|
-
}, children: [
|
|
1809
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "ai-copy" }),
|
|
1810
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
1811
|
-
"Copy with AI context",
|
|
1812
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
1813
|
-
] })
|
|
1814
|
-
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
1815
|
-
closePalette();
|
|
1816
|
-
void transfer("markdown", false, variant);
|
|
1817
|
-
} }),
|
|
1818
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
1819
|
-
closePalette();
|
|
1820
|
-
void openWorkspace();
|
|
1821
|
-
}, children: [
|
|
1822
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "sliders" }),
|
|
1823
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { children: [
|
|
1824
|
-
"Prepare for AI",
|
|
1825
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
1826
|
-
] })
|
|
1827
|
-
] }) })
|
|
1828
|
-
] }) : null,
|
|
1829
|
-
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1830
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1831
|
-
closePalette();
|
|
1832
|
-
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
1833
|
-
}, children: [
|
|
1834
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "surface" }),
|
|
1835
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "Prepare this page" })
|
|
1836
|
-
] }) : null,
|
|
1837
|
-
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
1838
|
-
closePalette();
|
|
1839
|
-
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
1840
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
1841
|
-
] }) }) : null,
|
|
1842
|
-
references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1843
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { children: "References" }),
|
|
1844
|
-
referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
1845
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "link" }),
|
|
1846
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: action.label }),
|
|
1847
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
1848
|
-
] }, action.id)),
|
|
1849
|
-
references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
1850
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PaletteGlyph, { kind: "link" }),
|
|
1851
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: reference.label })
|
|
1852
|
-
] }, reference.id))
|
|
1853
|
-
] }) : null,
|
|
1854
|
-
["save", "chat", "email", "other"].map((group) => {
|
|
1855
|
-
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
1856
|
-
return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
1857
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("summary", { children: [
|
|
1858
|
-
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
1859
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
1860
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: entries.length }),
|
|
1861
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
1862
|
-
] })
|
|
1863
|
-
] }),
|
|
1864
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1865
|
-
closePalette();
|
|
1866
|
-
void runAction(action);
|
|
1867
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
1868
|
-
] }, group) : null;
|
|
1869
|
-
})
|
|
1870
|
-
] })
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: palette })
|
|
1871
1911
|
] }) : null,
|
|
1872
|
-
|
|
1912
|
+
paletteTarget && paletteOpen ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "matrx-alchemy-menu matrx-alchemy-palette", role: "dialog", "aria-label": "Alchemy output options", children: palette }), paletteTarget) : null,
|
|
1913
|
+
notice && feedbackOwner ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "matrx-alchemy-feedback", children: [
|
|
1873
1914
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { role: "status", children: notice }),
|
|
1874
1915
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ReceiptLink, { target: receiptTarget }),
|
|
1875
1916
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
|
|
1876
|
-
] }),
|
|
1917
|
+
] }), feedbackOwner.ownerDocument.body) : null,
|
|
1877
1918
|
Object.values(workspaces).map((saved) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreparationWorkspace, { restoreFocus: () => restoreFocusRef.current?.() ?? triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, scopeLabels: table?.scopeLabels, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, actions: preparedActions, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key)),
|
|
1878
1919
|
emailReview
|
|
1879
1920
|
] });
|