@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
@@ -467,14 +467,14 @@ var PopoverContent = React6.forwardRef(
467
467
  );
468
468
  PopoverContent.displayName = PopoverPrimitive.Content.displayName;
469
469
 
470
+ // src/content-transfer/icon.ts
471
+ 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"];
472
+ 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>`;
473
+
470
474
  // src/content-transfer/index.tsx
471
475
  import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
472
476
  function AlchemyGlyph(props) {
473
- return /* @__PURE__ */ jsxs3("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
474
- /* @__PURE__ */ jsx7("path", { d: "M4.5 5.5h8v11h-8z" }),
475
- /* @__PURE__ */ jsx7("path", { d: "M8.5 9.5h8v9h-8z" }),
476
- /* @__PURE__ */ jsx7("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
477
- ] });
477
+ return /* @__PURE__ */ jsx7("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__ */ jsx7("path", { d }, d)) });
478
478
  }
479
479
  var CapabilityContext = React7.createContext({});
480
480
  var useContentTransferCapabilities = () => React7.useContext(CapabilityContext);
@@ -488,7 +488,16 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
488
488
  ] })
489
489
  ] });
490
490
  }
491
- function PaletteGlyph({ format, ai = false, file = false }) {
491
+ function PaletteGlyph({ format, ai = false, file = false, kind }) {
492
+ if (kind === "ai-copy") return /* @__PURE__ */ jsxs3("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: [
493
+ /* @__PURE__ */ jsx7("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
494
+ /* @__PURE__ */ jsx7("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
495
+ /* @__PURE__ */ jsx7("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
496
+ ] });
497
+ if (kind === "sliders") return /* @__PURE__ */ jsxs3("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: [
498
+ /* @__PURE__ */ jsx7("path", { d: "M4 6h16M4 12h16M4 18h16" }),
499
+ /* @__PURE__ */ jsx7("path", { d: "M8 3v6M16 9v6M10 15v6" })
500
+ ] });
492
501
  if (ai) return /* @__PURE__ */ jsxs3("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: [
493
502
  /* @__PURE__ */ jsx7("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" }),
494
503
  /* @__PURE__ */ jsx7("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" }),
@@ -521,15 +530,15 @@ function PaletteGlyph({ format, ai = false, file = false }) {
521
530
  ] }) : format === "html" ? /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsx7("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
522
531
  return /* @__PURE__ */ jsx7("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 });
523
532
  }
524
- function PaletteRows({ title, items, onRun, extra, ai = false }) {
533
+ function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
525
534
  if (!items.length && !extra) return null;
526
535
  return /* @__PURE__ */ jsxs3("section", { className: "matrx-alchemy-palette-section", children: [
527
536
  /* @__PURE__ */ jsx7("h3", { children: title }),
528
537
  items.map((item) => /* @__PURE__ */ jsxs3("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
529
- item.icon ? /* @__PURE__ */ jsx7(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx7(PaletteGlyph, { ai }),
538
+ item.icon ? /* @__PURE__ */ jsx7(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx7(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
530
539
  /* @__PURE__ */ jsxs3("span", { children: [
531
540
  item.copyLabel ?? item.label,
532
- item.hint ? /* @__PURE__ */ jsx7("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
541
+ item.hint ?? fallbackHint ? /* @__PURE__ */ jsx7("small", { className: "matrx-alchemy-menu-hint", children: item.hint ?? fallbackHint }) : null
533
542
  ] })
534
543
  ] }, item.id)),
535
544
  extra
@@ -926,45 +935,54 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
926
935
  }, children: [
927
936
  /* @__PURE__ */ jsx7(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx7("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__ */ jsx7(AlchemyGlyph, {}) }) }),
928
937
  /* @__PURE__ */ jsxs3(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
929
- copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
930
- /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
931
- /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
932
- ] }) : null,
933
938
  menuStatus === "loading" ? /* @__PURE__ */ jsx7("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx7("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
934
- resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs3(Fragment, { children: [
935
- /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-palette-grid", children: [
936
- 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]}` })),
937
- visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
938
- ] }),
939
- quickVariants("copy").length ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
939
+ copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs3("section", { className: "matrx-alchemy-output", children: [
940
+ /* @__PURE__ */ jsx7("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
941
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
942
+ /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
943
+ /* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
944
+ ] }) : null,
945
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs3(Fragment, { children: [
946
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-palette-grid", children: [
947
+ 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]}` })),
948
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
949
+ ] }),
950
+ quickVariants("copy").length ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
951
+ closePalette();
952
+ void transfer("markdown", false, variant);
953
+ } }) : null
954
+ ] }) : null,
955
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-palette-grid", children: [
956
+ 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]}` })),
957
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
958
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
959
+ ] }) }) : null
960
+ ] }) : null,
961
+ prepareAvailable ? /* @__PURE__ */ jsxs3(Fragment, { children: [
962
+ /* @__PURE__ */ jsx7(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", items: quickVariants("ai"), onRun: (variant) => {
940
963
  closePalette();
941
964
  void transfer("markdown", false, variant);
942
- } }) : null
965
+ } }),
966
+ /* @__PURE__ */ jsx7(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs3("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
967
+ closePalette();
968
+ void openWorkspace();
969
+ }, children: [
970
+ /* @__PURE__ */ jsx7(PaletteGlyph, { kind: "sliders" }),
971
+ /* @__PURE__ */ jsxs3("span", { children: [
972
+ "Prepare for AI",
973
+ /* @__PURE__ */ jsx7("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
974
+ ] })
975
+ ] }) })
943
976
  ] }) : null,
