@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
@@ -95,48 +95,6 @@ function XIcon(props) {
95
95
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })
96
96
  ] });
97
97
  }
98
- function radixProps(props) {
99
- return {
100
- xmlns: "http://www.w3.org/2000/svg",
101
- viewBox: "0 0 15 15",
102
- width: 15,
103
- height: 15,
104
- fill: "none",
105
- "aria-hidden": true,
106
- ...props
107
- };
108
- }
109
- function CheckIcon(props) {
110
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
- "path",
112
- {
113
- 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",
114
- fill: "currentColor",
115
- fillRule: "evenodd",
116
- clipRule: "evenodd"
117
- }
118
- ) });
119
- }
120
- function DotFilledIcon(props) {
121
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- "path",
123
- {
124
- 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",
125
- fill: "currentColor"
126
- }
127
- ) });
128
- }
129
- function RadixChevronRightIcon(props) {
130
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...radixProps(props), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
131
- "path",
132
- {
133
- 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",
134
- fill: "currentColor",
135
- fillRule: "evenodd",
136
- clipRule: "evenodd"
137
- }
138
- ) });
139
- }
140
98
 
141
99
  // src/portal-container.tsx
142
100
  var React = __toESM(require("react"), 1);
@@ -529,132 +487,45 @@ var Button = React5.forwardRef(
529
487
  );
530
488
  Button.displayName = "Button";
531
489
 
532
- // src/dropdown-menu.tsx
533
- var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
490
+ // src/popover.tsx
491
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
534
492
  var React6 = __toESM(require("react"), 1);
535
493
  var import_jsx_runtime9 = require("react/jsx-runtime");
536
- var DropdownMenu = DropdownMenuPrimitive.Root;
537
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
538
- 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";
539
- 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";
540
- 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";
541
- var DropdownMenuSubTrigger = React6.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
542
- DropdownMenuPrimitive.SubTrigger,
543
- {
544
- ref,
545
- "data-slot": "dropdown-menu-sub-trigger",
546
- className: cn(
547
- "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",
548
- inset && "pl-8",
549
- className
550
- ),
551
- ...props,
552
- children: [
553
- children,
554
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
555
- ]
556
- }
557
- ));
558
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
559
- var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
560
- DropdownMenuPrimitive.SubContent,
561
- {
562
- ref,
563
- "data-slot": "dropdown-menu-sub-content",
564
- className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
565
- ...props
566
- }
567
- ));
568
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
569
- var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
570
- const portalContainer = usePortalContainer(container);
571
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
572
- DropdownMenuPrimitive.Content,
573
- {
574
- ref,
575
- "data-slot": "dropdown-menu-content",
576
- sideOffset,
577
- className: cn(
578
- MENU_SURFACE_CLASS,
579
- "shadow-md",
580
- MOTION_POPPER,
581
- className
582
- ),
583
- ...props
584
- }
585
- ) });
586
- });
587
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
588
- var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
589
- DropdownMenuPrimitive.Item,
590
- {
591
- ref,
592
- "data-slot": "dropdown-menu-item",
593
- className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
594
- ...props
595
- }
596
- ));
597
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
598
- var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
599
- DropdownMenuPrimitive.CheckboxItem,
600
- {
601
- ref,
602
- "data-slot": "dropdown-menu-checkbox-item",
603
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
604
- ...props,
605
- children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon, { className: "h-4 w-4" }) }) }),
607
- children
608
- ]
609
- }
610
- ));
611
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
612
- var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
613
- DropdownMenuPrimitive.RadioItem,
614
- {
615
- ref,
616
- "data-slot": "dropdown-menu-radio-item",
617
- className: cn(MENU_INDICATOR_ITEM_CLASS, className),
618
- ...props,
619
- children: [
620
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
621
- children
622
- ]
623
- }
624
- ));
625
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
626
- var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
627
- DropdownMenuPrimitive.Label,
628
- {
629
- ref,
630
- "data-slot": "dropdown-menu-label",
631
- className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
632
- ...props
633
- }
634
- ));
635
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
636
- var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
637
- DropdownMenuPrimitive.Separator,
638
- {
639
- ref,
640
- "data-slot": "dropdown-menu-separator",
641
- className: cn("-mx-1 my-1 h-px bg-muted", className),
642
- ...props
643
- }
644
- ));
645
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
646
- var DropdownMenuShortcut = ({
647
- className,
648
- ...props
649
- }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
650
- "span",
651
- {
652
- "data-slot": "dropdown-menu-shortcut",
653
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
494
+ var Popover = PopoverPrimitive.Root;
495
+ var PopoverTrigger = PopoverPrimitive.Trigger;
496
+ var PopoverContent = React6.forwardRef(
497
+ ({
498
+ className,
499
+ align = "center",
500
+ sideOffset = 4,
501
+ container,
502
+ animated = true,
654
503
  ...props
504
+ }, ref) => {
505
+ const portalContainer = usePortalContainer(container);
506
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
507
+ PopoverPrimitive.Content,
508
+ {
509
+ ref,
510
+ align,
511
+ sideOffset,
512
+ className: cn(
513
+ // Cap to the viewport space Radix measured and scroll — a popover taller
514
+ // than the screen must never trap the user with unreachable content.
515
+ // z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
516
+ // z, DOM portal order decides, so a dialog opened FROM a popover stacks
517
+ // above it, and a popover opened from a dialog still stacks above the
518
+ // dialog. z-[10001] buried dialogs behind fullscreen popovers.
519
+ "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",
520
+ animated && MOTION_POPPER,
521
+ className
522
+ ),
523
+ ...props
524
+ }
525
+ ) });
655
526
  }
