@ai-matrx/design-system 0.18.10 → 0.18.13

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 +29 -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 +323 -277
  10. package/dist/content-transfer.cjs.map +1 -1
  11. package/dist/content-transfer.css +93 -25
  12. package/dist/content-transfer.d.cts +1 -1
  13. package/dist/content-transfer.d.ts +1 -1
  14. package/dist/content-transfer.js +323 -277
  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 +325 -276
  22. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  23. package/dist/data-table/data-row-inspector.js +325 -276
  24. package/dist/data-table/data-row-inspector.js.map +1 -1
  25. package/dist/data-table/data-row-window.cjs +325 -276
  26. package/dist/data-table/data-row-window.cjs.map +1 -1
  27. package/dist/data-table/data-row-window.js +325 -276
  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 +463 -398
  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 +464 -399
  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,150 @@ 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))
1366
1362
  ] }) : null,
1367
- displayedOmissions.length ? /* @__PURE__ */ jsxs5("details", { children: [
1363
+ rows ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
1368
1364
  /* @__PURE__ */ jsxs5("summary", { children: [
1369
- displayedOmissions.length,
1370
- " omissions or adjustments"
1365
+ "Data selection \xB7 ",
1366
+ controls.visibleColumns.length,
1367
+ " columns",
1368
+ controls.search || controls.sort || controls.top != null || controls.selectedOnly || Object.values(controls.filters).some(Boolean) ? " \xB7 customized" : " \xB7 all rows"
1371
1369
  ] }),
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
- ] })
1370
+ /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ jsx10(RowControls, { rows, controls, change: changeControls }) })
1371
+ ] }) : null,
1372
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1373
+ /* @__PURE__ */ jsxs5("summary", { children: [
1374
+ "Sections \xB7 ",
1375
+ controls.sections.length,
1376
+ " included"
1377
+ ] }),
1378
+ /* @__PURE__ */ jsx10("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs5("label", { children: [
1379
+ /* @__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) }) }),
1380
+ " ",
1381
+ section.label
1382
+ ] }, section.id)) })
1383
+ ] }) : null,
1384
+ /* @__PURE__ */ jsxs5("label", { className: "matrx-alchemy-preview-label", children: [
1385
+ "Output format",
1386
+ /* @__PURE__ */ jsxs5("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1387
+ formats.map((f) => /* @__PURE__ */ jsx10("option", { value: f, children: LABEL[f] }, f)),
1388
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx10("option", { value: "xlsx", children: "Excel workbook" }) : null,
1389
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx10("option", { value: adapter.id, children: adapter.label }, adapter.id))
1390
+ ] })
1391
+ ] }),
1392
+ /* @__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) }),
1393
+ /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-coverage", children: [
1394
+ /* @__PURE__ */ jsxs5("span", { children: [
1395
+ state.snapshot.coverage.included.toLocaleString(),
1396
+ " included",
1397
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1398
+ " \xB7 ",
1399
+ state.snapshot.coverage.status
1400
+ ] }),
1401
+ state.snapshot.coverage.reason ? /* @__PURE__ */ jsx10("span", { children: state.snapshot.coverage.reason }) : null,
1402
+ limitText ? /* @__PURE__ */ jsxs5("span", { children: [
1403
+ "Limits: ",
1404
+ limitText
1405
+ ] }) : null,
1406
+ displayedOmissions.length ? /* @__PURE__ */ jsxs5("details", { children: [
1407
+ /* @__PURE__ */ jsxs5("summary", { children: [
1408
+ displayedOmissions.length,
1409
+ " omissions or adjustments"
1410
+ ] }),
1411
+ /* @__PURE__ */ jsx10("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs5("li", { children: [
1412
+ o.path || "/",
1413
+ ": ",
1414
+ o.reason,
1415
+ o.count == null ? "" : ` (${o.count})`
1416
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1417
+ ] }) : null
1418
+ ] }),
1419
+ bufferError ? /* @__PURE__ */ jsx10("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1420
+ formatError ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1421
+ bufferError ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1422
+ const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1423
+ setBufferError(null);
1424
+ onChange({ ...state, draft: fallback, error: void 0 });
1425
+ setFormat("plain");
1426
+ }, children: "Use invalid JSON as plain text" }) : null
1387
1427
  ] }),
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
1428
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs5("aside", { children: [
1429
+ ai ? /* @__PURE__ */ jsxs5(Fragment, { children: [
1430
+ /* @__PURE__ */ jsxs5("label", { children: [
1431
+ "AI instruction",
1432
+ /* @__PURE__ */ jsx10("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1433
+ ] }),
1434
+ /* @__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" }),
1435
+ 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
1436
+ ] }) : null,
1437
+ busy === "capture" ? /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1438
+ activeCapture.current?.abort();
1439
+ activeCapture.current = null;
1440
+ setBusy(null);
1441
+ }, children: "Stop loading rows" }) : null,
1442
+ 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,
1443
+ 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,
1444
+ state.error ? /* @__PURE__ */ jsx10("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1445
+ ] }) : null
1397
1446
  ] }),
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
1447
+ pendingControls ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1448
+ /* @__PURE__ */ jsx10("p", { children: "This control would replace your manual edit." }),
1449
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1450
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1451
+ ] }) : null,
1452
+ 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,
1453
+ state.pending ? /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1454
+ /* @__PURE__ */ jsx10("p", { children: "A fresh source snapshot is ready." }),
1455
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1456
+ /* @__PURE__ */ jsx10(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1457
+ ] }) : null,
1458
+ deliveryNotice ? /* @__PURE__ */ jsx10("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1416
1459
  ] }),
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
1460
  /* @__PURE__ */ jsxs5(DialogFooter, { children: [
1430
1461
  /* @__PURE__ */ jsxs5("span", { className: "matrx-alchemy-meta", children: [
1431
1462
  buffer.length.toLocaleString(),
@@ -1433,13 +1464,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1433
1464
  estimateTokens(buffer).toLocaleString(),
1434
1465
  " tokens"
1435
1466
  ] }),
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" })
1467
+ /* @__PURE__ */ jsx10(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1468
+ /* @__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" }),
1469
+ /* @__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
1470
  ] })
1440
1471
  ] }) });
1441
1472
  }
1442
1473
  function RowControls({ rows, controls, change }) {
1474
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1475
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1476
+ 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
1477
  return /* @__PURE__ */ jsxs5(Fragment, { children: [
1444
1478
  /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-toolbar", children: [
1445
1479
  /* @__PURE__ */ jsxs5("label", { children: [
@@ -1465,32 +1499,40 @@ function RowControls({ rows, controls, change }) {
1465
1499
  /* @__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
1500
  ] })
1467
1501
  ] }),
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: [
1502
+ /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1503
+ /* @__PURE__ */ jsxs5("summary", { children: [
1504
+ "Columns and filters",
1505
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1506
+ ] }),
1507
+ /* @__PURE__ */ jsx10("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-column", children: [
1471
1508
  /* @__PURE__ */ jsxs5("label", { children: [
1472
1509
  /* @__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
1510
  " ",
1474
1511
  column.label
1475
1512
  ] }),
1476
1513
  /* @__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))
1514
+ ] }, column.id)) })
1478
1515
  ] }),
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"
1516
+ /* @__PURE__ */ jsxs5("details", { className: "matrx-alchemy-options", children: [
1517
+ /* @__PURE__ */ jsxs5("summary", { children: [
1518
+ "Rows \u2014 ",
1519
+ selectionSummary
1484
1520
  ] }),
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
- }) })
1521
+ /* @__PURE__ */ jsxs5("fieldset", { "aria-label": "Row selection", children: [
1522
+ /* @__PURE__ */ jsxs5("label", { children: [
1523
+ /* @__PURE__ */ jsx10("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1524
+ " Only selected rows"
1525
+ ] }),
1526
+ /* @__PURE__ */ jsx10("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1527
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1528
+ return /* @__PURE__ */ jsxs5("label", { children: [
1529
+ /* @__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) }) }),
1530
+ " Row ",
1531
+ index + 1,
1532
+ summary ? ` \u2014 ${summary}` : ""
1533
+ ] }, index);
1534
+ }) })
1535
+ ] })
1494
1536
  ] })
1495
1537
  ] });
1496
1538
  }
@@ -1642,7 +1684,7 @@ function MatrxCopyMenuSession(props) {
1642
1684
  if (aiVisible && props.aiCustom)
1643
1685
  actions.push({
1644
1686
  id: "configure-source",
1645
- label: props.aiCustom.label ?? "Customize source\u2026",
1687
+ label: props.aiCustom.label ?? "Customize source",
1646
1688
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1647
1689
  supports: () => true,
1648
1690
  run: async () => {
@@ -1653,7 +1695,7 @@ function MatrxCopyMenuSession(props) {
1653
1695
  if (aiVisible && props.groomer)
1654
1696
  actions.push({
1655
1697
  id: "groom-source",
1656
- label: "Customize sections\u2026",
1698
+ label: "Customize sections",
1657
1699
  supports: () => true,
1658
1700
  run: async () => {
1659
1701
  setConfiguration({ groomer: props.groomer() });
@@ -1763,7 +1805,8 @@ function MatrxCopyMenuSession(props) {
1763
1805
  className: cn(
1764
1806
  props.className,
1765
1807
  props.size === "xs" && "matrx-alchemy-xs",
1766
- props.size === "sm" && "matrx-alchemy-sm"
1808
+ props.size === "sm" && "matrx-alchemy-sm",
1809
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1767
1810
  ),
1768
1811
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1769
1812
  }
@@ -1868,127 +1911,132 @@ function SourceConfiguration({
1868
1911
  event.preventDefault();
1869
1912
  if (!handingOff.current) restoreFocus();
1870
1913
  },
1871
- className: "matrx-alchemy-workspace",
1914
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1872
1915
  children: [
1873
1916
  /* @__PURE__ */ jsxs6(DialogHeader, { children: [
1874
1917
  /* @__PURE__ */ jsx11(DialogTitle, { children: title }),
1875
1918
  /* @__PURE__ */ jsx11(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1876
1919
  ] }),
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(
1920
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-body", children: [
1921
+ /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1922
+ custom?.options.map((option) => /* @__PURE__ */ jsxs6("label", { children: [
1923
+ option.label,
1924
+ "hint" in option && option.hint ? /* @__PURE__ */ jsx11("small", { children: option.hint }) : null,
1925
+ option.kind === "toggle" ? /* @__PURE__ */ jsx11(
1900
1926
  "input",
1901
1927
  {
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
- })
1928
+ type: "checkbox",
1929
+ checked: Boolean(values[option.key]),
1930
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1911
1931
  }
1912
- ),
1913
- /* @__PURE__ */ jsx11("span", { children: option.formatValue(Number(values[option.key])) })
1914
- ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
1915
- /* @__PURE__ */ jsx11(
1916
- "input",
1932
+ ) : option.kind === "preset" ? /* @__PURE__ */ jsx11(
1933
+ "select",
1917
1934
  {
1918
- type: "number",
1919
- min: option.min,
1920
- step: option.step,
1921
1935
  value: Number(values[option.key]),
1922
1936
  onChange: (event) => setValues({
1923
1937
  ...values,
1924
1938
  [option.key]: Number(event.target.value)
1925
- })
1939
+ }),
1940
+ children: option.options.map((choice) => /* @__PURE__ */ jsx11("option", { value: choice.value, children: choice.label }, choice.value))
1926
1941
  }
1927
- ),
1928
- option.presets?.map((preset) => /* @__PURE__ */ jsx11(
1942
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1943
+ /* @__PURE__ */ jsx11(
1944
+ "input",
1945
+ {
1946
+ type: "range",
1947
+ min: 0,
1948
+ max: Math.max(0, option.stops.length - 1),
1949
+ step: 1,
1950
+ value: option.stops.indexOf(Number(values[option.key])),
1951
+ onChange: (event) => setValues({
1952
+ ...values,
1953
+ [option.key]: option.stops[Number(event.target.value)]
1954
+ })
1955
+ }
1956
+ ),
1957
+ /* @__PURE__ */ jsx11("span", { children: option.formatValue(Number(values[option.key])) })
1958
+ ] }) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
1959
+ /* @__PURE__ */ jsx11(
1960
+ "input",
1961
+ {
1962
+ type: "number",
1963
+ min: option.min,
1964
+ step: option.step,
1965
+ value: Number(values[option.key]),
1966
+ onChange: (event) => setValues({
1967
+ ...values,
1968
+ [option.key]: Number(event.target.value)
1969
+ })
1970
+ }
1971
+ ),
1972
+ option.presets?.map((preset) => /* @__PURE__ */ jsx11(
1973
+ Button,
1974
+ {
1975
+ type: "button",
1976
+ variant: "ghost",
1977
+ className: "matrx-alchemy-workspace-secondary",
1978
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1979
+ children: preset.label
1980
+ },
1981
+ preset.value
1982
+ ))
1983
+ ] })
1984
+ ] }, option.key)),
1985
+ groomer ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1986
+ /* @__PURE__ */ jsx11("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11(
1929
1987
  Button,
1930
1988
  {
1931
1989
  type: "button",
1932
1990
  variant: "ghost",
1933
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1934
- children: preset.label
1991
+ className: "matrx-alchemy-workspace-secondary",
1992
+ onClick: () => setSections(
1993
+ Object.fromEntries(
1994
+ groomer.sections.map((section) => [
1995
+ section.id,
1996
+ level === "brief" && section.cuttable ? "off" : level
1997
+ ])
1998
+ )
1999
+ ),
2000
+ children: level
1935
2001
  },
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
- )
2002
+ level
2003
+ )) }),
2004
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
2005
+ section.title,
2006
+ /* @__PURE__ */ jsxs6(
2007
+ "select",
2008
+ {
2009
+ value: sections[section.id],
2010
+ onChange: (event) => setSections({
2011
+ ...sections,
2012
+ [section.id]: event.target.value
2013
+ }),
2014
+ children: [
2015
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx11("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
2016
+ section.cuttable ? /* @__PURE__ */ jsx11("option", { value: "off", children: "Exclude" }) : null
2017
+ ]
2018
+ }
1953
2019
  ),
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"
2020
+ section.description ? /* @__PURE__ */ jsx11("span", { children: section.description }) : null
2021
+ ] }, section.id))
2022
+ ] }) : null
2023
+ ] }),
2024
+ /* @__PURE__ */ jsxs6("p", { children: [
2025
+ text.length.toLocaleString(),
2026
+ " characters \xB7 approximately",
2027
+ " ",
2028
+ Math.ceil(text.length / 4).toLocaleString(),
2029
+ " tokens"
2030
+ ] }),
2031
+ error || buildError ? /* @__PURE__ */ jsx11("p", { role: "alert", children: error ?? buildError }) : null
1984
2032
  ] }),
1985
- error || buildError ? /* @__PURE__ */ jsx11("p", { role: "alert", children: error ?? buildError }) : null,
1986
2033
  /* @__PURE__ */ jsxs6(DialogFooter, { children: [
1987
2034
  /* @__PURE__ */ jsx11(
1988
2035
  Button,
1989
2036
  {
1990
2037
  type: "button",
1991
2038
  variant: "ghost",
2039
+ className: "matrx-alchemy-workspace-secondary",
1992
2040
  disabled: busy,
1993
2041
  onClick: onClose,
1994
2042
  children: "Cancel"
@@ -1998,6 +2046,7 @@ function SourceConfiguration({
1998
2046
  Button,
1999
2047
  {
2000
2048
  type: "button",
2049
+ className: "matrx-alchemy-workspace-primary",
2001
2050
  disabled: busy || !prepared || Boolean(buildError),
2002
2051
  onClick: async () => {
2003
2052
  if (!prepared) return;