@ai-matrx/design-system 0.18.8 → 0.18.10

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 (58) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/content-transfer.cjs +163 -202
  3. package/dist/content-transfer.cjs.map +1 -1
  4. package/dist/content-transfer.css +43 -30
  5. package/dist/content-transfer.d.cts +4 -0
  6. package/dist/content-transfer.d.ts +4 -0
  7. package/dist/content-transfer.js +225 -264
  8. package/dist/content-transfer.js.map +1 -1
  9. package/dist/data-table/copy-helpers.d.cts +1 -1
  10. package/dist/data-table/copy-helpers.d.ts +1 -1
  11. package/dist/data-table/data-row-inspector.cjs +163 -202
  12. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  13. package/dist/data-table/data-row-inspector.js +245 -284
  14. package/dist/data-table/data-row-inspector.js.map +1 -1
  15. package/dist/data-table/data-row-window.cjs +163 -202
  16. package/dist/data-table/data-row-window.cjs.map +1 -1
  17. package/dist/data-table/data-row-window.js +245 -284
  18. package/dist/data-table/data-row-window.js.map +1 -1
  19. package/dist/data-table/filter-engine.d.cts +1 -1
  20. package/dist/data-table/filter-engine.d.ts +1 -1
  21. package/dist/data-table/host.cjs.map +1 -1
  22. package/dist/data-table/host.d.cts +2 -0
  23. package/dist/data-table/host.d.ts +2 -0
  24. package/dist/data-table/host.js.map +1 -1
  25. package/dist/data-table/index.cjs +1192 -751
  26. package/dist/data-table/index.cjs.map +1 -1
  27. package/dist/data-table/index.d.cts +24 -3
  28. package/dist/data-table/index.d.ts +24 -3
  29. package/dist/data-table/index.js +1264 -823
  30. package/dist/data-table/index.js.map +1 -1
  31. package/dist/data-table/infer-filter.d.cts +1 -1
  32. package/dist/data-table/infer-filter.d.ts +1 -1
  33. package/dist/data-table/layered-filters.d.cts +1 -1
  34. package/dist/data-table/layered-filters.d.ts +1 -1
  35. package/dist/data-table/pagination.cjs +5 -5
  36. package/dist/data-table/pagination.cjs.map +1 -1
  37. package/dist/data-table/pagination.js +5 -5
  38. package/dist/data-table/pagination.js.map +1 -1
  39. package/dist/data-table/query-control.d.cts +1 -1
  40. package/dist/data-table/query-control.d.ts +1 -1
  41. package/dist/data-table/types.cjs.map +1 -1
  42. package/dist/data-table/types.d.cts +1 -1
  43. package/dist/data-table/types.d.ts +1 -1
  44. package/dist/data-table/url-state.d.cts +1 -1
  45. package/dist/data-table/url-state.d.ts +1 -1
  46. package/dist/data-table/uuid-cell.cjs.map +1 -1
  47. package/dist/data-table/uuid-cell.js.map +1 -1
  48. package/dist/data-table/xlsx.d.cts +1 -1
  49. package/dist/data-table/xlsx.d.ts +1 -1
  50. package/dist/index.cjs +5 -5
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.js +5 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/styles.css +8 -1
  55. package/dist/tokens.css +2 -0
  56. package/dist/{types-cH8oLqUx.d.ts → types-C2xN6W_q.d.ts} +46 -3
  57. package/dist/{types-0CNCWvdK.d.cts → types-D_tpuk6m.d.cts} +46 -3
  58. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { AgentPayloadInput } from './copy-types.cjs';
2
- import { f as MatrxDataTableCopyConfig, M as MatrxColumnDef } from '../types-0CNCWvdK.cjs';
2
+ import { g as MatrxDataTableCopyConfig, M as MatrxColumnDef } from '../types-D_tpuk6m.cjs';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { AgentPayloadInput } from './copy-types.js';
2
- import { f as MatrxDataTableCopyConfig, M as MatrxColumnDef } from '../types-cH8oLqUx.js';
2
+ import { g as MatrxDataTableCopyConfig, M as MatrxColumnDef } from '../types-C2xN6W_q.js';
3
3
  import 'react';
4
4
 