656
527
  );
657
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
528
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
658
529
 
659
530
  // src/content-transfer/index.tsx
660
531
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -677,6 +548,53 @@ function MenuPresentation({ label, hint, icon: Icon2 }) {
677
548
  ] })
678
549
  ] });
679
550
  }
551
+ function PaletteGlyph({ format, ai = false, file = false }) {
552
+ if (ai) return /* @__PURE__ */ (0, import_jsx_runtime10.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: [
553
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
554
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
556
+ ] });
557
+ if (file) return /* @__PURE__ */ (0, import_jsx_runtime10.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: [
558
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
559
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
560
+ ] });
561
+ const path = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
562
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
563
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" })
564
+ ] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
565
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m14 10 7-7" }),
566
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M20 10h-6V4" }),
567
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m3 21 7-7" }),
568
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 14h6v6" })
569
+ ] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
570
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
571
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 10h16M10 4v16" })
572
+ ] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
573
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
574
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
575
+ ] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
576
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
578
+ ] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
579
+ /* @__PURE__ */ (0, import_jsx_runtime10.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" }),
580
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
581
+ ] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
582
+ return /* @__PURE__ */ (0, import_jsx_runtime10.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 });
583
+ }
584
+ function PaletteRows({ title, items, onRun, extra, ai = false }) {
585
+ if (!items.length && !extra) return null;
586
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
587
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h3", { children: title }),
588
+ items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
589
+ item.icon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { ai }),
590
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
591
+ item.copyLabel ?? item.label,
592
+ item.hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
593
+ ] })
594
+ ] }, item.id)),
595
+ extra
596
+ ] });
597
+ }
680
598
  var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
681
599
  var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
682
600
  var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
@@ -765,7 +683,7 @@ function ContentTransferMenu(props) {
765
683
  const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
766
684
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
767
685
  }
768
- function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
686
+ 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 }) {
769
687
  const triggerRef = React7.useRef(null);
770
688
  const inherited = React7.useContext(CapabilityContext);
771
689
  const nearestSurface = React7.useContext(SurfaceContext);
@@ -778,6 +696,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
778
696
  const workspaceCaptures = React7.useRef(/* @__PURE__ */ new Map());
779
697
  const externalWorkspaceKeys = React7.useRef(/* @__PURE__ */ new Set());
780
698
  const [notice, setNotice] = React7.useState(null);
699
+ const [paletteOpen, setPaletteOpen] = React7.useState(false);
700
+ const [mode, setMode] = React7.useState("copy");
781
701
  const scopes = React7.useMemo(() => table?.availableScopes ?? ["target"], [table]);
782
702
  const initialScope = table?.initialScope ?? "target";
783
703
  if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
@@ -1029,48 +949,87 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
1029
949
  }, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
1030
950
  if (!enabled) return null;
1031
951
  const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
1032
- const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section).map((v) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { "aria-label": v.ariaLabel, onSelect: () => void transfer("markdown", false, v), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...v, label: v.copyLabel }) }, `copy:${v.id}`));
1033
- const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
1034
- const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
1035
- const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
952
+ const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
953
+ const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
954
+ const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
955
+ const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
1036
956
  const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
