@ai-matrx/design-system 0.21.6 → 0.21.8
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 +10 -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 +162 -115
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +181 -134
- 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
|
@@ -1370,6 +1370,10 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1370
1370
|
const [notice, setNotice] = React9.useState(null);
|
|
1371
1371
|
const [receiptTarget, setReceiptTarget] = React9.useState();
|
|
1372
1372
|
const [paletteOpen, setPaletteOpen] = React9.useState(false);
|
|
1373
|
+
const [paletteTarget, setPaletteTarget] = React9.useState(null);
|
|
1374
|
+
const externalPaletteClose = React9.useRef(null);
|
|
1375
|
+
const externalPaletteRestoreFocus = React9.useRef(null);
|
|
1376
|
+
const feedbackDocument = React9.useRef(null);
|
|
1373
1377
|
const [mode, setMode] = React9.useState("copy");
|
|
1374
1378
|
const scopes = React9.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
1375
1379
|
const [requestedScope, setRequestedScope] = React9.useState(table?.initialScope ?? "target");
|
|
@@ -1466,6 +1470,40 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1466
1470
|
fence.finish(controller);
|
|
1467
1471
|
}
|
|
1468
1472
|
}, [captureOne, fence, initialScope, primary]);
|
|
1473
|
+
const closePalette = React9.useCallback(() => {
|
|
1474
|
+
const onClose = externalPaletteClose.current;
|
|
1475
|
+
const restoreFocus = externalPaletteRestoreFocus.current;
|
|
1476
|
+
externalPaletteClose.current = null;
|
|
1477
|
+
externalPaletteRestoreFocus.current = null;
|
|
1478
|
+
onClose?.();
|
|
1479
|
+
restoreFocus?.();
|
|
1480
|
+
setPaletteTarget(null);
|
|
1481
|
+
setPaletteOpen(false);
|
|
1482
|
+
}, []);
|
|
1483
|
+
const mountPalette = React9.useCallback((target, onClose, restoreFocus) => {
|
|
1484
|
+
if (!target) {
|
|
1485
|
+
externalPaletteClose.current = null;
|
|
1486
|
+
externalPaletteRestoreFocus.current = null;
|
|
1487
|
+
setPaletteTarget(null);
|
|
1488
|
+
setPaletteOpen(false);
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
1492
|
+
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
1493
|
+
externalPaletteClose.current = onClose ?? null;
|
|
1494
|
+
externalPaletteRestoreFocus.current = restoreFocus ?? null;
|
|
1495
|
+
feedbackDocument.current = target.ownerDocument;
|
|
1496
|
+
restoreFocusRef.current = restoreFocus ?? (() => target.focus());
|
|
1497
|
+
setPaletteTarget(target);
|
|
1498
|
+
setPaletteOpen(true);
|
|
1499
|
+
setMode("copy");
|
|
1500
|
+
void preflight();
|
|
1501
|
+
}, [closePalette, disabled, enabled, preflight]);
|
|
1502
|
+
React9.useEffect(() => {
|
|
1503
|
+
if (!paletteTarget || !paletteOpen) return;
|
|
1504
|
+
const firstControl = paletteTarget.querySelector("button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [href]");
|
|
1505
|
+
firstControl?.focus();
|
|
1506
|
+
}, [paletteOpen, paletteTarget]);
|
|
1469
1507
|
const transfer = React9.useCallback(async (format, download, alternate) => {
|
|
1470
1508
|
const { controller, id } = fence.begin();
|
|
1471
1509
|
try {
|
|
@@ -1606,6 +1644,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1606
1644
|
);
|
|
1607
1645
|
React9.useImperativeHandle(controllerRef, () => ({
|
|
1608
1646
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
1647
|
+
mountPalette,
|
|
1609
1648
|
preparePrimary: async (options) => {
|
|
1610
1649
|
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
1611
1650
|
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
@@ -1620,7 +1659,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1620
1659
|
externalWorkspaceKeys.current.add(requestedKey);
|
|
1621
1660
|
await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
|
|
1622
1661
|
}
|
|
1623
|
-
}), [disabled, enabled, hide, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
1662
|
+
}), [disabled, enabled, hide, mountPalette, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
1624
1663
|
const runAction = React9.useCallback(async (action) => {
|
|
1625
1664
|
const { controller, id } = fence.begin();
|
|
1626
1665
|
try {
|
|
@@ -1686,7 +1725,6 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1686
1725
|
return sealTransferArtifact2({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: buildAgentPayload({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
|
|
1687
1726
|
}
|
|
1688
1727
|
};
|
|
1689
|
-
const closePalette = () => setPaletteOpen(false);
|
|
1690
1728
|
const tile = (id, label2, onClick, options = {}) => {
|
|
1691
1729
|
const presentation = options.action;
|
|
1692
1730
|
const Icon2 = presentation?.icon;
|
|
@@ -1702,122 +1740,125 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
1702
1740
|
] })
|
|
1703
1741
|
] }, id);
|
|
1704
1742
|
};
|
|
1743
|
+
const palette = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1744
|
+
menuStatus === "loading" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1745
|
+
table && scopes.length > 1 ? /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-scope", children: [
|
|
1746
|
+
"Content scope",
|
|
1747
|
+
/* @__PURE__ */ jsx10("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
1748
|
+
const next = scopes.find((scope) => scope === event.target.value);
|
|
1749
|
+
if (next) {
|
|
1750
|
+
setRequestedScope(next);
|
|
1751
|
+
void preflight(next);
|
|
1752
|
+
}
|
|
1753
|
+
}, children: scopes.map((scope) => /* @__PURE__ */ jsx10("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
1754
|
+
] }) : null,
|
|
1755
|
+
copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-output", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx10("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
1757
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1758
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1759
|
+
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
1760
|
+
] }) : null,
|
|
1761
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1762
|
+
/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1763
|
+
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]}` })),
|
|
1764
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
1765
|
+
] }),
|
|
1766
|
+
quickVariants("copy").length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
1767
|
+
closePalette();
|
|
1768
|
+
void transfer("markdown", false, variant);
|
|
1769
|
+
} }) : null
|
|
1770
|
+
] }) : null,
|
|
1771
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1772
|
+
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]}` })),
|
|
1773
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
1774
|
+
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
1775
|
+
] }) }) : null
|
|
1776
|
+
] }) : null,
|
|
1777
|
+
prepareAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1778
|
+
/* @__PURE__ */ jsx10(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1779
|
+
closePalette();
|
|
1780
|
+
void transfer(nativeAiFormat, false);
|
|
1781
|
+
}, children: [
|
|
1782
|
+
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "ai-copy" }),
|
|
1783
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1784
|
+
"Copy with AI context",
|
|
1785
|
+
/* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
1786
|
+
] })
|
|
1787
|
+
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
1788
|
+
closePalette();
|
|
1789
|
+
void transfer("markdown", false, variant);
|
|
1790
|
+
} }),
|
|
1791
|
+
/* @__PURE__ */ jsx10(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
1792
|
+
closePalette();
|
|
1793
|
+
void openWorkspace();
|
|
1794
|
+
}, children: [
|
|
1795
|
+
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "sliders" }),
|
|
1796
|
+
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1797
|
+
"Prepare for AI",
|
|
1798
|
+
/* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
1799
|
+
] })
|
|
1800
|
+
] }) })
|
|
1801
|
+
] }) : null,
|
|
1802
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1803
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1804
|
+
closePalette();
|
|
1805
|
+
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
1806
|
+
}, children: [
|
|
1807
|
+
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "surface" }),
|
|
1808
|
+
/* @__PURE__ */ jsx10("span", { children: "Prepare this page" })
|
|
1809
|
+
] }) : null,
|
|
1810
|
+
variants.map((variant) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
1811
|
+
closePalette();
|
|
1812
|
+
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
1813
|
+
}, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
1814
|
+
] }) }) : null,
|
|
1815
|
+
references.length || referenceActions.length ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1816
|
+
/* @__PURE__ */ jsx10("h3", { children: "References" }),
|
|
1817
|
+
referenceActions.map((action) => /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
1818
|
+
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "link" }),
|
|
1819
|
+
/* @__PURE__ */ jsx10("span", { children: action.label }),
|
|
1820
|
+
/* @__PURE__ */ jsx10("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 4 4 4-4 4" }) })
|
|
1821
|
+
] }, action.id)),
|
|
1822
|
+
references.map((reference) => /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
1823
|
+
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "link" }),
|
|
1824
|
+
/* @__PURE__ */ jsx10("span", { children: reference.label })
|
|
1825
|
+
] }, reference.id))
|
|
1826
|
+
] }) : null,
|
|
1827
|
+
["save", "chat", "email", "other"].map((group) => {
|
|
1828
|
+
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
1829
|
+
return entries.length ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
1830
|
+
/* @__PURE__ */ jsxs5("summary", { children: [
|
|
1831
|
+
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
1832
|
+
/* @__PURE__ */ jsxs5("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
1833
|
+
/* @__PURE__ */ jsx10("span", { children: entries.length }),
|
|
1834
|
+
/* @__PURE__ */ jsx10("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 4 4 4-4 4" }) })
|
|
1835
|
+
] })
|
|
1836
|
+
] }),
|
|
1837
|
+
/* @__PURE__ */ jsx10("div", { children: entries.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1838
|
+
closePalette();
|
|
1839
|
+
void runAction(action);
|
|
1840
|
+
}, children: /* @__PURE__ */ jsx10(DestinationPresentation, { action }) }, action.id)) })
|
|
1841
|
+
] }, group) : null;
|
|
1842
|
+
})
|
|
1843
|
+
] });
|
|
1844
|
+
const feedbackOwner = paletteTarget ?? triggerRef.current ?? feedbackDocument.current?.body ?? null;
|
|
1705
1845
|
return /* @__PURE__ */ jsxs5("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
1706
|
-
!triggerHidden ? /* @__PURE__ */ jsxs5(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
1707
|
-
setPaletteOpen(open);
|
|
1846
|
+
!triggerHidden && !paletteTarget ? /* @__PURE__ */ jsxs5(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
1708
1847
|
if (open) {
|
|
1848
|
+
setPaletteOpen(true);
|
|
1709
1849
|
setMode("copy");
|
|
1710
1850
|
void preflight();
|
|
1711
|
-
}
|
|
1851
|
+
} else closePalette();
|
|
1712
1852
|
}, children: [
|
|
1713
1853
|
/* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: triggerVariant === "outline" ? /* @__PURE__ */ jsx10(Button, { ref: triggerRef, variant: "outline", size: "icon-sm", "aria-label": `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "outline", disabled, children: /* @__PURE__ */ jsx10(AlchemyGlyph, { icon }) }) : triggerVariant === "glass" ? /* @__PURE__ */ jsx10(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ jsx10(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass", "data-alchemy-size": triggerSize, disabled }) : /* @__PURE__ */ jsx10(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ jsx10(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent", "data-alchemy-size": triggerSize, disabled }) }),
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
menuStatus === "loading" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1716
|
-
table && scopes.length > 1 ? /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-scope", children: [
|
|
1717
|
-
"Content scope",
|
|
1718
|
-
/* @__PURE__ */ jsx10("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
1719
|
-
const next = scopes.find((scope) => scope === event.target.value);
|
|
1720
|
-
if (next) {
|
|
1721
|
-
setRequestedScope(next);
|
|
1722
|
-
void preflight(next);
|
|
1723
|
-
}
|
|
1724
|
-
}, children: scopes.map((scope) => /* @__PURE__ */ jsx10("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
1725
|
-
] }) : null,
|
|
1726
|
-
copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-output", children: [
|
|
1727
|
-
/* @__PURE__ */ jsx10("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
1728
|
-
copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1729
|
-
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1730
|
-
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
1731
|
-
] }) : null,
|
|
1732
|
-
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1733
|
-
/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1734
|
-
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]}` })),
|
|
1735
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
1736
|
-
] }),
|
|
1737
|
-
quickVariants("copy").length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
1738
|
-
closePalette();
|
|
1739
|
-
void transfer("markdown", false, variant);
|
|
1740
|
-
} }) : null
|
|
1741
|
-
] }) : null,
|
|
1742
|
-
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1743
|
-
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]}` })),
|
|
1744
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
1745
|
-
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
1746
|
-
] }) }) : null
|
|
1747
|
-
] }) : null,
|
|
1748
|
-
prepareAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1749
|
-
/* @__PURE__ */ jsx10(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1750
|
-
closePalette();
|
|
1751
|
-
void transfer(nativeAiFormat, false);
|
|
1752
|
-
}, children: [
|
|
1753
|
-
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "ai-copy" }),
|
|
1754
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1755
|
-
"Copy with AI context",
|
|
1756
|
-
/* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
1757
|
-
] })
|
|
1758
|
-
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
1759
|
-
closePalette();
|
|
1760
|
-
void transfer("markdown", false, variant);
|
|
1761
|
-
} }),
|
|
1762
|
-
/* @__PURE__ */ jsx10(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
1763
|
-
closePalette();
|
|
1764
|
-
void openWorkspace();
|
|
1765
|
-
}, children: [
|
|
1766
|
-
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "sliders" }),
|
|
1767
|
-
/* @__PURE__ */ jsxs5("span", { children: [
|
|
1768
|
-
"Prepare for AI",
|
|
1769
|
-
/* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
1770
|
-
] })
|
|
1771
|
-
] }) })
|
|
1772
|
-
] }) : null,
|
|
1773
|
-
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1774
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1775
|
-
closePalette();
|
|
1776
|
-
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
1777
|
-
}, children: [
|
|
1778
|
-
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "surface" }),
|
|
1779
|
-
/* @__PURE__ */ jsx10("span", { children: "Prepare this page" })
|
|
1780
|
-
] }) : null,
|
|
1781
|
-
variants.map((variant) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
1782
|
-
closePalette();
|
|
1783
|
-
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
1784
|
-
}, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
1785
|
-
] }) }) : null,
|
|
1786
|
-
references.length || referenceActions.length ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1787
|
-
/* @__PURE__ */ jsx10("h3", { children: "References" }),
|
|
1788
|
-
referenceActions.map((action) => /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
1789
|
-
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "link" }),
|
|
1790
|
-
/* @__PURE__ */ jsx10("span", { children: action.label }),
|
|
1791
|
-
/* @__PURE__ */ jsx10("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 4 4 4-4 4" }) })
|
|
1792
|
-
] }, action.id)),
|
|
1793
|
-
references.map((reference) => /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
1794
|
-
/* @__PURE__ */ jsx10(PaletteGlyph, { kind: "link" }),
|
|
1795
|
-
/* @__PURE__ */ jsx10("span", { children: reference.label })
|
|
1796
|
-
] }, reference.id))
|
|
1797
|
-
] }) : null,
|
|
1798
|
-
["save", "chat", "email", "other"].map((group) => {
|
|
1799
|
-
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
1800
|
-
return entries.length ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
1801
|
-
/* @__PURE__ */ jsxs5("summary", { children: [
|
|
1802
|
-
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
1803
|
-
/* @__PURE__ */ jsxs5("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
1804
|
-
/* @__PURE__ */ jsx10("span", { children: entries.length }),
|
|
1805
|
-
/* @__PURE__ */ jsx10("svg", { className: "matrx-alchemy-disclosure", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx10("path", { d: "m6 4 4 4-4 4" }) })
|
|
1806
|
-
] })
|
|
1807
|
-
] }),
|
|
1808
|
-
/* @__PURE__ */ jsx10("div", { children: entries.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1809
|
-
closePalette();
|
|
1810
|
-
void runAction(action);
|
|
1811
|
-
}, children: /* @__PURE__ */ jsx10(DestinationPresentation, { action }) }, action.id)) })
|
|
1812
|
-
] }, group) : null;
|
|
1813
|
-
})
|
|
1814
|
-
] })
|
|
1854
|
+
/* @__PURE__ */ jsx10(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: palette })
|
|
1815
1855
|
] }) : null,
|
|
1816
|
-
|
|
1856
|
+
paletteTarget && paletteOpen ? createPortal(/* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-menu matrx-alchemy-palette", role: "dialog", "aria-label": "Alchemy output options", children: palette }), paletteTarget) : null,
|
|
1857
|
+
notice && feedbackOwner ? createPortal(/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-feedback", children: [
|
|
1817
1858
|
/* @__PURE__ */ jsx10("span", { role: "status", children: notice }),
|
|
1818
1859
|
/* @__PURE__ */ jsx10(ReceiptLink, { target: receiptTarget }),
|
|
1819
1860
|
/* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
|
|
1820
|
-
] }),
|
|
1861
|
+
] }), feedbackOwner.ownerDocument.body) : null,
|
|
1821
1862
|
Object.values(workspaces).map((saved) => /* @__PURE__ */ jsx10(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)),
|
|
1822
1863
|
emailReview
|
|
1823
1864
|
] });
|