@ai-matrx/design-system 0.21.5 → 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 +8 -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 +187 -114
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.js +206 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.21.7
|
|
4
|
+
|
|
5
|
+
Embed the full canonical Alchemy palette in host submenus without duplicating actions. Preserve preparation windows, copy receipts, source capabilities, focus restoration and disabled guards after submenu dismissal.
|
|
6
|
+
|
|
7
|
+
## 0.21.6
|
|
8
|
+
|
|
9
|
+
Uncustomized favorite and pin values render accessible compact state icons. Custom cell rendering and permission-aware actions remain unchanged.
|
|
10
|
+
|
|
3
11
|
## 0.21.5
|
|
4
12
|
|
|
5
13
|
Shared compact favorite and pin columns: 40px default width, semantic sort and boolean filter menus, exact accessor inference and explicit opt-out. Existing custom cells and permission-aware toggles remain intact.
|
|
@@ -2089,6 +2089,10 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2089
2089
|
const [notice, setNotice] = React10.useState(null);
|
|
2090
2090
|
const [receiptTarget, setReceiptTarget] = React10.useState();
|
|
2091
2091
|
const [paletteOpen, setPaletteOpen] = React10.useState(false);
|
|
2092
|
+
const [paletteTarget, setPaletteTarget] = React10.useState(null);
|
|
2093
|
+
const externalPaletteClose = React10.useRef(null);
|
|
2094
|
+
const externalPaletteRestoreFocus = React10.useRef(null);
|
|
2095
|
+
const feedbackDocument = React10.useRef(null);
|
|
2092
2096
|
const [mode, setMode] = React10.useState("copy");
|
|
2093
2097
|
const scopes = React10.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
2094
2098
|
const [requestedScope, setRequestedScope] = React10.useState(table?.initialScope ?? "target");
|
|
@@ -2185,6 +2189,40 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2185
2189
|
fence.finish(controller);
|
|
2186
2190
|
}
|
|
2187
2191
|
}, [captureOne, fence, initialScope, primary]);
|
|
2192
|
+
const closePalette = React10.useCallback(() => {
|
|
2193
|
+
const onClose = externalPaletteClose.current;
|
|
2194
|
+
const restoreFocus = externalPaletteRestoreFocus.current;
|
|
2195
|
+
externalPaletteClose.current = null;
|
|
2196
|
+
externalPaletteRestoreFocus.current = null;
|
|
2197
|
+
onClose?.();
|
|
2198
|
+
restoreFocus?.();
|
|
2199
|
+
setPaletteTarget(null);
|
|
2200
|
+
setPaletteOpen(false);
|
|
2201
|
+
}, []);
|
|
2202
|
+
const mountPalette = React10.useCallback((target, onClose, restoreFocus) => {
|
|
2203
|
+
if (!target) {
|
|
2204
|
+
externalPaletteClose.current = null;
|
|
2205
|
+
externalPaletteRestoreFocus.current = null;
|
|
2206
|
+
setPaletteTarget(null);
|
|
2207
|
+
setPaletteOpen(false);
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
2211
|
+
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
2212
|
+
externalPaletteClose.current = onClose ?? null;
|
|
2213
|
+
externalPaletteRestoreFocus.current = restoreFocus ?? null;
|
|
2214
|
+
feedbackDocument.current = target.ownerDocument;
|
|
2215
|
+
restoreFocusRef.current = restoreFocus ?? (() => target.focus());
|
|
2216
|
+
setPaletteTarget(target);
|
|
2217
|
+
setPaletteOpen(true);
|
|
2218
|
+
setMode("copy");
|
|
2219
|
+
void preflight();
|
|
2220
|
+
}, [closePalette, disabled, enabled, preflight]);
|
|
2221
|
+
React10.useEffect(() => {
|
|
2222
|
+
if (!paletteTarget || !paletteOpen) return;
|
|
2223
|
+
const firstControl = paletteTarget.querySelector("button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [href]");
|
|
2224
|
+
firstControl?.focus();
|
|
2225
|
+
}, [paletteOpen, paletteTarget]);
|
|
2188
2226
|
const transfer = React10.useCallback(async (format, download, alternate) => {
|
|
2189
2227
|
const { controller, id } = fence.begin();
|
|
2190
2228
|
try {
|
|
@@ -2325,6 +2363,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2325
2363
|
);
|
|
2326
2364
|
React10.useImperativeHandle(controllerRef, () => ({
|
|
2327
2365
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
2366
|
+
mountPalette,
|
|
2328
2367
|
preparePrimary: async (options) => {
|
|
2329
2368
|
if (!enabled) throw new Error("Alchemy is not enabled for this record.");
|
|
2330
2369
|
if (disabled) throw new Error("Alchemy is disabled for this record.");
|
|
@@ -2339,7 +2378,7 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2339
2378
|
externalWorkspaceKeys.current.add(requestedKey);
|
|
2340
2379
|
await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
|
|
2341
2380
|
}
|
|
2342
|
-
}), [disabled, enabled, hide, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
2381
|
+
}), [disabled, enabled, hide, mountPalette, openWorkspace, primary, primaryWorkspaceKey, sourceLabel]);
|
|
2343
2382
|
const runAction = React10.useCallback(async (action) => {
|
|
2344
2383
|
const { controller, id } = fence.begin();
|
|
2345
2384
|
try {
|
|
@@ -2405,7 +2444,6 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2405
2444
|
return (0, import_content_transfer3.sealTransferArtifact)({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: (0, import_content_transfer3.buildAgentPayload)({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
|
|
2406
2445
|
}
|
|
2407
2446
|
};
|
|
2408
|
-
const closePalette = () => setPaletteOpen(false);
|
|
2409
2447
|
const tile = (id, label2, onClick, options = {}) => {
|
|
2410
2448
|
const presentation = options.action;
|
|
2411
2449
|
const Icon = presentation?.icon;
|
|
@@ -2421,122 +2459,125 @@ function ContentTransferMenuSession({ references = [], referenceActions = [], so
|
|
|
2421
2459
|
] })
|
|
2422
2460
|
] }, id);
|
|
2423
2461
|
};
|
|
2462
|
+
const palette = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2463
|
+
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
2464
|
+
table && scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "matrx-alchemy-scope", children: [
|
|
2465
|
+
"Content scope",
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
2467
|
+
const next = scopes.find((scope) => scope === event.target.value);
|
|
2468
|
+
if (next) {
|
|
2469
|
+
setRequestedScope(next);
|
|
2470
|
+
void preflight(next);
|
|
2471
|
+
}
|
|
2472
|
+
}, children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
2473
|
+
] }) : null,
|
|
2474
|
+
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "matrx-alchemy-output", children: [
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
2476
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
2479
|
+
] }) : null,
|
|
2480
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2481
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2482
|
+
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]}` })),
|
|
2483
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
2484
|
+
] }),
|
|
2485
|
+
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
2486
|
+
closePalette();
|
|
2487
|
+
void transfer("markdown", false, variant);
|
|
2488
|
+
} }) : null
|
|
2489
|
+
] }) : null,
|
|
2490
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2491
|
+
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]}` })),
|
|
2492
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
2493
|
+
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
2494
|
+
] }) }) : null
|
|
2495
|
+
] }) : null,
|
|
2496
|
+
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2498
|
+
closePalette();
|
|
2499
|
+
void transfer(nativeAiFormat, false);
|
|
2500
|
+
}, children: [
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "ai-copy" }),
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
2503
|
+
"Copy with AI context",
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
2505
|
+
] })
|
|
2506
|
+
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
2507
|
+
closePalette();
|
|
2508
|
+
void transfer("markdown", false, variant);
|
|
2509
|
+
} }),
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
2511
|
+
closePalette();
|
|
2512
|
+
void openWorkspace();
|
|
2513
|
+
}, children: [
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "sliders" }),
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
2516
|
+
"Prepare for AI",
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
2518
|
+
] })
|
|
2519
|
+
] }) })
|
|
2520
|
+
] }) : null,
|
|
2521
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2522
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2523
|
+
closePalette();
|
|
2524
|
+
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
2525
|
+
}, children: [
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "surface" }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "Prepare this page" })
|
|
2528
|
+
] }) : null,
|
|
2529
|
+
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
2530
|
+
closePalette();
|
|
2531
|
+
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
2532
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
2533
|
+
] }) }) : null,
|
|
2534
|
+
references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: "References" }),
|
|
2536
|
+
referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "link" }),
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: action.label }),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
2540
|
+
] }, action.id)),
|
|
2541
|
+
references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "link" }),
|
|
2543
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: reference.label })
|
|
2544
|
+
] }, reference.id))
|
|
2545
|
+
] }) : null,
|
|
2546
|
+
["save", "chat", "email", "other"].map((group) => {
|
|
2547
|
+
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
2548
|
+
return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("summary", { children: [
|
|
2550
|
+
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: entries.length }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
2554
|
+
] })
|
|
2555
|
+
] }),
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
2557
|
+
closePalette();
|
|
2558
|
+
void runAction(action);
|
|
2559
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
2560
|
+
] }, group) : null;
|
|
2561
|
+
})
|
|
2562
|
+
] });
|
|
2563
|
+
const feedbackOwner = paletteTarget ?? triggerRef.current ?? feedbackDocument.current?.body ?? null;
|
|
2424
2564
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
2425
|
-
!triggerHidden ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
2426
|
-
setPaletteOpen(open);
|
|
2565
|
+
!triggerHidden && !paletteTarget ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
2427
2566
|
if (open) {
|
|
2567
|
+
setPaletteOpen(true);
|
|
2428
2568
|
setMode("copy");
|
|
2429
2569
|
void preflight();
|
|
2430
|
-
}
|
|
2570
|
+
} else closePalette();
|
|
2431
2571
|
}, children: [
|
|
2432
2572
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoverTrigger, { asChild: true, children: triggerVariant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)(AlchemyGlyph, { icon }) }) : triggerVariant === "glass" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass", "data-alchemy-size": triggerSize, disabled }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent", "data-alchemy-size": triggerSize, disabled }) }),
|
|
2433
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.
|
|
2434
|
-
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
2435
|
-
table && scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "matrx-alchemy-scope", children: [
|
|
2436
|
-
"Content scope",
|
|
2437
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
2438
|
-
const next = scopes.find((scope) => scope === event.target.value);
|
|
2439
|
-
if (next) {
|
|
2440
|
-
setRequestedScope(next);
|
|
2441
|
-
void preflight(next);
|
|
2442
|
-
}
|
|
2443
|
-
}, children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
2444
|
-
] }) : null,
|
|
2445
|
-
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "matrx-alchemy-output", children: [
|
|
2446
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
2447
|
-
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
2448
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
2449
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
2450
|
-
] }) : null,
|
|
2451
|
-
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2452
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2453
|
-
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]}` })),
|
|
2454
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
2455
|
-
] }),
|
|
2456
|
-
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
2457
|
-
closePalette();
|
|
2458
|
-
void transfer("markdown", false, variant);
|
|
2459
|
-
} }) : null
|
|
2460
|
-
] }) : null,
|
|
2461
|
-
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2462
|
-
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]}` })),
|
|
2463
|
-
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
2464
|
-
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
2465
|
-
] }) }) : null
|
|
2466
|
-
] }) : null,
|
|
2467
|
-
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2468
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2469
|
-
closePalette();
|
|
2470
|
-
void transfer(nativeAiFormat, false);
|
|
2471
|
-
}, children: [
|
|
2472
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "ai-copy" }),
|
|
2473
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
2474
|
-
"Copy with AI context",
|
|
2475
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Include source context" })
|
|
2476
|
-
] })
|
|
2477
|
-
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
2478
|
-
closePalette();
|
|
2479
|
-
void transfer("markdown", false, variant);
|
|
2480
|
-
} }),
|
|
2481
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
2482
|
-
closePalette();
|
|
2483
|
-
void openWorkspace();
|
|
2484
|
-
}, children: [
|
|
2485
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "sliders" }),
|
|
2486
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
2487
|
-
"Prepare for AI",
|
|
2488
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Trim, edit or summarize" })
|
|
2489
|
-
] })
|
|
2490
|
-
] }) })
|
|
2491
|
-
] }) : null,
|
|
2492
|
-
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2493
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2494
|
-
closePalette();
|
|
2495
|
-
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
2496
|
-
}, children: [
|
|
2497
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "surface" }),
|
|
2498
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: "Prepare this page" })
|
|
2499
|
-
] }) : null,
|
|
2500
|
-
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
2501
|
-
closePalette();
|
|
2502
|
-
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
2503
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
2504
|
-
] }) }) : null,
|
|
2505
|
-
references.length || referenceActions.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
2506
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { children: "References" }),
|
|
2507
|
-
referenceActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: [
|
|
2508
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "link" }),
|
|
2509
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: action.label }),
|
|
2510
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
2511
|
-
] }, action.id)),
|
|
2512
|
-
references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", title: "Copies a reference to saved data", onClick: () => void copyReference(reference), children: [
|
|
2513
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PaletteGlyph, { kind: "link" }),
|
|
2514
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: reference.label })
|
|
2515
|
-
] }, reference.id))
|
|
2516
|
-
] }) : null,
|
|
2517
|
-
["save", "chat", "email", "other"].map((group) => {
|
|
2518
|
-
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
2519
|
-
return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
2520
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("summary", { children: [
|
|
2521
|
-
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
2522
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "matrx-alchemy-disclosure-meta", children: [
|
|
2523
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: entries.length }),
|
|
2524
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("path", { d: "m6 4 4 4-4 4" }) })
|
|
2525
|
-
] })
|
|
2526
|
-
] }),
|
|
2527
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
2528
|
-
closePalette();
|
|
2529
|
-
void runAction(action);
|
|
2530
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
2531
|
-
] }, group) : null;
|
|
2532
|
-
})
|
|
2533
|
-
] })
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: palette })
|
|
2534
2574
|
] }) : null,
|
|
2535
|
-
|
|
2575
|
+
paletteTarget && paletteOpen ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "matrx-alchemy-menu matrx-alchemy-palette", role: "dialog", "aria-label": "Alchemy output options", children: palette }), paletteTarget) : null,
|
|
2576
|
+
notice && feedbackOwner ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "matrx-alchemy-feedback", children: [
|
|
2536
2577
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { role: "status", children: notice }),
|
|
2537
2578
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ReceiptLink, { target: receiptTarget }),
|
|
2538
2579
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
|
|
2539
|
-
] }),
|
|
2580
|
+
] }), feedbackOwner.ownerDocument.body) : null,
|
|
2540
2581
|
Object.values(workspaces).map((saved) => /* @__PURE__ */ (0, import_jsx_runtime11.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)),
|
|
2541
2582
|
emailReview
|
|
2542
2583
|
] });
|