957
+ const downloadActions = visibleActions.filter((action) => action.placement === "download");
958
+ const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
959
+ const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
960
+ const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
961
+ const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
962
+ const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
963
+ const closePalette = () => setPaletteOpen(false);
964
+ const tile = (id, label2, onClick, options = {}) => {
965
+ const presentation = options.action;
966
+ const Icon2 = presentation?.icon;
967
+ const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
968
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
969
+ closePalette();
970
+ onClick();
971
+ }, children: [
972
+ Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
973
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
974
+ label2,
975
+ presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
976
+ ] })
977
+ ] }, id);
978
+ };
1037
979
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenu, { onOpenChange: (open) => {
1039
- if (open) void preflight();
980
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
981
+ setPaletteOpen(open);
982
+ if (open) {
983
+ setMode("copy");
984
+ void preflight();
985
+ }
1040
986
  }, children: [
1041
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.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_runtime10.jsx)(AlchemyGlyph, {}) }) }),
1042
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuContent, { align: "end", className: "matrx-alchemy-menu", children: [
1043
- menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { disabled: true, children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { disabled: true, children: menuStatus }) : null,
1044
- !hide.includes("copy") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1045
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuLabel, { children: "Copy" }),
1046
- quickVariants("copy"),
1047
- visibleCopies.map((format) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void transfer(format, false), children: format === "plain" ? "Copy" : `Copy ${LABEL[format]}` }, format)),
1048
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, false), children: [
1049
- "Copy ",
1050
- adapter.label
1051
- ] }, adapter.id))
987
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.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_runtime10.jsx)(AlchemyGlyph, {}) }) }),
988
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
989
+ copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
990
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
991
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
1052
992
  ] }) : null,
1053
- !hide.includes("prepare") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}),
1055
- quickVariants("ai"),
1056
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(), children: "Prepare for AI\u2026" }),
1057
- nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName }), children: "Prepare this surface\u2026" }) : null,
1058
- variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { onSelect: () => void openWorkspace(variantWorkspaceKeys.get(variant.id), variant), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
1059
- ] }) : null,
1060
- !hide.includes("download") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1061
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}),
1062
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuLabel, { children: "Download" }),
1063
- visibleDownloads.map((format) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(format, true), children: [
1064
- "Download ",
1065
- LABEL[format]
1066
- ] }, format)),
1067
- visibleAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DropdownMenuItem, { onSelect: () => void transfer(adapter, true), children: [
1068
- "Download ",
1069
- adapter.label
1070
- ] }, `download:${adapter.id}`))
993
+ menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
994
+ resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
995
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
996
+ 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]}` })),
997
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
998
+ ] }),
999
+ quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
1000
+ closePalette();
1001
+ void transfer("markdown", false, variant);
1002
+ } }) : null
1071
1003
  ] }) : null,
1072
- visibleActions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuSeparator, {}) : null,
1073
- visibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DropdownMenuItem, { "aria-label": action.ariaLabel, onSelect: () => void runAction(action), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id))
1004
+ resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
1005
+ 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]}` })),
1006
+ visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
1007
+ downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
1008
+ ] }) }) : null,
1009
+ prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
1010
+ closePalette();
1011
+ void transfer("markdown", false, variant);
1012
+ }, extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1013
+ closePalette();
1014
+ void openWorkspace();
1015
+ }, children: [
1016
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteGlyph, { ai: true }),
1017
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Prepare for AI\u2026" })
1018
+ ] }) }) : null,
1019
+ prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
1020
+ nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
1021
+ closePalette();
1022
+ void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
1023
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Prepare this surface\u2026" }) }) : null,
1024
+ variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
1025
+ closePalette();
1026
+ void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
1027
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
1028
+ ] }) }) : null,
1029
+ ordinaryActions.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
1030
+ closePalette();
1031
+ void runAction(action);
1032
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
1074
1033
  ] })
1075
1034
  ] }),
1076
1035
  notice ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
@@ -1715,6 +1674,7 @@ function MatrxCopyMenuSession(props) {
1715
1674
  label: item.label,
1716
1675
  supports: () => true,
1717
1676
  ...item.build && !item.onSelect ? {
1677
+ placement: "download",
1718
1678
  source: make(
1719
1679
  `export:${item.id}`,
1720
1680
  async () => {
@@ -1795,10 +1755,11 @@ function MatrxCopyMenuSession(props) {
1795
1755
  label: props.label,
1796
1756
  variants,
1797
1757
  actions,
1758
+ sourceFormats: Boolean(source),
1798
1759
  hide: [
1799
1760
  ...!copyVisible || !source ? ["copy"] : [],
1800
1761
  ...!aiVisible || !source ? ["prepare"] : [],
1801
- ...!exportVisible || !source ? ["download"] : []
1762
+ ...!exportVisible ? ["download"] : []
1802
1763
  ],
1803
1764
  formatSources: {
1804
1765
  ...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},