@ai-matrx/design-system 0.18.10 → 0.18.12

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/content-transfer/alchemy.svg +1 -1
  3. package/dist/content-transfer/icon.cjs +3 -1
  4. package/dist/content-transfer/icon.cjs.map +1 -1
  5. package/dist/content-transfer/icon.d.cts +3 -2
  6. package/dist/content-transfer/icon.d.ts +3 -2
  7. package/dist/content-transfer/icon.js +3 -1
  8. package/dist/content-transfer/icon.js.map +1 -1
  9. package/dist/content-transfer.cjs +312 -278
  10. package/dist/content-transfer.cjs.map +1 -1
  11. package/dist/content-transfer.css +87 -24
  12. package/dist/content-transfer.d.cts +1 -1
  13. package/dist/content-transfer.d.ts +1 -1
  14. package/dist/content-transfer.js +312 -278
  15. package/dist/content-transfer.js.map +1 -1
  16. package/dist/data-table/copy-helpers.d.cts +1 -1
  17. package/dist/data-table/copy-helpers.d.ts +1 -1
  18. package/dist/data-table/copy-types.cjs.map +1 -1
  19. package/dist/data-table/copy-types.d.cts +1 -1
  20. package/dist/data-table/copy-types.d.ts +1 -1
  21. package/dist/data-table/data-row-inspector.cjs +314 -277
  22. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  23. package/dist/data-table/data-row-inspector.js +314 -277
  24. package/dist/data-table/data-row-inspector.js.map +1 -1
  25. package/dist/data-table/data-row-window.cjs +314 -277
  26. package/dist/data-table/data-row-window.cjs.map +1 -1
  27. package/dist/data-table/data-row-window.js +314 -277
  28. package/dist/data-table/data-row-window.js.map +1 -1
  29. package/dist/data-table/filter-engine.d.cts +1 -1
  30. package/dist/data-table/filter-engine.d.ts +1 -1
  31. package/dist/data-table/host.cjs.map +1 -1
  32. package/dist/data-table/host.d.cts +16 -2
  33. package/dist/data-table/host.d.ts +16 -2
  34. package/dist/data-table/host.js.map +1 -1
  35. package/dist/data-table/index.cjs +452 -399
  36. package/dist/data-table/index.cjs.map +1 -1
  37. package/dist/data-table/index.d.cts +3 -3
  38. package/dist/data-table/index.d.ts +3 -3
  39. package/dist/data-table/index.js +453 -400
  40. package/dist/data-table/index.js.map +1 -1
  41. package/dist/data-table/infer-filter.d.cts +1 -1
  42. package/dist/data-table/infer-filter.d.ts +1 -1
  43. package/dist/data-table/layered-filters.d.cts +1 -1
  44. package/dist/data-table/layered-filters.d.ts +1 -1
  45. package/dist/data-table/pagination.cjs.map +1 -1
  46. package/dist/data-table/pagination.js.map +1 -1
  47. package/dist/data-table/query-control.d.cts +1 -1
  48. package/dist/data-table/query-control.d.ts +1 -1
  49. package/dist/data-table/types.cjs.map +1 -1
  50. package/dist/data-table/types.d.cts +1 -1
  51. package/dist/data-table/types.d.ts +1 -1
  52. package/dist/data-table/url-state.d.cts +1 -1
  53. package/dist/data-table/url-state.d.ts +1 -1
  54. package/dist/data-table/uuid-cell.cjs.map +1 -1
  55. package/dist/data-table/uuid-cell.js.map +1 -1
  56. package/dist/data-table/xlsx.d.cts +1 -1
  57. package/dist/data-table/xlsx.d.ts +1 -1
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/{types-C2xN6W_q.d.ts → types-BuDKVpeF.d.ts} +2 -1
  61. package/dist/{types-D_tpuk6m.d.cts → types-Dqcb7jXO.d.cts} +2 -1
  62. package/package.json +2 -2
@@ -520,14 +520,14 @@ var PopoverContent = React6.forwardRef(
520
520
  );
521
521
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
522
522
 