5
5
  /**
@@ -173,48 +173,6 @@ function XIcon(props) {
173
173
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "m6 6 12 12" })
174
174
  ] });
175
175
  }
176
- function radixProps(props) {
177
- return {
178
- xmlns: "http://www.w3.org/2000/svg",
179
- viewBox: "0 0 15 15",
180
- width: 15,
181
- height: 15,
182
- fill: "none",
183
- "aria-hidden": true,
184
- ...props
185
- };
186
- }
187
- function CheckIcon(props) {
188
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
189
- "path",
190
- {
191
- d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
192
- fill: "currentColor",
193
- fillRule: "evenodd",
194
- clipRule: "evenodd"
195
- }
196
- ) });
197
- }
198
- function DotFilledIcon(props) {
199
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
200
- "path",
201
- {
202
- d: "M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",
203
- fill: "currentColor"
204
- }
205
- ) });
206
- }
207
- function RadixChevronRightIcon(props) {
208
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
209
- "path",
210
- {
211
- d: "M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",
212
- fill: "currentColor",
213
- fillRule: "evenodd",
214
- clipRule: "evenodd"
215
- }
216
- ) });
217
- }
218
176
 
219
177
  // src/portal-container.tsx
220
178
  var React2 = __toESM(require("react"), 1);
@@ -478,132 +436,45 @@ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @
478
436
  ));
479
437
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
480
438
 
481
- // src/dropdown-menu.tsx
482
- var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
439
+ // src/popover.tsx
440
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
483
441
  var React6 = __toESM(require("react"), 1);
484
442
  var import_jsx_runtime6 = require("react/jsx-runtime");
485
- var DropdownMenu = DropdownMenuPrimitive.Root;
486
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
487
- var MENU_SURFACE_CLASS = "z-[10001] min-w-[8rem] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto overflow-x-hidden overscroll-contain rounded-md border bg-popover p-1 text-popover-foreground";
488
- var MENU_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
489
- var MENU_INDICATOR_ITEM_CLASS = "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
490
- var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
491
- DropdownMenuPrimitive.SubTrigger,
492
- {
493
- ref,
494
- "data-slot": "dropdown-menu-sub-trigger",
495
- className: cn(
496
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
497
- inset && "pl-8",
498
- className
499
- ),
500
- ...props,
501
- children: [
502
- children,
503
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
504
- ]
505
- }
506
- ));
507
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
508
- var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
509
- DropdownMenuPrimitive.SubContent,
510
- {
511
- ref,
512
- "data-slot": "dropdown-menu-sub-content",
513
- className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
514
- ...props
515
- }
516
- ));
517
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
518
- var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
519
- const portalContainer = usePortalContainer(container);
520
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
521
- DropdownMenuPrimitive.Content,
522
- {
523
- ref,
524
- "data-slot": "dropdown-menu-content",
525
- sideOffset,
526
- className: cn(
527
- MENU_SURFACE_CLASS,
528
- "shadow-md",
529
- MOTION_POPPER,
530
- className
531
- ),
532
- ...props
533
- }
534
- ) });
535
- });
536
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
537
- var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
538
- DropdownMenuPrimitive.Item,
539
- {
540
- ref,
541
- "data-slot": "dropdown-menu-item",
542
- className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
543
- ...props
544
- }
545
- ));
546
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
547
- var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
548
- DropdownMenuPrimitive.CheckboxItem,
549
- {
550
- ref,
551
- "data-slot": "dropdown-menu-checkbox-item",
552
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
553
- ...props,
554
- children: [
555
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
556
- children
557
- ]
558
- }
559
- ));
560
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
561
- var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
562
- DropdownMenuPrimitive.RadioItem,
563
- {
564
- ref,
565
- "data-slot": "dropdown-menu-radio-item",
566
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
567
- ...props,
568
- children: [
569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
570
- children
571
- ]
572
- }
573
- ));
574
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
575
- var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
576
- DropdownMenuPrimitive.Label,
577
- {
578
- ref,
579
- "data-slot": "dropdown-menu-label",
580
- className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
581
- ...props
582
- }
583
- ));
584
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
585
- var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
586
- DropdownMenuPrimitive.Separator,
587
- {
588
- ref,
589
- "data-slot": "dropdown-menu-separator",
590
- className: cn("-mx-1 my-1 h-px bg-muted", className),
591
- ...props
592
- }
593
- ));
594
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
595
- var DropdownMenuShortcut = ({
596
- className,
597
- ...props
598
- }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
599
- "span",
600
- {
601
- "data-slot": "dropdown-menu-shortcut",
602
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
443
+ var Popover = PopoverPrimitive.Root;
444
+ var PopoverTrigger = PopoverPrimitive.Trigger;
445
+ var PopoverContent = React6.forwardRef(
446
+ ({
447
+ className,
448
+ align = "center",
449
+ sideOffset = 4,
450
+ container,
451
+ animated = true,
603
452
  ...props
453
+ }, ref) => {
454
+ const portalContainer = usePortalContainer(container);
455
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
456
+ PopoverPrimitive.Content,
457
+ {
458
+ ref,
459
+ align,
460
+ sideOffset,
461
+ className: cn(
462
+ // Cap to the viewport space Radix measured and scroll — a popover taller
463
+ // than the screen must never trap the user with unreachable content.
464
+ // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
465
+ // z, DOM portal order decides, so a dialog opened FROM a popover stacks
466
+ // above it, and a popover opened from a dialog still stacks above the
467
+ // dialog. z-[10001] buried dialogs behind fullscreen popovers.
468
+ "z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
469
+ animated && MOTION_POPPER,
470
+ className
471
+ ),
472
+ ...props
473
+ }
474
+ ) });
604
475
  }
605
476
  );
606
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
477
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
607
478
 
608
479
  // src/content-transfer/index.tsx
609
480
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -626,6 +497,53 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
626
497
  ] })
627
498
  ] });
628
499
  }
500
+ function PaletteGlyph({ format, ai = false, file = false }) {
501
+ if (ai) return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("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: [
502
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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" }),
503
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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" }),
504
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
505
+ ] });
506
+ if (file) return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("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: [
507
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
508
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
509
+ ] });
510
+ const path = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
511
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
512
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
513
+ ] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
514
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m14 10 7-7" }),
515
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M20 10h-6V4" }),
516
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "m3 21 7-7" }),
517
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 14h6v6" })
518
+ ] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
519
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
520
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 10h16M10 4v16" })
521
+ ] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
522
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
523
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
524
+ ] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
525
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
526
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
527
+ ] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
528
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
529
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
530
+ ] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
531
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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 });
532
+ }
533
+ function PaletteRows({ title, items, onRun, extra, ai = false }) {
534
+ if (!items.length && !extra) return null;
535
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
536
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: title }),
537
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
538
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { ai }),
539
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
540
+ item.copyLabel ?? item.label,
541
+ item.hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
542
+ ] })
543
+ ] }, item.id)),
544
+ extra
545
+ ] });
546
+ }
629
547
  var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
630
548
  var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
631
549
  var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
@@ -714,7 +632,7 @@ function ContentTransferMenu(props) {
714
632
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
715
633
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
716
634
  }
717
- function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
635
+ function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, sourceFormats = true, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
718
636
  const triggerRef = React7.useRef(null);
719
637
  const inherited = React7.useContext(CapabilityContext);
720
638
  const nearestSurface = React7.useContext(SurfaceContext);
@@ -727,6 +645,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
727
645
  const workspaceCaptures = React7.useRef(/* @__PURE__ */ new Map());
