@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
@@ -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,150 @@ 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))
1313
1309
  ] }) : null,
1314
- displayedOmissions.length ? /* @__PURE__ */ jsxs3("details", { children: [
1310
+ rows ? /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
1315
1311
  /* @__PURE__ */ jsxs3("summary", { children: [
1316
- displayedOmissions.length,
1317
- " omissions or adjustments"
1312
+ "Data selection \xB7 ",
1313
+ controls.visibleColumns.length,
1314
+ " columns",
1315
+ controls.search || controls.sort || controls.top != null || controls.selectedOnly || Object.values(controls.filters).some(Boolean) ? " \xB7 customized" : " \xB7 all rows"
1318
1316
  ] }),
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
- ] })
1317
+ /* @__PURE__ */ jsx7("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ jsx7(RowControls, { rows, controls, change: changeControls }) })
1318
+ ] }) : null,
1319
+ state.snapshot.sections.length ? /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options", children: [
1320
+ /* @__PURE__ */ jsxs3("summary", { children: [
1321
+ "Sections \xB7 ",
1322
+ controls.sections.length,
1323
+ " included"
1324
+ ] }),
1325
+ /* @__PURE__ */ jsx7("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs3("label", { children: [
1326
+ /* @__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) }) }),
1327
+ " ",
1328
+ section.label
1329
+ ] }, section.id)) })
1330
+ ] }) : null,
1331
+ /* @__PURE__ */ jsxs3("label", { className: "matrx-alchemy-preview-label", children: [
1332
+ "Output format",
1333
+ /* @__PURE__ */ jsxs3("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
1334
+ formats.map((f) => /* @__PURE__ */ jsx7("option", { value: f, children: LABEL[f] }, f)),
1335
+ state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx7("option", { value: "xlsx", children: "Excel workbook" }) : null,
1336
+ workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx7("option", { value: adapter.id, children: adapter.label }, adapter.id))
1337
+ ] })
1338
+ ] }),
1339
+ /* @__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) }),
1340
+ /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-coverage", children: [
1341
+ /* @__PURE__ */ jsxs3("span", { children: [
1342
+ state.snapshot.coverage.included.toLocaleString(),
1343
+ " included",
1344
+ state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
1345
+ " \xB7 ",
1346
+ state.snapshot.coverage.status
1347
+ ] }),
1348
+ state.snapshot.coverage.reason ? /* @__PURE__ */ jsx7("span", { children: state.snapshot.coverage.reason }) : null,
1349
+ limitText ? /* @__PURE__ */ jsxs3("span", { children: [
1350
+ "Limits: ",
1351
+ limitText
1352
+ ] }) : null,
1353
+ displayedOmissions.length ? /* @__PURE__ */ jsxs3("details", { children: [
1354
+ /* @__PURE__ */ jsxs3("summary", { children: [
1355
+ displayedOmissions.length,
1356
+ " omissions or adjustments"
1357
+ ] }),
1358
+ /* @__PURE__ */ jsx7("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs3("li", { children: [
1359
+ o.path || "/",
1360
+ ": ",
1361
+ o.reason,
1362
+ o.count == null ? "" : ` (${o.count})`
1363
+ ] }, `${o.path}-${o.reason}-${i}`)) })
1364
+ ] }) : null
1365
+ ] }),
1366
+ bufferError ? /* @__PURE__ */ jsx7("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
1367
+ formatError ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
1368
+ bufferError ? /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
1369
+ const fallback = editDraft(state.draft, { kind: "text", text: buffer });
1370
+ setBufferError(null);
1371
+ onChange({ ...state, draft: fallback, error: void 0 });
1372
+ setFormat("plain");
1373
+ }, children: "Use invalid JSON as plain text" }) : null
1334
1374
  ] }),
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
1375
+ ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs3("aside", { children: [
1376
+ ai ? /* @__PURE__ */ jsxs3(Fragment, { children: [
1377
+ /* @__PURE__ */ jsxs3("label", { children: [
1378
+ "AI instruction",
1379
+ /* @__PURE__ */ jsx7("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
1380
+ ] }),
1381
+ /* @__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" }),
1382
+ 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
1383
+ ] }) : null,
1384
+ busy === "capture" ? /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
1385
+ activeCapture.current?.abort();
1386
+ activeCapture.current = null;
1387
+ setBusy(null);
1388
+ }, children: "Stop loading rows" }) : null,
1389
+ 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,
1390
+ 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,
1391
+ state.error ? /* @__PURE__ */ jsx7("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
1392
+ ] }) : null
1344
1393
  ] }),
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
1394
+ pendingControls ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1395
+ /* @__PURE__ */ jsx7("p", { children: "This control would replace your manual edit." }),
1396
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
1397
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
1398
+ ] }) : null,
1399
+ 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,
1400
+ state.pending ? /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-decision", role: "alert", children: [
1401
+ /* @__PURE__ */ jsx7("p", { children: "A fresh source snapshot is ready." }),
1402
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
1403
+ /* @__PURE__ */ jsx7(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
1404
+ ] }) : null,
1405
+ deliveryNotice ? /* @__PURE__ */ jsx7("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
1363
1406
  ] }),
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
1407
  /* @__PURE__ */ jsxs3(DialogFooter, { children: [
1377
1408
  /* @__PURE__ */ jsxs3("span", { className: "matrx-alchemy-meta", children: [
1378
1409
  buffer.length.toLocaleString(),
@@ -1380,13 +1411,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
1380
1411
  estimateTokens(buffer).toLocaleString(),
1381
1412
  " tokens"
1382
1413
  ] }),
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" })
1414
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
1415
+ /* @__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" }),
1416
+ /* @__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
1417
  ] })
1387
1418
  ] }) });
1388
1419
  }
1389
1420
  function RowControls({ rows, controls, change }) {
1421
+ const filterCount = Object.values(controls.filters).filter(Boolean).length;
1422
+ const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
1423
+ 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
1424
  return /* @__PURE__ */ jsxs3(Fragment, { children: [
1391
1425
  /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-toolbar", children: [
1392
1426
  /* @__PURE__ */ jsxs3("label", { children: [
@@ -1412,32 +1446,40 @@ function RowControls({ rows, controls, change }) {
1412
1446
  /* @__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
1447
  ] })
1414
1448
  ] }),
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: [
1449
+ /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options", children: [
1450
+ /* @__PURE__ */ jsxs3("summary", { children: [
1451
+ "Columns and filters",
1452
+ dataSummary ? ` \u2014 ${dataSummary}` : ""
1453
+ ] }),
1454
+ /* @__PURE__ */ jsx7("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-column", children: [
1418
1455
  /* @__PURE__ */ jsxs3("label", { children: [
1419
1456
  /* @__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
1457
  " ",
1421
1458
  column.label
1422
1459
  ] }),
1423
1460
  /* @__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))
1461
+ ] }, column.id)) })
1425
1462
  ] }),
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"
1463
+ /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-options", children: [
1464
+ /* @__PURE__ */ jsxs3("summary", { children: [
1465
+ "Rows \u2014 ",
1466
+ selectionSummary
1431
1467
  ] }),
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
- }) })
1468
+ /* @__PURE__ */ jsxs3("fieldset", { "aria-label": "Row selection", children: [
1469
+ /* @__PURE__ */ jsxs3("label", { children: [
1470
+ /* @__PURE__ */ jsx7("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
1471
+ " Only selected rows"
1472
+ ] }),
1473
+ /* @__PURE__ */ jsx7("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
1474
+ const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
1475
+ return /* @__PURE__ */ jsxs3("label", { children: [
1476
+ /* @__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) }) }),
1477
+ " Row ",
1478
+ index + 1,
1479
+ summary ? ` \u2014 ${summary}` : ""
1480
+ ] }, index);
1481
+ }) })
1482
+ ] })
1441
1483
  ] })
1442
1484
  ] });
1443
1485
  }
@@ -1589,7 +1631,7 @@ function MatrxCopyMenuSession(props) {
1589
1631
  if (aiVisible && props.aiCustom)
1590
1632
  actions.push({
1591
1633
  id: "configure-source",
1592
- label: props.aiCustom.label ?? "Customize source\u2026",
1634
+ label: props.aiCustom.label ?? "Customize source",
1593
1635
  ...props.aiCustom.hint ? { hint: props.aiCustom.hint } : {},
1594
1636
  supports: () => true,
1595
1637
  run: async () => {
@@ -1600,7 +1642,7 @@ function MatrxCopyMenuSession(props) {
1600
1642
  if (aiVisible && props.groomer)
1601
1643
  actions.push({
1602
1644
  id: "groom-source",
1603
- label: "Customize sections\u2026",
1645
+ label: "Customize sections",
1604
1646
  supports: () => true,
1605
1647
  run: async () => {
1606
1648
  setConfiguration({ groomer: props.groomer() });
@@ -1710,7 +1752,8 @@ function MatrxCopyMenuSession(props) {
1710
1752
  className: cn(
1711
1753
  props.className,
1712
1754
  props.size === "xs" && "matrx-alchemy-xs",
1713
- props.size === "sm" && "matrx-alchemy-sm"
1755
+ props.size === "sm" && "matrx-alchemy-sm",
1756
+ props.size === "toolbar" && "matrx-alchemy-toolbar-target"
1714
1757
  ),
1715
1758
  ...props.stopPropagation !== void 0 ? { stopPropagation: props.stopPropagation } : {}
1716
1759
  }
@@ -1815,127 +1858,132 @@ function SourceConfiguration({
1815
1858
  event.preventDefault();
1816
1859
  if (!handingOff.current) restoreFocus();
1817
1860
  },
1818
- className: "matrx-alchemy-workspace",
1861
+ className: "matrx-alchemy-workspace matrx-alchemy-configuration",
1819
1862
  children: [
1820
1863
  /* @__PURE__ */ jsxs4(DialogHeader, { children: [
1821
1864
  /* @__PURE__ */ jsx8(DialogTitle, { children: title }),
1822
1865
  /* @__PURE__ */ jsx8(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
1823
1866
  ] }),
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(
1867
+ /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-workspace-body", children: [
1868
+ /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
1869
+ custom?.options.map((option) => /* @__PURE__ */ jsxs4("label", { children: [
1870
+ option.label,
1871
+ "hint" in option && option.hint ? /* @__PURE__ */ jsx8("small", { children: option.hint }) : null,
1872
+ option.kind === "toggle" ? /* @__PURE__ */ jsx8(
1847
1873
  "input",
1848
1874
  {
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
- })
1875
+ type: "checkbox",
1876
+ checked: Boolean(values[option.key]),
1877
+ onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
1858
1878
  }
1859
- ),
1860
- /* @__PURE__ */ jsx8("span", { children: option.formatValue(Number(values[option.key])) })
1861
- ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1862
- /* @__PURE__ */ jsx8(
1863
- "input",
1879
+ ) : option.kind === "preset" ? /* @__PURE__ */ jsx8(
1880
+ "select",
1864
1881
  {
1865
- type: "number",
1866
- min: option.min,
1867
- step: option.step,
1868
1882
  value: Number(values[option.key]),
1869
1883
  onChange: (event) => setValues({
1870
1884
  ...values,
1871
1885
  [option.key]: Number(event.target.value)
1872
- })
1886
+ }),
1887
+ children: option.options.map((choice) => /* @__PURE__ */ jsx8("option", { value: choice.value, children: choice.label }, choice.value))
1873
1888
  }
1874
- ),
1875
- option.presets?.map((preset) => /* @__PURE__ */ jsx8(
1889
+ ) : option.kind === "slider" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1890
+ /* @__PURE__ */ jsx8(
1891
+ "input",
1892
+ {
1893
+ type: "range",
1894
+ min: 0,
1895
+ max: Math.max(0, option.stops.length - 1),
1896
+ step: 1,
1897
+ value: option.stops.indexOf(Number(values[option.key])),
1898
+ onChange: (event) => setValues({
1899
+ ...values,
1900
+ [option.key]: option.stops[Number(event.target.value)]
1901
+ })
1902
+ }
1903
+ ),
1904
+ /* @__PURE__ */ jsx8("span", { children: option.formatValue(Number(values[option.key])) })
1905
+ ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
1906
+ /* @__PURE__ */ jsx8(
1907
+ "input",
1908
+ {
1909
+ type: "number",
1910
+ min: option.min,
1911
+ step: option.step,
1912
+ value: Number(values[option.key]),
1913
+ onChange: (event) => setValues({
1914
+ ...values,
1915
+ [option.key]: Number(event.target.value)
1916
+ })
1917
+ }
1918
+ ),
1919
+ option.presets?.map((preset) => /* @__PURE__ */ jsx8(
1920
+ Button,
1921
+ {
1922
+ type: "button",
1923
+ variant: "ghost",
1924
+ className: "matrx-alchemy-workspace-secondary",
1925
+ onClick: () => setValues({ ...values, [option.key]: preset.value }),
1926
+ children: preset.label
1927
+ },
1928
+ preset.value
1929
+ ))
1930
+ ] })
1931
+ ] }, option.key)),
1932
+ groomer ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1933
+ /* @__PURE__ */ jsx8("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8(
1876
1934
  Button,
1877
1935
  {
1878
1936
  type: "button",
1879
1937
  variant: "ghost",
1880
- onClick: () => setValues({ ...values, [option.key]: preset.value }),
1881
- children: preset.label
1938
+ className: "matrx-alchemy-workspace-secondary",
1939
+ onClick: () => setSections(
1940
+ Object.fromEntries(
1941
+ groomer.sections.map((section) => [
1942
+ section.id,
1943
+ level === "brief" && section.cuttable ? "off" : level
1944
+ ])
1945
+ )
1946
+ ),
1947
+ children: level
1882
1948
  },
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
- )
1949
+ level
1950
+ )) }),
1951
+ groomer.sections.map((section) => /* @__PURE__ */ jsxs4("label", { children: [
1952
+ section.title,
1953
+ /* @__PURE__ */ jsxs4(
1954
+ "select",
1955
+ {
1956
+ value: sections[section.id],
1957
+ onChange: (event) => setSections({
1958
+ ...sections,
1959
+ [section.id]: event.target.value
1960
+ }),
1961
+ children: [
1962
+ ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx8("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
1963
+ section.cuttable ? /* @__PURE__ */ jsx8("option", { value: "off", children: "Exclude" }) : null
1964
+ ]
1965
+ }
1900
1966
  ),
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"
1967
+ section.description ? /* @__PURE__ */ jsx8("span", { children: section.description }) : null
1968
+ ] }, section.id))
1969
+ ] }) : null
1970
+ ] }),
1971
+ /* @__PURE__ */ jsxs4("p", { children: [
1972
+ text.length.toLocaleString(),
1973
+ " characters \xB7 approximately",
1974
+ " ",
1975
+ Math.ceil(text.length / 4).toLocaleString(),
1976
+ " tokens"
1977
+ ] }),
1978
+ error || buildError ? /* @__PURE__ */ jsx8("p", { role: "alert", children: error ?? buildError }) : null
1931
1979
  ] }),
1932
- error || buildError ? /* @__PURE__ */ jsx8("p", { role: "alert", children: error ?? buildError }) : null,
1933
1980
  /* @__PURE__ */ jsxs4(DialogFooter, { children: [
1934
1981
  /* @__PURE__ */ jsx8(
1935
1982
  Button,
1936
1983
  {
1937
1984
  type: "button",
1938
1985
  variant: "ghost",
1986
+ className: "matrx-alchemy-workspace-secondary",
1939
1987
  disabled: busy,
1940
1988
  onClick: onClose,
1941
1989
  children: "Cancel"
@@ -1945,6 +1993,7 @@ function SourceConfiguration({
1945
1993
  Button,
1946
1994
  {
1947
1995
  type: "button",
1996
+ className: "matrx-alchemy-workspace-primary",
1948
1997
  disabled: busy || !prepared || Boolean(buildError),
1949
1998
  onClick: async () => {
1950
1999
  if (!prepared) return;