@ai-matrx/design-system 0.18.22 → 0.19.0
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.
- package/CHANGELOG.md +8 -0
- package/dist/content-transfer/alchemy.svg +1 -1
- package/dist/content-transfer/copy-transform.svg +1 -0
- package/dist/content-transfer/icon.cjs +8 -2
- package/dist/content-transfer/icon.cjs.map +1 -1
- package/dist/content-transfer/icon.d.cts +5 -3
- package/dist/content-transfer/icon.d.ts +5 -3
- package/dist/content-transfer/icon.js +8 -2
- package/dist/content-transfer/icon.js.map +1 -1
- package/dist/content-transfer/portal.svg +1 -0
- package/dist/content-transfer.cjs +923 -304
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.css +17 -74
- package/dist/content-transfer.d.cts +14 -3
- package/dist/content-transfer.d.ts +14 -3
- package/dist/content-transfer.js +929 -305
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/data-row-inspector.cjs +990 -397
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +988 -390
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +989 -396
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +987 -389
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.d.cts +1 -1
- package/dist/data-table/host.d.ts +1 -1
- package/dist/data-table/index.cjs +1628 -1007
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +1480 -854
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/pagination.cjs +1 -1
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +1 -1
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/scroll-pagination.cjs +82 -54
- package/dist/data-table/scroll-pagination.cjs.map +1 -1
- package/dist/data-table/scroll-pagination.js +82 -54
- package/dist/data-table/scroll-pagination.js.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/uuid-cell.cjs +1 -1
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js +1 -1
- package/dist/data-table/uuid-cell.js.map +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +527 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +531 -0
- package/dist/index.js.map +1 -1
- package/dist/tap-target.cjs +636 -0
- package/dist/tap-target.cjs.map +1 -0
- package/dist/tap-target.css +151 -0
- package/dist/tap-target.d.cts +131 -0
- package/dist/tap-target.d.ts +131 -0
- package/dist/tap-target.js +608 -0
- package/dist/tap-target.js.map +1 -0
- package/dist/{types-Cbnj1Qlm.d.ts → types-D1m14boM.d.ts} +1 -1
- package/dist/{types-CWW4Tur-.d.cts → types-Di6QT0P1.d.cts} +1 -1
- package/package.json +14 -1
|
@@ -44,11 +44,11 @@ function cn(...inputs) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// src/content-transfer/matrx-copy.tsx
|
|
47
|
-
var
|
|
47
|
+
var React9 = __toESM(require("react"), 1);
|
|
48
48
|
var import_content_transfer2 = require("@ai-matrx/kit/content-transfer");
|
|
49
49
|
|
|
50
50
|
// src/content-transfer/index.tsx
|
|
51
|
-
var
|
|
51
|
+
var React8 = __toESM(require("react"), 1);
|
|
52
52
|
var import_react_dom = require("react-dom");
|
|
53
53
|
var import_content_transfer = require("@ai-matrx/kit/content-transfer");
|
|
54
54
|
|
|
@@ -477,81 +477,620 @@ var PopoverContent = React6.forwardRef(
|
|
|
477
477
|
);
|
|
478
478
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
479
479
|
|
|
480
|
+
// src/tap-target/tap-target-button.tsx
|
|
481
|
+
var import_react = require("react");
|
|
482
|
+
|
|
483
|
+
// src/tooltip.tsx
|
|
484
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
485
|
+
var React7 = __toESM(require("react"), 1);
|
|
486
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
487
|
+
var TooltipProvider = TooltipPrimitive.Provider;
|
|
488
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
489
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
490
|
+
var TooltipContent = React7.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
|
|
491
|
+
const resolved = usePortalContainer(container);
|
|
492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
493
|
+
TooltipPrimitive.Content,
|
|
494
|
+
{
|
|
495
|
+
ref,
|
|
496
|
+
"data-slot": "tooltip-content",
|
|
497
|
+
sideOffset,
|
|
498
|
+
className: cn(
|
|
499
|
+
"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md",
|
|
500
|
+
animated && MOTION_POPPER,
|
|
501
|
+
className
|
|
502
|
+
),
|
|
503
|
+
...props
|
|
504
|
+
}
|
|
505
|
+
) });
|
|
506
|
+
});
|
|
507
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
508
|
+
|
|
509
|
+
// src/tap-target/cn.ts
|
|
510
|
+
function cn2(...values) {
|
|
511
|
+
return values.filter(Boolean).join(" ").trim();
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// src/tap-target/link.ts
|
|
515
|
+
var LINK_SLOT = /* @__PURE__ */ Symbol.for("@ai-matrx/tap-target:link-component");
|
|
516
|
+
function getTapTargetLinkComponent() {
|
|
517
|
+
return globalThis[LINK_SLOT] ?? null;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
// src/tap-target/tap-target-button.tsx
|
|
521
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
522
|
+
var EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;
|
|
523
|
+
var TAP_OUTER_CLASS = "matrx-tap-target group";
|
|
524
|
+
var TAP_GROUP_OUTER_CLASS = "matrx-tap-target matrx-tap-target-sm group";
|
|
525
|
+
function IconContent({
|
|
526
|
+
icon,
|
|
527
|
+
children,
|
|
528
|
+
strokeWidth = 2,
|
|
529
|
+
className
|
|
530
|
+
}) {
|
|
531
|
+
if (icon) {
|
|
532
|
+
if ((0, import_react.isValidElement)(icon)) {
|
|
533
|
+
return (0, import_react.cloneElement)(icon, {
|
|
534
|
+
className: cn2(className, icon.props.className)
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className, children: icon });
|
|
538
|
+
}
|
|
539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
540
|
+
"svg",
|
|
541
|
+
{
|
|
542
|
+
className,
|
|
543
|
+
fill: "none",
|
|
544
|
+
viewBox: "0 0 24 24",
|
|
545
|
+
stroke: "currentColor",
|
|
546
|
+
strokeWidth,
|
|
547
|
+
children
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
function resolveTapGeometry(label, size, mobileIconOnly) {
|
|
552
|
+
const inline = Boolean(label);
|
|
553
|
+
if (size === "sm") {
|
|
554
|
+
return {
|
|
555
|
+
outerClassName: inline && mobileIconOnly ? "matrx-tap-target matrx-tap-target-sm matrx-tap-target-mobile-icon-only-sm group" : inline ? "matrx-tap-target matrx-tap-target-sm matrx-tap-target-inline-sm group" : TAP_GROUP_OUTER_CLASS,
|
|
556
|
+
inlineModifier: mobileIconOnly ? "matrx-tap-pill-mobile-icon-only-sm" : "matrx-tap-pill-inline-sm"
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
outerClassName: inline && mobileIconOnly ? `${TAP_OUTER_CLASS} matrx-tap-target-mobile-icon-only` : inline ? `${TAP_OUTER_CLASS} matrx-tap-target-inline` : TAP_OUTER_CLASS,
|
|
561
|
+
inlineModifier: mobileIconOnly ? "matrx-tap-pill-mobile-icon-only" : "matrx-tap-pill-inline"
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function buildTapInner({
|
|
565
|
+
label,
|
|
566
|
+
pillClassName,
|
|
567
|
+
iconClassName,
|
|
568
|
+
labelClassName,
|
|
569
|
+
inlineModifier,
|
|
570
|
+
icon,
|
|
571
|
+
children,
|
|
572
|
+
strokeWidth = 2
|
|
573
|
+
}) {
|
|
574
|
+
const iconEl = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
575
|
+
IconContent,
|
|
576
|
+
{
|
|
577
|
+
icon,
|
|
578
|
+
strokeWidth,
|
|
579
|
+
className: iconClassName,
|
|
580
|
+
children
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
const pillClasses = label ? `${pillClassName} ${inlineModifier}`.trim() : pillClassName;
|
|
584
|
+
if (!label) {
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: pillClasses, children: iconEl });
|
|
586
|
+
}
|
|
587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: pillClasses, children: [
|
|
588
|
+
iconEl,
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: labelClassName ?? "matrx-tap-label", children: label })
|
|
590
|
+
] });
|
|
591
|
+
}
|
|
592
|
+
function renderTapTarget({
|
|
593
|
+
size = "default",
|
|
594
|
+
pillClassName,
|
|
595
|
+
iconClassName,
|
|
596
|
+
labelClassName,
|
|
597
|
+
icon,
|
|
598
|
+
children,
|
|
599
|
+
strokeWidth,
|
|
600
|
+
label,
|
|
601
|
+
mobileIconOnly = false,
|
|
602
|
+
onClick,
|
|
603
|
+
as,
|
|
604
|
+
htmlFor,
|
|
605
|
+
ariaLabel,
|
|
606
|
+
disabled,
|
|
607
|
+
href,
|
|
608
|
+
target,
|
|
609
|
+
rel,
|
|
610
|
+
prefetch,
|
|
611
|
+
linkComponent,
|
|
612
|
+
tooltip,
|
|
613
|
+
tooltipSide,
|
|
614
|
+
tooltipAlign,
|
|
615
|
+
rest,
|
|
616
|
+
buttonRef
|
|
617
|
+
}) {
|
|
618
|
+
const { outerClassName, inlineModifier } = resolveTapGeometry(
|
|
619
|
+
label,
|
|
620
|
+
size,
|
|
621
|
+
mobileIconOnly
|
|
622
|
+
);
|
|
623
|
+
const responsiveLabelClassName = mobileIconOnly ? `${labelClassName ?? "matrx-tap-label"} matrx-tap-label-mobile-icon-only` : labelClassName;
|
|
624
|
+
const inner = buildTapInner({
|
|
625
|
+
label,
|
|
626
|
+
pillClassName,
|
|
627
|
+
iconClassName,
|
|
628
|
+
labelClassName: responsiveLabelClassName,
|
|
629
|
+
inlineModifier: label ? inlineModifier : "",
|
|
630
|
+
icon,
|
|
631
|
+
children,
|
|
632
|
+
strokeWidth
|
|
633
|
+
});
|
|
634
|
+
const resolvedTooltip = tooltip !== void 0 ? tooltip : label ? false : void 0;
|
|
635
|
+
const triggerAriaLabel = label && !mobileIconOnly ? void 0 : ariaLabel ?? label;
|
|
636
|
+
const trigger = renderTrigger({
|
|
637
|
+
href,
|
|
638
|
+
target,
|
|
639
|
+
rel,
|
|
640
|
+
prefetch,
|
|
641
|
+
linkComponent,
|
|
642
|
+
as,
|
|
643
|
+
htmlFor,
|
|
644
|
+
onClick,
|
|
645
|
+
ariaLabel: triggerAriaLabel,
|
|
646
|
+
disabled,
|
|
647
|
+
outerClassName,
|
|
648
|
+
children: inner,
|
|
649
|
+
rest,
|
|
650
|
+
buttonRef
|
|
651
|
+
});
|
|
652
|
+
return withTooltip(trigger, {
|
|
653
|
+
tooltip: resolvedTooltip,
|
|
654
|
+
ariaLabel: triggerAriaLabel,
|
|
655
|
+
disabled,
|
|
656
|
+
tooltipSide,
|
|
657
|
+
tooltipAlign
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
function renderTrigger({
|
|
661
|
+
href,
|
|
662
|
+
target,
|
|
663
|
+
rel,
|
|
664
|
+
prefetch,
|
|
665
|
+
linkComponent,
|
|
666
|
+
as,
|
|
667
|
+
htmlFor,
|
|
668
|
+
onClick,
|
|
669
|
+
ariaLabel,
|
|
670
|
+
disabled,
|
|
671
|
+
outerClassName,
|
|
672
|
+
children,
|
|
673
|
+
rest,
|
|
674
|
+
buttonRef
|
|
675
|
+
}) {
|
|
676
|
+
if (disabled && href) {
|
|
677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
678
|
+
"span",
|
|
679
|
+
{
|
|
680
|
+
"aria-disabled": "true",
|
|
681
|
+
"aria-label": ariaLabel,
|
|
682
|
+
className: `${outerClassName} opacity-40 pointer-events-none`,
|
|
683
|
+
children
|
|
684
|
+
}
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
if (href) {
|
|
688
|
+
const isExternal = EXTERNAL_RE.test(href);
|
|
689
|
+
if (isExternal) {
|
|
690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
691
|
+
"a",
|
|
692
|
+
{
|
|
693
|
+
href,
|
|
694
|
+
target: target ?? "_blank",
|
|
695
|
+
rel: rel ?? "noopener noreferrer",
|
|
696
|
+
"aria-label": ariaLabel,
|
|
697
|
+
className: outerClassName,
|
|
698
|
+
children
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
const Link = linkComponent ?? getTapTargetLinkComponent();
|
|
703
|
+
if (Link) {
|
|
704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
705
|
+
Link,
|
|
706
|
+
{
|
|
707
|
+
href,
|
|
708
|
+
target,
|
|
709
|
+
rel,
|
|
710
|
+
prefetch,
|
|
711
|
+
"aria-label": ariaLabel,
|
|
712
|
+
className: outerClassName,
|
|
713
|
+
children
|
|
714
|
+
}
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
718
|
+
"a",
|
|
719
|
+
{
|
|
720
|
+
href,
|
|
721
|
+
target,
|
|
722
|
+
rel,
|
|
723
|
+
"aria-label": ariaLabel,
|
|
724
|
+
className: outerClassName,
|
|
725
|
+
children
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
if (as === "label") {
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
731
|
+
"label",
|
|
732
|
+
{
|
|
733
|
+
htmlFor,
|
|
734
|
+
"aria-label": ariaLabel,
|
|
735
|
+
className: outerClassName,
|
|
736
|
+
children
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
741
|
+
"button",
|
|
742
|
+
{
|
|
743
|
+
ref: buttonRef,
|
|
744
|
+
type: "button",
|
|
745
|
+
onClick,
|
|
746
|
+
"aria-label": ariaLabel,
|
|
747
|
+
disabled,
|
|
748
|
+
...rest,
|
|
749
|
+
className: outerClassName,
|
|
750
|
+
children
|
|
751
|
+
}
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
function withTooltip(trigger, {
|
|
755
|
+
tooltip,
|
|
756
|
+
ariaLabel,
|
|
757
|
+
disabled,
|
|
758
|
+
tooltipSide = "top",
|
|
759
|
+
tooltipAlign = "center"
|
|
760
|
+
}) {
|
|
761
|
+
if (tooltip === false) return trigger;
|
|
762
|
+
const label = typeof tooltip === "string" && tooltip.length > 0 ? tooltip : ariaLabel;
|
|
763
|
+
if (!label) return trigger;
|
|
764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: disabled ? (
|
|
766
|
+
// Radix Tooltip triggers need a hoverable element; a disabled button
|
|
767
|
+
// does not dispatch pointer events, so we wrap in a span for the
|
|
768
|
+
// trigger target while keeping the disabled visual state.
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "inline-flex", children: trigger })
|
|
770
|
+
) : trigger }),
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: label })
|
|
772
|
+
] });
|
|
773
|
+
}
|
|
774
|
+
var TapTargetButton = (0, import_react.forwardRef)(function TapTargetButton2({
|
|
775
|
+
icon,
|
|
776
|
+
children,
|
|
777
|
+
strokeWidth = 2,
|
|
778
|
+
onClick,
|
|
779
|
+
className,
|
|
780
|
+
as,
|
|
781
|
+
htmlFor,
|
|
782
|
+
ariaLabel,
|
|
783
|
+
disabled,
|
|
784
|
+
href,
|
|
785
|
+
target,
|
|
786
|
+
rel,
|
|
787
|
+
prefetch,
|
|
788
|
+
linkComponent,
|
|
789
|
+
tooltip,
|
|
790
|
+
tooltipSide,
|
|
791
|
+
tooltipAlign,
|
|
792
|
+
label,
|
|
793
|
+
mobileIconOnly,
|
|
794
|
+
...rest
|
|
795
|
+
}, ref) {
|
|
796
|
+
const color = className ?? "text-foreground";
|
|
797
|
+
return renderTapTarget({
|
|
798
|
+
icon,
|
|
799
|
+
children,
|
|
800
|
+
strokeWidth,
|
|
801
|
+
onClick,
|
|
802
|
+
as,
|
|
803
|
+
htmlFor,
|
|
804
|
+
ariaLabel,
|
|
805
|
+
disabled,
|
|
806
|
+
href,
|
|
807
|
+
target,
|
|
808
|
+
rel,
|
|
809
|
+
prefetch,
|
|
810
|
+
linkComponent,
|
|
811
|
+
tooltip,
|
|
812
|
+
tooltipSide,
|
|
813
|
+
tooltipAlign,
|
|
814
|
+
label,
|
|
815
|
+
mobileIconOnly,
|
|
816
|
+
pillClassName: "matrx-tap-pill matrx-glass-thin-border",
|
|
817
|
+
iconClassName: `matrx-tap-icon ${color}`,
|
|
818
|
+
rest,
|
|
819
|
+
buttonRef: ref
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
var TapTargetButtonTransparent = (0, import_react.forwardRef)(function TapTargetButtonTransparent2({
|
|
823
|
+
icon,
|
|
824
|
+
children,
|
|
825
|
+
strokeWidth = 2,
|
|
826
|
+
onClick,
|
|
827
|
+
className,
|
|
828
|
+
as,
|
|
829
|
+
htmlFor,
|
|
830
|
+
ariaLabel,
|
|
831
|
+
disabled,
|
|
832
|
+
href,
|
|
833
|
+
target,
|
|
834
|
+
rel,
|
|
835
|
+
prefetch,
|
|
836
|
+
linkComponent,
|
|
837
|
+
tooltip,
|
|
838
|
+
tooltipSide,
|
|
839
|
+
tooltipAlign,
|
|
840
|
+
label,
|
|
841
|
+
mobileIconOnly,
|
|
842
|
+
...rest
|
|
843
|
+
}, ref) {
|
|
844
|
+
const color = className ?? "text-foreground";
|
|
845
|
+
return renderTapTarget({
|
|
846
|
+
icon,
|
|
847
|
+
children,
|
|
848
|
+
strokeWidth,
|
|
849
|
+
onClick,
|
|
850
|
+
as,
|
|
851
|
+
htmlFor,
|
|
852
|
+
ariaLabel,
|
|
853
|
+
disabled,
|
|
854
|
+
href,
|
|
855
|
+
target,
|
|
856
|
+
rel,
|
|
857
|
+
prefetch,
|
|
858
|
+
linkComponent,
|
|
859
|
+
tooltip,
|
|
860
|
+
tooltipSide,
|
|
861
|
+
tooltipAlign,
|
|
862
|
+
label,
|
|
863
|
+
mobileIconOnly,
|
|
864
|
+
pillClassName: "matrx-tap-pill hover:bg-muted active:bg-muted-foreground/15",
|
|
865
|
+
iconClassName: `matrx-tap-icon ${color}`,
|
|
866
|
+
rest,
|
|
867
|
+
buttonRef: ref
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
var TapTargetButtonSolid = (0, import_react.forwardRef)(function TapTargetButtonSolid2({
|
|
871
|
+
icon,
|
|
872
|
+
children,
|
|
873
|
+
strokeWidth = 2,
|
|
874
|
+
onClick,
|
|
875
|
+
as,
|
|
876
|
+
htmlFor,
|
|
877
|
+
ariaLabel,
|
|
878
|
+
disabled,
|
|
879
|
+
href,
|
|
880
|
+
target,
|
|
881
|
+
rel,
|
|
882
|
+
prefetch,
|
|
883
|
+
linkComponent,
|
|
884
|
+
bgColor = "bg-primary",
|
|
885
|
+
iconColor = "text-primary-foreground",
|
|
886
|
+
hoverBgColor = "hover:bg-primary/80",
|
|
887
|
+
activeBgColor = "active:brightness-90",
|
|
888
|
+
tooltip,
|
|
889
|
+
tooltipSide,
|
|
890
|
+
tooltipAlign,
|
|
891
|
+
label,
|
|
892
|
+
mobileIconOnly,
|
|
893
|
+
...rest
|
|
894
|
+
}, ref) {
|
|
895
|
+
return renderTapTarget({
|
|
896
|
+
icon,
|
|
897
|
+
children,
|
|
898
|
+
strokeWidth,
|
|
899
|
+
onClick,
|
|
900
|
+
as,
|
|
901
|
+
htmlFor,
|
|
902
|
+
ariaLabel,
|
|
903
|
+
disabled,
|
|
904
|
+
href,
|
|
905
|
+
target,
|
|
906
|
+
rel,
|
|
907
|
+
prefetch,
|
|
908
|
+
linkComponent,
|
|
909
|
+
tooltip,
|
|
910
|
+
tooltipSide,
|
|
911
|
+
tooltipAlign,
|
|
912
|
+
label,
|
|
913
|
+
mobileIconOnly,
|
|
914
|
+
pillClassName: `matrx-tap-pill ${bgColor} ${iconColor} ${hoverBgColor} ${activeBgColor}`,
|
|
915
|
+
iconClassName: `matrx-tap-icon ${iconColor}`,
|
|
916
|
+
labelClassName: `matrx-tap-label ${iconColor}`,
|
|
917
|
+
rest,
|
|
918
|
+
buttonRef: ref
|
|
919
|
+
});
|
|
920
|
+
});
|
|
921
|
+
var TapTargetButtonDestructive = (0, import_react.forwardRef)(function TapTargetButtonDestructive2({
|
|
922
|
+
bgColor = "bg-destructive",
|
|
923
|
+
iconColor = "text-destructive-foreground",
|
|
924
|
+
hoverBgColor = "hover:bg-destructive/90",
|
|
925
|
+
...rest
|
|
926
|
+
}, ref) {
|
|
927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
928
|
+
TapTargetButtonSolid,
|
|
929
|
+
{
|
|
930
|
+
ref,
|
|
931
|
+
bgColor,
|
|
932
|
+
iconColor,
|
|
933
|
+
hoverBgColor,
|
|
934
|
+
...rest
|
|
935
|
+
}
|
|
936
|
+
);
|
|
937
|
+
});
|
|
938
|
+
var TapTargetButtonForGroup = (0, import_react.forwardRef)(function TapTargetButtonForGroup2({
|
|
939
|
+
icon,
|
|
940
|
+
children,
|
|
941
|
+
strokeWidth = 2,
|
|
942
|
+
onClick,
|
|
943
|
+
className,
|
|
944
|
+
as,
|
|
945
|
+
htmlFor,
|
|
946
|
+
ariaLabel,
|
|
947
|
+
disabled,
|
|
948
|
+
href,
|
|
949
|
+
target,
|
|
950
|
+
rel,
|
|
951
|
+
prefetch,
|
|
952
|
+
linkComponent,
|
|
953
|
+
tooltip,
|
|
954
|
+
tooltipSide,
|
|
955
|
+
tooltipAlign,
|
|
956
|
+
label,
|
|
957
|
+
mobileIconOnly,
|
|
958
|
+
...rest
|
|
959
|
+
}, ref) {
|
|
960
|
+
const color = className ?? "text-foreground";
|
|
961
|
+
return renderTapTarget({
|
|
962
|
+
size: "sm",
|
|
963
|
+
icon,
|
|
964
|
+
children,
|
|
965
|
+
strokeWidth,
|
|
966
|
+
onClick,
|
|
967
|
+
as,
|
|
968
|
+
htmlFor,
|
|
969
|
+
ariaLabel,
|
|
970
|
+
disabled,
|
|
971
|
+
href,
|
|
972
|
+
target,
|
|
973
|
+
rel,
|
|
974
|
+
prefetch,
|
|
975
|
+
linkComponent,
|
|
976
|
+
tooltip,
|
|
977
|
+
tooltipSide,
|
|
978
|
+
tooltipAlign,
|
|
979
|
+
label,
|
|
980
|
+
mobileIconOnly,
|
|
981
|
+
pillClassName: "matrx-tap-pill matrx-tap-pill-sm matrx-glass-interactive",
|
|
982
|
+
iconClassName: `matrx-tap-icon ${color}`,
|
|
983
|
+
labelClassName: `matrx-tap-label ${color}`,
|
|
984
|
+
rest,
|
|
985
|
+
buttonRef: ref
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
|
|
480
989
|
// src/content-transfer/icon.ts
|
|
481
|
-
var ALCHEMY_GLYPH_PATHS =
|
|
482
|
-
|
|
990
|
+
var ALCHEMY_GLYPH_PATHS = {
|
|
991
|
+
portal: ["M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4M14 4h4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4M8 12h8m-3-3 3 3-3 3"],
|
|
992
|
+
"copy-transform": ["M8 7V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v8M13 21H5a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v3m-5 4h11m-3-3 3 3-3 3"]
|
|
993
|
+
};
|
|
994
|
+
var svg = (paths) => `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${paths.map((d) => `<path d="${d}"/>`).join("")}</svg>`;
|
|
995
|
+
var ALCHEMY_GLYPH_SVG = svg(ALCHEMY_GLYPH_PATHS.portal);
|
|
996
|
+
var ALCHEMY_COPY_TRANSFORM_SVG = svg(ALCHEMY_GLYPH_PATHS["copy-transform"]);
|
|
483
997
|
|
|
484
998
|
// src/content-transfer/index.tsx
|
|
485
|
-
var
|
|
486
|
-
function AlchemyGlyph(props) {
|
|
487
|
-
return /* @__PURE__ */ (0,
|
|
999
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1000
|
+
function AlchemyGlyph({ icon = "portal", ...props }) {
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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[icon].map((d) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d }, d)) });
|
|
488
1002
|
}
|
|
489
|
-
var CapabilityContext =
|
|
490
|
-
var useContentTransferCapabilities = () =>
|
|
491
|
-
var SurfaceContext =
|
|
1003
|
+
var CapabilityContext = React8.createContext({});
|
|
1004
|
+
var useContentTransferCapabilities = () => React8.useContext(CapabilityContext);
|
|
1005
|
+
var SurfaceContext = React8.createContext(null);
|
|
492
1006
|
function MenuPresentation({ label, hint, icon: Icon2 }) {
|
|
493
|
-
return /* @__PURE__ */ (0,
|
|
494
|
-
Icon2 ? /* @__PURE__ */ (0,
|
|
495
|
-
/* @__PURE__ */ (0,
|
|
1007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1008
|
+
Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : null,
|
|
1009
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
496
1010
|
label,
|
|
497
|
-
hint ? /* @__PURE__ */ (0,
|
|
1011
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
|
|
498
1012
|
] })
|
|
499
1013
|
] });
|
|
500
1014
|
}
|
|
1015
|
+
function DestinationPresentation({ action }) {
|
|
1016
|
+
const paths = {
|
|
1017
|
+
notes: "M5 3h14v18H5zM8 8h8M8 12h8M8 16h5",
|
|
1018
|
+
scratch: "M5 3h14v18H5zM9 12h6M12 9v6",
|
|
1019
|
+
document: "M6 3h8l4 4v14H6zM14 3v5h4M9 12h6M9 16h6",
|
|
1020
|
+
workbook: "M3 4h18v16H3zM3 9h18M9 4v16M15 9v11M3 15h18",
|
|
1021
|
+
task: "M9 6h11M9 12h11M9 18h11M3 6l1 1 2-2M3 12l1 1 2-2M3 18l1 1 2-2",
|
|
1022
|
+
attach: "m9 12 5-5a3 3 0 0 1 4 4l-7 7a5 5 0 0 1-7-7l8-8M7 14l7-7",
|
|
1023
|
+
code: "m8 6-6 6 6 6m8-12 6 6-6 6m-3-14-2 16",
|
|
1024
|
+
chat: "M4 4h16v13H9l-5 4zM8 9h8M8 13h5",
|
|
1025
|
+
assistant: "M3 4h18v16H3zM15 4v16M6 9h6M6 13h4",
|
|
1026
|
+
tools: "m14 4 3 3 4-1a6 6 0 0 1-8 7l-7 7-3-3 7-7a6 6 0 0 1 4-6z"
|
|
1027
|
+
};
|
|
1028
|
+
const path = paths[action.id.replace(/^matrx:/, "")];
|
|
1029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1030
|
+
!action.icon ? path ? /* @__PURE__ */ (0, import_jsx_runtime9.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: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: path }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteGlyph, { file: true }) : null,
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuPresentation, { ...action })
|
|
1032
|
+
] });
|
|
1033
|
+
}
|
|
1034
|
+
function ReceiptLink({ target }) {
|
|
1035
|
+
return target?.href && /^(\/(?!\/)|https?:\/\/)/.test(target.href) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("a", { className: "matrx-alchemy-receipt-link", href: target.href, children: [
|
|
1036
|
+
"Open ",
|
|
1037
|
+
target.kind
|
|
1038
|
+
] }) : null;
|
|
1039
|
+
}
|
|
501
1040
|
function PaletteGlyph({ format, ai = false, file = false, kind }) {
|
|
502
|
-
if (kind === "ai-copy") return /* @__PURE__ */ (0,
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
504
|
-
/* @__PURE__ */ (0,
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
1041
|
+
if (kind === "ai-copy") return /* @__PURE__ */ (0, import_jsx_runtime9.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: [
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
|
|
506
1045
|
] });
|
|
507
|
-
if (kind === "sliders") return /* @__PURE__ */ (0,
|
|
508
|
-
/* @__PURE__ */ (0,
|
|
509
|
-
/* @__PURE__ */ (0,
|
|
1046
|
+
if (kind === "sliders") return /* @__PURE__ */ (0, import_jsx_runtime9.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: [
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 6h16M4 12h16M4 18h16" }),
|
|
1048
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M8 3v6M16 9v6M10 15v6" })
|
|
510
1049
|
] });
|
|
511
|
-
if (ai) return /* @__PURE__ */ (0,
|
|
512
|
-
/* @__PURE__ */ (0,
|
|
513
|
-
/* @__PURE__ */ (0,
|
|
514
|
-
/* @__PURE__ */ (0,
|
|
1050
|
+
if (ai) return /* @__PURE__ */ (0, import_jsx_runtime9.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: [
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" }),
|
|
1052
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" }),
|
|
1053
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
|
|
515
1054
|
] });
|
|
516
|
-
if (file) return /* @__PURE__ */ (0,
|
|
517
|
-
/* @__PURE__ */ (0,
|
|
518
|
-
/* @__PURE__ */ (0,
|
|
1055
|
+
if (file) return /* @__PURE__ */ (0, import_jsx_runtime9.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: [
|
|
1056
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M6 3h8l4 4v14H6z" }),
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
|
|
519
1058
|
] });
|
|
520
|
-
const path = format === "json" ? /* @__PURE__ */ (0,
|
|
521
|
-
/* @__PURE__ */ (0,
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
523
|
-
] }) : format === "compact-json" ? /* @__PURE__ */ (0,
|
|
524
|
-
/* @__PURE__ */ (0,
|
|
525
|
-
/* @__PURE__ */ (0,
|
|
526
|
-
/* @__PURE__ */ (0,
|
|
527
|
-
/* @__PURE__ */ (0,
|
|
528
|
-
] }) : format === "csv" ? /* @__PURE__ */ (0,
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
531
|
-
] }) : format === "tsv" ? /* @__PURE__ */ (0,
|
|
532
|
-
/* @__PURE__ */ (0,
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
534
|
-
] }) : format === "xlsx" ? /* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
536
|
-
/* @__PURE__ */ (0,
|
|
537
|
-
] }) : format === "markdown" ? /* @__PURE__ */ (0,
|
|
538
|
-
/* @__PURE__ */ (0,
|
|
539
|
-
/* @__PURE__ */ (0,
|
|
540
|
-
] }) : format === "html" ? /* @__PURE__ */ (0,
|
|
541
|
-
return /* @__PURE__ */ (0,
|
|
1059
|
+
const path = format === "json" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" })
|
|
1062
|
+
] }) : format === "compact-json" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1063
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m14 10 7-7" }),
|
|
1064
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M20 10h-6V4" }),
|
|
1065
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m3 21 7-7" }),
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 14h6v6" })
|
|
1067
|
+
] }) : format === "csv" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 10h16M10 4v16" })
|
|
1070
|
+
] }) : format === "tsv" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1071
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
|
|
1073
|
+
] }) : format === "xlsx" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1074
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
|
|
1076
|
+
] }) : format === "markdown" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.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" }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
|
|
1079
|
+
] }) : format === "html" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
|
|
1080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.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 });
|
|
542
1081
|
}
|
|
543
1082
|
function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
|
|
544
1083
|
if (!items.length && !extra) return null;
|
|
545
|
-
return /* @__PURE__ */ (0,
|
|
546
|
-
/* @__PURE__ */ (0,
|
|
1084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: title }),
|
|
547
1086
|
items.map((item) => {
|
|
548
1087
|
const label = item.copyLabel ?? item.label;
|
|
549
1088
|
const hint = item.hint ?? fallbackHint;
|
|
550
|
-
return /* @__PURE__ */ (0,
|
|
551
|
-
item.icon ? /* @__PURE__ */ (0,
|
|
552
|
-
/* @__PURE__ */ (0,
|
|
1089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel ?? `${label}${hint ? ` ${hint}` : ""}`, onClick: () => onRun?.(item), children: [
|
|
1090
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
553
1092
|
label,
|
|
554
|
-
hint ? /* @__PURE__ */ (0,
|
|
1093
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
|
|
555
1094
|
] })
|
|
556
1095
|
] }, item.id);
|
|
557
1096
|
}),
|
|
@@ -594,10 +1133,10 @@ function snapshotContent(snapshot) {
|
|
|
594
1133
|
return JSON.stringify({ sourceId, label, payload, coverage, unsavedChanges, omissions, sections, limits });
|
|
595
1134
|
}
|
|
596
1135
|
function useFence() {
|
|
597
|
-
const mounted =
|
|
598
|
-
const nextId =
|
|
599
|
-
const active =
|
|
600
|
-
|
|
1136
|
+
const mounted = React8.useRef(true);
|
|
1137
|
+
const nextId = React8.useRef(0);
|
|
1138
|
+
const active = React8.useRef(/* @__PURE__ */ new Set());
|
|
1139
|
+
React8.useEffect(() => {
|
|
601
1140
|
mounted.current = true;
|
|
602
1141
|
return () => {
|
|
603
1142
|
mounted.current = false;
|
|
@@ -606,14 +1145,14 @@ function useFence() {
|
|
|
606
1145
|
active.current.clear();
|
|
607
1146
|
};
|
|
608
1147
|
}, []);
|
|
609
|
-
const begin =
|
|
1148
|
+
const begin = React8.useCallback(() => {
|
|
610
1149
|
const controller = new AbortController();
|
|
611
1150
|
active.current.add(controller);
|
|
612
1151
|
return { controller, id: ++nextId.current };
|
|
613
1152
|
}, []);
|
|
614
|
-
const finish =
|
|
615
|
-
const valid =
|
|
616
|
-
const abortAll =
|
|
1153
|
+
const finish = React8.useCallback((controller) => active.current.delete(controller), []);
|
|
1154
|
+
const valid = React8.useCallback((id, controller) => mounted.current && !controller.signal.aborted && nextId.current === id, []);
|
|
1155
|
+
const abortAll = React8.useCallback(() => {
|
|
617
1156
|
nextId.current += 1;
|
|
618
1157
|
active.current.forEach((c) => c.abort());
|
|
619
1158
|
active.current.clear();
|
|
@@ -642,45 +1181,47 @@ async function buildArtifact(draft, format, label) {
|
|
|
642
1181
|
return (0, import_content_transfer.serialize)(draft, format, { spreadsheetSafe: format === "csv" || format === "tsv", filename: `${filenameFor(label)}.${extension}` });
|
|
643
1182
|
}
|
|
644
1183
|
function ContentTransferMenu(props) {
|
|
645
|
-
const inherited =
|
|
1184
|
+
const inherited = React8.useContext(CapabilityContext);
|
|
646
1185
|
const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
|
|
647
|
-
return /* @__PURE__ */ (0,
|
|
1186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
|
|
648
1187
|
}
|
|
649
|
-
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 }) {
|
|
650
|
-
const triggerRef =
|
|
651
|
-
const inherited =
|
|
652
|
-
const nearestSurface =
|
|
1188
|
+
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, icon = "portal", triggerVariant = "transparent" }) {
|
|
1189
|
+
const triggerRef = React8.useRef(null);
|
|
1190
|
+
const inherited = React8.useContext(CapabilityContext);
|
|
1191
|
+
const nearestSurface = React8.useContext(SurfaceContext);
|
|
653
1192
|
const fence = useFence();
|
|
654
|
-
const [menuCapture, setMenuCapture] =
|
|
655
|
-
const [menuStatus, setMenuStatus] =
|
|
656
|
-
const [workspaces, setWorkspaces] =
|
|
657
|
-
const [workspaceKey, setWorkspaceKey] =
|
|
658
|
-
const [workspaceOpen, setWorkspaceOpen] =
|
|
659
|
-
const workspaceCaptures =
|
|
660
|
-
const externalWorkspaceKeys =
|
|
661
|
-
const [notice, setNotice] =
|
|
662
|
-
const [
|
|
663
|
-
const [
|
|
664
|
-
const
|
|
1193
|
+
const [menuCapture, setMenuCapture] = React8.useState(null);
|
|
1194
|
+
const [menuStatus, setMenuStatus] = React8.useState("idle");
|
|
1195
|
+
const [workspaces, setWorkspaces] = React8.useState({});
|
|
1196
|
+
const [workspaceKey, setWorkspaceKey] = React8.useState(null);
|
|
1197
|
+
const [workspaceOpen, setWorkspaceOpen] = React8.useState(false);
|
|
1198
|
+
const workspaceCaptures = React8.useRef(/* @__PURE__ */ new Map());
|
|
1199
|
+
const externalWorkspaceKeys = React8.useRef(/* @__PURE__ */ new Set());
|
|
1200
|
+
const [notice, setNotice] = React8.useState(null);
|
|
1201
|
+
const [receiptTarget, setReceiptTarget] = React8.useState();
|
|
1202
|
+
const [paletteOpen, setPaletteOpen] = React8.useState(false);
|
|
1203
|
+
const [mode, setMode] = React8.useState("copy");
|
|
1204
|
+
const scopes = React8.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
665
1205
|
const initialScope = table?.initialScope ?? "target";
|
|
666
1206
|
if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
|
|
667
1207
|
const primary = surface ?? source ?? nearestSurface;
|
|
668
1208
|
const sourceLabel = label ?? (surface?.surfaceName ?? (source && "label" in source ? source.label : nearestSurface?.surfaceName) ?? "content");
|
|
669
1209
|
const primaryWorkspaceKey = `primary:${materialIdentity(primary)}`;
|
|
670
1210
|
const nearestWorkspaceKey = source && !surface && nearestSurface ? `surface:${materialIdentity(nearestSurface)}` : null;
|
|
671
|
-
const variantWorkspaceKeys =
|
|
1211
|
+
const variantWorkspaceKeys = React8.useMemo(() => new Map(variants.map((variant) => [variant.id, `variant:${variant.id}:${materialIdentity(variant.source)}`])), [variants]);
|
|
672
1212
|
const transport = local?.transport ?? inherited.transport ?? (0, import_content_transfer.createBrowserTransport)();
|
|
673
1213
|
const ai = local?.ai ?? inherited.ai;
|
|
674
|
-
const providerPreferences =
|
|
675
|
-
const adapters =
|
|
676
|
-
const registeredActions =
|
|
677
|
-
|
|
678
|
-
const report =
|
|
1214
|
+
const providerPreferences = React8.useMemo(() => (0, import_content_transfer.resolveTransferPreferences)(inherited.preferences, local?.preferences), [inherited.preferences, local?.preferences]);
|
|
1215
|
+
const adapters = React8.useMemo(() => (0, import_content_transfer.resolveTransferRegistry)(BUILT_INS, inherited.formats ?? [], local?.formats ?? []).filter((x) => "build" in x), [inherited.formats, local?.formats]);
|
|
1216
|
+
const registeredActions = React8.useMemo(() => (0, import_content_transfer.resolveTransferRegistry)(inherited.actions ?? [], local?.actions ?? [], actions), [actions, inherited.actions, local?.actions]);
|
|
1217
|
+
React8.useMemo(() => (0, import_content_transfer.resolveTransferRegistry)(variants), [variants]);
|
|
1218
|
+
const report = React8.useCallback((result) => {
|
|
679
1219
|
inherited.onOutcome?.(result);
|
|
680
1220
|
local?.onOutcome?.(result);
|
|
681
1221
|
setNotice(outcomeMessage(result));
|
|
1222
|
+
setReceiptTarget("target" in result ? result.target : void 0);
|
|
682
1223
|
}, [inherited, local]);
|
|
683
|
-
|
|
1224
|
+
React8.useEffect(() => {
|
|
684
1225
|
const valid = /* @__PURE__ */ new Set([primaryWorkspaceKey, ...nearestWorkspaceKey ? [nearestWorkspaceKey] : [], ...variantWorkspaceKeys.values(), ...externalWorkspaceKeys.current]);
|
|
685
1226
|
setWorkspaces((current) => Object.fromEntries(Object.entries(current).filter(([key]) => valid.has(key))));
|
|
686
1227
|
for (const key of workspaceCaptures.current.keys()) if (!valid.has(key)) workspaceCaptures.current.delete(key);
|
|
@@ -689,7 +1230,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
689
1230
|
setWorkspaceOpen(false);
|
|
690
1231
|
}
|
|
691
1232
|
}, [nearestWorkspaceKey, primaryWorkspaceKey, variantWorkspaceKeys, workspaceKey]);
|
|
692
|
-
const captureOne =
|
|
1233
|
+
const captureOne = React8.useCallback(async (material, scope, signal, applyMenuProjection = false, collectPages = true) => {
|
|
693
1234
|
if (!material) throw new Error("Alchemy needs a source or a mounted transfer surface.");
|
|
694
1235
|
let sourceMaterial;
|
|
695
1236
|
if ("instanceId" in material) {
|
|
@@ -723,14 +1264,14 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
723
1264
|
if (result.snapshot.payload.kind !== "rows") throw new Error("All-matching export requires tabular content.");
|
|
724
1265
|
return { snapshot: (0, import_content_transfer.projectSnapshot)({ ...result.snapshot, payload: { kind: "rows", rows: collected.rows, columns: result.snapshot.payload.columns }, coverage: collected.coverage, omissions: [...collected.omissions] }, { rules: [] }), allMatching: result.allMatching, ...collected.error ? { collectionError: collected.error.message } : {} };
|
|
725
1266
|
}, [preferences, projection, providerPreferences, sections, sourceLabel]);
|
|
726
|
-
const capturePrimary =
|
|
1267
|
+
const capturePrimary = React8.useCallback((scope, signal) => captureOne(primary, scope, signal, true), [captureOne, primary]);
|
|
727
1268
|
workspaceCaptures.current.set(primaryWorkspaceKey, capturePrimary);
|
|
728
1269
|
if (nearestWorkspaceKey && nearestSurface) workspaceCaptures.current.set(nearestWorkspaceKey, (scope, signal) => captureOne(nearestSurface, scope, signal, true));
|
|
729
1270
|
for (const variant of variants) {
|
|
730
1271
|
const key = variantWorkspaceKeys.get(variant.id);
|
|
731
1272
|
workspaceCaptures.current.set(key, (scope, signal) => captureOne(variant.source, scope, signal, true));
|
|
732
1273
|
}
|
|
733
|
-
const preflight =
|
|
1274
|
+
const preflight = React8.useCallback(async () => {
|
|
734
1275
|
const { controller, id } = fence.begin();
|
|
735
1276
|
setMenuCapture(null);
|
|
736
1277
|
setMenuStatus("loading");
|
|
@@ -749,7 +1290,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
749
1290
|
fence.finish(controller);
|
|
750
1291
|
}
|
|
751
1292
|
}, [captureOne, fence, initialScope, primary]);
|
|
752
|
-
const transfer =
|
|
1293
|
+
const transfer = React8.useCallback(async (format, download, alternate) => {
|
|
753
1294
|
const { controller, id } = fence.begin();
|
|
754
1295
|
try {
|
|
755
1296
|
const explicit = alternate?.source ?? (typeof format === "string" && format !== "xlsx" ? formatSources?.[format] : void 0);
|
|
@@ -774,7 +1315,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
774
1315
|
fence.finish(controller);
|
|
775
1316
|
}
|
|
776
1317
|
}, [captureOne, capturePrimary, fence, formatSources, initialScope, preferences, providerPreferences, report, transport]);
|
|
777
|
-
const openWorkspace =
|
|
1318
|
+
const openWorkspace = React8.useCallback(
|
|
778
1319
|
async (key = primaryWorkspaceKey, variant) => {
|
|
779
1320
|
const variantMaterial = variant && "kind" in variant.source ? {
|
|
780
1321
|
id: `variant:${key}`,
|
|
@@ -868,7 +1409,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
868
1409
|
setWorkspaceOpen(true);
|
|
869
1410
|
} catch (error) {
|
|
870
1411
|
if (fence.valid(id, controller))
|
|
871
|
-
|
|
1412
|
+
setReceiptTarget(void 0);
|
|
1413
|
+
setNotice(errorMessage(error, "Could not capture content"));
|
|
872
1414
|
} finally {
|
|
873
1415
|
fence.finish(controller);
|
|
874
1416
|
}
|
|
@@ -885,7 +1427,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
885
1427
|
workspaces
|
|
886
1428
|
]
|
|
887
1429
|
);
|
|
888
|
-
|
|
1430
|
+
React8.useImperativeHandle(controllerRef, () => ({
|
|
889
1431
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
890
1432
|
prepare: async (requestedSource, options) => {
|
|
891
1433
|
const requestedLabel = options?.label ?? ("label" in requestedSource ? requestedSource.label : "content");
|
|
@@ -894,14 +1436,15 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
894
1436
|
await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
|
|
895
1437
|
}
|
|
896
1438
|
}), [openWorkspace]);
|
|
897
|
-
const runAction =
|
|
1439
|
+
const runAction = React8.useCallback(async (action) => {
|
|
898
1440
|
const { controller, id } = fence.begin();
|
|
899
1441
|
try {
|
|
900
1442
|
const actionSource = action.source;
|
|
901
1443
|
const { snapshot } = actionSource ? await captureOne(actionSource, initialScope, controller.signal, true) : await capturePrimary(initialScope, controller.signal);
|
|
902
1444
|
const resolved = (0, import_content_transfer.resolveTransferPreferences)(providerPreferences, preferences, snapshot.limits);
|
|
903
1445
|
const draft = (0, import_content_transfer.applyTransferLimits)((0, import_content_transfer.createDraft)(snapshot), resolved.limits);
|
|
904
|
-
if (
|
|
1446
|
+
if (snapshot.coverage.status !== "complete" || draft.omissions.length) throw new Error("This content is partial or requires reductions. Open Prepare for AI to review it before sending it to a destination.");
|
|
1447
|
+
if (!action.supports(snapshot, draft)) throw new Error(`${action.label} is unavailable for this content.`);
|
|
905
1448
|
const result = await action.run({ snapshot, draft, signal: controller.signal });
|
|
906
1449
|
if (fence.valid(id, controller) && draft.snapshotId === snapshot.id) report(result);
|
|
907
1450
|
} catch (error) {
|
|
@@ -916,99 +1459,128 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
916
1459
|
const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
|
|
917
1460
|
const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
|
|
918
1461
|
const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
|
|
919
|
-
const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
|
|
1462
|
+
const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot, (0, import_content_transfer.applyTransferLimits)((0, import_content_transfer.createDraft)(menuCapture.snapshot), (0, import_content_transfer.resolveTransferPreferences)(providerPreferences, preferences, menuCapture.snapshot.limits).limits))) : [];
|
|
920
1463
|
const downloadActions = visibleActions.filter((action) => action.placement === "download");
|
|
921
1464
|
const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
|
|
1465
|
+
const preparedActions = registeredActions.filter((action) => action.prepared && !action.source);
|
|
922
1466
|
const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
|
|
923
1467
|
const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
|
|
924
1468
|
const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
|
|
925
1469
|
const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
|
|
1470
|
+
const nativeAiFormat = {
|
|
1471
|
+
id: "ai-context",
|
|
1472
|
+
label: "AI context",
|
|
1473
|
+
supports: () => true,
|
|
1474
|
+
build: async (draft) => {
|
|
1475
|
+
const json = (0, import_content_transfer.serialize)(draft, "json");
|
|
1476
|
+
return (0, import_content_transfer.sealTransferArtifact)({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: (0, import_content_transfer.buildAgentPayload)({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
926
1479
|
const closePalette = () => setPaletteOpen(false);
|
|
927
1480
|
const tile = (id, label2, onClick, options = {}) => {
|
|
928
1481
|
const presentation = options.action;
|
|
929
1482
|
const Icon2 = presentation?.icon;
|
|
930
1483
|
const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
|
|
931
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
|
|
932
1485
|
closePalette();
|
|
933
1486
|
onClick();
|
|
934
1487
|
}, children: [
|
|
935
|
-
Icon2 ? /* @__PURE__ */ (0,
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
1488
|
+
Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon2, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
937
1490
|
label2,
|
|
938
|
-
presentation?.hint ? /* @__PURE__ */ (0,
|
|
1491
|
+
presentation?.hint ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
|
|
939
1492
|
] })
|
|
940
1493
|
] }, id);
|
|
941
1494
|
};
|
|
942
|
-
return /* @__PURE__ */ (0,
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
1495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
944
1497
|
setPaletteOpen(open);
|
|
945
1498
|
if (open) {
|
|
946
1499
|
setMode("copy");
|
|
947
1500
|
void preflight();
|
|
948
1501
|
}
|
|
949
1502
|
}, children: [
|
|
950
|
-
/* @__PURE__ */ (0,
|
|
951
|
-
/* @__PURE__ */ (0,
|
|
952
|
-
menuStatus === "loading" ? /* @__PURE__ */ (0,
|
|
953
|
-
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0,
|
|
954
|
-
/* @__PURE__ */ (0,
|
|
955
|
-
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0,
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
957
|
-
/* @__PURE__ */ (0,
|
|
1503
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopoverTrigger, { asChild: true, children: triggerVariant === "glass" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent" }) }),
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
|
|
1505
|
+
menuStatus === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1506
|
+
copyAvailable || downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "matrx-alchemy-output", children: [
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
1508
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1510
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
958
1511
|
] }) : null,
|
|
959
|
-
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0,
|
|
960
|
-
/* @__PURE__ */ (0,
|
|
1512
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
961
1514
|
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]}` })),
|
|
962
1515
|
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
963
1516
|
] }),
|
|
964
|
-
quickVariants("copy").length ? /* @__PURE__ */ (0,
|
|
1517
|
+
quickVariants("copy").length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
965
1518
|
closePalette();
|
|
966
1519
|
void transfer("markdown", false, variant);
|
|
967
1520
|
} }) : null
|
|
968
1521
|
] }) : null,
|
|
969
|
-
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0,
|
|
1522
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
970
1523
|
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]}` })),
|
|
971
1524
|
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
972
1525
|
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
973
1526
|
] }) }) : null
|
|
974
1527
|
] }) : null,
|
|
975
|
-
prepareAvailable ? /* @__PURE__ */ (0,
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
1528
|
+
prepareAvailable ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1529
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1530
|
+
closePalette();
|
|
1531
|
+
void transfer(nativeAiFormat, false);
|
|
1532
|
+
}, children: [
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteGlyph, { kind: "ai-copy" }),
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
1535
|
+
"Copy with AI context",
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
|
|
1537
|
+
] })
|
|
1538
|
+
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
977
1539
|
closePalette();
|
|
978
1540
|
void transfer("markdown", false, variant);
|
|
979
1541
|
} }),
|
|
980
|
-
/* @__PURE__ */ (0,
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
981
1543
|
closePalette();
|
|
982
1544
|
void openWorkspace();
|
|
983
1545
|
}, children: [
|
|
984
|
-
/* @__PURE__ */ (0,
|
|
985
|
-
/* @__PURE__ */ (0,
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteGlyph, { kind: "sliders" }),
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
986
1548
|
"Prepare for AI",
|
|
987
|
-
/* @__PURE__ */ (0,
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
|
|
988
1550
|
] })
|
|
989
1551
|
] }) })
|
|
990
1552
|
] }) : null,
|
|
991
|
-
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0,
|
|
992
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0,
|
|
1553
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1554
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
993
1555
|
closePalette();
|
|
994
1556
|
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
995
|
-
}, children: /* @__PURE__ */ (0,
|
|
996
|
-
variants.map((variant) => /* @__PURE__ */ (0,
|
|
1557
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "Prepare this surface" }) }) : null,
|
|
1558
|
+
variants.map((variant) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
997
1559
|
closePalette();
|
|
998
1560
|
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
999
|
-
}, children: /* @__PURE__ */ (0,
|
|
1561
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
1000
1562
|
] }) }) : null,
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1563
|
+
["save", "chat", "other"].map((group) => {
|
|
1564
|
+
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
1565
|
+
return entries.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1567
|
+
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : "Actions",
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: entries.length })
|
|
1569
|
+
] }),
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: entries.map((action) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1571
|
+
closePalette();
|
|
1572
|
+
void runAction(action);
|
|
1573
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
1574
|
+
] }, group) : null;
|
|
1575
|
+
})
|
|
1005
1576
|
] })
|
|
1006
1577
|
] }),
|
|
1007
|
-
notice && triggerRef.current ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0,
|
|
1008
|
-
/* @__PURE__ */ (0,
|
|
1009
|
-
/* @__PURE__ */ (0,
|
|
1578
|
+
notice && triggerRef.current ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-feedback", children: [
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { role: "status", children: notice }),
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ReceiptLink, { target: receiptTarget }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
|
|
1010
1582
|
] }), triggerRef.current.ownerDocument.body) : null,
|
|
1011
|
-
Object.values(workspaces).map((saved) => /* @__PURE__ */ (0,
|
|
1583
|
+
Object.values(workspaces).map((saved) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PreparationWorkspace, { restoreFocus: () => triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, onClose: () => setWorkspaceOpen(false), onChange: (next) => setWorkspaces((current) => ({ ...current, [saved.key]: next })), transport, adapters, actions: preparedActions, captureScope: workspaceCaptures.current.get(saved.key) ?? capturePrimary, ...ai ? { ai } : {}, onOutcome: report }, saved.key))
|
|
1012
1584
|
] });
|
|
1013
1585
|
}
|
|
1014
1586
|
function initialControls(state) {
|
|
@@ -1060,30 +1632,34 @@ function preview(draft, format) {
|
|
|
1060
1632
|
const resolved = isBuiltInFormat(format) ? format : "plain";
|
|
1061
1633
|
return (0, import_content_transfer.serialize)(draft, resolved === "xlsx" ? "tsv" : resolved, { spreadsheetSafe: resolved === "csv" || resolved === "tsv" || resolved === "xlsx" }).plainText;
|
|
1062
1634
|
}
|
|
1063
|
-
function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onChange, transport, ai, adapters, onOutcome, captureScope }) {
|
|
1635
|
+
function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onChange, transport, ai, adapters, actions, onOutcome, captureScope }) {
|
|
1064
1636
|
const fence = useFence();
|
|
1065
|
-
const latest =
|
|
1637
|
+
const latest = React8.useRef(state);
|
|
1066
1638
|
latest.current = state;
|
|
1067
|
-
const aiSession =
|
|
1639
|
+
const aiSession = React8.useRef(void 0);
|
|
1068
1640
|
if (!aiSession.current && ai) aiSession.current = ai.fork?.() ?? ai;
|
|
1069
|
-
const [controls, setControls] =
|
|
1070
|
-
const [controlsHistory, setControlsHistory] =
|
|
1071
|
-
const [pendingControls, setPendingControls] =
|
|
1641
|
+
const [controls, setControls] = React8.useState(() => initialControls(state));
|
|
1642
|
+
const [controlsHistory, setControlsHistory] = React8.useState([]);
|
|
1643
|
+
const [pendingControls, setPendingControls] = React8.useState(null);
|
|
1072
1644
|
const requestedFormat = state.preferences.initialFormat;
|
|
1073
|
-
const [format, setFormat] =
|
|
1074
|
-
const [buffer, setBuffer] =
|
|
1075
|
-
const [bufferError, setBufferError] =
|
|
1076
|
-
const [formatError, setFormatError] =
|
|
1077
|
-
const [preparedArtifact, setPreparedArtifact] =
|
|
1078
|
-
const [instruction, setInstruction] =
|
|
1079
|
-
const [busy, setBusy] =
|
|
1080
|
-
const [aiFailed, setAiFailed] =
|
|
1081
|
-
|
|
1645
|
+
const [format, setFormat] = React8.useState(() => isBuiltInFormat(requestedFormat) ? supportsBuiltIn(requestedFormat, state.draft.payload) ? requestedFormat : "plain" : adapters.some((adapter) => adapter.id === requestedFormat && adapter.supports(state.draft.payload)) ? requestedFormat : "plain");
|
|
1646
|
+
const [buffer, setBuffer] = React8.useState(() => isBuiltInFormat(format) ? preview(state.draft, format) : "Preparing format preview\u2026");
|
|
1647
|
+
const [bufferError, setBufferError] = React8.useState(null);
|
|
1648
|
+
const [formatError, setFormatError] = React8.useState(null);
|
|
1649
|
+
const [preparedArtifact, setPreparedArtifact] = React8.useState(null);
|
|
1650
|
+
const [instruction, setInstruction] = React8.useState("");
|
|
1651
|
+
const [busy, setBusy] = React8.useState(null);
|
|
1652
|
+
const [aiFailed, setAiFailed] = React8.useState(false);
|
|
1653
|
+
React8.useEffect(() => {
|
|
1082
1654
|
setAiFailed(false);
|
|
1083
1655
|
}, [state.snapshot.id, state.draft.revision]);
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
|
|
1656
|
+
const handingOff = React8.useRef(false);
|
|
1657
|
+
React8.useEffect(() => {
|
|
1658
|
+
if (open) handingOff.current = false;
|
|
1659
|
+
}, [open]);
|
|
1660
|
+
const activeAi = React8.useRef(null);
|
|
1661
|
+
const activeCapture = React8.useRef(null);
|
|
1662
|
+
React8.useEffect(() => {
|
|
1087
1663
|
if (bufferError) return;
|
|
1088
1664
|
const adapter = adapters.find((candidate) => candidate.id === format);
|
|
1089
1665
|
const controller = new AbortController();
|
|
@@ -1103,7 +1679,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1103
1679
|
});
|
|
1104
1680
|
return () => controller.abort();
|
|
1105
1681
|
}, [adapters, bufferError, format, state.draft, state.snapshot.id]);
|
|
1106
|
-
const close =
|
|
1682
|
+
const close = React8.useCallback(() => {
|
|
1107
1683
|
activeAi.current?.abort();
|
|
1108
1684
|
activeCapture.current?.abort();
|
|
1109
1685
|
activeAi.current = null;
|
|
@@ -1232,8 +1808,8 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1232
1808
|
if (fence.valid(id, controller)) setBusy(null);
|
|
1233
1809
|
}
|
|
1234
1810
|
};
|
|
1235
|
-
const [deliveryNotice, setDeliveryNotice] =
|
|
1236
|
-
|
|
1811
|
+
const [deliveryNotice, setDeliveryNotice] = React8.useState(null);
|
|
1812
|
+
React8.useEffect(() => {
|
|
1237
1813
|
setDeliveryNotice(null);
|
|
1238
1814
|
}, [state.draft.revision]);
|
|
1239
1815
|
const reportDelivery = (outcome) => {
|
|
@@ -1260,45 +1836,64 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1260
1836
|
if (fence.valid(id, controller)) setBusy(null);
|
|
1261
1837
|
}
|
|
1262
1838
|
};
|
|
1839
|
+
const deliverAction = async (action) => {
|
|
1840
|
+
if (busy || bufferError || formatError || !preparedArtifact) return;
|
|
1841
|
+
const { controller, id } = fence.begin();
|
|
1842
|
+
const current = latest.current;
|
|
1843
|
+
setBusy("action");
|
|
1844
|
+
try {
|
|
1845
|
+
if (!action.supports(current.snapshot, current.draft)) throw new Error(`${action.label} is unavailable for this prepared content.`);
|
|
1846
|
+
handingOff.current = true;
|
|
1847
|
+
(0, import_react_dom.flushSync)(() => onClose());
|
|
1848
|
+
const result = await action.run({ snapshot: current.snapshot, draft: current.draft, signal: controller.signal });
|
|
1849
|
+
if (fence.valid(id, controller)) reportDelivery(result);
|
|
1850
|
+
} catch (error) {
|
|
1851
|
+
if (fence.valid(id, controller)) reportDelivery({ status: "error", code: "destination-failed", message: errorMessage(error, "Could not deliver prepared content"), retryable: false });
|
|
1852
|
+
} finally {
|
|
1853
|
+
fence.finish(controller);
|
|
1854
|
+
if (fence.valid(id, controller)) setBusy(null);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
const eligibleActions = actions.filter((action) => action.supports(state.snapshot, state.draft));
|
|
1263
1858
|
const rows = state.original.payload.kind === "rows" ? state.original.payload : null;
|
|
1264
1859
|
const formats = COPIES.filter((f) => supportsBuiltIn(f, state.draft.payload));
|
|
1265
1860
|
const workspaceAdapters = adapters.filter((adapter) => adapter.supports(state.draft.payload));
|
|
1266
1861
|
const displayedOmissions = preparedArtifact?.omissions ?? state.draft.omissions;
|
|
1267
1862
|
const limitText = Object.entries(state.preferences.limits).filter(([, value]) => value != null).map(([key, value]) => `${key.replace(/^max/, "max ")} ${Number(value).toLocaleString()}`).join(" \xB7 ");
|
|
1268
|
-
return /* @__PURE__ */ (0,
|
|
1863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Dialog, { open, onOpenChange: (next) => {
|
|
1269
1864
|
if (!next) close();
|
|
1270
|
-
}, children: /* @__PURE__ */ (0,
|
|
1865
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogContent, { onCloseAutoFocus: (event) => {
|
|
1271
1866
|
event.preventDefault();
|
|
1272
|
-
restoreFocus();
|
|
1867
|
+
if (!handingOff.current) restoreFocus();
|
|
1273
1868
|
}, className: "matrx-alchemy-workspace max-w-5xl", "aria-busy": busy !== null, children: [
|
|
1274
|
-
/* @__PURE__ */ (0,
|
|
1275
|
-
/* @__PURE__ */ (0,
|
|
1869
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogHeader, { children: [
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogTitle, { children: [
|
|
1276
1871
|
"Prepare ",
|
|
1277
1872
|
state.snapshot.label
|
|
1278
1873
|
] }),
|
|
1279
|
-
/* @__PURE__ */ (0,
|
|
1874
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogDescription, { children: [
|
|
1280
1875
|
state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
|
|
1281
1876
|
"Review and edit this copy. Your original stays unchanged."
|
|
1282
1877
|
] })
|
|
1283
1878
|
] }),
|
|
1284
|
-
/* @__PURE__ */ (0,
|
|
1285
|
-
/* @__PURE__ */ (0,
|
|
1286
|
-
/* @__PURE__ */ (0,
|
|
1287
|
-
/* @__PURE__ */ (0,
|
|
1288
|
-
scopes.length > 1 ? /* @__PURE__ */ (0,
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
|
|
1880
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-workspace-grid", children: [
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "matrx-alchemy-main", children: [
|
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
|
|
1883
|
+
scopes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1289
1884
|
"Scope",
|
|
1290
|
-
/* @__PURE__ */ (0,
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
|
|
1291
1886
|
] }) : null,
|
|
1292
|
-
/* @__PURE__ */ (0,
|
|
1887
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1293
1888
|
"Detail",
|
|
1294
|
-
/* @__PURE__ */ (0,
|
|
1295
|
-
/* @__PURE__ */ (0,
|
|
1296
|
-
/* @__PURE__ */ (0,
|
|
1297
|
-
/* @__PURE__ */ (0,
|
|
1298
|
-
/* @__PURE__ */ (0,
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
|
|
1890
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "full", children: "Full" }),
|
|
1891
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "compact", children: "Compact" }),
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "brief", children: "Brief" }),
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "custom", children: "Custom" })
|
|
1299
1894
|
] })
|
|
1300
1895
|
] }),
|
|
1301
|
-
/* @__PURE__ */ (0,
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
|
|
1302
1897
|
setBufferError(null);
|
|
1303
1898
|
if (controlsHistory.length) {
|
|
1304
1899
|
const next = controlsHistory[controlsHistory.length - 1];
|
|
@@ -1307,7 +1902,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1307
1902
|
onChange({ ...state, draft: rebuild(state, next), error: void 0 });
|
|
1308
1903
|
} else onChange({ ...state, draft: (0, import_content_transfer.undoDraft)(state.draft), error: void 0 });
|
|
1309
1904
|
}, children: "Undo" }),
|
|
1310
|
-
/* @__PURE__ */ (0,
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
|
|
1311
1906
|
const next = initialControls(state);
|
|
1312
1907
|
setControls(next);
|
|
1313
1908
|
setControlsHistory([]);
|
|
@@ -1315,64 +1910,64 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1315
1910
|
setBufferError(null);
|
|
1316
1911
|
onChange({ ...state, draft: rebuild(state, next), error: void 0 });
|
|
1317
1912
|
}, children: "Reset" }),
|
|
1318
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
|
|
1319
1914
|
] }),
|
|
1320
|
-
controls.preset === "custom"
|
|
1321
|
-
/* @__PURE__ */ (0,
|
|
1322
|
-
[["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ (0,
|
|
1915
|
+
controls.preset === "custom" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("fieldset", { className: "matrx-alchemy-options", children: [
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("legend", { children: state.draft.payload.kind === "json" || state.draft.payload.kind === "registered" ? "JSON limits" : "Content limits" }),
|
|
1917
|
+
[["maxDepth", "Maximum depth"], ["maxStringChars", state.draft.payload.kind === "rows" ? "Maximum characters per cell" : "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].filter(([key]) => key === "maxStringChars" || state.draft.payload.kind === "json" || state.draft.payload.kind === "registered").map(([key, text]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1323
1918
|
text,
|
|
1324
|
-
/* @__PURE__ */ (0,
|
|
1919
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
1325
1920
|
] }, key))
|
|
1326
1921
|
] }) : null,
|
|
1327
|
-
rows ? /* @__PURE__ */ (0,
|
|
1328
|
-
/* @__PURE__ */ (0,
|
|
1922
|
+
rows ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1329
1924
|
"Data selection \xB7 ",
|
|
1330
1925
|
controls.visibleColumns.length,
|
|
1331
1926
|
" columns",
|
|
1332
1927
|
controls.search || controls.sort || controls.top != null || controls.selectedOnly || Object.values(controls.filters).some(Boolean) ? " \xB7 customized" : " \xB7 all rows"
|
|
1333
1928
|
] }),
|
|
1334
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RowControls, { rows, controls, change: changeControls }) })
|
|
1335
1930
|
] }) : null,
|
|
1336
|
-
state.snapshot.sections.length ? /* @__PURE__ */ (0,
|
|
1337
|
-
/* @__PURE__ */ (0,
|
|
1931
|
+
state.snapshot.sections.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-options", children: [
|
|
1932
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1338
1933
|
"Sections \xB7 ",
|
|
1339
1934
|
controls.sections.length,
|
|
1340
1935
|
" included"
|
|
1341
1936
|
] }),
|
|
1342
|
-
/* @__PURE__ */ (0,
|
|
1343
|
-
/* @__PURE__ */ (0,
|
|
1937
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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) }) }),
|
|
1344
1939
|
" ",
|
|
1345
1940
|
section.label
|
|
1346
1941
|
] }, section.id)) })
|
|
1347
1942
|
] }) : null,
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1943
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "matrx-alchemy-preview-label", children: [
|
|
1349
1944
|
"Output format",
|
|
1350
|
-
/* @__PURE__ */ (0,
|
|
1351
|
-
formats.map((f) => /* @__PURE__ */ (0,
|
|
1352
|
-
state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0,
|
|
1353
|
-
workspaceAdapters.map((adapter) => /* @__PURE__ */ (0,
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
|
|
1946
|
+
formats.map((f) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: f, children: LABEL[f] }, f)),
|
|
1947
|
+
state.draft.payload.kind === "rows" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "xlsx", children: "Excel workbook" }) : null,
|
|
1948
|
+
workspaceAdapters.map((adapter) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: adapter.id, children: adapter.label }, adapter.id))
|
|
1354
1949
|
] })
|
|
1355
1950
|
] }),
|
|
1356
|
-
/* @__PURE__ */ (0,
|
|
1357
|
-
/* @__PURE__ */ (0,
|
|
1358
|
-
/* @__PURE__ */ (0,
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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) }),
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-coverage", children: [
|
|
1953
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
1359
1954
|
state.snapshot.coverage.included.toLocaleString(),
|
|
1360
1955
|
" included",
|
|
1361
1956
|
state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
|
|
1362
1957
|
" \xB7 ",
|
|
1363
1958
|
state.snapshot.coverage.status
|
|
1364
1959
|
] }),
|
|
1365
|
-
state.snapshot.coverage.reason ? /* @__PURE__ */ (0,
|
|
1366
|
-
limitText ? /* @__PURE__ */ (0,
|
|
1960
|
+
state.snapshot.coverage.reason ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: state.snapshot.coverage.reason }) : null,
|
|
1961
|
+
limitText ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
1367
1962
|
"Limits: ",
|
|
1368
1963
|
limitText
|
|
1369
1964
|
] }) : null,
|
|
1370
|
-
displayedOmissions.length ? /* @__PURE__ */ (0,
|
|
1371
|
-
/* @__PURE__ */ (0,
|
|
1965
|
+
displayedOmissions.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { children: [
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1372
1967
|
displayedOmissions.length,
|
|
1373
1968
|
" omissions or adjustments"
|
|
1374
1969
|
] }),
|
|
1375
|
-
/* @__PURE__ */ (0,
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { children: [
|
|
1376
1971
|
o.path || "/",
|
|
1377
1972
|
": ",
|
|
1378
1973
|
o.reason,
|
|
@@ -1380,57 +1975,79 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1380
1975
|
] }, `${o.path}-${o.reason}-${i}`)) })
|
|
1381
1976
|
] }) : null
|
|
1382
1977
|
] }),
|
|
1383
|
-
bufferError ? /* @__PURE__ */ (0,
|
|
1384
|
-
formatError ? /* @__PURE__ */ (0,
|
|
1385
|
-
bufferError ? /* @__PURE__ */ (0,
|
|
1978
|
+
bufferError ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
|
|
1979
|
+
formatError ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
|
|
1980
|
+
bufferError ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
|
|
1386
1981
|
const fallback = (0, import_content_transfer.editDraft)(state.draft, { kind: "text", text: buffer });
|
|
1387
1982
|
setBufferError(null);
|
|
1388
1983
|
onChange({ ...state, draft: fallback, error: void 0 });
|
|
1389
1984
|
setFormat("plain");
|
|
1390
1985
|
}, children: "Use invalid JSON as plain text" }) : null
|
|
1391
1986
|
] }),
|
|
1392
|
-
ai || busy === "capture" || state.error ? /* @__PURE__ */ (0,
|
|
1393
|
-
ai ? /* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1987
|
+
ai || busy === "capture" || state.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("aside", { children: [
|
|
1988
|
+
ai ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1990
|
+
"Start with",
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { "aria-label": "AI preparation recipe", defaultValue: "", onChange: (event) => {
|
|
1992
|
+
if (event.target.value) setInstruction(event.target.value);
|
|
1993
|
+
}, children: [
|
|
1994
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "Choose an instruction" }),
|
|
1995
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Summarize this content concisely. Preserve important facts, names, decisions, and source references.", children: "Summarize" }),
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Extract decisions, action items, owners, and due dates. Mark missing details as unspecified.", children: "Extract action items" }),
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Prepare a complete handoff for another assistant. Include the objective, relevant facts, constraints, decisions, and unresolved questions.", children: "Assistant handoff" }),
|
|
1998
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Condense this content by removing repetition and formatting noise. Preserve every unique fact and all identifiers.", children: "Condense without losing facts" }),
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Turn this content into a clear structured outline. Keep the original meaning and explicitly flag uncertainty.", children: "Create an outline" }),
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "Analyze this data. Identify patterns, anomalies, and useful comparisons. Distinguish observations from inferences.", children: "Analyze the data" })
|
|
2001
|
+
] })
|
|
2002
|
+
] }),
|
|
2003
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1395
2004
|
"AI instruction",
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
2005
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
|
|
1397
2006
|
] }),
|
|
1398
|
-
/* @__PURE__ */ (0,
|
|
1399
|
-
busy === "ai" ? /* @__PURE__ */ (0,
|
|
2007
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(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" }),
|
|
2008
|
+
busy === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
|
|
1400
2009
|
] }) : null,
|
|
1401
|
-
busy === "capture" ? /* @__PURE__ */ (0,
|
|
2010
|
+
busy === "capture" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
|
|
1402
2011
|
activeCapture.current?.abort();
|
|
1403
2012
|
activeCapture.current = null;
|
|
1404
2013
|
setBusy(null);
|
|
1405
2014
|
}, children: "Stop loading rows" }) : null,
|
|
1406
|
-
ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0,
|
|
1407
|
-
ai ? /* @__PURE__ */ (0,
|
|
1408
|
-
state.error ? /* @__PURE__ */ (0,
|
|
2015
|
+
ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(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,
|
|
2016
|
+
ai ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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,
|
|
2017
|
+
state.error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
|
|
1409
2018
|
] }) : null
|
|
1410
2019
|
] }),
|
|
1411
|
-
pendingControls ? /* @__PURE__ */ (0,
|
|
1412
|
-
/* @__PURE__ */ (0,
|
|
1413
|
-
/* @__PURE__ */ (0,
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
2020
|
+
pendingControls ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "This control would replace your manual edit." }),
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
|
|
1415
2024
|
] }) : null,
|
|
1416
|
-
state.sourceStale ? /* @__PURE__ */ (0,
|
|
1417
|
-
state.pending ? /* @__PURE__ */ (0,
|
|
1418
|
-
/* @__PURE__ */ (0,
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
1420
|
-
/* @__PURE__ */ (0,
|
|
2025
|
+
state.sourceStale ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
|
|
2026
|
+
state.pending ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "A fresh source snapshot is ready." }),
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
|
|
1421
2030
|
] }) : null,
|
|
1422
|
-
|
|
2031
|
+
eligibleActions.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-options matrx-alchemy-destinations", children: [
|
|
2032
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
2033
|
+
"Use prepared content \xB7 ",
|
|
2034
|
+
eligibleActions.length,
|
|
2035
|
+
" destinations"
|
|
2036
|
+
] }),
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "matrx-alchemy-destination-grid", children: eligibleActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: "matrx-alchemy-palette-row", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliverAction(action), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DestinationPresentation, { action }) }, action.id)) })
|
|
2038
|
+
] }) : null,
|
|
2039
|
+
deliveryNotice ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
|
|
1423
2040
|
] }),
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
2041
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(DialogFooter, { children: [
|
|
2042
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "matrx-alchemy-meta", children: [
|
|
1426
2043
|
buffer.length.toLocaleString(),
|
|
1427
2044
|
" characters \xB7 ~",
|
|
1428
2045
|
estimateTokens(buffer).toLocaleString(),
|
|
1429
2046
|
" tokens"
|
|
1430
2047
|
] }),
|
|
1431
|
-
/* @__PURE__ */ (0,
|
|
1432
|
-
/* @__PURE__ */ (0,
|
|
1433
|
-
/* @__PURE__ */ (0,
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(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" }),
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(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" })
|
|
1434
2051
|
] })
|
|
1435
2052
|
] }) });
|
|
1436
2053
|
}
|
|
@@ -1438,59 +2055,59 @@ function RowControls({ rows, controls, change }) {
|
|
|
1438
2055
|
const filterCount = Object.values(controls.filters).filter(Boolean).length;
|
|
1439
2056
|
const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
|
|
1440
2057
|
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 ");
|
|
1441
|
-
return /* @__PURE__ */ (0,
|
|
1442
|
-
/* @__PURE__ */ (0,
|
|
1443
|
-
/* @__PURE__ */ (0,
|
|
2058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-toolbar", children: [
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1444
2061
|
"Search",
|
|
1445
|
-
/* @__PURE__ */ (0,
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
|
|
1446
2063
|
] }),
|
|
1447
|
-
/* @__PURE__ */ (0,
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1448
2065
|
"Sort",
|
|
1449
|
-
/* @__PURE__ */ (0,
|
|
1450
|
-
/* @__PURE__ */ (0,
|
|
1451
|
-
rows.columns.map((column) => /* @__PURE__ */ (0,
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", children: "None" }),
|
|
2068
|
+
rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: column.id, children: column.label }, column.id))
|
|
1452
2069
|
] })
|
|
1453
2070
|
] }),
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1455
2072
|
"Direction",
|
|
1456
|
-
/* @__PURE__ */ (0,
|
|
1457
|
-
/* @__PURE__ */ (0,
|
|
1458
|
-
/* @__PURE__ */ (0,
|
|
2073
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "asc", children: "Ascending" }),
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "desc", children: "Descending" })
|
|
1459
2076
|
] })
|
|
1460
2077
|
] }),
|
|
1461
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
1462
2079
|
"Top rows",
|
|
1463
|
-
/* @__PURE__ */ (0,
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
1464
2081
|
] })
|
|
1465
2082
|
] }),
|
|
1466
|
-
/* @__PURE__ */ (0,
|
|
1467
|
-
/* @__PURE__ */ (0,
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-options", children: [
|
|
2084
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1468
2085
|
"Columns and filters",
|
|
1469
2086
|
dataSummary ? ` \u2014 ${dataSummary}` : ""
|
|
1470
2087
|
] }),
|
|
1471
|
-
/* @__PURE__ */ (0,
|
|
1472
|
-
/* @__PURE__ */ (0,
|
|
1473
|
-
/* @__PURE__ */ (0,
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "matrx-alchemy-column", children: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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) }) }),
|
|
1474
2091
|
" ",
|
|
1475
2092
|
column.label
|
|
1476
2093
|
] }),
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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 } }) })
|
|
1478
2095
|
] }, column.id)) })
|
|
1479
2096
|
] }),
|
|
1480
|
-
/* @__PURE__ */ (0,
|
|
1481
|
-
/* @__PURE__ */ (0,
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "matrx-alchemy-options", children: [
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
1482
2099
|
"Rows \u2014 ",
|
|
1483
2100
|
selectionSummary
|
|
1484
2101
|
] }),
|
|
1485
|
-
/* @__PURE__ */ (0,
|
|
1486
|
-
/* @__PURE__ */ (0,
|
|
1487
|
-
/* @__PURE__ */ (0,
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("fieldset", { "aria-label": "Row selection", children: [
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
|
|
1488
2105
|
" Only selected rows"
|
|
1489
2106
|
] }),
|
|
1490
|
-
/* @__PURE__ */ (0,
|
|
2107
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
|
|
1491
2108
|
const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String((0, import_content_transfer.readTransferCell)(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
|
|
1492
|
-
return /* @__PURE__ */ (0,
|
|
1493
|
-
/* @__PURE__ */ (0,
|
|
2109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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) }) }),
|
|
1494
2111
|
" Row ",
|
|
1495
2112
|
index + 1,
|
|
1496
2113
|
summary ? ` \u2014 ${summary}` : ""
|
|
@@ -1502,7 +2119,7 @@ function RowControls({ rows, controls, change }) {
|
|
|
1502
2119
|
}
|
|
1503
2120
|
|
|
1504
2121
|
// src/content-transfer/matrx-copy.tsx
|
|
1505
|
-
var
|
|
2122
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1506
2123
|
var resolve = (value) => typeof value === "function" ? value() : value;
|
|
1507
2124
|
var asPayload = (value) => ({
|
|
1508
2125
|
kind: "markdown",
|
|
@@ -1548,7 +2165,7 @@ var sourceFor = (id, label, build) => ({
|
|
|
1548
2165
|
});
|
|
1549
2166
|
function MatrxCopyMenu(props) {
|
|
1550
2167
|
const inherited = useContentTransferCapabilities();
|
|
1551
|
-
return /* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1552
2169
|
MatrxCopyMenuSession,
|
|
1553
2170
|
{
|
|
1554
2171
|
...props
|
|
@@ -1560,12 +2177,12 @@ function MatrxCopyMenu(props) {
|
|
|
1560
2177
|
);
|
|
1561
2178
|
}
|
|
1562
2179
|
function MatrxCopyMenuSession(props) {
|
|
1563
|
-
const instance =
|
|
1564
|
-
const controller =
|
|
2180
|
+
const instance = React9.useId();
|
|
2181
|
+
const controller = React9.useRef(null);
|
|
1565
2182
|
const capabilities = useContentTransferCapabilities();
|
|
1566
2183
|
const transport = capabilities.transport ?? (0, import_content_transfer2.createBrowserTransport)();
|
|
1567
|
-
const [modal, setModal] =
|
|
1568
|
-
const [configuration, setConfiguration] =
|
|
2184
|
+
const [modal, setModal] = React9.useState(null);
|
|
2185
|
+
const [configuration, setConfiguration] = React9.useState(null);
|
|
1569
2186
|
const copyVisible = !props.hide?.includes("copy");
|
|
1570
2187
|
const aiVisible = !props.hide?.includes("ai");
|
|
1571
2188
|
const exportVisible = !props.hide?.includes("export");
|
|
@@ -1752,11 +2369,13 @@ function MatrxCopyMenuSession(props) {
|
|
|
1752
2369
|
const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
|
|
1753
2370
|
if (!source && !actions.length) return null;
|
|
1754
2371
|
const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
|
|
1755
|
-
return /* @__PURE__ */ (0,
|
|
1756
|
-
/* @__PURE__ */ (0,
|
|
2372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1757
2374
|
ContentTransferMenu,
|
|
1758
2375
|
{
|
|
1759
2376
|
source: target,
|
|
2377
|
+
...props.icon !== void 0 ? { icon: props.icon } : {},
|
|
2378
|
+
...props.triggerVariant !== void 0 ? { triggerVariant: props.triggerVariant } : {},
|
|
1760
2379
|
controllerRef: controller,
|
|
1761
2380
|
label: props.label,
|
|
1762
2381
|
variants,
|
|
@@ -1788,7 +2407,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
1788
2407
|
if (!open) setModal(null);
|
|
1789
2408
|
}
|
|
1790
2409
|
}),
|
|
1791
|
-
configuration ? /* @__PURE__ */ (0,
|
|
2410
|
+
configuration ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1792
2411
|
SourceConfiguration,
|
|
1793
2412
|
{
|
|
1794
2413
|
restoreFocus: () => controller.current?.focusTrigger(),
|
|
@@ -1815,14 +2434,14 @@ function SourceConfiguration({
|
|
|
1815
2434
|
onPrepare
|
|
1816
2435
|
}) {
|
|
1817
2436
|
const custom = configuration.custom;
|
|
1818
|
-
const handingOff =
|
|
2437
|
+
const handingOff = React9.useRef(false);
|
|
1819
2438
|
const groomer = configuration.groomer;
|
|
1820
|
-
const [values, setValues] =
|
|
2439
|
+
const [values, setValues] = React9.useState(
|
|
1821
2440
|
() => Object.fromEntries(
|
|
1822
2441
|
custom?.options.map((option) => [option.key, option.default]) ?? []
|
|
1823
2442
|
)
|
|
1824
2443
|
);
|
|
1825
|
-
const [sections, setSections] =
|
|
2444
|
+
const [sections, setSections] = React9.useState(
|
|
1826
2445
|
() => Object.fromEntries(
|
|
1827
2446
|
groomer?.sections.map((section) => [
|
|
1828
2447
|
section.id,
|
|
@@ -1830,8 +2449,8 @@ function SourceConfiguration({
|
|
|
1830
2449
|
]) ?? []
|
|
1831
2450
|
)
|
|
1832
2451
|
);
|
|
1833
|
-
const [error, setError] =
|
|
1834
|
-
const [busy, setBusy] =
|
|
2452
|
+
const [error, setError] = React9.useState(null);
|
|
2453
|
+
const [busy, setBusy] = React9.useState(false);
|
|
1835
2454
|
const title = custom?.dialogTitle ?? groomer?.label ?? "Customize source";
|
|
1836
2455
|
let prepared = null;
|
|
1837
2456
|
let buildError = null;
|
|
@@ -1868,14 +2487,14 @@ function SourceConfiguration({
|
|
|
1868
2487
|
} catch (cause) {
|
|
1869
2488
|
buildError = cause instanceof Error ? cause.message : "Could not prepare this source.";
|
|
1870
2489
|
}
|
|
1871
|
-
return /* @__PURE__ */ (0,
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1872
2491
|
Dialog,
|
|
1873
2492
|
{
|
|
1874
2493
|
open: true,
|
|
1875
2494
|
onOpenChange: (open) => {
|
|
1876
2495
|
if (!open && !busy) onClose();
|
|
1877
2496
|
},
|
|
1878
|
-
children: /* @__PURE__ */ (0,
|
|
2497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1879
2498
|
DialogContent,
|
|
1880
2499
|
{
|
|
1881
2500
|
onCloseAutoFocus: (event) => {
|
|
@@ -1884,23 +2503,23 @@ function SourceConfiguration({
|
|
|
1884
2503
|
},
|
|
1885
2504
|
className: "matrx-alchemy-workspace matrx-alchemy-configuration",
|
|
1886
2505
|
children: [
|
|
1887
|
-
/* @__PURE__ */ (0,
|
|
1888
|
-
/* @__PURE__ */ (0,
|
|
1889
|
-
/* @__PURE__ */ (0,
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogHeader, { children: [
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitle, { children: title }),
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
|
|
1890
2509
|
] }),
|
|
1891
|
-
/* @__PURE__ */ (0,
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1893
|
-
custom?.options.map((option) => /* @__PURE__ */ (0,
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-workspace-body", children: [
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
|
|
2512
|
+
custom?.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
|
|
1894
2513
|
option.label,
|
|
1895
|
-
"hint" in option && option.hint ? /* @__PURE__ */ (0,
|
|
1896
|
-
option.kind === "toggle" ? /* @__PURE__ */ (0,
|
|
2514
|
+
"hint" in option && option.hint ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("small", { children: option.hint }) : null,
|
|
2515
|
+
option.kind === "toggle" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1897
2516
|
"input",
|
|
1898
2517
|
{
|
|
1899
2518
|
type: "checkbox",
|
|
1900
2519
|
checked: Boolean(values[option.key]),
|
|
1901
2520
|
onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
|
|
1902
2521
|
}
|
|
1903
|
-
) : option.kind === "preset" ? /* @__PURE__ */ (0,
|
|
2522
|
+
) : option.kind === "preset" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1904
2523
|
"select",
|
|
1905
2524
|
{
|
|
1906
2525
|
value: Number(values[option.key]),
|
|
@@ -1908,10 +2527,10 @@ function SourceConfiguration({
|
|
|
1908
2527
|
...values,
|
|
1909
2528
|
[option.key]: Number(event.target.value)
|
|
1910
2529
|
}),
|
|
1911
|
-
children: option.options.map((choice) => /* @__PURE__ */ (0,
|
|
2530
|
+
children: option.options.map((choice) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: choice.value, children: choice.label }, choice.value))
|
|
1912
2531
|
}
|
|
1913
|
-
) : option.kind === "slider" ? /* @__PURE__ */ (0,
|
|
1914
|
-
/* @__PURE__ */ (0,
|
|
2532
|
+
) : option.kind === "slider" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1915
2534
|
"input",
|
|
1916
2535
|
{
|
|
1917
2536
|
type: "range",
|
|
@@ -1925,9 +2544,9 @@ function SourceConfiguration({
|
|
|
1925
2544
|
})
|
|
1926
2545
|
}
|
|
1927
2546
|
),
|
|
1928
|
-
/* @__PURE__ */ (0,
|
|
1929
|
-
] }) : /* @__PURE__ */ (0,
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.formatValue(Number(values[option.key])) })
|
|
2548
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1931
2550
|
"input",
|
|
1932
2551
|
{
|
|
1933
2552
|
type: "number",
|
|
@@ -1940,7 +2559,7 @@ function SourceConfiguration({
|
|
|
1940
2559
|
})
|
|
1941
2560
|
}
|
|
1942
2561
|
),
|
|
1943
|
-
option.presets?.map((preset) => /* @__PURE__ */ (0,
|
|
2562
|
+
option.presets?.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1944
2563
|
Button,
|
|
1945
2564
|
{
|
|
1946
2565
|
type: "button",
|
|
@@ -1953,8 +2572,8 @@ function SourceConfiguration({
|
|
|
1953
2572
|
))
|
|
1954
2573
|
] })
|
|
1955
2574
|
] }, option.key)),
|
|
1956
|
-
groomer ? /* @__PURE__ */ (0,
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
2575
|
+
groomer ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1958
2577
|
Button,
|
|
1959
2578
|
{
|
|
1960
2579
|
type: "button",
|
|
@@ -1972,9 +2591,9 @@ function SourceConfiguration({
|
|
|
1972
2591
|
},
|
|
1973
2592
|
level
|
|
1974
2593
|
)) }),
|
|
1975
|
-
groomer.sections.map((section) => /* @__PURE__ */ (0,
|
|
2594
|
+
groomer.sections.map((section) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
|
|
1976
2595
|
section.title,
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1978
2597
|
"select",
|
|
1979
2598
|
{
|
|
1980
2599
|
value: sections[section.id],
|
|
@@ -1983,26 +2602,26 @@ function SourceConfiguration({
|
|
|
1983
2602
|
[section.id]: event.target.value
|
|
1984
2603
|
}),
|
|
1985
2604
|
children: [
|
|
1986
|
-
["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0,
|
|
1987
|
-
section.cuttable ? /* @__PURE__ */ (0,
|
|
2605
|
+
["full", "compact", "brief"].map((level) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
|
|
2606
|
+
section.cuttable ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "off", children: "Exclude" }) : null
|
|
1988
2607
|
]
|
|
1989
2608
|
}
|
|
1990
2609
|
),
|
|
1991
|
-
section.description ? /* @__PURE__ */ (0,
|
|
2610
|
+
section.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: section.description }) : null
|
|
1992
2611
|
] }, section.id))
|
|
1993
2612
|
] }) : null
|
|
1994
2613
|
] }),
|
|
1995
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("p", { children: [
|
|
1996
2615
|
text.length.toLocaleString(),
|
|
1997
2616
|
" characters \xB7 approximately",
|
|
1998
2617
|
" ",
|
|
1999
2618
|
Math.ceil(text.length / 4).toLocaleString(),
|
|
2000
2619
|
" tokens"
|
|
2001
2620
|
] }),
|
|
2002
|
-
error || buildError ? /* @__PURE__ */ (0,
|
|
2621
|
+
error || buildError ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { role: "alert", children: error ?? buildError }) : null
|
|
2003
2622
|
] }),
|
|
2004
|
-
/* @__PURE__ */ (0,
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogFooter, { children: [
|
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2006
2625
|
Button,
|
|
2007
2626
|
{
|
|
2008
2627
|
type: "button",
|
|
@@ -2013,7 +2632,7 @@ function SourceConfiguration({
|
|
|
2013
2632
|
children: "Cancel"
|
|
2014
2633
|
}
|
|
2015
2634
|
),
|
|
2016
|
-
/* @__PURE__ */ (0,
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2017
2636
|
Button,
|
|
2018
2637
|
{
|
|
2019
2638
|
type: "button",
|
|
@@ -2047,51 +2666,51 @@ function SourceConfiguration({
|
|
|
2047
2666
|
}
|
|
2048
2667
|
|
|
2049
2668
|
// src/data-table/host.tsx
|
|
2050
|
-
var
|
|
2051
|
-
var
|
|
2669
|
+
var import_react2 = require("react");
|
|
2670
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2052
2671
|
var HOST_SLOT = /* @__PURE__ */ Symbol.for("ai-matrx.design-system.table-host-context");
|
|
2053
2672
|
var hostRegistry = globalThis;
|
|
2054
|
-
var HostContext = hostRegistry[HOST_SLOT] ??= (0,
|
|
2673
|
+
var HostContext = hostRegistry[HOST_SLOT] ??= (0, import_react2.createContext)({});
|
|
2055
2674
|
function useMatrxDataTableHost() {
|
|
2056
|
-
return (0,
|
|
2675
|
+
return (0, import_react2.useContext)(HostContext);
|
|
2057
2676
|
}
|
|
2058
2677
|
|
|
2059
2678
|
// src/data-table/copy.tsx
|
|
2060
|
-
var
|
|
2679
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2061
2680
|
function CopyButtons(props) {
|
|
2062
2681
|
const { CopyControls } = useMatrxDataTableHost();
|
|
2063
2682
|
const copyProps = props.export?.sheetRows ? { ...props, primarySource: "table" } : props;
|
|
2064
|
-
if (CopyControls) return /* @__PURE__ */ (0,
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2683
|
+
if (CopyControls) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CopyControls, { ...copyProps });
|
|
2684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MatrxCopyMenu, { ...copyProps });
|
|
2066
2685
|
}
|
|
2067
2686
|
|
|
2068
2687
|
// src/data-table/MatrxUuidCell.tsx
|
|
2069
|
-
var
|
|
2688
|
+
var import_react4 = require("react");
|
|
2070
2689
|
|
|
2071
2690
|
// src/data-table/icons.tsx
|
|
2072
|
-
var
|
|
2691
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2073
2692
|
function Icon({ children, ...props }) {
|
|
2074
|
-
return /* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children });
|
|
2075
2694
|
}
|
|
2076
|
-
var Check = (p) => /* @__PURE__ */ (0,
|
|
2077
|
-
var PanelRight = (p) => /* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2695
|
+
var Check = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m5 12 4 4L19 6" }) });
|
|
2696
|
+
var PanelRight = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Icon, { ...p, children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
2698
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M15 4v16" })
|
|
2080
2699
|
] });
|
|
2081
|
-
var ExternalLink = (p) => /* @__PURE__ */ (0,
|
|
2082
|
-
var Copy = (p) => /* @__PURE__ */ (0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2084
|
-
/* @__PURE__ */ (0,
|
|
2700
|
+
var ExternalLink = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M14 4h6v6M20 4l-9 9M19 13v6H5V5h6" }) });
|
|
2701
|
+
var Copy = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Icon, { ...p, children: [
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { x: "9", y: "9", width: "11", height: "11", rx: "2" }),
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3" })
|
|
2085
2704
|
] });
|
|
2086
|
-
var Lightbulb = (p) => /* @__PURE__ */ (0,
|
|
2087
|
-
var ShieldOff = (p) => /* @__PURE__ */ (0,
|
|
2705
|
+
var Lightbulb = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M9 18h6M10 22h4M8 14a6 6 0 1 1 8 0c-1 1-1 2-1 3H9c0-1 0-2-1-3z" }) });
|
|
2706
|
+
var ShieldOff = (p) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { ...p, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m3 3 18 18M12 3l7 3v5c0 4-3 7-7 9-4-2-7-5-7-9V6l4-2" }) });
|
|
2088
2707
|
|
|
2089
2708
|
// src/data-table/useTableNotice.tsx
|
|
2090
|
-
var
|
|
2091
|
-
var
|
|
2709
|
+
var import_react3 = require("react");
|
|
2710
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2092
2711
|
function useTableNotice() {
|
|
2093
2712
|
const host = useMatrxDataTableHost();
|
|
2094
|
-
const [message, setMessage] = (0,
|
|
2713
|
+
const [message, setMessage] = (0, import_react3.useState)(null);
|
|
2095
2714
|
const notify = {
|
|
2096
2715
|
success(text) {
|
|
2097
2716
|
if (host.notify) host.notify.success(text);
|
|
@@ -2102,41 +2721,15 @@ function useTableNotice() {
|
|
|
2102
2721
|
else setMessage({ text, error: true });
|
|
2103
2722
|
}
|
|
2104
2723
|
};
|
|
2105
|
-
const notice = message ? /* @__PURE__ */ (0,
|
|
2724
|
+
const notice = message ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { role: message.error ? "alert" : "status", className: message.error ? "text-xs text-destructive" : "text-xs text-muted-foreground", children: [
|
|
2106
2725
|
message.text,
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", "aria-label": "Dismiss notification", className: "ml-2 underline", onClick: () => setMessage(null), children: "Dismiss" })
|
|
2108
2727
|
] }) : null;
|
|
2109
2728
|
return { notify, notice };
|
|
2110
2729
|
}
|
|
2111
2730
|
|
|
2112
|
-
// src/tooltip.tsx
|
|
2113
|
-
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
2114
|
-
var React9 = __toESM(require("react"), 1);
|
|
2115
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2116
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
2117
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
2118
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
2119
|
-
var TooltipContent = React9.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
|
|
2120
|
-
const resolved = usePortalContainer(container);
|
|
2121
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2122
|
-
TooltipPrimitive.Content,
|
|
2123
|
-
{
|
|
2124
|
-
ref,
|
|
2125
|
-
"data-slot": "tooltip-content",
|
|
2126
|
-
sideOffset,
|
|
2127
|
-
className: cn(
|
|
2128
|
-
"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md",
|
|
2129
|
-
animated && MOTION_POPPER,
|
|
2130
|
-
className
|
|
2131
|
-
),
|
|
2132
|
-
...props
|
|
2133
|
-
}
|
|
2134
|
-
) });
|
|
2135
|
-
});
|
|
2136
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
2137
|
-
|
|
2138
2731
|
// src/data-table/MatrxUuidCell.tsx
|
|
2139
|
-
var
|
|
2732
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2140
2733
|
var SHORT_LEN = 8;
|
|
2141
2734
|
function shortUuid(id, len = SHORT_LEN) {
|
|
2142
2735
|
return id.slice(0, len);
|
|
@@ -2175,18 +2768,18 @@ function MatrxUuidCell({
|
|
|
2175
2768
|
}) {
|
|
2176
2769
|
const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();
|
|
2177
2770
|
const { notify, notice } = useTableNotice();
|
|
2178
|
-
const [copied, setCopied] = (0,
|
|
2179
|
-
const [opening, setOpening] = (0,
|
|
2180
|
-
const [peekOpen, setPeekOpen] = (0,
|
|
2181
|
-
const timer = (0,
|
|
2182
|
-
(0,
|
|
2771
|
+
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
2772
|
+
const [opening, setOpening] = (0, import_react4.useState)(false);
|
|
2773
|
+
const [peekOpen, setPeekOpen] = (0, import_react4.useState)(false);
|
|
2774
|
+
const timer = (0, import_react4.useRef)(null);
|
|
2775
|
+
(0, import_react4.useEffect)(
|
|
2183
2776
|
() => () => {
|
|
2184
2777
|
if (timer.current) clearTimeout(timer.current);
|
|
2185
2778
|
},
|
|
2186
2779
|
[]
|
|
2187
2780
|
);
|
|
2188
2781
|
if (!value) {
|
|
2189
|
-
return /* @__PURE__ */ (0,
|
|
2782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-muted-foreground/40", children: "\u2014" });
|
|
2190
2783
|
}
|
|
2191
2784
|
const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;
|
|
2192
2785
|
const resolvedHref = doors?.href ?? href ?? null;
|
|
@@ -2229,13 +2822,13 @@ function MatrxUuidCell({
|
|
|
2229
2822
|
};
|
|
2230
2823
|
const idNode = (() => {
|
|
2231
2824
|
if (forbidden) {
|
|
2232
|
-
return /* @__PURE__ */ (0,
|
|
2233
|
-
/* @__PURE__ */ (0,
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums", children: [
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 truncate", children: display }),
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ShieldOff, { className: "h-3 w-3 shrink-0 opacity-60", "aria-hidden": true })
|
|
2235
2828
|
] });
|
|
2236
2829
|
}
|
|
2237
2830
|
if (onOpen) {
|
|
2238
|
-
return /* @__PURE__ */ (0,
|
|
2831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2239
2832
|
"button",
|
|
2240
2833
|
{
|
|
2241
2834
|
type: "button",
|
|
@@ -2244,14 +2837,14 @@ function MatrxUuidCell({
|
|
|
2244
2837
|
disabled: opening,
|
|
2245
2838
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60",
|
|
2246
2839
|
children: [
|
|
2247
|
-
/* @__PURE__ */ (0,
|
|
2248
|
-
/* @__PURE__ */ (0,
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PanelRight, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
2249
2842
|
]
|
|
2250
2843
|
}
|
|
2251
2844
|
);
|
|
2252
2845
|
}
|
|
2253
2846
|
if (resolvedHref) {
|
|
2254
|
-
return /* @__PURE__ */ (0,
|
|
2847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2255
2848
|
"a",
|
|
2256
2849
|
{
|
|
2257
2850
|
href: resolvedHref,
|
|
@@ -2261,15 +2854,15 @@ function MatrxUuidCell({
|
|
|
2261
2854
|
onClick: stop,
|
|
2262
2855
|
className: "inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400",
|
|
2263
2856
|
children: [
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2265
|
-
/* @__PURE__ */ (0,
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 truncate tabular-nums", children: display }),
|
|
2858
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExternalLink, { className: "h-3 w-3 shrink-0 opacity-50" })
|
|
2266
2859
|
]
|
|
2267
2860
|
}
|
|
2268
2861
|
);
|
|
2269
2862
|
}
|
|
2270
|
-
return /* @__PURE__ */ (0,
|
|
2863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all", children: display });
|
|
2271
2864
|
})();
|
|
2272
|
-
return /* @__PURE__ */ (0,
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2273
2866
|
"span",
|
|
2274
2867
|
{
|
|
2275
2868
|
"data-matrx-cell-control": true,
|
|
@@ -2279,12 +2872,12 @@ function MatrxUuidCell({
|
|
|
2279
2872
|
),
|
|
2280
2873
|
onClick: stop,
|
|
2281
2874
|
children: [
|
|
2282
|
-
/* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2875
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "inline-flex min-w-0 max-w-full items-center", children: idNode }) }),
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContent, { side: "top", className: "max-w-sm break-all font-mono", children: forbidden ? `No access \xB7 ${tip}` : tip })
|
|
2285
2878
|
] }),
|
|
2286
|
-
/* @__PURE__ */ (0,
|
|
2287
|
-
/* @__PURE__ */ (0,
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
|
|
2880
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2288
2881
|
"button",
|
|
2289
2882
|
{
|
|
2290
2883
|
type: "button",
|
|
@@ -2294,13 +2887,13 @@ function MatrxUuidCell({
|
|
|
2294
2887
|
"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
2295
2888
|
copied && "text-primary"
|
|
2296
2889
|
),
|
|
2297
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2890
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Check, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Copy, { className: "h-3 w-3" })
|
|
2298
2891
|
}
|
|
2299
2892
|
) }),
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContent, { side: "top", children: copied ? "Copied" : `Copy ${label ?? "id"}: ${value}` })
|
|
2301
2894
|
] }),
|
|
2302
|
-
canPeek ? /* @__PURE__ */ (0,
|
|
2303
|
-
/* @__PURE__ */ (0,
|
|
2895
|
+
canPeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
|
|
2896
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2304
2897
|
"button",
|
|
2305
2898
|
{
|
|
2306
2899
|
type: "button",
|
|
@@ -2310,16 +2903,16 @@ function MatrxUuidCell({
|
|
|
2310
2903
|
},
|
|
2311
2904
|
"aria-label": `Quick look at ${label ?? "record"}`,
|
|
2312
2905
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
2313
|
-
children: /* @__PURE__ */ (0,
|
|
2906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Lightbulb, { className: "h-3 w-3" })
|
|
2314
2907
|
}
|
|
2315
2908
|
) }),
|
|
2316
|
-
/* @__PURE__ */ (0,
|
|
2909
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipContent, { side: "top", children: [
|
|
2317
2910
|
"Quick look at ",
|
|
2318
2911
|
label ?? "record"
|
|
2319
2912
|
] })
|
|
2320
2913
|
] }) : null,
|
|
2321
|
-
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0,
|
|
2322
|
-
/* @__PURE__ */ (0,
|
|
2914
|
+
onOpen && resolvedHref && !forbidden ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2323
2916
|
"a",
|
|
2324
2917
|
{
|
|
2325
2918
|
href: resolvedHref,
|
|
@@ -2328,10 +2921,10 @@ function MatrxUuidCell({
|
|
|
2328
2921
|
onClick: stop,
|
|
2329
2922
|
"aria-label": `Open ${label ?? "record"} in a new tab`,
|
|
2330
2923
|
className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none",
|
|
2331
|
-
children: /* @__PURE__ */ (0,
|
|
2924
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExternalLink, { className: "h-3 w-3" })
|
|
2332
2925
|
}
|
|
2333
2926
|
) }),
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2927
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipContent, { side: "top", children: [
|
|
2335
2928
|
"Open ",
|
|
2336
2929
|
label ?? "record",
|
|
2337
2930
|
" in a new tab"
|
|
@@ -2339,7 +2932,7 @@ function MatrxUuidCell({
|
|
|
2339
2932
|
] }) : null,
|
|
2340
2933
|
trailing,
|
|
2341
2934
|
notice,
|
|
2342
|
-
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0,
|
|
2935
|
+
canPeek && peekOpen && ResourcePeek ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2343
2936
|
ResourcePeek,
|
|
2344
2937
|
{
|
|
2345
2938
|
kind: doors?.peekKind ?? token ?? "record",
|
|
@@ -2359,7 +2952,7 @@ function isUuidValue(value) {
|
|
|
2359
2952
|
}
|
|
2360
2953
|
|
|
2361
2954
|
// src/data-table/DataRowInspector.tsx
|
|
2362
|
-
var
|
|
2955
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2363
2956
|
var noFieldToken = () => null;
|
|
2364
2957
|
function formatValue(value) {
|
|
2365
2958
|
if (value == null) return "\u2014";
|
|
@@ -2388,7 +2981,7 @@ function DataRowInspector({
|
|
|
2388
2981
|
tokenForField = noFieldToken
|
|
2389
2982
|
}) {
|
|
2390
2983
|
const entries = isPlainObject(row) ? Object.entries(row) : [["value", row]];
|
|
2391
|
-
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0,
|
|
2984
|
+
const fieldButtons = (key, value) => fieldCopy ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute right-1 top-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/field:opacity-100", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2392
2985
|
CopyButtons,
|
|
2393
2986
|
{
|
|
2394
2987
|
size: "xs",
|
|
@@ -2403,21 +2996,21 @@ function DataRowInspector({
|
|
|
2403
2996
|
})
|
|
2404
2997
|
}
|
|
2405
2998
|
) }) : null;
|
|
2406
|
-
return /* @__PURE__ */ (0,
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2407
3000
|
"div",
|
|
2408
3001
|
{
|
|
2409
3002
|
className: cn("flex h-full min-h-0 flex-col overflow-hidden", className),
|
|
2410
3003
|
children: [
|
|
2411
|
-
title ? /* @__PURE__ */ (0,
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
3004
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "shrink-0 border-b border-border px-3 py-2 text-sm font-medium", children: title }) : null,
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "min-h-0 flex-1 overflow-auto p-3", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dl", { className: "space-y-2", children: entries.map(([key, value]) => {
|
|
2413
3006
|
if (isUuidValue(value)) {
|
|
2414
|
-
return /* @__PURE__ */ (0,
|
|
3007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2415
3008
|
"div",
|
|
2416
3009
|
{
|
|
2417
3010
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 px-2.5 py-2",
|
|
2418
3011
|
children: [
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
3013
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2421
3014
|
MatrxUuidCell,
|
|
2422
3015
|
{
|
|
2423
3016
|
value,
|
|
@@ -2432,13 +3025,13 @@ function DataRowInspector({
|
|
|
2432
3025
|
}
|
|
2433
3026
|
const formatted = formatValue(value);
|
|
2434
3027
|
const multiline = formatted.includes("\n") || formatted.length > 80;
|
|
2435
|
-
return /* @__PURE__ */ (0,
|
|
3028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2436
3029
|
"div",
|
|
2437
3030
|
{
|
|
2438
3031
|
className: "group/field relative grid grid-cols-[minmax(7rem,9rem)_1fr] gap-2 rounded-md border border-border/60 bg-muted/20 py-2 pl-2.5 pr-12",
|
|
2439
3032
|
children: [
|
|
2440
|
-
/* @__PURE__ */ (0,
|
|
2441
|
-
/* @__PURE__ */ (0,
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { className: "truncate text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: key }),
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2442
3035
|
"dd",
|
|
2443
3036
|
{
|
|
2444
3037
|
className: cn(
|