523
+ // src/content-transfer/icon.ts
524
+ var ALCHEMY_GLYPH_PATHS = ["M9 3h6", "M10 3v6l-5.2 8.7A2 2 0 0 0 6.5 21h11a2 2 0 0 0 1.7-3.3L14 9V3", "M8 15h8"];
525
+ var ALCHEMY_GLYPH_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${ALCHEMY_GLYPH_PATHS.map((d) => `<path d="${d}"/>`).join("")}</svg>`;
526
+
523
527
  // src/content-transfer/index.tsx
524
528
  import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
525
529
  function AlchemyGlyph(props) {
526
- return /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
527
- /* @__PURE__ */ jsx10("path", { d: "M4.5 5.5h8v11h-8z" }),
528
- /* @__PURE__ */ jsx10("path", { d: "M8.5 9.5h8v9h-8z" }),
529
- /* @__PURE__ */ jsx10("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
530
- ] });
530
+ return /* @__PURE__ */ jsx10("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: ALCHEMY_GLYPH_PATHS.map((d) => /* @__PURE__ */ jsx10("path", { d }, d)) });
531
531
  }
532
532
  var CapabilityContext = React7.createContext({});
533
533
  var useContentTransferCapabilities = () => React7.useContext(CapabilityContext);
@@ -541,7 +541,16 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
541
541
  ] })
542
542
  ] });
543
543
  }
544
- function PaletteGlyph({ format, ai = false, file = false }) {
544
+ function PaletteGlyph({ format, ai = false, file = false, kind }) {
545
+ if (kind === "ai-copy") return /* @__PURE__ */ jsxs5("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
546
+ /* @__PURE__ */ jsx10("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
547
+ /* @__PURE__ */ jsx10("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
548
+ /* @__PURE__ */ jsx10("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
549
+ ] });
550
+ if (kind === "sliders") return /* @__PURE__ */ jsxs5("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
551
+ /* @__PURE__ */ jsx10("path", { d: "M4 6h16M4 12h16M4 18h16" }),
552
+ /* @__PURE__ */ jsx10("path", { d: "M8 3v6M16 9v6M10 15v6" })
553
+ ] });
545
554
  if (ai) return /* @__PURE__ */ jsxs5("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
546
555
  /* @__PURE__ */ jsx10("path", { d: "M12 5a3 3 0 1 0-5.997.125A4 4 0 0 0 3.5 10.9a4 4 0 0 0 .556 6.588A4 4 0 0 0 12 19" }),
547
556
  /* @__PURE__ */ jsx10("path", { d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.503 5.775 4 4 0 0 1-.556 6.588A4 4 0 0 1 12 19" }),
@@ -574,15 +583,15 @@ function PaletteGlyph({ format, ai = false, file = false }) {
574
583
  ] }) : format === "html" ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsx10("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsx10("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
575
584
  return /* @__PURE__ */ jsx10("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: path });
576
585
  }
577
- function PaletteRows({ title, items, onRun, extra, ai = false }) {
586
+ function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
578
587
  if (!items.length && !extra) return null;
579
588
  return /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-palette-section", children: [
580
589
  /* @__PURE__ */ jsx10("h3", { children: title }),
581
590
  items.map((item) => /* @__PURE__ */ jsxs5("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
582
- item.icon ? /* @__PURE__ */ jsx10(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx10(PaletteGlyph, { ai }),
591
+ item.icon ? /* @__PURE__ */ jsx10(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx10(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
583
592
  /* @__PURE__ */ jsxs5("span", { children: [
584
593
  item.copyLabel ?? item.label,
585
- item.hint ? /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
594
+ item.hint ?? fallbackHint ? /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: item.hint ?? fallbackHint }) : null
586
595
  ] })
587
596
  ] }, item.id)),
588
597
  extra
@@ -979,45 +988,54 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
979
988
  }, children: [
980
989
  /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx10("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ jsx10(AlchemyGlyph, {}) }) }),
981
990
  /* @__PURE__ */ jsxs5(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
982
- copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
983
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
984
- /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
985
- ] }) : null,
986
991
  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,
987
- resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
988
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
989
- 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]}` })),
990
- visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
991
- ] }),
992
- quickVariants("copy").length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
992
+ copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-output", children: [
993
+ /* @__PURE__ */ jsx10("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
994
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
995
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
996
+ /* @__PURE__ */ jsx10("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
997
+ ] }) : null,
998
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
999
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
1000
+ 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]}` })),
1001
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
1002
+ ] }),
1003
+ quickVariants("copy").length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
1004
+ closePalette();
1005
+ void transfer("markdown", false, variant);
1006
+ } }) : null
1007
+ ] }) : null,
1008
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
1009
+ 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]}` })),
1010
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
1011
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
1012
+ ] }) }) : null
1013
+ ] }) : null,
1014
+ prepareAvailable ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1015
+ /* @__PURE__ */ jsx10(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", items: quickVariants("ai"), onRun: (variant) => {
993
1016
  closePalette();
994
1017
  void transfer("markdown", false, variant);
995
- } }) : null
1018
+ } }),
1019
+ /* @__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: () => {
1020
+ closePalette();
1021
+ void openWorkspace();
1022
+ }, children: [
1023
+ /* @__PURE__ */ jsx10(PaletteGlyph, { kind: "sliders" }),
1024
+ /* @__PURE__ */ jsxs5("span", { children: [
1025
+ "Prepare for AI",
1026
+ /* @__PURE__ */ jsx10("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
1027
+ ] })
1028
+ ] }) })
996
1029
  ] }) : null,
