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