728
646
  const externalWorkspaceKeys = React7.useRef(/* @__PURE__ */ new Set());
729
647
  const [notice, setNotice] = React7.useState(null);
648
+ const [paletteOpen, setPaletteOpen] = React7.useState(false);
649
+ const [mode, setMode] = React7.useState("copy");
730
650
  const scopes = React7.useMemo(() => table?.availableScopes ?? ["target"], [table]);
731
651
  const initialScope = table?.initialScope ?? "target";
732
652
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
@@ -978,48 +898,87 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
978
898
  }, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
979
899
  if (!enabled) return null;
980
900
  const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
981
- const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section).map((v) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { "aria-label": v.ariaLabel, onSelect: () => void transfer("markdown", false, v), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...v, label: v.copyLabel }) }, `copy:${v.id}`));
982
- const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
983
- const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
984
- const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
901
+ const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
902
+ const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
903
+ const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
904
+ const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
985
905
  const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
906
+ const downloadActions = visibleActions.filter((action) => action.placement === "download");
907
+ const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
908
+ const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
909
+ const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
910
+ const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
911
+ const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
912
+ const closePalette = () => setPaletteOpen(false);
913
+ const tile = (id, label2, onClick, options = {}) => {
914
+ const presentation = options.action;
915
+ const Icon2 = presentation?.icon;
916
+ const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
917
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
918
+ closePalette();
919
+ onClick();
920
+ }, children: [
921
+ Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
922
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
923
+ label2,
924
+ presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
925
+ ] })
926
+ ] }, id);
927
+ };
986
928
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
987
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenu, { onOpenChange: (open) => {
988
- if (open) void preflight();
929
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
930
+ setPaletteOpen(open);
931
+ if (open) {
932
+ setMode("copy");
933
+ void preflight();
934
+ }
989
935
  }, children: [
990
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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__ */ (0, import_jsx_runtime7.jsx)(AlchemyGlyph, {}) }) }),
991
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuContent, { align: "end", className: "matrx-alchemy-menu", children: [
992
- menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { disabled: true, children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { disabled: true, children: menuStatus }) : null,
993
- !hide.includes("copy") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
994
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuLabel, { children: "Copy" }),
995
- quickVariants("copy"),
996
- visibleCopies.map((format) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
997
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
998
- "Copy ",
999
- adapter.label
1000
- ] }, adapter.id))
936
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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__ */ (0, import_jsx_runtime7.jsx)(AlchemyGlyph, {}) }) }),
937
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
938
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
939
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
940
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
1001
941
  ] }) : null,