997
- resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx10(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-palette-grid", children: [
998
- 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]}` })),
999
- visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
1000
- downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
1001
- ] }) }) : null,
1002
- prepareAvailable ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
1003
- closePalette();
1004
- void transfer("markdown", false, variant);
1005
- }, extra: /* @__PURE__ */ jsxs5("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1006
- closePalette();
1007
- void openWorkspace();
1008
- }, children: [
1009
- /* @__PURE__ */ jsx10(PaletteGlyph, { ai: true }),
1010
- /* @__PURE__ */ jsx10("span", { children: "Prepare for AI\u2026" })
1011
- ] }) }) : null,
1012
- prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ jsxs5(Fragment, { children: [
1030
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs5(Fragment, { children: [
1013
1031
  nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1014
1032
  closePalette();
1015
1033
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
1016
- }, children: /* @__PURE__ */ jsx10("span", { children: "Prepare this surface\u2026" }) }) : null,
1034
+ }, children: /* @__PURE__ */ jsx10("span", { children: "Prepare this surface" }) }) : null,
1017
1035
  variants.map((variant) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1018
1036
  closePalette();
1019
1037
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
1020
- }, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
1038
+ }, children: /* @__PURE__ */ jsx10(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
1021
1039
  ] }) }) : null,
1022
1040
  ordinaryActions.length ? /* @__PURE__ */ jsx10(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ jsx10("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1023
1041
  closePalette();
@@ -1295,137 +1313,138 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1295
1313
  state.snapshot.label
1296
1314
  ] }),
1297
1315
  /* @__PURE__ */ jsxs5(DialogDescription, { children: [
1298
- "Captured ",
1299
- state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
1300
- ". Your source is never edited."
1316
+ state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
1317
+ "Review and edit this copy. Your original stays unchanged."
1301
1318
  ] })
1302
1319
  ] }),
1303
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-grid", children: [
1304
- /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-main", children: [
1305
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1306
- scopes.length > 1 ? /* @__PURE__ */ jsxs5("label", { children: [
1307
- "Scope",
1308
- /* @__PURE__ */ jsx10("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx10("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1309
- ] }) : null,
1310
- /* @__PURE__ */ jsxs5("label", { children: [
1311
- "Detail",
1312
- /* @__PURE__ */ jsxs5("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1313
- /* @__PURE__ */ jsx10("option", { value: "full", children: "Full" }),
1314
- /* @__PURE__ */ jsx10("option", { value: "compact", children: "Compact" }),
1315
- /* @__PURE__ */ jsx10("option", { value: "brief", children: "Brief" }),
1316
- /* @__PURE__ */ jsx10("option", { value: "custom", children: "Custom" })
1317
- ] })
1318
- ] }),
1319
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1320
- setBufferError(null);
1321
- if (controlsHistory.length) {
1322
- const next = controlsHistory[controlsHistory.length - 1];
1320
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-body", children: [
1321
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-grid", children: [
1322
+ /* @__PURE__ */ jsxs5("section", { className: "matrx-alchemy-main", children: [
1323
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1324
+ scopes.length > 1 ? /* @__PURE__ */ jsxs5("label", { children: [
1325
+ "Scope",
1326
+ /* @__PURE__ */ jsx10("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx10("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1327
+ ] }) : null,
1328
+ /* @__PURE__ */ jsxs5("label", { children: [
1329
+ "Detail",
1330
+ /* @__PURE__ */ jsxs5("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1331
+ /* @__PURE__ */ jsx10("option", { value: "full", children: "Full" }),
1332
+ /* @__PURE__ */ jsx10("option", { value: "compact", children: "Compact" }),
1333
+ /* @__PURE__ */ jsx10("option", { value: "brief", children: "Brief" }),
1334
+ /* @__PURE__ */ jsx10("option", { value: "custom", children: "Custom" })
1335
+ ] })
1336
+ ] }),
1337
+ /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1338
+ setBufferError(null);
1339
+ if (controlsHistory.length) {
1340
+ const next = controlsHistory[controlsHistory.length - 1];
1341
+ setControls(next);
1342
+ setControlsHistory((history) => history.slice(0, -1));
1343
+ onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1344
+ } else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
1345
+ }, children: "Undo" }),
1346
+ /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1347
+ const next = initialControls(state);
1323
1348
  setControls(next);
1324
- setControlsHistory((history) => history.slice(0, -1));
1349
+ setControlsHistory([]);
1350
+ setPendingControls(null);
1351
+ setBufferError(null);
1325
1352
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1326
- } else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
1327
- }, children: "Undo" }),
1328
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => {
1329
- const next = initialControls(state);
1330
- setControls(next);
1331
- setControlsHistory([]);
1332
- setPendingControls(null);
1333
- setBufferError(null);
1334
- onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1335
- }, children: "Reset" }),
1336
- /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1337
- ] }),
1338
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1339
- /* @__PURE__ */ jsx10("legend", { children: "JSON limits" }),
1340
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs5("label", { children: [
1341
- text,
1342
- /* @__PURE__ */ jsx10("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1343
- ] }, key))
1344
- ] }) : null,
1345
- rows ? /* @__PURE__ */ jsx10(RowControls, { rows, controls, change: changeControls }) : null,
1346
- state.snapshot.sections.length ? /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1347
- /* @__PURE__ */ jsx10("legend", { children: "Sections" }),
1348
- state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs5("label", { children: [
1349
- /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1350
- " ",
1351
- section.label
1352
- ] }, section.id))
1353
- ] }) : null,
1354
- /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-coverage", children: [
1355
- /* @__PURE__ */ jsxs5("span", { children: [
1356
- state.snapshot.coverage.included.toLocaleString(),
1357
- " included",
1358
- state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1359
- " \xB7 ",
1360
- state.snapshot.coverage.status
1353
+ }, children: "Reset" }),
1354
+ /* @__PURE__ */ jsx10(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1361
1355
  ] }),
1362
- state.snapshot.coverage.reason ? /* @__PURE__ */ jsx10("span", { children: state.snapshot.coverage.reason }) : null,
1363
- limitText ? /* @__PURE__ */ jsxs5("span", { children: [
1364
- "Limits: ",
1365
- limitText
1356
+ controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1357
+ /* @__PURE__ */ jsx10("legend", { children: "JSON limits" }),
1358
+ [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs5("label", { children: [
1359
+ text,
1360
+ /* @__PURE__ */ jsx10("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1361
+ ] }, key))
1362
+ ] }) : null,
1363
+ rows ? /* @__PURE__ */ jsx10(RowControls, { rows, controls, change: changeControls }) : null,
1364
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1365
+ /* @__PURE__ */ jsx10("legend", { children: "Sections" }),
1366
+ state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs5("label", { children: [
1367
+ /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.sections.includes(section.id), onChange: (e) => changeControls({ ...controls, sections: e.target.checked ? [...controls.sections, section.id] : controls.sections.filter((id) => id !== section.id) }) }),
1368
+ " ",
1369
+ section.label
1370
+ ] }, section.id))
1366
1371
  ] }) : null,
1367
- displayedOmissions.length ? /* @__PURE__ */ jsxs5("details", { children: [
1368
- /* @__PURE__ */ jsxs5("summary", { children: [
1369
- displayedOmissions.length,
1370
- " omissions or adjustments"
1372
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-coverage", children: [
1373
+ /* @__PURE__ */ jsxs5("span", { children: [
1374
+ state.snapshot.coverage.included.toLocaleString(),
1375
+ " included",
1376
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1377
+ " \xB7 ",
1378
+ state.snapshot.coverage.status
1371
1379
  ] }),
1372
- /* @__PURE__ */ jsx10("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs5("li", { children: [
1373
- o.path || "/",
1374
- ": ",
1375
- o.reason,
1376
- o.count == null ? "" : ` (${o.count})`
1377
- ] }, `${o.path}-${o.reason}-${i}`)) })
1378
- ] }) : null
1379
- ] }),
1380
- /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-preview-label", children: [
1381
- "Output format",
1382
- /* @__PURE__ */ jsxs5("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1383
- formats.map((f) => /* @__PURE__ */ jsx10("option", { value: f, children: LABEL[f] }, f)),
1384
- state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx10("option", { value: "xlsx", children: "Excel workbook" }) : null,
1385
- workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx10("option", { value: adapter.id, children: adapter.label }, adapter.id))
1386
- ] })
1380
+ state.snapshot.coverage.reason ? /* @__PURE__ */ jsx10("span", { children: state.snapshot.coverage.reason }) : null,
1381
+ limitText ? /* @__PURE__ */ jsxs5("span", { children: [
1382
+ "Limits: ",
1383
+ limitText
1384
+ ] }) : null,
1385
+ displayedOmissions.length ? /* @__PURE__ */ jsxs5("details", { children: [
1386
+ /* @__PURE__ */ jsxs5("summary", { children: [
1387
+ displayedOmissions.length,
1388
+ " omissions or adjustments"
1389
+ ] }),
1390
+ /* @__PURE__ */ jsx10("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs5("li", { children: [
1391
+ o.path || "/",
1392
+ ": ",
1393
+ o.reason,
1394
+ o.count == null ? "" : ` (${o.count})`
1395
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1396
+ ] }) : null
1397
+ ] }),
1398
+ /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-preview-label", children: [
1399
+ "Output format",
1400
+ /* @__PURE__ */ jsxs5("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1401
+ formats.map((f) => /* @__PURE__ */ jsx10("option", { value: f, children: LABEL[f] }, f)),
1402
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx10("option", { value: "xlsx", children: "Excel workbook" }) : null,
1403
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx10("option", { value: adapter.id, children: adapter.label }, adapter.id))
1404
+ ] })
1405
+ ] }),
1406
+ /* @__PURE__ */ jsx10("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1407
+ bufferError ? /* @__PURE__ */ jsx10("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1408
+ formatError ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1409
+ bufferError ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1410
+ const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1411
+ setBufferError(null);
1412
+ onChange({ ...state, draft: fallback, error: void 0 });
1413
+ setFormat("plain");
1414
+ }, children: "Use invalid JSON as plain text" }) : null
1387
1415
  ] }),
1388
- /* @__PURE__ */ jsx10("textarea", { className: "matrx-alchemy-preview", "aria-label": "Prepared output", "aria-invalid": bufferError ? true : void 0, "aria-describedby": bufferError ? "alchemy-buffer-error" : void 0, value: buffer, onChange: (e) => editBuffer(e.target.value) }),
1389
- bufferError ? /* @__PURE__ */ jsx10("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1390
- formatError ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1391
- bufferError ? /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1392
- const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1393
- setBufferError(null);
1394
- onChange({ ...state, draft: fallback, error: void 0 });
1395
- setFormat("plain");
1396
- }, children: "Use invalid JSON as plain text" }) : null
1416
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs5("aside", { children: [
1417
+ ai ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1418
+ /* @__PURE__ */ jsxs5("label", { children: [
1419
+ "AI instruction",
1420
+ /* @__PURE__ */ jsx10("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1421
+ ] }),
1422
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1423
+ busy === "ai" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1424
+ ] }) : null,
1425
+ busy === "capture" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1426
+ activeCapture.current?.abort();
1427
+ activeCapture.current = null;
1428
+ setBusy(null);
1429
+ }, children: "Stop loading rows" }) : null,
1430
+ ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1431
+ ai ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-meta", children: "AI updates the preview; copy it when you are ready. Closing this window lets the AI run continue." }) : null,
1432
+ state.error ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1433
+ ] }) : null
1397
1434
  ] }),
1398
- ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs5("aside", { children: [
1399
- ai ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1400
- /* @__PURE__ */ jsxs5("label", { children: [
1401
- "AI instruction",
1402
- /* @__PURE__ */ jsx10("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1403
- ] }),
1404
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1405
- busy === "ai" ? /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1406
- ] }) : null,
1407
- busy === "capture" ? /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => {
1408
- activeCapture.current?.abort();
1409
- activeCapture.current = null;
1410
- setBusy(null);
1411
- }, children: "Stop loading rows" }) : null,
1412
- ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1413
- ai ? /* @__PURE__ */ jsx10("p", { className: "matrx-alchemy-meta", children: "AI creates a preview. It never copies automatically. Closing detaches this view without cancelling server work." }) : null,
1414
- state.error ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1415
- ] }) : null
1435
+ pendingControls ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1436
+ /* @__PURE__ */ jsx10("p", { children: "This control would replace your manual edit." }),
1437
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1438
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1439
+ ] }) : null,
1440
+ state.sourceStale ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1441
+ state.pending ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1442
+ /* @__PURE__ */ jsx10("p", { children: "A fresh source snapshot is ready." }),
1443
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1444
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1445
+ ] }) : null,
1446
+ deliveryNotice ? /* @__PURE__ */ jsx10("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1416
1447
  ] }),
1417
- pendingControls ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1418
- /* @__PURE__ */ jsx10("p", { children: "This control would replace your manual edit." }),
1419
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1420
- /* @__PURE__ */ jsx10(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1421
- ] }) : null,
1422
- state.sourceStale ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1423
- state.pending ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1424
- /* @__PURE__ */ jsx10("p", { children: "A fresh source snapshot is ready." }),
1425
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1426
- /* @__PURE__ */ jsx10(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1427
- ] }) : null,
1428
- deliveryNotice ? /* @__PURE__ */ jsx10("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
1429
1448
  /* @__PURE__ */ jsxs5(DialogFooter, { children: [
1430
1449
  /* @__PURE__ */ jsxs5("span", { className: "matrx-alchemy-meta", children: [
1431
1450
  buffer.length.toLocaleString(),
@@ -1433,13 +1452,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1433
1452
  estimateTokens(buffer).toLocaleString(),
1434
1453
  " tokens"
1435
1454
  ] }),
1436
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", onClick: close, children: "Close" }),
1437
- /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download prepared output" }),
1438
- /* @__PURE__ */ jsx10(Button, { type: "button", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy prepared output" })
1455
+ /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1456
+ /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", "aria-label": "Download prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download" }),
1457
+ /* @__PURE__ */ jsx10(Button, { type: "button", className: "matrx-alchemy-workspace-primary", "aria-label": "Copy prepared output", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy" })
1439
1458
  ] })
1440
1459
  ] }) });
1441
1460
  }
1442
1461
  function RowControls({ rows, controls, change }) {
1462
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1463
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1464
+ const dataSummary = [controls.search ? "search active" : "", controls.sort ? `sorted by ${rows.columns.find((column) => column.id === controls.sort)?.label ?? controls.sort}` : "", filterCount ? `${filterCount} filter${filterCount === 1 ? "" : "s"}` : ""].filter(Boolean).join(" \xB7 ");
1443
1465
  return /* @__PURE__ */ jsxs5(Fragment, { children: [
1444
1466
  /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1445
1467
  /* @__PURE__ */ jsxs5("label", { children: [
@@ -1465,32 +1487,40 @@ function RowControls({ rows, controls, change }) {
1465
1487
  /* @__PURE__ */ jsx10("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1466
1488
  ] })
1467
1489
  ] }),
1468
- /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1469
- /* @__PURE__ */ jsx10("legend", { children: "Columns and filters" }),
1470
- rows.columns.map((column) => /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-column", children: [
1490
+ /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1491
+ /* @__PURE__ */ jsxs5("summary", { children: [
1492
+ "Columns and filters",
1493
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1494
+ ] }),
1495
+ /* @__PURE__ */ jsx10("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-column", children: [
1471
1496
  /* @__PURE__ */ jsxs5("label", { children: [
1472
1497
  /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.visibleColumns.includes(column.id), onChange: (e) => change({ ...controls, visibleColumns: e.target.checked ? [...controls.visibleColumns, column.id] : controls.visibleColumns.filter((id) => id !== column.id) }) }),
1473
1498
  " ",
1474
1499
  column.label
1475
1500
  ] }),
1476
1501
  /* @__PURE__ */ jsx10("input", { "aria-label": `Filter ${column.label}`, placeholder: "Filter", value: controls.filters[column.id] ?? "", onChange: (e) => change({ ...controls, filters: { ...controls.filters, [column.id]: e.target.value } }) })
1477
- ] }, column.id))
1502
+ ] }, column.id)) })
1478
1503
  ] }),
1479
- /* @__PURE__ */ jsxs5("fieldset", { className: "matrx-alchemy-options", children: [
1480
- /* @__PURE__ */ jsx10("legend", { children: "Rows" }),
1481
- /* @__PURE__ */ jsxs5("label", { children: [
1482
- /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1483
- " Only selected rows"
1504
+ /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1505
+ /* @__PURE__ */ jsxs5("summary", { children: [
1506
+ "Rows \u2014 ",
1507
+ selectionSummary
1484
1508
  ] }),
1485
- /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1486
- const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1487
- return /* @__PURE__ */ jsxs5("label", { children: [
1488
- /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1489
- " Row ",
1490
- index + 1,
1491
- summary ? ` \u2014 ${summary}` : ""
1492
- ] }, index);
1493
- }) })
1509
+ /* @__PURE__ */ jsxs5("fieldset", { "aria-label": "Row selection", children: [
1510
+ /* @__PURE__ */ jsxs5("label", { children: [
1511
+ /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1512
+ " Only selected rows"
1513
+ ] }),
1514
+ /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1515
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1516
+ return /* @__PURE__ */ jsxs5("label", { children: [
1517
+ /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedIndices.includes(index), onChange: (e) => change({ ...controls, selectedIndices: e.target.checked ? [...controls.selectedIndices, index] : controls.selectedIndices.filter((value) => value !== index) }) }),
1518
+ " Row ",
1519
+ index + 1,
1520
+ summary ? ` \u2014 ${summary}` : ""
1521
+ ] }, index);
1522
+ }) })
1523
+ ] })
1494
1524
  ] })
1495
1525
  ] });
1496
1526
  }
@@ -1642,7 +1672,7 @@ function MatrxCopyMenuSession(props) {
1642
1672
  if (aiVisible && props.aiCustom)
1643
1673
  actions.push({
1644
1674
  id: "configure-source",
1645
- label: props.aiCustom.label ?? "Customize source\u2026",
1675
+ label: props.aiCustom.label ?? "Customize source",
1646
1676
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1647
1677
  supports: () => true,
1648
1678
  run: async () => {
@@ -1653,7 +1683,7 @@ function MatrxCopyMenuSession(props) {
1653
1683
  if (aiVisible && props.groomer)
1654
1684
  actions.push({
1655
1685
  id: "groom-source",
1656
- label: "Customize sections\u2026",
1686
+ label: "Customize sections",
1657
1687
  supports: () => true,
1658
1688
  run: async () => {
1659
1689
  setConfiguration({ groomer: props.groomer() });
@@ -1763,7 +1793,8 @@ function MatrxCopyMenuSession(props) {
1763
1793
  className: cn(
1764
1794
  props.className,
1765
1795
  props.size === "xs" && "matrx-alchemy-xs",
1766
- props.size === "sm" && "matrx-alchemy-sm"
1796
+ props.size === "sm" && "matrx-alchemy-sm",
1797
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1767
1798
  ),
1768
1799
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1769
1800
  }
@@ -1868,127 +1899,132 @@ function SourceConfiguration({
1868
1899
  event.preventDefault();
1869
1900
  if (!handingOff.current) restoreFocus();
1870
1901
  },
1871
- className: "matrx-alchemy-workspace",
1902
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1872
1903
  children: [
1873
1904
  /* @__PURE__ */ jsxs6(DialogHeader, { children: [
1874
1905
  /* @__PURE__ */ jsx11(DialogTitle, { children: title }),
1875
1906
  /* @__PURE__ */ jsx11(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1876
1907
  ] }),
1877
- /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1878
- custom?.options.map((option) => /* @__PURE__ */ jsxs6("label", { children: [
1879
- option.label,
1880
- "hint" in option && option.hint ? /* @__PURE__ */ jsx11("small", { children: option.hint }) : null,
1881
- option.kind === "toggle" ? /* @__PURE__ */ jsx11(
1882
- "input",
1883
- {
1884
- type: "checkbox",
1885
- checked: Boolean(values[option.key]),
1886
- onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1887
- }
1888
- ) : option.kind === "preset" ? /* @__PURE__ */ jsx11(
1889
- "select",
1890
- {
1891
- value: Number(values[option.key]),
1892
- onChange: (event) => setValues({
1893
- ...values,
1894
- [option.key]: Number(event.target.value)
1895
- }),
1896
- children: option.options.map((choice) => /* @__PURE__ */ jsx11("option", { value: choice.value, children: choice.label }, choice.value))
1897
- }
1898
- ) : option.kind === "slider" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1899
- /* @__PURE__ */ jsx11(
1908
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-body", children: [
1909
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1910
+ custom?.options.map((option) => /* @__PURE__ */ jsxs6("label", { children: [
1911
+ option.label,
1912
+ "hint" in option && option.hint ? /* @__PURE__ */ jsx11("small", { children: option.hint }) : null,
1913
+ option.kind === "toggle" ? /* @__PURE__ */ jsx11(
1900
1914
  "input",
1901
1915
  {
1902
- type: "range",
1903
- min: 0,
1904
- max: Math.max(0, option.stops.length - 1),
1905
- step: 1,
1906
- value: option.stops.indexOf(Number(values[option.key])),
1907
- onChange: (event) => setValues({
1908
- ...values,
1909
- [option.key]: option.stops[Number(event.target.value)]
1910
- })
1916
+ type: "checkbox",
1917
+ checked: Boolean(values[option.key]),
1918
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1911
1919
  }
1912
- ),
1913
- /* @__PURE__ */ jsx11("span", { children: option.formatValue(Number(values[option.key])) })
1914
- ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
1915
- /* @__PURE__ */ jsx11(
1916
- "input",
1920
+ ) : option.kind === "preset" ? /* @__PURE__ */ jsx11(
1921
+ "select",
1917
1922
  {
1918
- type: "number",
1919
- min: option.min,
1920
- step: option.step,
1921
1923
  value: Number(values[option.key]),
1922
1924
  onChange: (event) => setValues({
1923
1925
  ...values,
1924
1926
  [option.key]: Number(event.target.value)
1925
- })
1927
+ }),
1928
+ children: option.options.map((choice) => /* @__PURE__ */ jsx11("option", { value: choice.value, children: choice.label }, choice.value))
1926
1929
  }
1927
- ),
1928
- option.presets?.map((preset) => /* @__PURE__ */ jsx11(
1930
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1931
+ /* @__PURE__ */ jsx11(
1932
+ "input",
1933
+ {
1934
+ type: "range",
1935
+ min: 0,
1936
+ max: Math.max(0, option.stops.length - 1),
1937
+ step: 1,
1938
+ value: option.stops.indexOf(Number(values[option.key])),
1939
+ onChange: (event) => setValues({
1940
+ ...values,
1941
+ [option.key]: option.stops[Number(event.target.value)]
1942
+ })
1943
+ }
1944
+ ),
1945
+ /* @__PURE__ */ jsx11("span", { children: option.formatValue(Number(values[option.key])) })
1946
+ ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
1947
+ /* @__PURE__ */ jsx11(
1948
+ "input",
1949
+ {
1950
+ type: "number",
1951
+ min: option.min,
1952
+ step: option.step,
1953
+ value: Number(values[option.key]),
1954
+ onChange: (event) => setValues({
1955
+ ...values,
1956
+ [option.key]: Number(event.target.value)
1957
+ })
1958
+ }
1959
+ ),
1960
+ option.presets?.map((preset) => /* @__PURE__ */ jsx11(
1961
+ Button,
1962
+ {
1963
+ type: "button",
1964
+ variant: "ghost",
1965
+ className: "matrx-alchemy-workspace-secondary",
1966
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1967
+ children: preset.label
1968
+ },
1969
+ preset.value
1970
+ ))
1971
+ ] })
1972
+ ] }, option.key)),
1973
+ groomer ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1974
+ /* @__PURE__ */ jsx11("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11(
1929
1975
  Button,
1930
1976
  {
1931
1977
  type: "button",
1932
1978
  variant: "ghost",
1933
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1934
- children: preset.label
1979
+ className: "matrx-alchemy-workspace-secondary",
1980
+ onClick: () => setSections(
1981
+ Object.fromEntries(
1982
+ groomer.sections.map((section) => [
1983
+ section.id,
1984
+ level === "brief" && section.cuttable ? "off" : level
1985
+ ])
1986
+ )
1987
+ ),
1988
+ children: level
1935
1989
  },
1936
- preset.value
1937
- ))
1938
- ] })
1939
- ] }, option.key)),
1940
- groomer ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1941
- /* @__PURE__ */ jsx11("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11(
1942
- Button,
1943
- {
1944
- type: "button",
1945
- variant: "ghost",
1946
- onClick: () => setSections(
1947
- Object.fromEntries(
1948
- groomer.sections.map((section) => [
1949
- section.id,
1950
- level === "brief" && section.cuttable ? "off" : level
1951
- ])
1952
- )
1990
+ level
1991
+ )) }),
1992
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
1993
+ section.title,
1994
+ /* @__PURE__ */ jsxs6(
1995
+ "select",
1996
+ {
1997
+ value: sections[section.id],
1998
+ onChange: (event) => setSections({
1999
+ ...sections,
2000
+ [section.id]: event.target.value
2001
+ }),
2002
+ children: [
2003
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2004
+ section.cuttable ? /* @__PURE__ */ jsx11("option", { value: "off", children: "Exclude" }) : null
2005
+ ]
2006
+ }
1953
2007
  ),
1954
- children: level
1955
- },
1956
- level
1957
- )) }),
1958
- groomer.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
1959
- section.title,
1960
- /* @__PURE__ */ jsxs6(
1961
- "select",
1962
- {
1963
- value: sections[section.id],
1964
- onChange: (event) => setSections({
1965
- ...sections,
1966
- [section.id]: event.target.value
1967
- }),
1968
- children: [
1969
- ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1970
- section.cuttable ? /* @__PURE__ */ jsx11("option", { value: "off", children: "Exclude" }) : null
1971
- ]
1972
- }
1973
- ),
1974
- section.description ? /* @__PURE__ */ jsx11("span", { children: section.description }) : null
1975
- ] }, section.id))
1976
- ] }) : null
1977
- ] }),
1978
- /* @__PURE__ */ jsxs6("p", { children: [
1979
- text.length.toLocaleString(),
1980
- " characters \xB7 approximately",
1981
- " ",
1982
- Math.ceil(text.length / 4).toLocaleString(),
1983
- " tokens"
2008
+ section.description ? /* @__PURE__ */ jsx11("span", { children: section.description }) : null
2009
+ ] }, section.id))
2010
+ ] }) : null
2011
+ ] }),
2012
+ /* @__PURE__ */ jsxs6("p", { children: [
2013
+ text.length.toLocaleString(),
2014
+ " characters \xB7 approximately",
2015
+ " ",
2016
+ Math.ceil(text.length / 4).toLocaleString(),
2017
+ " tokens"
2018
+ ] }),
2019
+ error || buildError ? /* @__PURE__ */ jsx11("p", { role: "alert", children: error ?? buildError }) : null
1984
2020
  ] }),
1985
- error || buildError ? /* @__PURE__ */ jsx11("p", { role: "alert", children: error ?? buildError }) : null,
1986
2021
  /* @__PURE__ */ jsxs6(DialogFooter, { children: [
1987
2022
  /* @__PURE__ */ jsx11(
1988
2023
  Button,
1989
2024
  {
1990
2025
  type: "button",
1991
2026
  variant: "ghost",
2027
+ className: "matrx-alchemy-workspace-secondary",
1992
2028
  disabled: busy,
1993
2029
  onClick: onClose,
1994
2030
  children: "Cancel"
@@ -1998,6 +2034,7 @@ function SourceConfiguration({
1998
2034
  Button,
1999
2035
  {
2000
2036
  type: "button",
2037
+ className: "matrx-alchemy-workspace-primary",
2001
2038
  disabled: busy || !prepared || Boolean(buildError),
2002
2039
  onClick: async () => {
2003
2040
  if (!prepared) return;