944
- resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx7(Fragment, { children: /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-palette-grid", children: [
945
- 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]}` })),
946
- visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
947
- downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
948
- ] }) }) : null,
949
- prepareAvailable ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
950
- closePalette();
951
- void transfer("markdown", false, variant);
952
- }, extra: /* @__PURE__ */ jsxs3("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
953
- closePalette();
954
- void openWorkspace();
955
- }, children: [
956
- /* @__PURE__ */ jsx7(PaletteGlyph, { ai: true }),
957
- /* @__PURE__ */ jsx7("span", { children: "Prepare for AI\u2026" })
958
- ] }) }) : null,
959
- prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ jsxs3(Fragment, { children: [
977
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs3(Fragment, { children: [
960
978
  nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx7("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
961
979
  closePalette();
962
980
  void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
963
- }, children: /* @__PURE__ */ jsx7("span", { children: "Prepare this surface\u2026" }) }) : null,
981
+ }, children: /* @__PURE__ */ jsx7("span", { children: "Prepare this surface" }) }) : null,
964
982
  variants.map((variant) => /* @__PURE__ */ jsx7("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
965
983
  closePalette();
966
984
  void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
967
- }, children: /* @__PURE__ */ jsx7(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
985
+ }, children: /* @__PURE__ */ jsx7(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
968
986
  ] }) }) : null,
969
987
  ordinaryActions.length ? /* @__PURE__ */ jsx7(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ jsx7("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
970
988
  closePalette();
@@ -1242,137 +1260,138 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1242
1260
  state.snapshot.label
1243
1261
  ] }),
1244
1262
  /* @__PURE__ */ jsxs3(DialogDescription, { children: [
1245
- "Captured ",
1246
- state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
1247
- ". Your source is never edited."
1263
+ state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
1264
+ "Review and edit this copy. Your original stays unchanged."
1248
1265
  ] })
1249
1266
  ] }),
1250
- /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-workspace-grid", children: [
1251
- /* @__PURE__ */ jsxs3("section", { className: "matrx-alchemy-main", children: [
1252
- /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-toolbar", children: [
1253
- scopes.length > 1 ? /* @__PURE__ */ jsxs3("label", { children: [
1254
- "Scope",
1255
- /* @__PURE__ */ jsx7("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx7("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1256
- ] }) : null,
1257
- /* @__PURE__ */ jsxs3("label", { children: [
1258
- "Detail",
1259
- /* @__PURE__ */ jsxs3("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1260
- /* @__PURE__ */ jsx7("option", { value: "full", children: "Full" }),
1261
- /* @__PURE__ */ jsx7("option", { value: "compact", children: "Compact" }),
1262
- /* @__PURE__ */ jsx7("option", { value: "brief", children: "Brief" }),
1263
- /* @__PURE__ */ jsx7("option", { value: "custom", children: "Custom" })
1264
- ] })
1265
- ] }),
1266
- /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1267
- setBufferError(null);
1268
- if (controlsHistory.length) {
1269
- const next = controlsHistory[controlsHistory.length - 1];
1267
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-workspace-body", children: [
1268
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-workspace-grid", children: [
1269
+ /* @__PURE__ */ jsxs3("section", { className: "matrx-alchemy-main", children: [
1270
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-toolbar", children: [
1271
+ scopes.length > 1 ? /* @__PURE__ */ jsxs3("label", { children: [
1272
+ "Scope",
1273
+ /* @__PURE__ */ jsx7("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx7("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
1274
+ ] }) : null,
1275
+ /* @__PURE__ */ jsxs3("label", { children: [
1276
+ "Detail",
1277
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
1278
+ /* @__PURE__ */ jsx7("option", { value: "full", children: "Full" }),
1279
+ /* @__PURE__ */ jsx7("option", { value: "compact", children: "Compact" }),
1280
+ /* @__PURE__ */ jsx7("option", { value: "brief", children: "Brief" }),
1281
+ /* @__PURE__ */ jsx7("option", { value: "custom", children: "Custom" })
1282
+ ] })
1283
+ ] }),
1284
+ /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
1285
+ setBufferError(null);
1286
+ if (controlsHistory.length) {
1287
+ const next = controlsHistory[controlsHistory.length - 1];
1288
+ setControls(next);
1289
+ setControlsHistory((history) => history.slice(0, -1));
1290
+ onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1291
+ } else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
1292
+ }, children: "Undo" }),
1293
+ /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
1294
+ const next = initialControls(state);
1270
1295
  setControls(next);
1271
- setControlsHistory((history) => history.slice(0, -1));
1296
+ setControlsHistory([]);
1297
+ setPendingControls(null);
1298
+ setBufferError(null);
1272
1299
  onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1273
- } else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
1274
- }, children: "Undo" }),
1275
- /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => {
1276
- const next = initialControls(state);
1277
- setControls(next);
1278
- setControlsHistory([]);
1279
- setPendingControls(null);
1280
- setBufferError(null);
1281
- onChange({ ...state, draft: rebuild(state, next), error: void 0 });
1282
- }, children: "Reset" }),
1283
- /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1284
- ] }),
1285
- controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1286
- /* @__PURE__ */ jsx7("legend", { children: "JSON limits" }),
1287
- [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs3("label", { children: [
1288
- text,
1289
- /* @__PURE__ */ jsx7("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1290
- ] }, key))
1291
- ] }) : null,
1292
- rows ? /* @__PURE__ */ jsx7(RowControls, { rows, controls, change: changeControls }) : null,
1293
- state.snapshot.sections.length ? /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1294
- /* @__PURE__ */ jsx7("legend", { children: "Sections" }),
1295
- state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs3("label", { children: [
1296
- /* @__PURE__ */ jsx7("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) }) }),
1297
- " ",
1298
- section.label
1299
- ] }, section.id))
1300
- ] }) : null,
1301
- /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-coverage", children: [
1302
- /* @__PURE__ */ jsxs3("span", { children: [
1303
- state.snapshot.coverage.included.toLocaleString(),
1304
- " included",
1305
- state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1306
- " \xB7 ",
1307
- state.snapshot.coverage.status
1300
+ }, children: "Reset" }),
1301
+ /* @__PURE__ */ jsx7(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
1308
1302
  ] }),
1309
- state.snapshot.coverage.reason ? /* @__PURE__ */ jsx7("span", { children: state.snapshot.coverage.reason }) : null,
1310
- limitText ? /* @__PURE__ */ jsxs3("span", { children: [
1311
- "Limits: ",
1312
- limitText
1303
+ controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1304
+ /* @__PURE__ */ jsx7("legend", { children: "JSON limits" }),
1305
+ [["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs3("label", { children: [
1306
+ text,
1307
+ /* @__PURE__ */ jsx7("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1308
+ ] }, key))
1309
+ ] }) : null,
1310
+ rows ? /* @__PURE__ */ jsx7(RowControls, { rows, controls, change: changeControls }) : null,
1311
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1312
+ /* @__PURE__ */ jsx7("legend", { children: "Sections" }),
1313
+ state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs3("label", { children: [
1314
+ /* @__PURE__ */ jsx7("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) }) }),
1315
+ " ",
1316
+ section.label
1317
+ ] }, section.id))
1313
1318
  ] }) : null,
1314
- displayedOmissions.length ? /* @__PURE__ */ jsxs3("details", { children: [
1315
- /* @__PURE__ */ jsxs3("summary", { children: [
1316
- displayedOmissions.length,
1317
- " omissions or adjustments"
1319
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-coverage", children: [
1320
+ /* @__PURE__ */ jsxs3("span", { children: [
1321
+ state.snapshot.coverage.included.toLocaleString(),
1322
+ " included",
1323
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1324
+ " \xB7 ",
1325
+ state.snapshot.coverage.status
1318
1326
  ] }),
1319
- /* @__PURE__ */ jsx7("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs3("li", { children: [
1320
- o.path || "/",
1321
- ": ",
1322
- o.reason,
1323
- o.count == null ? "" : ` (${o.count})`
1324
- ] }, `${o.path}-${o.reason}-${i}`)) })
1325
- ] }) : null
1326
- ] }),
1327
- /* @__PURE__ */ jsxs3("label", { className: "matrx-alchemy-preview-label", children: [
1328
- "Output format",
1329
- /* @__PURE__ */ jsxs3("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1330
- formats.map((f) => /* @__PURE__ */ jsx7("option", { value: f, children: LABEL[f] }, f)),
1331
- state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx7("option", { value: "xlsx", children: "Excel workbook" }) : null,
1332
- workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx7("option", { value: adapter.id, children: adapter.label }, adapter.id))
1333
- ] })
1327
+ state.snapshot.coverage.reason ? /* @__PURE__ */ jsx7("span", { children: state.snapshot.coverage.reason }) : null,
1328
+ limitText ? /* @__PURE__ */ jsxs3("span", { children: [
1329
+ "Limits: ",
1330
+ limitText
1331
+ ] }) : null,
1332
+ displayedOmissions.length ? /* @__PURE__ */ jsxs3("details", { children: [
1333
+ /* @__PURE__ */ jsxs3("summary", { children: [
1334
+ displayedOmissions.length,
1335
+ " omissions or adjustments"
1336
+ ] }),
1337
+ /* @__PURE__ */ jsx7("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs3("li", { children: [
1338
+ o.path || "/",
1339
+ ": ",
1340
+ o.reason,
1341
+ o.count == null ? "" : ` (${o.count})`
1342
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1343
+ ] }) : null
1344
+ ] }),
1345
+ /* @__PURE__ */ jsxs3("label", { className: "matrx-alchemy-preview-label", children: [
1346
+ "Output format",
1347
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1348
+ formats.map((f) => /* @__PURE__ */ jsx7("option", { value: f, children: LABEL[f] }, f)),
1349
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx7("option", { value: "xlsx", children: "Excel workbook" }) : null,
1350
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx7("option", { value: adapter.id, children: adapter.label }, adapter.id))
1351
+ ] })
1352
+ ] }),
1353
+ /* @__PURE__ */ jsx7("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) }),
1354
+ bufferError ? /* @__PURE__ */ jsx7("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1355
+ formatError ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1356
+ bufferError ? /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1357
+ const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1358
+ setBufferError(null);
1359
+ onChange({ ...state, draft: fallback, error: void 0 });
1360
+ setFormat("plain");
1361
+ }, children: "Use invalid JSON as plain text" }) : null
1334
1362
  ] }),
1335
- /* @__PURE__ */ jsx7("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) }),
1336
- bufferError ? /* @__PURE__ */ jsx7("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1337
- formatError ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1338
- bufferError ? /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1339
- const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1340
- setBufferError(null);
1341
- onChange({ ...state, draft: fallback, error: void 0 });
1342
- setFormat("plain");
1343
- }, children: "Use invalid JSON as plain text" }) : null
1363
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs3("aside", { children: [
1364
+ ai ? /* @__PURE__ */ jsxs3(Fragment, { children: [
1365
+ /* @__PURE__ */ jsxs3("label", { children: [
1366
+ "AI instruction",
1367
+ /* @__PURE__ */ jsx7("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1368
+ ] }),
1369
+ /* @__PURE__ */ jsx7(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" }),
1370
+ busy === "ai" ? /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1371
+ ] }) : null,
1372
+ busy === "capture" ? /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1373
+ activeCapture.current?.abort();
1374
+ activeCapture.current = null;
1375
+ setBusy(null);
1376
+ }, children: "Stop loading rows" }) : null,
1377
+ ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx7(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,
1378
+ ai ? /* @__PURE__ */ jsx7("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,
1379
+ state.error ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1380
+ ] }) : null
1344
1381
  ] }),
1345
- ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs3("aside", { children: [
1346
- ai ? /* @__PURE__ */ jsxs3(Fragment, { children: [
1347
- /* @__PURE__ */ jsxs3("label", { children: [
1348
- "AI instruction",
1349
- /* @__PURE__ */ jsx7("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1350
- ] }),
1351
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: !aiSession.current || !instruction.trim() || busy !== null || !aiSession.current.supports(state.snapshot), onClick: () => void runAi(false), children: "Generate preview" }),
1352
- busy === "ai" ? /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
1353
- ] }) : null,
1354
- busy === "capture" ? /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: () => {
1355
- activeCapture.current?.abort();
1356
- activeCapture.current = null;
1357
- setBusy(null);
1358
- }, children: "Stop loading rows" }) : null,
1359
- ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: () => void runAi(true), children: aiFailed ? "Retry or rejoin AI run" : "Rejoin AI run" }) : null,
1360
- ai ? /* @__PURE__ */ jsx7("p", { className: "matrx-alchemy-meta", children: "AI creates a preview. It never copies automatically. Closing detaches this view without cancelling server work." }) : null,
1361
- state.error ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1362
- ] }) : null
1382
+ pendingControls ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1383
+ /* @__PURE__ */ jsx7("p", { children: "This control would replace your manual edit." }),
1384
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1385
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1386
+ ] }) : null,
1387
+ state.sourceStale ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1388
+ state.pending ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1389
+ /* @__PURE__ */ jsx7("p", { children: "A fresh source snapshot is ready." }),
1390
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1391
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1392
+ ] }) : null,
1393
+ deliveryNotice ? /* @__PURE__ */ jsx7("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1363
1394
  ] }),
1364
- pendingControls ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1365
- /* @__PURE__ */ jsx7("p", { children: "This control would replace your manual edit." }),
1366
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1367
- /* @__PURE__ */ jsx7(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1368
- ] }) : null,
1369
- state.sourceStale ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
1370
- state.pending ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1371
- /* @__PURE__ */ jsx7("p", { children: "A fresh source snapshot is ready." }),
1372
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1373
- /* @__PURE__ */ jsx7(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1374
- ] }) : null,
1375
- deliveryNotice ? /* @__PURE__ */ jsx7("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
1376
1395
  /* @__PURE__ */ jsxs3(DialogFooter, { children: [
1377
1396
  /* @__PURE__ */ jsxs3("span", { className: "matrx-alchemy-meta", children: [
1378
1397
  buffer.length.toLocaleString(),
@@ -1380,13 +1399,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1380
1399
  estimateTokens(buffer).toLocaleString(),
1381
1400
  " tokens"
1382
1401
  ] }),
1383
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", onClick: close, children: "Close" }),
1384
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(true), children: "Download prepared output" }),
1385
- /* @__PURE__ */ jsx7(Button, { type: "button", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliver(false), children: "Copy prepared output" })
1402
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1403
+ /* @__PURE__ */ jsx7(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" }),
1404
+ /* @__PURE__ */ jsx7(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" })
1386
1405
  ] })
1387
1406
  ] }) });
1388
1407
  }
1389
1408
  function RowControls({ rows, controls, change }) {
1409
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1410
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1411
+ 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 ");
1390
1412
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
1391
1413
  /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-toolbar", children: [
1392
1414
  /* @__PURE__ */ jsxs3("label", { children: [
@@ -1412,32 +1434,40 @@ function RowControls({ rows, controls, change }) {
1412
1434
  /* @__PURE__ */ jsx7("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
1413
1435
  ] })
1414
1436
  ] }),
1415
- /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1416
- /* @__PURE__ */ jsx7("legend", { children: "Columns and filters" }),
1417
- rows.columns.map((column) => /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-column", children: [
1437
+ /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options", children: [
1438
+ /* @__PURE__ */ jsxs3("summary", { children: [
1439
+ "Columns and filters",
1440
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1441
+ ] }),
1442
+ /* @__PURE__ */ jsx7("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-column", children: [
1418
1443
  /* @__PURE__ */ jsxs3("label", { children: [
1419
1444
  /* @__PURE__ */ jsx7("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) }) }),
1420
1445
  " ",
1421
1446
  column.label
1422
1447
  ] }),
1423
1448
  /* @__PURE__ */ jsx7("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 } }) })
1424
- ] }, column.id))
1449
+ ] }, column.id)) })
1425
1450
  ] }),
1426
- /* @__PURE__ */ jsxs3("fieldset", { className: "matrx-alchemy-options", children: [
1427
- /* @__PURE__ */ jsx7("legend", { children: "Rows" }),
1428
- /* @__PURE__ */ jsxs3("label", { children: [
1429
- /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1430
- " Only selected rows"
1451
+ /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options", children: [
1452
+ /* @__PURE__ */ jsxs3("summary", { children: [
1453
+ "Rows \u2014 ",
1454
+ selectionSummary
1431
1455
  ] }),
1432
- /* @__PURE__ */ jsx7("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1433
- const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1434
- return /* @__PURE__ */ jsxs3("label", { children: [
1435
- /* @__PURE__ */ jsx7("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) }) }),
1436
- " Row ",
1437
- index + 1,
1438
- summary ? ` \u2014 ${summary}` : ""
1439
- ] }, index);
1440
- }) })
1456
+ /* @__PURE__ */ jsxs3("fieldset", { "aria-label": "Row selection", children: [
1457
+ /* @__PURE__ */ jsxs3("label", { children: [
1458
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1459
+ " Only selected rows"
1460
+ ] }),
1461
+ /* @__PURE__ */ jsx7("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1462
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1463
+ return /* @__PURE__ */ jsxs3("label", { children: [
1464
+ /* @__PURE__ */ jsx7("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) }) }),
1465
+ " Row ",
1466
+ index + 1,
1467
+ summary ? ` \u2014 ${summary}` : ""
1468
+ ] }, index);
1469
+ }) })
1470
+ ] })
1441
1471
  ] })
1442
1472
  ] });
1443
1473
  }
@@ -1589,7 +1619,7 @@ function MatrxCopyMenuSession(props) {
1589
1619
  if (aiVisible && props.aiCustom)
1590
1620
  actions.push({
1591
1621
  id: "configure-source",
1592
- label: props.aiCustom.label ?? "Customize source\u2026",
1622
+ label: props.aiCustom.label ?? "Customize source",
1593
1623
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1594
1624
  supports: () => true,
1595
1625
  run: async () => {
@@ -1600,7 +1630,7 @@ function MatrxCopyMenuSession(props) {
1600
1630
  if (aiVisible && props.groomer)
1601
1631
  actions.push({
1602
1632
  id: "groom-source",
1603
- label: "Customize sections\u2026",
1633
+ label: "Customize sections",
1604
1634
  supports: () => true,
1605
1635
  run: async () => {
1606
1636
  setConfiguration({ groomer: props.groomer() });
@@ -1710,7 +1740,8 @@ function MatrxCopyMenuSession(props) {
1710
1740
  className: cn(
1711
1741
  props.className,
1712
1742
  props.size === "xs" && "matrx-alchemy-xs",
1713
- props.size === "sm" && "matrx-alchemy-sm"
1743
+ props.size === "sm" && "matrx-alchemy-sm",
1744
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1714
1745
  ),
1715
1746
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1716
1747
  }
@@ -1815,127 +1846,132 @@ function SourceConfiguration({
1815
1846
  event.preventDefault();
1816
1847
  if (!handingOff.current) restoreFocus();
1817
1848
  },
1818
- className: "matrx-alchemy-workspace",
1849
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1819
1850
  children: [
1820
1851
  /* @__PURE__ */ jsxs4(DialogHeader, { children: [
1821
1852
  /* @__PURE__ */ jsx8(DialogTitle, { children: title }),
1822
1853
  /* @__PURE__ */ jsx8(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1823
1854
  ] }),
1824
- /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1825
- custom?.options.map((option) => /* @__PURE__ */ jsxs4("label", { children: [
1826
- option.label,
1827
- "hint" in option && option.hint ? /* @__PURE__ */ jsx8("small", { children: option.hint }) : null,
1828
- option.kind === "toggle" ? /* @__PURE__ */ jsx8(
1829
- "input",
1830
- {
1831
- type: "checkbox",
1832
- checked: Boolean(values[option.key]),
1833
- onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1834
- }
1835
- ) : option.kind === "preset" ? /* @__PURE__ */ jsx8(
1836
- "select",
1837
- {
1838
- value: Number(values[option.key]),
1839
- onChange: (event) => setValues({
1840
- ...values,
1841
- [option.key]: Number(event.target.value)
1842
- }),
1843
- children: option.options.map((choice) => /* @__PURE__ */ jsx8("option", { value: choice.value, children: choice.label }, choice.value))
1844
- }
1845
- ) : option.kind === "slider" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1846
- /* @__PURE__ */ jsx8(
1855
+ /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-workspace-body", children: [
1856
+ /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1857
+ custom?.options.map((option) => /* @__PURE__ */ jsxs4("label", { children: [
1858
+ option.label,
1859
+ "hint" in option && option.hint ? /* @__PURE__ */ jsx8("small", { children: option.hint }) : null,
1860
+ option.kind === "toggle" ? /* @__PURE__ */ jsx8(
1847
1861
  "input",
1848
1862
  {
1849
- type: "range",
1850
- min: 0,
1851
- max: Math.max(0, option.stops.length - 1),
1852
- step: 1,
1853
- value: option.stops.indexOf(Number(values[option.key])),
1854
- onChange: (event) => setValues({
1855
- ...values,
1856
- [option.key]: option.stops[Number(event.target.value)]
1857
- })
1863
+ type: "checkbox",
1864
+ checked: Boolean(values[option.key]),
1865
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1858
1866
  }
1859
- ),
1860
- /* @__PURE__ */ jsx8("span", { children: option.formatValue(Number(values[option.key])) })
1861
- ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1862
- /* @__PURE__ */ jsx8(
1863
- "input",
1867
+ ) : option.kind === "preset" ? /* @__PURE__ */ jsx8(
1868
+ "select",
1864
1869
  {
1865
- type: "number",
1866
- min: option.min,
1867
- step: option.step,
1868
1870
  value: Number(values[option.key]),
1869
1871
  onChange: (event) => setValues({
1870
1872
  ...values,
1871
1873
  [option.key]: Number(event.target.value)
1872
- })
1874
+ }),
1875
+ children: option.options.map((choice) => /* @__PURE__ */ jsx8("option", { value: choice.value, children: choice.label }, choice.value))
1873
1876
  }
1874
- ),
1875
- option.presets?.map((preset) => /* @__PURE__ */ jsx8(
1877
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1878
+ /* @__PURE__ */ jsx8(
1879
+ "input",
1880
+ {
1881
+ type: "range",
1882
+ min: 0,
1883
+ max: Math.max(0, option.stops.length - 1),
1884
+ step: 1,
1885
+ value: option.stops.indexOf(Number(values[option.key])),
1886
+ onChange: (event) => setValues({
1887
+ ...values,
1888
+ [option.key]: option.stops[Number(event.target.value)]
1889
+ })
1890
+ }
1891
+ ),
1892
+ /* @__PURE__ */ jsx8("span", { children: option.formatValue(Number(values[option.key])) })
1893
+ ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1894
+ /* @__PURE__ */ jsx8(
1895
+ "input",
1896
+ {
1897
+ type: "number",
1898
+ min: option.min,
1899
+ step: option.step,
1900
+ value: Number(values[option.key]),
1901
+ onChange: (event) => setValues({
1902
+ ...values,
1903
+ [option.key]: Number(event.target.value)
1904
+ })
1905
+ }
1906
+ ),
1907
+ option.presets?.map((preset) => /* @__PURE__ */ jsx8(
1908
+ Button,
1909
+ {
1910
+ type: "button",
1911
+ variant: "ghost",
1912
+ className: "matrx-alchemy-workspace-secondary",
1913
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1914
+ children: preset.label
1915
+ },
1916
+ preset.value
1917
+ ))
1918
+ ] })
1919
+ ] }, option.key)),
1920
+ groomer ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1921
+ /* @__PURE__ */ jsx8("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8(
1876
1922
  Button,
1877
1923
  {
1878
1924
  type: "button",
1879
1925
  variant: "ghost",
1880
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1881
- children: preset.label
1926
+ className: "matrx-alchemy-workspace-secondary",
1927
+ onClick: () => setSections(
1928
+ Object.fromEntries(
1929
+ groomer.sections.map((section) => [
1930
+ section.id,
1931
+ level === "brief" && section.cuttable ? "off" : level
1932
+ ])
1933
+ )
1934
+ ),
1935
+ children: level
1882
1936
  },
1883
- preset.value
1884
- ))
1885
- ] })
1886
- ] }, option.key)),
1887
- groomer ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1888
- /* @__PURE__ */ jsx8("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8(
1889
- Button,
1890
- {
1891
- type: "button",
1892
- variant: "ghost",
1893
- onClick: () => setSections(
1894
- Object.fromEntries(
1895
- groomer.sections.map((section) => [
1896
- section.id,
1897
- level === "brief" && section.cuttable ? "off" : level
1898
- ])
1899
- )
1937
+ level
1938
+ )) }),
1939
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs4("label", { children: [
1940
+ section.title,
1941
+ /* @__PURE__ */ jsxs4(
1942
+ "select",
1943
+ {
1944
+ value: sections[section.id],
1945
+ onChange: (event) => setSections({
1946
+ ...sections,
1947
+ [section.id]: event.target.value
1948
+ }),
1949
+ children: [
1950
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1951
+ section.cuttable ? /* @__PURE__ */ jsx8("option", { value: "off", children: "Exclude" }) : null
1952
+ ]
1953
+ }
1900
1954
  ),
1901
- children: level
1902
- },
1903
- level
1904
- )) }),
1905
- groomer.sections.map((section) => /* @__PURE__ */ jsxs4("label", { children: [
1906
- section.title,
1907
- /* @__PURE__ */ jsxs4(
1908
- "select",
1909
- {
1910
- value: sections[section.id],
1911
- onChange: (event) => setSections({
1912
- ...sections,
1913
- [section.id]: event.target.value
1914
- }),
1915
- children: [
1916
- ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1917
- section.cuttable ? /* @__PURE__ */ jsx8("option", { value: "off", children: "Exclude" }) : null
1918
- ]
1919
- }
1920
- ),
1921
- section.description ? /* @__PURE__ */ jsx8("span", { children: section.description }) : null
1922
- ] }, section.id))
1923
- ] }) : null
1924
- ] }),
1925
- /* @__PURE__ */ jsxs4("p", { children: [
1926
- text.length.toLocaleString(),
1927
- " characters \xB7 approximately",
1928
- " ",
1929
- Math.ceil(text.length / 4).toLocaleString(),
1930
- " tokens"
1955
+ section.description ? /* @__PURE__ */ jsx8("span", { children: section.description }) : null
1956
+ ] }, section.id))
1957
+ ] }) : null
1958
+ ] }),
1959
+ /* @__PURE__ */ jsxs4("p", { children: [
1960
+ text.length.toLocaleString(),
1961
+ " characters \xB7 approximately",
1962
+ " ",
1963
+ Math.ceil(text.length / 4).toLocaleString(),
1964
+ " tokens"
1965
+ ] }),
1966
+ error || buildError ? /* @__PURE__ */ jsx8("p", { role: "alert", children: error ?? buildError }) : null
1931
1967
  ] }),
1932
- error || buildError ? /* @__PURE__ */ jsx8("p", { role: "alert", children: error ?? buildError }) : null,
1933
1968
  /* @__PURE__ */ jsxs4(DialogFooter, { children: [
1934
1969
  /* @__PURE__ */ jsx8(
1935
1970
  Button,
1936
1971
  {
1937
1972
  type: "button",
1938
1973
  variant: "ghost",
1974
+ className: "matrx-alchemy-workspace-secondary",
1939
1975
  disabled: busy,
1940
1976
  onClick: onClose,
1941
1977
  children: "Cancel"
@@ -1945,6 +1981,7 @@ function SourceConfiguration({
1945
1981
  Button,
1946
1982
  {
1947
1983
  type: "button",
1984
+ className: "matrx-alchemy-workspace-primary",
1948
1985
  disabled: busy || !prepared || Boolean(buildError),
1949
1986
  onClick: async () => {
1950
1987
  if (!prepared) return;