1002
- !hide.includes("prepare") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1003
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}),
1004
- quickVariants("ai"),
1005
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
1006
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
1007
- variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
1008
- ] }) : null,
1009
- !hide.includes("download") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1010
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}),
1011
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuLabel, { children: "Download" }),
1012
- visibleDownloads.map((format) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(format, true), children: [
1013
- "Download ",
1014
- LABEL[format]
1015
- ] }, format)),
1016
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, true), children: [
1017
- "Download ",
1018
- adapter.label
1019
- ] }, `download:${adapter.id}`))
942
+ menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
943
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
944
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
945
+ 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]}` })),
946
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
947
+ ] }),
948
+ quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
949
+ closePalette();
950
+ void transfer("markdown", false, variant);
951
+ } }) : null
1020
952
  ] }) : null,
1021
- visibleActions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuSeparator, {}) : null,
1022
- visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DropdownMenuItem, { "aria-label": action.ariaLabel, onSelect: () => void runAction(action), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id))
953
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
954
+ 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]}` })),
955
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
956
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
957
+ ] }) }) : null,
958
+ prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
959
+ closePalette();
960
+ void transfer("markdown", false, variant);
961
+ }, extra: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
962
+ closePalette();
963
+ void openWorkspace();
964
+ }, children: [
965
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteGlyph, { ai: true }),
966
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Prepare for AI\u2026" })
967
+ ] }) }) : null,
968
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
969
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
970
+ closePalette();
971
+ void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
972
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Prepare this surface\u2026" }) }) : null,
973
+ variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
974
+ closePalette();
975
+ void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
976
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
977
+ ] }) }) : null,
978
+ ordinaryActions.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
979
+ closePalette();
980
+ void runAction(action);
981
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
1023
982
  ] })
1024
983
  ] }),
1025
984
  notice ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
@@ -1664,6 +1623,7 @@ function MatrxCopyMenuSession(props) {
1664
1623
  label: item.label,
1665
1624
  supports: () => true,
1666
1625
  ...item.build && !item.onSelect ? {
1626
+ placement: "download",
1667
1627
  source: make(
1668
1628
  `export:${item.id}`,
1669
1629
  async () => {
@@ -1744,10 +1704,11 @@ function MatrxCopyMenuSession(props) {
1744
1704
  label: props.label,
1745
1705
  variants,
1746
1706
  actions,
1707
+ sourceFormats: Boolean(source),
1747
1708
  hide: [
1748
1709
  ...!copyVisible || !source ? ["copy"] : [],
1749
1710
  ...!aiVisible || !source ? ["prepare"] : [],
1750
- ...!exportVisible || !source ? ["download"] : []
1711
+ ...!exportVisible ? ["download"] : []
1751
1712
  ],
1752
1713
  formatSources: {
1753
1714
  ...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},