@ai-matrx/design-system 0.19.17 → 0.20.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/icon.cjs +1 -1
- package/dist/content-transfer/icon.cjs.map +1 -1
- package/dist/content-transfer/icon.js +1 -1
- package/dist/content-transfer/icon.js.map +1 -1
- package/dist/content-transfer/portal.svg +1 -1
- package/dist/content-transfer.cjs +692 -407
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.css +15 -0
- package/dist/content-transfer.d.cts +19 -4
- package/dist/content-transfer.d.ts +19 -4
- package/dist/content-transfer.js +684 -396
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +3 -1
- package/dist/data-table/copy-helpers.d.ts +3 -1
- package/dist/data-table/copy-types.cjs.map +1 -1
- package/dist/data-table/copy-types.d.cts +4 -0
- package/dist/data-table/copy-types.d.ts +4 -0
- package/dist/data-table/data-row-inspector.cjs +659 -465
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +662 -463
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +657 -463
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +663 -464
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +3 -1
- package/dist/data-table/filter-engine.d.ts +3 -1
- package/dist/data-table/host.cjs.map +1 -1
- package/dist/data-table/host.d.cts +6 -1
- package/dist/data-table/host.d.ts +6 -1
- package/dist/data-table/host.js.map +1 -1
- package/dist/data-table/index.cjs +1211 -980
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +4 -2
- package/dist/data-table/index.d.ts +4 -2
- package/dist/data-table/index.js +1350 -1114
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +3 -1
- package/dist/data-table/infer-filter.d.ts +3 -1
- package/dist/data-table/layered-filters.d.cts +3 -1
- package/dist/data-table/layered-filters.d.ts +3 -1
- package/dist/data-table/pagination.cjs +2 -2
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +2 -2
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.d.cts +3 -1
- package/dist/data-table/query-control.d.ts +3 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +3 -1
- package/dist/data-table/types.d.ts +3 -1
- package/dist/data-table/url-state.d.cts +3 -1
- package/dist/data-table/url-state.d.ts +3 -1
- package/dist/data-table/uuid-cell.cjs.map +1 -1
- package/dist/data-table/uuid-cell.js.map +1 -1
- package/dist/data-table/xlsx.d.cts +3 -1
- package/dist/data-table/xlsx.d.ts +3 -1
- package/dist/extensions-DCHtNwG3.d.cts +32 -0
- package/dist/extensions-DCHtNwG3.d.ts +32 -0
- package/dist/tap-target.css +2 -2
- package/dist/{types-DqlfNcC5.d.cts → types-C2yaTspG.d.cts} +6 -1
- package/dist/{types-lNw7TnTM.d.ts → types-DB30aCHu.d.ts} +6 -1
- package/package.json +1 -1
package/dist/content-transfer.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
|
-
// src/content-transfer/
|
|
5
|
-
import * as
|
|
6
|
-
import { createPortal, flushSync } from "react-dom";
|
|
7
|
-
import {
|
|
8
|
-
applySectionSelection,
|
|
9
|
-
applyTransferLimits,
|
|
10
|
-
capture,
|
|
11
|
-
buildAgentPayload as buildAgentPayload2,
|
|
12
|
-
collectAllMatching,
|
|
13
|
-
createBrowserTransport as createBrowserTransport2,
|
|
14
|
-
createDraft,
|
|
15
|
-
directSource as directSource2,
|
|
16
|
-
editDraft,
|
|
17
|
-
projectSnapshot,
|
|
18
|
-
readTransferCell,
|
|
19
|
-
reduceJson,
|
|
20
|
-
resetDraft,
|
|
21
|
-
resolveTransferPreferences,
|
|
22
|
-
resolveTransferRegistry,
|
|
23
|
-
sealTransferArtifact as sealTransferArtifact2,
|
|
24
|
-
serialize,
|
|
25
|
-
serializeMarkdownRich,
|
|
26
|
-
transformRows,
|
|
27
|
-
undoDraft
|
|
28
|
-
} from "@ai-matrx/kit/content-transfer";
|
|
29
|
-
import { formatCount as formatCount2 } from "@ai-matrx/kit/format";
|
|
4
|
+
// src/content-transfer/email-review.tsx
|
|
5
|
+
import * as React6 from "react";
|
|
30
6
|
|
|
31
7
|
// src/button.tsx
|
|
32
8
|
import { Slot } from "@radix-ui/react-slot";
|
|
@@ -422,13 +398,154 @@ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
422
398
|
));
|
|
423
399
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
424
400
|
|
|
401
|
+
// src/content-transfer/email-review.tsx
|
|
402
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
403
|
+
var cancelled = () => ({ status: "cancelled" });
|
|
404
|
+
var failed = (error) => ({
|
|
405
|
+
status: "error",
|
|
406
|
+
code: "email-failed",
|
|
407
|
+
message: error instanceof Error ? error.message : "Could not send email.",
|
|
408
|
+
retryable: true
|
|
409
|
+
});
|
|
410
|
+
function useReviewedTransferEmail(email) {
|
|
411
|
+
const [pending, setPending] = React6.useState(null);
|
|
412
|
+
const [sending, setSending] = React6.useState(false);
|
|
413
|
+
const pendingRef = React6.useRef(null);
|
|
414
|
+
const sendingRef = React6.useRef(false);
|
|
415
|
+
const settle = React6.useCallback((request, outcome, render = true) => {
|
|
416
|
+
if (pendingRef.current !== request) return;
|
|
417
|
+
pendingRef.current = null;
|
|
418
|
+
request.context.signal.removeEventListener("abort", request.onAbort);
|
|
419
|
+
request.resolve(outcome);
|
|
420
|
+
sendingRef.current = false;
|
|
421
|
+
if (render) {
|
|
422
|
+
setSending(false);
|
|
423
|
+
setPending(null);
|
|
424
|
+
}
|
|
425
|
+
}, []);
|
|
426
|
+
React6.useEffect(
|
|
427
|
+
() => () => {
|
|
428
|
+
const request = pendingRef.current;
|
|
429
|
+
if (!request) return;
|
|
430
|
+
pendingRef.current = null;
|
|
431
|
+
request.context.signal.removeEventListener("abort", request.onAbort);
|
|
432
|
+
request.resolve(cancelled());
|
|
433
|
+
sendingRef.current = false;
|
|
434
|
+
},
|
|
435
|
+
[]
|
|
436
|
+
);
|
|
437
|
+
const reviewed = React6.useMemo(() => {
|
|
438
|
+
if (!email) return void 0;
|
|
439
|
+
return {
|
|
440
|
+
send: (artifact, context) => {
|
|
441
|
+
if (context.signal.aborted) return Promise.resolve(cancelled());
|
|
442
|
+
if (pendingRef.current)
|
|
443
|
+
return Promise.resolve({
|
|
444
|
+
status: "error",
|
|
445
|
+
code: "email-review-active",
|
|
446
|
+
message: "Finish reviewing the current email before starting another.",
|
|
447
|
+
retryable: true
|
|
448
|
+
});
|
|
449
|
+
return new Promise((resolve2) => {
|
|
450
|
+
const request = {
|
|
451
|
+
artifact,
|
|
452
|
+
context,
|
|
453
|
+
resolve: resolve2,
|
|
454
|
+
onAbort: () => settle(request, cancelled())
|
|
455
|
+
};
|
|
456
|
+
pendingRef.current = request;
|
|
457
|
+
context.signal.addEventListener("abort", request.onAbort, { once: true });
|
|
458
|
+
setSending(false);
|
|
459
|
+
setPending(request);
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
}, [email, settle]);
|
|
464
|
+
const cancel = React6.useCallback(() => {
|
|
465
|
+
const request = pendingRef.current;
|
|
466
|
+
if (request && !sendingRef.current) settle(request, cancelled());
|
|
467
|
+
}, [settle]);
|
|
468
|
+
const confirm = React6.useCallback(() => {
|
|
469
|
+
const request = pendingRef.current;
|
|
470
|
+
if (!request || sendingRef.current || request.context.signal.aborted) return;
|
|
471
|
+
sendingRef.current = true;
|
|
472
|
+
setSending(true);
|
|
473
|
+
void email?.send(request.artifact, request.context).then(
|
|
474
|
+
(outcome) => settle(request, outcome),
|
|
475
|
+
(error) => settle(request, failed(error))
|
|
476
|
+
);
|
|
477
|
+
}, [email, settle]);
|
|
478
|
+
const review = pending ? /* @__PURE__ */ jsx6(Dialog, { open: true, onOpenChange: (open) => {
|
|
479
|
+
if (!open) cancel();
|
|
480
|
+
}, children: /* @__PURE__ */ jsxs3(DialogContent, { className: "matrx-alchemy-workspace matrx-alchemy-email-review", "aria-busy": sending, children: [
|
|
481
|
+
/* @__PURE__ */ jsxs3(DialogHeader, { children: [
|
|
482
|
+
/* @__PURE__ */ jsx6(DialogTitle, { children: "Review email attachment" }),
|
|
483
|
+
/* @__PURE__ */ jsxs3(DialogDescription, { children: [
|
|
484
|
+
"Email ",
|
|
485
|
+
pending.artifact.file?.filename ?? `${pending.artifact.format} output`,
|
|
486
|
+
" from ",
|
|
487
|
+
pending.context.label,
|
|
488
|
+
". Review this exact attachment before sending."
|
|
489
|
+
] })
|
|
490
|
+
] }),
|
|
491
|
+
/* @__PURE__ */ jsx6("textarea", { "aria-label": "Email attachment preview", readOnly: true, value: pending.artifact.plainText, className: "matrx-alchemy-preview" }),
|
|
492
|
+
pending.artifact.omissions.length ? /* @__PURE__ */ jsxs3("details", { className: "matrx-alchemy-email-adjustments", open: true, children: [
|
|
493
|
+
/* @__PURE__ */ jsxs3("summary", { children: [
|
|
494
|
+
pending.artifact.omissions.length,
|
|
495
|
+
" omission",
|
|
496
|
+
pending.artifact.omissions.length === 1 ? "" : "s",
|
|
497
|
+
" or adjustment",
|
|
498
|
+
pending.artifact.omissions.length === 1 ? "" : "s"
|
|
499
|
+
] }),
|
|
500
|
+
/* @__PURE__ */ jsx6("ul", { children: pending.artifact.omissions.map((omission, index) => /* @__PURE__ */ jsxs3("li", { children: [
|
|
501
|
+
omission.path || "/",
|
|
502
|
+
": ",
|
|
503
|
+
omission.reason,
|
|
504
|
+
omission.count == null ? "" : ` (${omission.count})`
|
|
505
|
+
] }, `${omission.path}-${omission.reason}-${index}`)) })
|
|
506
|
+
] }) : /* @__PURE__ */ jsx6("p", { className: "matrx-alchemy-meta", children: "No omissions or adjustments." }),
|
|
507
|
+
/* @__PURE__ */ jsxs3(DialogFooter, { children: [
|
|
508
|
+
/* @__PURE__ */ jsx6(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: sending, onClick: cancel, children: "Cancel" }),
|
|
509
|
+
/* @__PURE__ */ jsx6(Button, { type: "button", className: "matrx-alchemy-workspace-primary", disabled: sending, onClick: confirm, children: sending ? "Sending email\u2026" : "Send email" })
|
|
510
|
+
] })
|
|
511
|
+
] }) }) : null;
|
|
512
|
+
return { email: reviewed, review };
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// src/content-transfer/index.tsx
|
|
516
|
+
import * as React10 from "react";
|
|
517
|
+
import { createPortal, flushSync } from "react-dom";
|
|
518
|
+
import {
|
|
519
|
+
applySectionSelection,
|
|
520
|
+
applyTransferLimits,
|
|
521
|
+
capture,
|
|
522
|
+
buildAgentPayload as buildAgentPayload2,
|
|
523
|
+
collectAllMatching,
|
|
524
|
+
createBrowserTransport as createBrowserTransport2,
|
|
525
|
+
createDraft,
|
|
526
|
+
directSource as directSource2,
|
|
527
|
+
editDraft,
|
|
528
|
+
projectSnapshot,
|
|
529
|
+
readTransferCell as readTransferCell2,
|
|
530
|
+
reduceJson,
|
|
531
|
+
resetDraft,
|
|
532
|
+
resolveTransferPreferences,
|
|
533
|
+
resolveTransferRegistry,
|
|
534
|
+
sealTransferArtifact as sealTransferArtifact3,
|
|
535
|
+
serialize as serialize2,
|
|
536
|
+
serializeMarkdownRich,
|
|
537
|
+
transformRows,
|
|
538
|
+
undoDraft
|
|
539
|
+
} from "@ai-matrx/kit/content-transfer";
|
|
540
|
+
import { formatCount as formatCount2 } from "@ai-matrx/kit/format";
|
|
541
|
+
|
|
425
542
|
// src/popover.tsx
|
|
426
543
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
427
|
-
import * as
|
|
428
|
-
import { jsx as
|
|
544
|
+
import * as React7 from "react";
|
|
545
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
429
546
|
var Popover = PopoverPrimitive.Root;
|
|
430
547
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
431
|
-
var PopoverContent =
|
|
548
|
+
var PopoverContent = React7.forwardRef(
|
|
432
549
|
({
|
|
433
550
|
className,
|
|
434
551
|
align = "center",
|
|
@@ -438,7 +555,7 @@ var PopoverContent = React6.forwardRef(
|
|
|
438
555
|
...props
|
|
439
556
|
}, ref) => {
|
|
440
557
|
const portalContainer = usePortalContainer(container);
|
|
441
|
-
return /* @__PURE__ */
|
|
558
|
+
return /* @__PURE__ */ jsx7(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx7(
|
|
442
559
|
PopoverPrimitive.Content,
|
|
443
560
|
{
|
|
444
561
|
ref,
|
|
@@ -471,13 +588,13 @@ import {
|
|
|
471
588
|
|
|
472
589
|
// src/tooltip.tsx
|
|
473
590
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
474
|
-
import * as
|
|
475
|
-
import { jsx as
|
|
591
|
+
import * as React8 from "react";
|
|
592
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
476
593
|
var Tooltip = TooltipPrimitive.Root;
|
|
477
594
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
478
|
-
var TooltipContent =
|
|
595
|
+
var TooltipContent = React8.forwardRef(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {
|
|
479
596
|
const resolved = usePortalContainer(container);
|
|
480
|
-
return /* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ jsx8(TooltipPrimitive.Portal, { container: resolved ?? null, children: /* @__PURE__ */ jsx8(
|
|
481
598
|
TooltipPrimitive.Content,
|
|
482
599
|
{
|
|
483
600
|
ref,
|
|
@@ -506,7 +623,7 @@ function getTapTargetLinkComponent() {
|
|
|
506
623
|
}
|
|
507
624
|
|
|
508
625
|
// src/tap-target/tap-target-button.tsx
|
|
509
|
-
import { jsx as
|
|
626
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
510
627
|
var EXTERNAL_RE = /^(https?:|mailto:|tel:)/i;
|
|
511
628
|
var TAP_OUTER_CLASS = "matrx-tap-target group";
|
|
512
629
|
var TAP_GROUP_OUTER_CLASS = "matrx-tap-target matrx-tap-target-sm group";
|
|
@@ -522,9 +639,9 @@ function IconContent({
|
|
|
522
639
|
className: cn2(className, icon.props.className)
|
|
523
640
|
});
|
|
524
641
|
}
|
|
525
|
-
return /* @__PURE__ */
|
|
642
|
+
return /* @__PURE__ */ jsx9("span", { className, children: icon });
|
|
526
643
|
}
|
|
527
|
-
return /* @__PURE__ */
|
|
644
|
+
return /* @__PURE__ */ jsx9(
|
|
528
645
|
"svg",
|
|
529
646
|
{
|
|
530
647
|
className,
|
|
@@ -561,7 +678,7 @@ function buildTapInner({
|
|
|
561
678
|
children,
|
|
562
679
|
strokeWidth = 2
|
|
563
680
|
}) {
|
|
564
|
-
const iconEl = /* @__PURE__ */
|
|
681
|
+
const iconEl = /* @__PURE__ */ jsx9(
|
|
565
682
|
IconContent,
|
|
566
683
|
{
|
|
567
684
|
icon,
|
|
@@ -572,11 +689,11 @@ function buildTapInner({
|
|
|
572
689
|
);
|
|
573
690
|
const pillClasses = label ? `${pillClassName} ${inlineModifier}`.trim() : pillClassName;
|
|
574
691
|
if (!label) {
|
|
575
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsx9("div", { className: pillClasses, children: iconEl });
|
|
576
693
|
}
|
|
577
|
-
return /* @__PURE__ */
|
|
694
|
+
return /* @__PURE__ */ jsxs4("div", { className: pillClasses, children: [
|
|
578
695
|
iconEl,
|
|
579
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ jsx9("span", { className: labelClassName ?? "matrx-tap-label", children: label })
|
|
580
697
|
] });
|
|
581
698
|
}
|
|
582
699
|
function renderTapTarget({
|
|
@@ -664,7 +781,7 @@ function renderTrigger({
|
|
|
664
781
|
buttonRef
|
|
665
782
|
}) {
|
|
666
783
|
if (disabled && href) {
|
|
667
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ jsx9(
|
|
668
785
|
"span",
|
|
669
786
|
{
|
|
670
787
|
"aria-disabled": "true",
|
|
@@ -677,7 +794,7 @@ function renderTrigger({
|
|
|
677
794
|
if (href) {
|
|
678
795
|
const isExternal = EXTERNAL_RE.test(href);
|
|
679
796
|
if (isExternal) {
|
|
680
|
-
return /* @__PURE__ */
|
|
797
|
+
return /* @__PURE__ */ jsx9(
|
|
681
798
|
"a",
|
|
682
799
|
{
|
|
683
800
|
href,
|
|
@@ -691,7 +808,7 @@ function renderTrigger({
|
|
|
691
808
|
}
|
|
692
809
|
const Link = linkComponent ?? getTapTargetLinkComponent();
|
|
693
810
|
if (Link) {
|
|
694
|
-
return /* @__PURE__ */
|
|
811
|
+
return /* @__PURE__ */ jsx9(
|
|
695
812
|
Link,
|
|
696
813
|
{
|
|
697
814
|
href,
|
|
@@ -704,7 +821,7 @@ function renderTrigger({
|
|
|
704
821
|
}
|
|
705
822
|
);
|
|
706
823
|
}
|
|
707
|
-
return /* @__PURE__ */
|
|
824
|
+
return /* @__PURE__ */ jsx9(
|
|
708
825
|
"a",
|
|
709
826
|
{
|
|
710
827
|
href,
|
|
@@ -717,7 +834,7 @@ function renderTrigger({
|
|
|
717
834
|
);
|
|
718
835
|
}
|
|
719
836
|
if (as === "label") {
|
|
720
|
-
return /* @__PURE__ */
|
|
837
|
+
return /* @__PURE__ */ jsx9(
|
|
721
838
|
"label",
|
|
722
839
|
{
|
|
723
840
|
htmlFor,
|
|
@@ -727,7 +844,7 @@ function renderTrigger({
|
|
|
727
844
|
}
|
|
728
845
|
);
|
|
729
846
|
}
|
|
730
|
-
return /* @__PURE__ */
|
|
847
|
+
return /* @__PURE__ */ jsx9(
|
|
731
848
|
"button",
|
|
732
849
|
{
|
|
733
850
|
ref: buttonRef,
|
|
@@ -751,14 +868,14 @@ function withTooltip(trigger, {
|
|
|
751
868
|
if (tooltip === false) return trigger;
|
|
752
869
|
const label = typeof tooltip === "string" && tooltip.length > 0 ? tooltip : ariaLabel;
|
|
753
870
|
if (!label) return trigger;
|
|
754
|
-
return /* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
872
|
+
/* @__PURE__ */ jsx9(TooltipTrigger, { asChild: true, children: disabled ? (
|
|
756
873
|
// Radix Tooltip triggers need a hoverable element; a disabled button
|
|
757
874
|
// does not dispatch pointer events, so we wrap in a span for the
|
|
758
875
|
// trigger target while keeping the disabled visual state.
|
|
759
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ jsx9("span", { className: "inline-flex", children: trigger })
|
|
760
877
|
) : trigger }),
|
|
761
|
-
/* @__PURE__ */
|
|
878
|
+
/* @__PURE__ */ jsx9(TooltipContent, { side: tooltipSide, align: tooltipAlign, children: label })
|
|
762
879
|
] });
|
|
763
880
|
}
|
|
764
881
|
var TapTargetButton = forwardRef5(function TapTargetButton2({
|
|
@@ -914,7 +1031,7 @@ var TapTargetButtonDestructive = forwardRef5(function TapTargetButtonDestructive
|
|
|
914
1031
|
hoverBgColor = "hover:bg-destructive/90",
|
|
915
1032
|
...rest
|
|
916
1033
|
}, ref) {
|
|
917
|
-
return /* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ jsx9(
|
|
918
1035
|
TapTargetButtonSolid,
|
|
919
1036
|
{
|
|
920
1037
|
ref,
|
|
@@ -978,7 +1095,7 @@ var TapTargetButtonForGroup = forwardRef5(function TapTargetButtonForGroup2({
|
|
|
978
1095
|
|
|
979
1096
|
// src/content-transfer/icon.ts
|
|
980
1097
|
var ALCHEMY_GLYPH_PATHS = {
|
|
981
|
-
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-
|
|
1098
|
+
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-4M12 8v8m-3-3 3 3 3-3"],
|
|
982
1099
|
"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"]
|
|
983
1100
|
};
|
|
984
1101
|
var ALCHEMY_GLYPH_VIEWBOX = { portal: "0 0 24 24", "copy-transform": "0 0 24 24" };
|
|
@@ -986,17 +1103,126 @@ var svg = (paths, viewBox) => `<svg xmlns="http://www.w3.org/2000/svg" width="18
|
|
|
986
1103
|
var ALCHEMY_GLYPH_SVG = svg(ALCHEMY_GLYPH_PATHS.portal, ALCHEMY_GLYPH_VIEWBOX.portal);
|
|
987
1104
|
var ALCHEMY_COPY_TRANSFORM_SVG = svg(ALCHEMY_GLYPH_PATHS["copy-transform"], ALCHEMY_GLYPH_VIEWBOX["copy-transform"]);
|
|
988
1105
|
|
|
1106
|
+
// src/content-transfer/extensions.ts
|
|
1107
|
+
import {
|
|
1108
|
+
ContentTransferError,
|
|
1109
|
+
readTransferCell,
|
|
1110
|
+
sealTransferArtifact,
|
|
1111
|
+
serialize
|
|
1112
|
+
} from "@ai-matrx/kit/content-transfer";
|
|
1113
|
+
var exportableColumns = (payload) => payload.columns.filter(
|
|
1114
|
+
(column) => column.visible && column.exportable !== false && column.classification !== "secret" && column.classification !== "credential"
|
|
1115
|
+
);
|
|
1116
|
+
var tableSchemaFormat = {
|
|
1117
|
+
id: "table-schema",
|
|
1118
|
+
label: "Schema + rows",
|
|
1119
|
+
supports: (payload) => payload.kind === "rows",
|
|
1120
|
+
async build(draft, signal) {
|
|
1121
|
+
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1122
|
+
if (draft.payload.kind !== "rows")
|
|
1123
|
+
throw new ContentTransferError(
|
|
1124
|
+
"unsupported-format",
|
|
1125
|
+
"Schema + rows requires tabular content; manually edited text cannot carry a table schema."
|
|
1126
|
+
);
|
|
1127
|
+
const rowColumns = exportableColumns(draft.payload);
|
|
1128
|
+
const columns = rowColumns.map((column) => ({
|
|
1129
|
+
id: column.id,
|
|
1130
|
+
label: column.label,
|
|
1131
|
+
path: column.path,
|
|
1132
|
+
...column.schema === void 0 ? {} : { schema: column.schema }
|
|
1133
|
+
}));
|
|
1134
|
+
const body = {
|
|
1135
|
+
sourceId: draft.sourceId,
|
|
1136
|
+
columns,
|
|
1137
|
+
rows: draft.payload.rows.map(
|
|
1138
|
+
(row) => Object.fromEntries(rowColumns.map((column) => [column.id, readTransferCell(row, column) ?? null]))
|
|
1139
|
+
)
|
|
1140
|
+
};
|
|
1141
|
+
const plainText = JSON.stringify(body, null, 2);
|
|
1142
|
+
return sealTransferArtifact({
|
|
1143
|
+
snapshotId: draft.snapshotId,
|
|
1144
|
+
draftRevision: draft.revision,
|
|
1145
|
+
format: "table-schema",
|
|
1146
|
+
plainText,
|
|
1147
|
+
file: {
|
|
1148
|
+
filename: "table-schema.json",
|
|
1149
|
+
mime: "application/json",
|
|
1150
|
+
bytes: new TextEncoder().encode(plainText)
|
|
1151
|
+
},
|
|
1152
|
+
omissions: [...draft.omissions]
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
function displayLabels(payload) {
|
|
1157
|
+
const columns = exportableColumns(payload);
|
|
1158
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1159
|
+
for (const column of columns) counts.set(column.label, (counts.get(column.label) ?? 0) + 1);
|
|
1160
|
+
const used = /* @__PURE__ */ new Set();
|
|
1161
|
+
return columns.map((column) => {
|
|
1162
|
+
const base = counts.get(column.label) === 1 ? column.label : `${column.label} [${column.id}]`;
|
|
1163
|
+
let label = base;
|
|
1164
|
+
for (let suffix = 2; used.has(label); suffix += 1) label = `${base} (${suffix})`;
|
|
1165
|
+
used.add(label);
|
|
1166
|
+
return [label, column];
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
var tableDataFormat = {
|
|
1170
|
+
id: "table-data",
|
|
1171
|
+
label: "JSON (display labels)",
|
|
1172
|
+
supports: (payload) => payload.kind === "rows",
|
|
1173
|
+
async build(draft, signal) {
|
|
1174
|
+
if (signal.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
1175
|
+
if (draft.payload.kind !== "rows")
|
|
1176
|
+
throw new ContentTransferError("unsupported-format", "Display-label JSON requires tabular content.");
|
|
1177
|
+
const columns = displayLabels(draft.payload);
|
|
1178
|
+
const plainText = JSON.stringify(
|
|
1179
|
+
draft.payload.rows.map(
|
|
1180
|
+
(row) => Object.fromEntries(columns.map(([label, column]) => [label, readTransferCell(row, column) ?? null]))
|
|
1181
|
+
),
|
|
1182
|
+
null,
|
|
1183
|
+
2
|
|
1184
|
+
);
|
|
1185
|
+
return sealTransferArtifact({
|
|
1186
|
+
snapshotId: draft.snapshotId,
|
|
1187
|
+
draftRevision: draft.revision,
|
|
1188
|
+
format: "json",
|
|
1189
|
+
plainText,
|
|
1190
|
+
file: {
|
|
1191
|
+
filename: "data.json",
|
|
1192
|
+
mime: "application/json;charset=utf-8",
|
|
1193
|
+
bytes: new TextEncoder().encode(plainText)
|
|
1194
|
+
},
|
|
1195
|
+
omissions: [...draft.omissions]
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
var emailArtifact = (draft, format, signal, jsonFormat) => format === "json" && jsonFormat?.supports(draft.payload) ? jsonFormat.build(draft, signal) : Promise.resolve(serialize(draft, format, { spreadsheetSafe: format === "csv" }));
|
|
1200
|
+
function createTransferEmailActions(email, options = {}) {
|
|
1201
|
+
return ["csv", "json", "markdown"].map((format) => ({
|
|
1202
|
+
id: `email-${format}`,
|
|
1203
|
+
label: `Email ${format === "csv" ? "CSV" : format === "json" ? "JSON" : "Markdown"}`,
|
|
1204
|
+
prepared: true,
|
|
1205
|
+
group: "email",
|
|
1206
|
+
supports: (_snapshot, draft) => Boolean(draft) && (format !== "csv" || draft?.payload.kind === "rows"),
|
|
1207
|
+
async run({ draft, signal, snapshot }) {
|
|
1208
|
+
if (signal.aborted) return { status: "cancelled" };
|
|
1209
|
+
const artifact = await emailArtifact(draft, format, signal, options.jsonFormat);
|
|
1210
|
+
return email.send(artifact, { label: snapshot.label, signal });
|
|
1211
|
+
}
|
|
1212
|
+
}));
|
|
1213
|
+
}
|
|
1214
|
+
|
|
989
1215
|
// src/content-transfer/matrx-copy.tsx
|
|
990
|
-
import * as
|
|
1216
|
+
import * as React9 from "react";
|
|
991
1217
|
import {
|
|
992
1218
|
buildAgentPayload,
|
|
993
1219
|
createBrowserTransport,
|
|
994
1220
|
directSource,
|
|
995
1221
|
normalizeTransferJson,
|
|
996
|
-
sealTransferArtifact
|
|
1222
|
+
sealTransferArtifact as sealTransferArtifact2
|
|
997
1223
|
} from "@ai-matrx/kit/content-transfer";
|
|
998
1224
|
import { formatCount } from "@ai-matrx/kit/format";
|
|
999
|
-
import { Fragment, jsx as
|
|
1225
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1000
1226
|
var resolve = (value) => typeof value === "function" ? value() : value;
|
|
1001
1227
|
var asPayload = (value) => ({
|
|
1002
1228
|
kind: "markdown",
|
|
@@ -1042,7 +1268,7 @@ var sourceFor = (id, label, build) => ({
|
|
|
1042
1268
|
});
|
|
1043
1269
|
function MatrxCopyMenu(props) {
|
|
1044
1270
|
const inherited = useContentTransferCapabilities();
|
|
1045
|
-
return /* @__PURE__ */
|
|
1271
|
+
return /* @__PURE__ */ jsx10(
|
|
1046
1272
|
MatrxCopyMenuSession,
|
|
1047
1273
|
{
|
|
1048
1274
|
...props
|
|
@@ -1054,12 +1280,12 @@ function MatrxCopyMenu(props) {
|
|
|
1054
1280
|
);
|
|
1055
1281
|
}
|
|
1056
1282
|
function MatrxCopyMenuSession(props) {
|
|
1057
|
-
const instance =
|
|
1058
|
-
const controller =
|
|
1283
|
+
const instance = React9.useId();
|
|
1284
|
+
const controller = React9.useRef(null);
|
|
1059
1285
|
const capabilities = useContentTransferCapabilities();
|
|
1060
1286
|
const transport = capabilities.transport ?? createBrowserTransport();
|
|
1061
|
-
const [modal, setModal] =
|
|
1062
|
-
const [configuration, setConfiguration] =
|
|
1287
|
+
const [modal, setModal] = React9.useState(null);
|
|
1288
|
+
const [configuration, setConfiguration] = React9.useState(null);
|
|
1063
1289
|
const copyVisible = !props.hide?.includes("copy");
|
|
1064
1290
|
const aiVisible = !props.hide?.includes("ai");
|
|
1065
1291
|
const exportVisible = !props.hide?.includes("export");
|
|
@@ -1219,7 +1445,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
1219
1445
|
const bytes = new Uint8Array(value.bytes);
|
|
1220
1446
|
const filename = typeof value.filename === "string" ? value.filename : `${props.label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "export"}.${value.extension.replace(/[^a-zA-Z0-9.-]/g, "") || "bin"}`;
|
|
1221
1447
|
return transport.download(
|
|
1222
|
-
|
|
1448
|
+
sealTransferArtifact2({
|
|
1223
1449
|
snapshotId: snapshot.id,
|
|
1224
1450
|
draftRevision: draft.revision,
|
|
1225
1451
|
format: `export:${item.id}`,
|
|
@@ -1246,11 +1472,14 @@ function MatrxCopyMenuSession(props) {
|
|
|
1246
1472
|
const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
|
|
1247
1473
|
if (!source && !actions.length) return null;
|
|
1248
1474
|
const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
|
|
1249
|
-
return /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1476
|
+
/* @__PURE__ */ jsx10(
|
|
1251
1477
|
ContentTransferMenu,
|
|
1252
1478
|
{
|
|
1479
|
+
triggerSize: props.size === "xs" || props.size === "toolbar" ? "compact" : "default",
|
|
1253
1480
|
source: target,
|
|
1481
|
+
...props.references ? { references: props.references } : {},
|
|
1482
|
+
...props.referenceActions ? { referenceActions: props.referenceActions } : {},
|
|
1254
1483
|
...props.icon !== void 0 ? { icon: props.icon } : {},
|
|
1255
1484
|
...props.triggerVariant !== void 0 ? { triggerVariant: props.triggerVariant } : {},
|
|
1256
1485
|
controllerRef: controller,
|
|
@@ -1284,7 +1513,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
1284
1513
|
if (!open) setModal(null);
|
|
1285
1514
|
}
|
|
1286
1515
|
}),
|
|
1287
|
-
configuration ? /* @__PURE__ */
|
|
1516
|
+
configuration ? /* @__PURE__ */ jsx10(
|
|
1288
1517
|
SourceConfiguration,
|
|
1289
1518
|
{
|
|
1290
1519
|
restoreFocus: () => controller.current?.focusTrigger(),
|
|
@@ -1311,14 +1540,14 @@ function SourceConfiguration({
|
|
|
1311
1540
|
onPrepare
|
|
1312
1541
|
}) {
|
|
1313
1542
|
const custom = configuration.custom;
|
|
1314
|
-
const handingOff =
|
|
1543
|
+
const handingOff = React9.useRef(false);
|
|
1315
1544
|
const groomer = configuration.groomer;
|
|
1316
|
-
const [values, setValues] =
|
|
1545
|
+
const [values, setValues] = React9.useState(
|
|
1317
1546
|
() => Object.fromEntries(
|
|
1318
1547
|
custom?.options.map((option) => [option.key, option.default]) ?? []
|
|
1319
1548
|
)
|
|
1320
1549
|
);
|
|
1321
|
-
const [sections, setSections] =
|
|
1550
|
+
const [sections, setSections] = React9.useState(
|
|
1322
1551
|
() => Object.fromEntries(
|
|
1323
1552
|
groomer?.sections.map((section) => [
|
|
1324
1553
|
section.id,
|
|
@@ -1326,8 +1555,8 @@ function SourceConfiguration({
|
|
|
1326
1555
|
]) ?? []
|
|
1327
1556
|
)
|
|
1328
1557
|
);
|
|
1329
|
-
const [error, setError] =
|
|
1330
|
-
const [busy, setBusy] =
|
|
1558
|
+
const [error, setError] = React9.useState(null);
|
|
1559
|
+
const [busy, setBusy] = React9.useState(false);
|
|
1331
1560
|
const title = custom?.dialogTitle ?? groomer?.label ?? "Customize source";
|
|
1332
1561
|
let prepared = null;
|
|
1333
1562
|
let buildError = null;
|
|
@@ -1364,14 +1593,14 @@ function SourceConfiguration({
|
|
|
1364
1593
|
} catch (cause) {
|
|
1365
1594
|
buildError = cause instanceof Error ? cause.message : "Could not prepare this source.";
|
|
1366
1595
|
}
|
|
1367
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ jsx10(
|
|
1368
1597
|
Dialog,
|
|
1369
1598
|
{
|
|
1370
1599
|
open: true,
|
|
1371
1600
|
onOpenChange: (open) => {
|
|
1372
1601
|
if (!open && !busy) onClose();
|
|
1373
1602
|
},
|
|
1374
|
-
children: /* @__PURE__ */
|
|
1603
|
+
children: /* @__PURE__ */ jsxs5(
|
|
1375
1604
|
DialogContent,
|
|
1376
1605
|
{
|
|
1377
1606
|
onCloseAutoFocus: (event) => {
|
|
@@ -1380,23 +1609,23 @@ function SourceConfiguration({
|
|
|
1380
1609
|
},
|
|
1381
1610
|
className: "matrx-alchemy-workspace matrx-alchemy-configuration",
|
|
1382
1611
|
children: [
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
/* @__PURE__ */
|
|
1385
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ jsxs5(DialogHeader, { children: [
|
|
1613
|
+
/* @__PURE__ */ jsx10(DialogTitle, { children: title }),
|
|
1614
|
+
/* @__PURE__ */ jsx10(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
|
|
1386
1615
|
] }),
|
|
1387
|
-
/* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
custom?.options.map((option) => /* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-workspace-body", children: [
|
|
1617
|
+
/* @__PURE__ */ jsxs5("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
|
|
1618
|
+
custom?.options.map((option) => /* @__PURE__ */ jsxs5("label", { children: [
|
|
1390
1619
|
option.label,
|
|
1391
|
-
"hint" in option && option.hint ? /* @__PURE__ */
|
|
1392
|
-
option.kind === "toggle" ? /* @__PURE__ */
|
|
1620
|
+
"hint" in option && option.hint ? /* @__PURE__ */ jsx10("small", { children: option.hint }) : null,
|
|
1621
|
+
option.kind === "toggle" ? /* @__PURE__ */ jsx10(
|
|
1393
1622
|
"input",
|
|
1394
1623
|
{
|
|
1395
1624
|
type: "checkbox",
|
|
1396
1625
|
checked: Boolean(values[option.key]),
|
|
1397
1626
|
onChange: (event) => setValues({ ...values, [option.key]: event.target.checked })
|
|
1398
1627
|
}
|
|
1399
|
-
) : option.kind === "preset" ? /* @__PURE__ */
|
|
1628
|
+
) : option.kind === "preset" ? /* @__PURE__ */ jsx10(
|
|
1400
1629
|
"select",
|
|
1401
1630
|
{
|
|
1402
1631
|
value: Number(values[option.key]),
|
|
@@ -1404,10 +1633,10 @@ function SourceConfiguration({
|
|
|
1404
1633
|
...values,
|
|
1405
1634
|
[option.key]: Number(event.target.value)
|
|
1406
1635
|
}),
|
|
1407
|
-
children: option.options.map((choice) => /* @__PURE__ */
|
|
1636
|
+
children: option.options.map((choice) => /* @__PURE__ */ jsx10("option", { value: choice.value, children: choice.label }, choice.value))
|
|
1408
1637
|
}
|
|
1409
|
-
) : option.kind === "slider" ? /* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1638
|
+
) : option.kind === "slider" ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1639
|
+
/* @__PURE__ */ jsx10(
|
|
1411
1640
|
"input",
|
|
1412
1641
|
{
|
|
1413
1642
|
type: "range",
|
|
@@ -1421,9 +1650,9 @@ function SourceConfiguration({
|
|
|
1421
1650
|
})
|
|
1422
1651
|
}
|
|
1423
1652
|
),
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
] }) : /* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1653
|
+
/* @__PURE__ */ jsx10("span", { children: option.formatValue(Number(values[option.key])) })
|
|
1654
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1655
|
+
/* @__PURE__ */ jsx10(
|
|
1427
1656
|
"input",
|
|
1428
1657
|
{
|
|
1429
1658
|
type: "number",
|
|
@@ -1436,7 +1665,7 @@ function SourceConfiguration({
|
|
|
1436
1665
|
})
|
|
1437
1666
|
}
|
|
1438
1667
|
),
|
|
1439
|
-
option.presets?.map((preset) => /* @__PURE__ */
|
|
1668
|
+
option.presets?.map((preset) => /* @__PURE__ */ jsx10(
|
|
1440
1669
|
Button,
|
|
1441
1670
|
{
|
|
1442
1671
|
type: "button",
|
|
@@ -1449,8 +1678,8 @@ function SourceConfiguration({
|
|
|
1449
1678
|
))
|
|
1450
1679
|
] })
|
|
1451
1680
|
] }, option.key)),
|
|
1452
|
-
groomer ? /* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1681
|
+
groomer ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1682
|
+
/* @__PURE__ */ jsx10("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx10(
|
|
1454
1683
|
Button,
|
|
1455
1684
|
{
|
|
1456
1685
|
type: "button",
|
|
@@ -1468,9 +1697,9 @@ function SourceConfiguration({
|
|
|
1468
1697
|
},
|
|
1469
1698
|
level
|
|
1470
1699
|
)) }),
|
|
1471
|
-
groomer.sections.map((section) => /* @__PURE__ */
|
|
1700
|
+
groomer.sections.map((section) => /* @__PURE__ */ jsxs5("label", { children: [
|
|
1472
1701
|
section.title,
|
|
1473
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ jsxs5(
|
|
1474
1703
|
"select",
|
|
1475
1704
|
{
|
|
1476
1705
|
value: sections[section.id],
|
|
@@ -1479,26 +1708,26 @@ function SourceConfiguration({
|
|
|
1479
1708
|
[section.id]: event.target.value
|
|
1480
1709
|
}),
|
|
1481
1710
|
children: [
|
|
1482
|
-
["full", "compact", "brief"].map((level) => /* @__PURE__ */
|
|
1483
|
-
section.cuttable ? /* @__PURE__ */
|
|
1711
|
+
["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx10("option", { value: level, children: section.levelLabels?.[level] ?? level }, level)),
|
|
1712
|
+
section.cuttable ? /* @__PURE__ */ jsx10("option", { value: "off", children: "Exclude" }) : null
|
|
1484
1713
|
]
|
|
1485
1714
|
}
|
|
1486
1715
|
),
|
|
1487
|
-
section.description ? /* @__PURE__ */
|
|
1716
|
+
section.description ? /* @__PURE__ */ jsx10("span", { children: section.description }) : null
|
|
1488
1717
|
] }, section.id))
|
|
1489
1718
|
] }) : null
|
|
1490
1719
|
] }),
|
|
1491
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxs5("p", { children: [
|
|
1492
1721
|
formatCount(text.length),
|
|
1493
1722
|
" characters \xB7 approximately",
|
|
1494
1723
|
" ",
|
|
1495
1724
|
formatCount(Math.ceil(text.length / 4)),
|
|
1496
1725
|
" tokens"
|
|
1497
1726
|
] }),
|
|
1498
|
-
error || buildError ? /* @__PURE__ */
|
|
1727
|
+
error || buildError ? /* @__PURE__ */ jsx10("p", { role: "alert", children: error ?? buildError }) : null
|
|
1499
1728
|
] }),
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ jsxs5(DialogFooter, { children: [
|
|
1730
|
+
/* @__PURE__ */ jsx10(
|
|
1502
1731
|
Button,
|
|
1503
1732
|
{
|
|
1504
1733
|
type: "button",
|
|
@@ -1509,7 +1738,7 @@ function SourceConfiguration({
|
|
|
1509
1738
|
children: "Cancel"
|
|
1510
1739
|
}
|
|
1511
1740
|
),
|
|
1512
|
-
/* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ jsx10(
|
|
1513
1742
|
Button,
|
|
1514
1743
|
{
|
|
1515
1744
|
type: "button",
|
|
@@ -1600,26 +1829,26 @@ function groomerPresetVariants(getConfig) {
|
|
|
1600
1829
|
}
|
|
1601
1830
|
|
|
1602
1831
|
// src/content-transfer/index.tsx
|
|
1603
|
-
import { Fragment as Fragment2, jsx as
|
|
1832
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1604
1833
|
function AlchemyGlyph({ icon = "portal", ...props }) {
|
|
1605
|
-
return /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsx11("svg", { width: "18", height: "18", viewBox: ALCHEMY_GLYPH_VIEWBOX[icon], fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: ALCHEMY_GLYPH_PATHS[icon].map((d) => /* @__PURE__ */ jsx11("path", { d }, d)) });
|
|
1606
1835
|
}
|
|
1607
|
-
var CapabilityContext =
|
|
1836
|
+
var CapabilityContext = React10.createContext({});
|
|
1608
1837
|
function ContentTransferCapabilitiesProvider({ value, children }) {
|
|
1609
|
-
return /* @__PURE__ */
|
|
1838
|
+
return /* @__PURE__ */ jsx11(CapabilityContext.Provider, { value, children });
|
|
1610
1839
|
}
|
|
1611
|
-
var useContentTransferCapabilities = () =>
|
|
1612
|
-
var SurfaceContext =
|
|
1840
|
+
var useContentTransferCapabilities = () => React10.useContext(CapabilityContext);
|
|
1841
|
+
var SurfaceContext = React10.createContext(null);
|
|
1613
1842
|
function ContentTransferSurfaceProvider({ handle, children }) {
|
|
1614
|
-
return /* @__PURE__ */
|
|
1843
|
+
return /* @__PURE__ */ jsx11(SurfaceContext.Provider, { value: handle, children });
|
|
1615
1844
|
}
|
|
1616
|
-
var useContentTransferSurface = () =>
|
|
1845
|
+
var useContentTransferSurface = () => React10.useContext(SurfaceContext);
|
|
1617
1846
|
function MenuPresentation({ label, hint, icon: Icon }) {
|
|
1618
|
-
return /* @__PURE__ */
|
|
1619
|
-
Icon ? /* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1847
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1848
|
+
Icon ? /* @__PURE__ */ jsx11(Icon, { className: "matrx-alchemy-menu-icon" }) : null,
|
|
1849
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1621
1850
|
label,
|
|
1622
|
-
hint ? /* @__PURE__ */
|
|
1851
|
+
hint ? /* @__PURE__ */ jsx11("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
|
|
1623
1852
|
] })
|
|
1624
1853
|
] });
|
|
1625
1854
|
}
|
|
@@ -1637,71 +1866,71 @@ function DestinationPresentation({ action }) {
|
|
|
1637
1866
|
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"
|
|
1638
1867
|
};
|
|
1639
1868
|
const path = paths[action.id.replace(/^matrx:/, "")];
|
|
1640
|
-
return /* @__PURE__ */
|
|
1641
|
-
!action.icon ? path ? /* @__PURE__ */
|
|
1642
|
-
/* @__PURE__ */
|
|
1869
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1870
|
+
!action.icon ? path ? /* @__PURE__ */ jsx11("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__ */ jsx11("path", { d: path }) }) : /* @__PURE__ */ jsx11(PaletteGlyph, { file: true }) : null,
|
|
1871
|
+
/* @__PURE__ */ jsx11(MenuPresentation, { ...action })
|
|
1643
1872
|
] });
|
|
1644
1873
|
}
|
|
1645
1874
|
function ReceiptLink({ target }) {
|
|
1646
|
-
return target?.href && /^(\/(?!\/)|https?:\/\/)/.test(target.href) ? /* @__PURE__ */
|
|
1875
|
+
return target?.href && /^(\/(?!\/)|https?:\/\/)/.test(target.href) ? /* @__PURE__ */ jsxs6("a", { className: "matrx-alchemy-receipt-link", href: target.href, children: [
|
|
1647
1876
|
"Open ",
|
|
1648
1877
|
target.kind
|
|
1649
1878
|
] }) : null;
|
|
1650
1879
|
}
|
|
1651
1880
|
function PaletteGlyph({ format, ai = false, file = false, kind }) {
|
|
1652
|
-
if (kind === "ai-copy") return /* @__PURE__ */
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1881
|
+
if (kind === "ai-copy") return /* @__PURE__ */ jsxs6("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: [
|
|
1882
|
+
/* @__PURE__ */ jsx11("rect", { x: "5", y: "5", width: "11", height: "14", rx: "2" }),
|
|
1883
|
+
/* @__PURE__ */ jsx11("path", { d: "M9 3h6a2 2 0 0 1 2 2v10" }),
|
|
1884
|
+
/* @__PURE__ */ jsx11("path", { d: "m18.5 3 .55 1.45L20.5 5l-1.45.55L18.5 7l-.55-1.45L16.5 5l1.45-.55z" })
|
|
1656
1885
|
] });
|
|
1657
|
-
if (kind === "sliders") return /* @__PURE__ */
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
1886
|
+
if (kind === "sliders") return /* @__PURE__ */ jsxs6("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: [
|
|
1887
|
+
/* @__PURE__ */ jsx11("path", { d: "M4 6h16M4 12h16M4 18h16" }),
|
|
1888
|
+
/* @__PURE__ */ jsx11("path", { d: "M8 3v6M16 9v6M10 15v6" })
|
|
1660
1889
|
] });
|
|
1661
|
-
if (ai) return /* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */
|
|
1663
|
-
/* @__PURE__ */
|
|
1664
|
-
/* @__PURE__ */
|
|
1890
|
+
if (ai) return /* @__PURE__ */ jsxs6("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: [
|
|
1891
|
+
/* @__PURE__ */ jsx11("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" }),
|
|
1892
|
+
/* @__PURE__ */ jsx11("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" }),
|
|
1893
|
+
/* @__PURE__ */ jsx11("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
|
|
1665
1894
|
] });
|
|
1666
|
-
if (file) return /* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
/* @__PURE__ */
|
|
1895
|
+
if (file) return /* @__PURE__ */ jsxs6("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: [
|
|
1896
|
+
/* @__PURE__ */ jsx11("path", { d: "M6 3h8l4 4v14H6z" }),
|
|
1897
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
|
|
1669
1898
|
] });
|
|
1670
|
-
const path = format === "json" ? /* @__PURE__ */
|
|
1671
|
-
/* @__PURE__ */
|
|
1672
|
-
/* @__PURE__ */
|
|
1673
|
-
] }) : format === "compact-json" ? /* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1676
|
-
/* @__PURE__ */
|
|
1677
|
-
/* @__PURE__ */
|
|
1678
|
-
] }) : format === "csv" ? /* @__PURE__ */
|
|
1679
|
-
/* @__PURE__ */
|
|
1680
|
-
/* @__PURE__ */
|
|
1681
|
-
] }) : format === "tsv" ? /* @__PURE__ */
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
/* @__PURE__ */
|
|
1684
|
-
] }) : format === "xlsx" ? /* @__PURE__ */
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1687
|
-
] }) : format === "markdown" ? /* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
] }) : format === "html" ? /* @__PURE__ */
|
|
1691
|
-
return /* @__PURE__ */
|
|
1899
|
+
const path = format === "json" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1900
|
+
/* @__PURE__ */ jsx11("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
|
|
1901
|
+
/* @__PURE__ */ jsx11("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
|
|
1902
|
+
] }) : format === "compact-json" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1903
|
+
/* @__PURE__ */ jsx11("path", { d: "m14 10 7-7" }),
|
|
1904
|
+
/* @__PURE__ */ jsx11("path", { d: "M20 10h-6V4" }),
|
|
1905
|
+
/* @__PURE__ */ jsx11("path", { d: "m3 21 7-7" }),
|
|
1906
|
+
/* @__PURE__ */ jsx11("path", { d: "M4 14h6v6" })
|
|
1907
|
+
] }) : format === "csv" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1908
|
+
/* @__PURE__ */ jsx11("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
|
|
1909
|
+
/* @__PURE__ */ jsx11("path", { d: "M4 10h16M10 4v16" })
|
|
1910
|
+
] }) : format === "tsv" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1911
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1912
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
|
|
1913
|
+
] }) : format === "xlsx" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1914
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1915
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
|
|
1916
|
+
] }) : format === "markdown" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
1917
|
+
/* @__PURE__ */ jsx11("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
|
|
1918
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
|
|
1919
|
+
] }) : format === "html" ? /* @__PURE__ */ jsx11(Fragment2, { children: /* @__PURE__ */ jsx11("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx11(Fragment2, { children: /* @__PURE__ */ jsx11("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
|
|
1920
|
+
return /* @__PURE__ */ jsx11("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 });
|
|
1692
1921
|
}
|
|
1693
1922
|
function PaletteRows({ title, items, onRun, extra, ai = false, glyphKind, fallbackHint }) {
|
|
1694
1923
|
if (!items.length && !extra) return null;
|
|
1695
|
-
return /* @__PURE__ */
|
|
1696
|
-
/* @__PURE__ */
|
|
1924
|
+
return /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1925
|
+
/* @__PURE__ */ jsx11("h3", { children: title }),
|
|
1697
1926
|
items.map((item) => {
|
|
1698
1927
|
const label = item.copyLabel ?? item.label;
|
|
1699
1928
|
const hint = item.hint ?? fallbackHint;
|
|
1700
|
-
return /* @__PURE__ */
|
|
1701
|
-
item.icon ? /* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1929
|
+
return /* @__PURE__ */ jsxs6("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: [
|
|
1930
|
+
item.icon ? /* @__PURE__ */ jsx11(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx11(PaletteGlyph, { ai, ...glyphKind ? { kind: glyphKind } : {} }),
|
|
1931
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1703
1932
|
label,
|
|
1704
|
-
hint ? /* @__PURE__ */
|
|
1933
|
+
hint ? /* @__PURE__ */ jsx11("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
|
|
1705
1934
|
] })
|
|
1706
1935
|
] }, item.id);
|
|
1707
1936
|
}),
|
|
@@ -1744,10 +1973,10 @@ function snapshotContent(snapshot) {
|
|
|
1744
1973
|
return JSON.stringify({ sourceId, label, payload, coverage, unsavedChanges, omissions, sections, limits });
|
|
1745
1974
|
}
|
|
1746
1975
|
function useFence() {
|
|
1747
|
-
const mounted =
|
|
1748
|
-
const nextId =
|
|
1749
|
-
const active =
|
|
1750
|
-
|
|
1976
|
+
const mounted = React10.useRef(true);
|
|
1977
|
+
const nextId = React10.useRef(0);
|
|
1978
|
+
const active = React10.useRef(/* @__PURE__ */ new Set());
|
|
1979
|
+
React10.useEffect(() => {
|
|
1751
1980
|
mounted.current = true;
|
|
1752
1981
|
return () => {
|
|
1753
1982
|
mounted.current = false;
|
|
@@ -1756,14 +1985,14 @@ function useFence() {
|
|
|
1756
1985
|
active.current.clear();
|
|
1757
1986
|
};
|
|
1758
1987
|
}, []);
|
|
1759
|
-
const begin =
|
|
1988
|
+
const begin = React10.useCallback(() => {
|
|
1760
1989
|
const controller = new AbortController();
|
|
1761
1990
|
active.current.add(controller);
|
|
1762
1991
|
return { controller, id: ++nextId.current };
|
|
1763
1992
|
}, []);
|
|
1764
|
-
const finish =
|
|
1765
|
-
const valid =
|
|
1766
|
-
const abortAll =
|
|
1993
|
+
const finish = React10.useCallback((controller) => active.current.delete(controller), []);
|
|
1994
|
+
const valid = React10.useCallback((id, controller) => mounted.current && !controller.signal.aborted && nextId.current === id, []);
|
|
1995
|
+
const abortAll = React10.useCallback(() => {
|
|
1767
1996
|
nextId.current += 1;
|
|
1768
1997
|
active.current.forEach((c) => c.abort());
|
|
1769
1998
|
active.current.clear();
|
|
@@ -1775,73 +2004,79 @@ async function xlsxArtifact(draft, label) {
|
|
|
1775
2004
|
const XLSX = await import("xlsx");
|
|
1776
2005
|
const columns = draft.payload.columns.filter((c) => c.visible && c.exportable !== false && c.classification !== "secret" && c.classification !== "credential");
|
|
1777
2006
|
const cells = draft.payload.rows.map((row) => columns.map((column) => {
|
|
1778
|
-
const value =
|
|
2007
|
+
const value = readTransferCell2(row, column);
|
|
1779
2008
|
return value === null || ["string", "number", "boolean"].includes(typeof value) ? value : value === void 0 ? "" : JSON.stringify(value);
|
|
1780
2009
|
}));
|
|
1781
2010
|
const sheet = XLSX.utils.aoa_to_sheet([columns.map((c) => c.label), ...cells]);
|
|
1782
2011
|
const book = XLSX.utils.book_new();
|
|
1783
2012
|
XLSX.utils.book_append_sheet(book, sheet, label.replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31) || "Data");
|
|
1784
2013
|
const written = XLSX.write(book, { type: "array", bookType: "xlsx", compression: true });
|
|
1785
|
-
return
|
|
2014
|
+
return sealTransferArtifact3({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "xlsx", plainText: serialize2(draft, "tsv", { spreadsheetSafe: true }).plainText, file: { filename: `${filenameFor(label)}.xlsx`, mime: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", bytes: written instanceof Uint8Array ? written : new Uint8Array(written) }, omissions: [...draft.omissions] });
|
|
1786
2015
|
}
|
|
1787
2016
|
async function buildArtifact(draft, format, label) {
|
|
1788
2017
|
if (!supportsBuiltIn(format, draft.payload)) throw new Error(`${LABEL[format]} is available for tabular content only.`);
|
|
1789
2018
|
if (format === "xlsx") return xlsxArtifact(draft, label);
|
|
1790
2019
|
if (format === "html" && draft.payload.kind === "markdown") return serializeMarkdownRich(draft, `${filenameFor(label)}.html`);
|
|
1791
2020
|
const extension = format === "plain" ? "txt" : format === "compact-json" ? "json" : format;
|
|
1792
|
-
return
|
|
2021
|
+
return serialize2(draft, format, { spreadsheetSafe: format === "csv" || format === "tsv", filename: `${filenameFor(label)}.${extension}` });
|
|
1793
2022
|
}
|
|
1794
2023
|
function ContentTransferMenu(props) {
|
|
1795
|
-
const inherited =
|
|
2024
|
+
const inherited = React10.useContext(CapabilityContext);
|
|
1796
2025
|
const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
|
|
1797
|
-
return /* @__PURE__ */
|
|
2026
|
+
return /* @__PURE__ */ jsx11(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
|
|
1798
2027
|
}
|
|
1799
|
-
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" }) {
|
|
1800
|
-
const triggerRef =
|
|
1801
|
-
const inherited =
|
|
1802
|
-
const nearestSurface =
|
|
2028
|
+
function ContentTransferMenuSession({ references = [], referenceActions = [], 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", triggerSize = "default" }) {
|
|
2029
|
+
const triggerRef = React10.useRef(null);
|
|
2030
|
+
const inherited = React10.useContext(CapabilityContext);
|
|
2031
|
+
const nearestSurface = React10.useContext(SurfaceContext);
|
|
1803
2032
|
const fence = useFence();
|
|
1804
|
-
const [menuCapture, setMenuCapture] =
|
|
1805
|
-
const [menuStatus, setMenuStatus] =
|
|
1806
|
-
const [workspaces, setWorkspaces] =
|
|
1807
|
-
const [workspaceKey, setWorkspaceKey] =
|
|
1808
|
-
const [workspaceOpen, setWorkspaceOpen] =
|
|
1809
|
-
const workspaceCaptures =
|
|
1810
|
-
const externalWorkspaceKeys =
|
|
1811
|
-
const [notice, setNotice] =
|
|
1812
|
-
const [receiptTarget, setReceiptTarget] =
|
|
1813
|
-
const [paletteOpen, setPaletteOpen] =
|
|
1814
|
-
const [mode, setMode] =
|
|
1815
|
-
const scopes =
|
|
1816
|
-
const
|
|
2033
|
+
const [menuCapture, setMenuCapture] = React10.useState(null);
|
|
2034
|
+
const [menuStatus, setMenuStatus] = React10.useState("idle");
|
|
2035
|
+
const [workspaces, setWorkspaces] = React10.useState({});
|
|
2036
|
+
const [workspaceKey, setWorkspaceKey] = React10.useState(null);
|
|
2037
|
+
const [workspaceOpen, setWorkspaceOpen] = React10.useState(false);
|
|
2038
|
+
const workspaceCaptures = React10.useRef(/* @__PURE__ */ new Map());
|
|
2039
|
+
const externalWorkspaceKeys = React10.useRef(/* @__PURE__ */ new Set());
|
|
2040
|
+
const [notice, setNotice] = React10.useState(null);
|
|
2041
|
+
const [receiptTarget, setReceiptTarget] = React10.useState();
|
|
2042
|
+
const [paletteOpen, setPaletteOpen] = React10.useState(false);
|
|
2043
|
+
const [mode, setMode] = React10.useState("copy");
|
|
2044
|
+
const scopes = React10.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
2045
|
+
const [requestedScope, setRequestedScope] = React10.useState(table?.initialScope ?? "target");
|
|
2046
|
+
const initialScope = scopes.includes(requestedScope) ? requestedScope : table?.initialScope ?? "target";
|
|
1817
2047
|
if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
|
|
1818
2048
|
const primary = surface ?? source ?? nearestSurface;
|
|
1819
2049
|
const sourceLabel = label ?? (surface?.surfaceName ?? (source && "label" in source ? source.label : nearestSurface?.surfaceName) ?? "content");
|
|
1820
|
-
const
|
|
2050
|
+
const primaryWorkspaceBase = `primary:${materialIdentity(primary)}`;
|
|
2051
|
+
const primaryWorkspaceKey = `${primaryWorkspaceBase}:${initialScope}`;
|
|
1821
2052
|
const nearestWorkspaceKey = source && !surface && nearestSurface ? `surface:${materialIdentity(nearestSurface)}` : null;
|
|
1822
|
-
const variantWorkspaceKeys =
|
|
2053
|
+
const variantWorkspaceKeys = React10.useMemo(() => new Map(variants.map((variant) => [variant.id, `variant:${variant.id}:${materialIdentity(variant.source)}`])), [variants]);
|
|
1823
2054
|
const transport = local?.transport ?? inherited.transport ?? createBrowserTransport2();
|
|
1824
2055
|
const ai = local?.ai ?? inherited.ai;
|
|
1825
|
-
const
|
|
1826
|
-
const
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1829
|
-
const
|
|
2056
|
+
const referencePort = local?.reference ?? inherited.reference;
|
|
2057
|
+
const { email: emailPort, review: emailReview } = useReviewedTransferEmail(local?.email ?? inherited.email);
|
|
2058
|
+
const providerPreferences = React10.useMemo(() => resolveTransferPreferences(inherited.preferences, local?.preferences), [inherited.preferences, local?.preferences]);
|
|
2059
|
+
const adapters = React10.useMemo(() => resolveTransferRegistry(BUILT_INS, inherited.formats ?? [], local?.formats ?? []).filter((x) => "build" in x), [inherited.formats, local?.formats]);
|
|
2060
|
+
const emailJsonFormat = adapters.find((adapter) => adapter.id === "table-data");
|
|
2061
|
+
const emailActions = React10.useMemo(() => emailPort ? createTransferEmailActions(emailPort, emailJsonFormat ? { jsonFormat: emailJsonFormat } : {}) : [], [emailPort, emailJsonFormat]);
|
|
2062
|
+
const registeredActions = React10.useMemo(() => resolveTransferRegistry(emailActions, inherited.actions ?? [], local?.actions ?? [], actions), [actions, emailActions, inherited.actions, local?.actions]);
|
|
2063
|
+
React10.useMemo(() => resolveTransferRegistry(variants), [variants]);
|
|
2064
|
+
const report = React10.useCallback((result) => {
|
|
1830
2065
|
inherited.onOutcome?.(result);
|
|
1831
2066
|
local?.onOutcome?.(result);
|
|
1832
2067
|
setNotice(outcomeMessage(result));
|
|
1833
2068
|
setReceiptTarget("target" in result ? result.target : void 0);
|
|
1834
2069
|
}, [inherited, local]);
|
|
1835
|
-
|
|
1836
|
-
const valid = /* @__PURE__ */ new Set([
|
|
2070
|
+
React10.useEffect(() => {
|
|
2071
|
+
const valid = /* @__PURE__ */ new Set([...scopes.map((scope) => `${primaryWorkspaceBase}:${scope}`), ...nearestWorkspaceKey ? [nearestWorkspaceKey] : [], ...variantWorkspaceKeys.values(), ...externalWorkspaceKeys.current]);
|
|
1837
2072
|
setWorkspaces((current) => Object.fromEntries(Object.entries(current).filter(([key]) => valid.has(key))));
|
|
1838
2073
|
for (const key of workspaceCaptures.current.keys()) if (!valid.has(key)) workspaceCaptures.current.delete(key);
|
|
1839
2074
|
if (workspaceKey && !valid.has(workspaceKey)) {
|
|
1840
2075
|
setWorkspaceKey(null);
|
|
1841
2076
|
setWorkspaceOpen(false);
|
|
1842
2077
|
}
|
|
1843
|
-
}, [nearestWorkspaceKey,
|
|
1844
|
-
const captureOne =
|
|
2078
|
+
}, [nearestWorkspaceKey, primaryWorkspaceBase, scopes, variantWorkspaceKeys, workspaceKey]);
|
|
2079
|
+
const captureOne = React10.useCallback(async (material, scope, signal, applyMenuProjection = false, collectPages = true) => {
|
|
1845
2080
|
if (!material) throw new Error("Alchemy needs a source or a mounted transfer surface.");
|
|
1846
2081
|
let sourceMaterial;
|
|
1847
2082
|
if ("instanceId" in material) {
|
|
@@ -1875,19 +2110,19 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1875
2110
|
if (result.snapshot.payload.kind !== "rows") throw new Error("All-matching export requires tabular content.");
|
|
1876
2111
|
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 } : {} };
|
|
1877
2112
|
}, [preferences, projection, providerPreferences, sections, sourceLabel]);
|
|
1878
|
-
const capturePrimary =
|
|
2113
|
+
const capturePrimary = React10.useCallback((scope, signal) => captureOne(primary, scope, signal, true), [captureOne, primary]);
|
|
1879
2114
|
workspaceCaptures.current.set(primaryWorkspaceKey, capturePrimary);
|
|
1880
2115
|
if (nearestWorkspaceKey && nearestSurface) workspaceCaptures.current.set(nearestWorkspaceKey, (scope, signal) => captureOne(nearestSurface, scope, signal, true));
|
|
1881
2116
|
for (const variant of variants) {
|
|
1882
2117
|
const key = variantWorkspaceKeys.get(variant.id);
|
|
1883
2118
|
workspaceCaptures.current.set(key, (scope, signal) => captureOne(variant.source, scope, signal, true));
|
|
1884
2119
|
}
|
|
1885
|
-
const preflight =
|
|
2120
|
+
const preflight = React10.useCallback(async (scope = initialScope) => {
|
|
1886
2121
|
const { controller, id } = fence.begin();
|
|
1887
2122
|
setMenuCapture(null);
|
|
1888
2123
|
setMenuStatus("loading");
|
|
1889
2124
|
try {
|
|
1890
|
-
const result = await captureOne(primary,
|
|
2125
|
+
const result = await captureOne(primary, scope, controller.signal, true, false);
|
|
1891
2126
|
if (fence.valid(id, controller)) {
|
|
1892
2127
|
setMenuCapture(result);
|
|
1893
2128
|
setMenuStatus("idle");
|
|
@@ -1901,7 +2136,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1901
2136
|
fence.finish(controller);
|
|
1902
2137
|
}
|
|
1903
2138
|
}, [captureOne, fence, initialScope, primary]);
|
|
1904
|
-
const transfer =
|
|
2139
|
+
const transfer = React10.useCallback(async (format, download, alternate) => {
|
|
1905
2140
|
const { controller, id } = fence.begin();
|
|
1906
2141
|
try {
|
|
1907
2142
|
const explicit = alternate?.source ?? (typeof format === "string" && format !== "xlsx" ? formatSources?.[format] : void 0);
|
|
@@ -1926,7 +2161,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1926
2161
|
fence.finish(controller);
|
|
1927
2162
|
}
|
|
1928
2163
|
}, [captureOne, capturePrimary, fence, formatSources, initialScope, preferences, providerPreferences, report, transport]);
|
|
1929
|
-
const openWorkspace =
|
|
2164
|
+
const openWorkspace = React10.useCallback(
|
|
1930
2165
|
async (key = primaryWorkspaceKey, variant) => {
|
|
1931
2166
|
const variantMaterial = variant && "kind" in variant.source ? {
|
|
1932
2167
|
id: `variant:${key}`,
|
|
@@ -1942,15 +2177,16 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1942
2177
|
const { controller, id } = fence.begin();
|
|
1943
2178
|
if (existing) {
|
|
1944
2179
|
try {
|
|
1945
|
-
const
|
|
2180
|
+
const scopeChanged = existing.scope !== initialScope;
|
|
2181
|
+
const allMatching = initialScope === "all-matching";
|
|
1946
2182
|
const fresh = await captureWorkspace(
|
|
1947
|
-
|
|
2183
|
+
initialScope,
|
|
1948
2184
|
controller.signal,
|
|
1949
|
-
!allMatching
|
|
2185
|
+
scopeChanged || !allMatching
|
|
1950
2186
|
);
|
|
1951
2187
|
if (!fence.valid(id, controller) || !workspaceCaptures.current.has(key))
|
|
1952
2188
|
return;
|
|
1953
|
-
if (allMatching && (!
|
|
2189
|
+
if (allMatching && (!fresh.allMatching || !scopeChanged && !existing.allMatching))
|
|
1954
2190
|
throw new Error(
|
|
1955
2191
|
"This source can no longer provide an all-matching snapshot."
|
|
1956
2192
|
);
|
|
@@ -1960,7 +2196,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1960
2196
|
columns: value.columns,
|
|
1961
2197
|
limits: value.limits
|
|
1962
2198
|
};
|
|
1963
|
-
const changed = allMatching ? JSON.stringify(collectionIdentity(existing.allMatching)) !== JSON.stringify(collectionIdentity(fresh.allMatching)) : snapshotContent(existing.snapshot) !== snapshotContent(fresh.snapshot);
|
|
2199
|
+
const changed = scopeChanged || (allMatching ? JSON.stringify(collectionIdentity(existing.allMatching)) !== JSON.stringify(collectionIdentity(fresh.allMatching)) : snapshotContent(existing.snapshot) !== snapshotContent(fresh.snapshot));
|
|
1964
2200
|
setWorkspaces((current) => {
|
|
1965
2201
|
const retained = current[key];
|
|
1966
2202
|
if (!retained) return current;
|
|
@@ -1969,7 +2205,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1969
2205
|
[key]: {
|
|
1970
2206
|
...retained,
|
|
1971
2207
|
error: fresh.collectionError,
|
|
1972
|
-
...allMatching ? { sourceStale: changed } : changed ? { pending: { ...fresh, scope:
|
|
2208
|
+
...allMatching && !scopeChanged ? { sourceStale: changed } : changed ? { pending: { ...fresh, scope: initialScope } } : { pending: void 0 }
|
|
1973
2209
|
}
|
|
1974
2210
|
};
|
|
1975
2211
|
});
|
|
@@ -2038,7 +2274,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2038
2274
|
workspaces
|
|
2039
2275
|
]
|
|
2040
2276
|
);
|
|
2041
|
-
|
|
2277
|
+
React10.useImperativeHandle(controllerRef, () => ({
|
|
2042
2278
|
focusTrigger: () => triggerRef.current?.focus(),
|
|
2043
2279
|
prepare: async (requestedSource, options) => {
|
|
2044
2280
|
const requestedLabel = options?.label ?? ("label" in requestedSource ? requestedSource.label : "content");
|
|
@@ -2047,7 +2283,7 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2047
2283
|
await openWorkspace(requestedKey, { source: requestedSource, label: requestedLabel });
|
|
2048
2284
|
}
|
|
2049
2285
|
}), [openWorkspace]);
|
|
2050
|
-
const runAction =
|
|
2286
|
+
const runAction = React10.useCallback(async (action) => {
|
|
2051
2287
|
const { controller, id } = fence.begin();
|
|
2052
2288
|
try {
|
|
2053
2289
|
const actionSource = action.source;
|
|
@@ -2064,6 +2300,31 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2064
2300
|
fence.finish(controller);
|
|
2065
2301
|
}
|
|
2066
2302
|
}, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
|
|
2303
|
+
const copyReference = async (reference) => {
|
|
2304
|
+
const { controller, id } = fence.begin();
|
|
2305
|
+
closePalette();
|
|
2306
|
+
try {
|
|
2307
|
+
if (!referencePort?.supports(reference)) throw new Error("This reference is not registered or its identity is incomplete.");
|
|
2308
|
+
const text = await referencePort.build(reference);
|
|
2309
|
+
if (!text.trim()) throw new Error("The reference serializer returned no content.");
|
|
2310
|
+
const artifact = sealTransferArtifact3({ snapshotId: `reference:${reference.id}`, draftRevision: 0, format: "matrx-reference", plainText: text, omissions: [] });
|
|
2311
|
+
if (!fence.valid(id, controller)) return;
|
|
2312
|
+
const outcome = await transport.copy(artifact, controller.signal);
|
|
2313
|
+
if (fence.valid(id, controller)) report(outcome);
|
|
2314
|
+
} catch (error) {
|
|
2315
|
+
if (fence.valid(id, controller)) report({ status: "error", code: "reference-failed", message: errorMessage(error, "Could not copy reference"), retryable: true });
|
|
2316
|
+
} finally {
|
|
2317
|
+
fence.finish(controller);
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
const openReference = async (action) => {
|
|
2321
|
+
closePalette();
|
|
2322
|
+
try {
|
|
2323
|
+
await action.run();
|
|
2324
|
+
} catch (error) {
|
|
2325
|
+
report({ status: "error", code: "reference-failed", message: errorMessage(error, "Could not open reference picker"), retryable: true });
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2067
2328
|
if (!enabled) return null;
|
|
2068
2329
|
const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
|
|
2069
2330
|
const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
|
|
@@ -2083,8 +2344,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2083
2344
|
label: "AI context",
|
|
2084
2345
|
supports: () => true,
|
|
2085
2346
|
build: async (draft) => {
|
|
2086
|
-
const json =
|
|
2087
|
-
return
|
|
2347
|
+
const json = serialize2(draft, "json");
|
|
2348
|
+
return sealTransferArtifact3({ snapshotId: draft.snapshotId, draftRevision: draft.revision, format: "ai-context", plainText: buildAgentPayload2({ kind: "matrx_content", location: sourceLabel, description: "Captured content for an assistant", data: JSON.parse(json.plainText), attributes: { source: draft.sourceId } }), omissions: [...json.omissions] });
|
|
2088
2349
|
}
|
|
2089
2350
|
};
|
|
2090
2351
|
const closePalette = () => setPaletteOpen(false);
|
|
@@ -2092,106 +2353,123 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
2092
2353
|
const presentation = options.action;
|
|
2093
2354
|
const Icon = presentation?.icon;
|
|
2094
2355
|
const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
|
|
2095
|
-
return /* @__PURE__ */
|
|
2356
|
+
return /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
|
|
2096
2357
|
closePalette();
|
|
2097
2358
|
onClick();
|
|
2098
2359
|
}, children: [
|
|
2099
|
-
Icon ? /* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2360
|
+
Icon ? /* @__PURE__ */ jsx11(Icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx11(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
|
|
2361
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2101
2362
|
label2,
|
|
2102
|
-
presentation?.hint ? /* @__PURE__ */
|
|
2363
|
+
presentation?.hint ? /* @__PURE__ */ jsx11("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
|
|
2103
2364
|
] })
|
|
2104
2365
|
] }, id);
|
|
2105
2366
|
};
|
|
2106
|
-
return /* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2367
|
+
return /* @__PURE__ */ jsxs6("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
2368
|
+
/* @__PURE__ */ jsxs6(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
2108
2369
|
setPaletteOpen(open);
|
|
2109
2370
|
if (open) {
|
|
2110
2371
|
setMode("copy");
|
|
2111
2372
|
void preflight();
|
|
2112
2373
|
}
|
|
2113
2374
|
}, children: [
|
|
2114
|
-
/* @__PURE__ */
|
|
2115
|
-
/* @__PURE__ */
|
|
2116
|
-
menuStatus === "loading" ? /* @__PURE__ */
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2375
|
+
/* @__PURE__ */ jsx11(PopoverTrigger, { asChild: true, children: triggerVariant === "outline" ? /* @__PURE__ */ jsx11(Button, { ref: triggerRef, variant: "outline", size: "icon-sm", "aria-label": `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "outline", disabled, children: /* @__PURE__ */ jsx11(AlchemyGlyph, { icon }) }) : triggerVariant === "glass" ? /* @__PURE__ */ jsx11(TapTargetButton, { ref: triggerRef, icon: /* @__PURE__ */ jsx11(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "glass", "data-alchemy-size": triggerSize, disabled }) : /* @__PURE__ */ jsx11(TapTargetButtonTransparent, { ref: triggerRef, icon: /* @__PURE__ */ jsx11(AlchemyGlyph, { icon }), tooltip: false, ariaLabel: `Copy, transform or export ${sourceLabel}`, "data-alchemy-trigger": "transparent", "data-alchemy-size": triggerSize, disabled }) }),
|
|
2376
|
+
/* @__PURE__ */ jsxs6(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
|
|
2377
|
+
menuStatus === "loading" ? /* @__PURE__ */ jsx11("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx11("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
2378
|
+
table && scopes.length > 1 ? /* @__PURE__ */ jsxs6("label", { className: "matrx-alchemy-scope", children: [
|
|
2379
|
+
"Content scope",
|
|
2380
|
+
/* @__PURE__ */ jsx11("select", { "aria-label": "Content scope", value: initialScope, onChange: (event) => {
|
|
2381
|
+
const next = scopes.find((scope) => scope === event.target.value);
|
|
2382
|
+
if (next) {
|
|
2383
|
+
setRequestedScope(next);
|
|
2384
|
+
void preflight(next);
|
|
2385
|
+
}
|
|
2386
|
+
}, children: scopes.map((scope) => /* @__PURE__ */ jsx11("option", { value: scope, children: table.scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
2387
|
+
] }) : null,
|
|
2388
|
+
copyAvailable || downloadAvailable ? /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-output", children: [
|
|
2389
|
+
/* @__PURE__ */ jsx11("h3", { children: resolvedMode === "copy" ? "Copy as" : "Download as" }),
|
|
2390
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
2391
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
2392
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
2122
2393
|
] }) : null,
|
|
2123
|
-
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */
|
|
2124
|
-
/* @__PURE__ */
|
|
2394
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2395
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2125
2396
|
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]}` })),
|
|
2126
2397
|
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
2127
2398
|
] }),
|
|
2128
|
-
quickVariants("copy").length ? /* @__PURE__ */
|
|
2399
|
+
quickVariants("copy").length ? /* @__PURE__ */ jsx11(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
2129
2400
|
closePalette();
|
|
2130
2401
|
void transfer("markdown", false, variant);
|
|
2131
2402
|
} }) : null
|
|
2132
2403
|
] }) : null,
|
|
2133
|
-
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */
|
|
2404
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx11(Fragment2, { children: /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
2134
2405
|
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]}` })),
|
|
2135
2406
|
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
2136
2407
|
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
2137
2408
|
] }) }) : null
|
|
2138
2409
|
] }) : null,
|
|
2139
|
-
prepareAvailable ? /* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2410
|
+
prepareAvailable ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2411
|
+
/* @__PURE__ */ jsx11(PaletteRows, { title: "Copy for AI", ai: true, glyphKind: "ai-copy", fallbackHint: "Copies immediately", extra: sourceFormats ? /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2141
2412
|
closePalette();
|
|
2142
2413
|
void transfer(nativeAiFormat, false);
|
|
2143
2414
|
}, children: [
|
|
2144
|
-
/* @__PURE__ */
|
|
2145
|
-
/* @__PURE__ */
|
|
2415
|
+
/* @__PURE__ */ jsx11(PaletteGlyph, { kind: "ai-copy" }),
|
|
2416
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2146
2417
|
"Copy with AI context",
|
|
2147
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ jsx11("small", { className: "matrx-alchemy-menu-hint", children: "Content, source and capture details" })
|
|
2148
2419
|
] })
|
|
2149
2420
|
] }) : null, items: quickVariants("ai"), onRun: (variant) => {
|
|
2150
2421
|
closePalette();
|
|
2151
2422
|
void transfer("markdown", false, variant);
|
|
2152
2423
|
} }),
|
|
2153
|
-
/* @__PURE__ */
|
|
2424
|
+
/* @__PURE__ */ jsx11(PaletteRows, { title: "Edit and prepare", items: [], extra: /* @__PURE__ */ jsxs6("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": "Prepare for AI", onClick: () => {
|
|
2154
2425
|
closePalette();
|
|
2155
2426
|
void openWorkspace();
|
|
2156
2427
|
}, children: [
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2428
|
+
/* @__PURE__ */ jsx11(PaletteGlyph, { kind: "sliders" }),
|
|
2429
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2159
2430
|
"Prepare for AI",
|
|
2160
|
-
/* @__PURE__ */
|
|
2431
|
+
/* @__PURE__ */ jsx11("small", { className: "matrx-alchemy-menu-hint", children: "Review and edit before copying" })
|
|
2161
2432
|
] })
|
|
2162
2433
|
] }) })
|
|
2163
2434
|
] }) : null,
|
|
2164
|
-
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */
|
|
2165
|
-
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */
|
|
2435
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx11(PaletteRows, { title: "Other sources", items: [], extra: /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2436
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
2166
2437
|
closePalette();
|
|
2167
2438
|
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
2168
|
-
}, children: /* @__PURE__ */
|
|
2169
|
-
variants.map((variant) => /* @__PURE__ */
|
|
2439
|
+
}, children: /* @__PURE__ */ jsx11("span", { children: "Prepare this surface" }) }) : null,
|
|
2440
|
+
variants.map((variant) => /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
2170
2441
|
closePalette();
|
|
2171
2442
|
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
2172
|
-
}, children: /* @__PURE__ */
|
|
2443
|
+
}, children: /* @__PURE__ */ jsx11(MenuPresentation, { ...variant, label: `Prepare ${variant.label}` }) }, variant.id))
|
|
2173
2444
|
] }) }) : null,
|
|
2174
|
-
|
|
2445
|
+
references.length || referenceActions.length ? /* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-palette-section", children: [
|
|
2446
|
+
/* @__PURE__ */ jsx11("h3", { children: "Live references" }),
|
|
2447
|
+
/* @__PURE__ */ jsx11("p", { className: "matrx-alchemy-menu-hint", children: "Pointers to saved data, independent of filters and edits." }),
|
|
2448
|
+
references.map((reference) => /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void copyReference(reference), children: /* @__PURE__ */ jsx11("span", { children: reference.label }) }, reference.id)),
|
|
2449
|
+
referenceActions.map((action) => /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => void openReference(action), children: /* @__PURE__ */ jsx11("span", { children: action.label }) }, action.id))
|
|
2450
|
+
] }) : null,
|
|
2451
|
+
["save", "chat", "email", "other"].map((group) => {
|
|
2175
2452
|
const entries = ordinaryActions.filter((action) => (action.group ?? "other") === group);
|
|
2176
|
-
return entries.length ? /* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
2178
|
-
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : "Actions",
|
|
2179
|
-
/* @__PURE__ */
|
|
2453
|
+
return entries.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-palette-destinations", children: [
|
|
2454
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2455
|
+
group === "save" ? "Save to Matrx" : group === "chat" ? "Continue with AI" : group === "email" ? "Email to me" : "Actions",
|
|
2456
|
+
/* @__PURE__ */ jsx11("span", { children: entries.length })
|
|
2180
2457
|
] }),
|
|
2181
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ jsx11("div", { children: entries.map((action) => /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
2182
2459
|
closePalette();
|
|
2183
2460
|
void runAction(action);
|
|
2184
|
-
}, children: /* @__PURE__ */
|
|
2461
|
+
}, children: /* @__PURE__ */ jsx11(DestinationPresentation, { action }) }, action.id)) })
|
|
2185
2462
|
] }, group) : null;
|
|
2186
2463
|
})
|
|
2187
2464
|
] })
|
|
2188
2465
|
] }),
|
|
2189
|
-
notice && triggerRef.current ? createPortal(/* @__PURE__ */
|
|
2190
|
-
/* @__PURE__ */
|
|
2191
|
-
/* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2466
|
+
notice && triggerRef.current ? createPortal(/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-feedback", children: [
|
|
2467
|
+
/* @__PURE__ */ jsx11("span", { role: "status", children: notice }),
|
|
2468
|
+
/* @__PURE__ */ jsx11(ReceiptLink, { target: receiptTarget }),
|
|
2469
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-label": "Dismiss Alchemy feedback", onClick: () => setNotice(null), children: "\xD7" })
|
|
2193
2470
|
] }), triggerRef.current.ownerDocument.body) : null,
|
|
2194
|
-
Object.values(workspaces).map((saved) => /* @__PURE__ */
|
|
2471
|
+
Object.values(workspaces).map((saved) => /* @__PURE__ */ jsx11(PreparationWorkspace, { restoreFocus: () => triggerRef.current?.focus(), open: workspaceOpen && workspaceKey === saved.key, state: saved, scopes, scopeLabels: table?.scopeLabels, 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)),
|
|
2472
|
+
emailReview
|
|
2195
2473
|
] });
|
|
2196
2474
|
}
|
|
2197
2475
|
function initialControls(state) {
|
|
@@ -2241,36 +2519,36 @@ function isBuiltInFormat(format) {
|
|
|
2241
2519
|
}
|
|
2242
2520
|
function preview(draft, format) {
|
|
2243
2521
|
const resolved = isBuiltInFormat(format) ? format : "plain";
|
|
2244
|
-
return
|
|
2522
|
+
return serialize2(draft, resolved === "xlsx" ? "tsv" : resolved, { spreadsheetSafe: resolved === "csv" || resolved === "tsv" || resolved === "xlsx" }).plainText;
|
|
2245
2523
|
}
|
|
2246
|
-
function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onChange, transport, ai, adapters, actions, onOutcome, captureScope }) {
|
|
2524
|
+
function PreparationWorkspace({ restoreFocus, open, state, scopes, scopeLabels, onClose, onChange, transport, ai, adapters, actions, onOutcome, captureScope }) {
|
|
2247
2525
|
const fence = useFence();
|
|
2248
|
-
const latest =
|
|
2526
|
+
const latest = React10.useRef(state);
|
|
2249
2527
|
latest.current = state;
|
|
2250
|
-
const aiSession =
|
|
2528
|
+
const aiSession = React10.useRef(void 0);
|
|
2251
2529
|
if (!aiSession.current && ai) aiSession.current = ai.fork?.() ?? ai;
|
|
2252
|
-
const [controls, setControls] =
|
|
2253
|
-
const [controlsHistory, setControlsHistory] =
|
|
2254
|
-
const [pendingControls, setPendingControls] =
|
|
2530
|
+
const [controls, setControls] = React10.useState(() => initialControls(state));
|
|
2531
|
+
const [controlsHistory, setControlsHistory] = React10.useState([]);
|
|
2532
|
+
const [pendingControls, setPendingControls] = React10.useState(null);
|
|
2255
2533
|
const requestedFormat = state.preferences.initialFormat;
|
|
2256
|
-
const [format, setFormat] =
|
|
2257
|
-
const [buffer, setBuffer] =
|
|
2258
|
-
const [bufferError, setBufferError] =
|
|
2259
|
-
const [formatError, setFormatError] =
|
|
2260
|
-
const [preparedArtifact, setPreparedArtifact] =
|
|
2261
|
-
const [instruction, setInstruction] =
|
|
2262
|
-
const [busy, setBusy] =
|
|
2263
|
-
const [aiFailed, setAiFailed] =
|
|
2264
|
-
|
|
2534
|
+
const [format, setFormat] = React10.useState(() => isBuiltInFormat(requestedFormat) ? supportsBuiltIn(requestedFormat, state.draft.payload) ? requestedFormat : "plain" : adapters.some((adapter) => adapter.id === requestedFormat && adapter.supports(state.draft.payload)) ? requestedFormat : "plain");
|
|
2535
|
+
const [buffer, setBuffer] = React10.useState(() => isBuiltInFormat(format) ? preview(state.draft, format) : "Preparing format preview\u2026");
|
|
2536
|
+
const [bufferError, setBufferError] = React10.useState(null);
|
|
2537
|
+
const [formatError, setFormatError] = React10.useState(null);
|
|
2538
|
+
const [preparedArtifact, setPreparedArtifact] = React10.useState(null);
|
|
2539
|
+
const [instruction, setInstruction] = React10.useState("");
|
|
2540
|
+
const [busy, setBusy] = React10.useState(null);
|
|
2541
|
+
const [aiFailed, setAiFailed] = React10.useState(false);
|
|
2542
|
+
React10.useEffect(() => {
|
|
2265
2543
|
setAiFailed(false);
|
|
2266
2544
|
}, [state.snapshot.id, state.draft.revision]);
|
|
2267
|
-
const handingOff =
|
|
2268
|
-
|
|
2545
|
+
const handingOff = React10.useRef(false);
|
|
2546
|
+
React10.useEffect(() => {
|
|
2269
2547
|
if (open) handingOff.current = false;
|
|
2270
2548
|
}, [open]);
|
|
2271
|
-
const activeAi =
|
|
2272
|
-
const activeCapture =
|
|
2273
|
-
|
|
2549
|
+
const activeAi = React10.useRef(null);
|
|
2550
|
+
const activeCapture = React10.useRef(null);
|
|
2551
|
+
React10.useEffect(() => {
|
|
2274
2552
|
if (bufferError) return;
|
|
2275
2553
|
const adapter = adapters.find((candidate) => candidate.id === format);
|
|
2276
2554
|
const controller = new AbortController();
|
|
@@ -2290,7 +2568,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2290
2568
|
});
|
|
2291
2569
|
return () => controller.abort();
|
|
2292
2570
|
}, [adapters, bufferError, format, state.draft, state.snapshot.id]);
|
|
2293
|
-
const close =
|
|
2571
|
+
const close = React10.useCallback(() => {
|
|
2294
2572
|
activeAi.current?.abort();
|
|
2295
2573
|
activeCapture.current?.abort();
|
|
2296
2574
|
activeAi.current = null;
|
|
@@ -2386,7 +2664,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2386
2664
|
const current = latest.current;
|
|
2387
2665
|
if (!fence.valid(id, controller) || current.snapshot.id !== snapshotId || current.draft.revision !== revision || next.snapshotId !== snapshotId || next.sourceId !== state.draft.sourceId || next.sourceRevision !== state.draft.sourceRevision || next.revision <= revision) return;
|
|
2388
2666
|
try {
|
|
2389
|
-
|
|
2667
|
+
serialize2(next, "plain");
|
|
2390
2668
|
} catch {
|
|
2391
2669
|
onChange({ ...current, error: "AI returned an invalid transfer draft." });
|
|
2392
2670
|
setAiFailed(true);
|
|
@@ -2419,8 +2697,8 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2419
2697
|
if (fence.valid(id, controller)) setBusy(null);
|
|
2420
2698
|
}
|
|
2421
2699
|
};
|
|
2422
|
-
const [deliveryNotice, setDeliveryNotice] =
|
|
2423
|
-
|
|
2700
|
+
const [deliveryNotice, setDeliveryNotice] = React10.useState(null);
|
|
2701
|
+
React10.useEffect(() => {
|
|
2424
2702
|
setDeliveryNotice(null);
|
|
2425
2703
|
}, [state.draft.revision]);
|
|
2426
2704
|
const reportDelivery = (outcome) => {
|
|
@@ -2471,40 +2749,40 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2471
2749
|
const workspaceAdapters = adapters.filter((adapter) => adapter.supports(state.draft.payload));
|
|
2472
2750
|
const displayedOmissions = preparedArtifact?.omissions ?? state.draft.omissions;
|
|
2473
2751
|
const limitText = Object.entries(state.preferences.limits).filter(([, value]) => value != null).map(([key, value]) => `${key.replace(/^max/, "max ")} ${formatCount2(Number(value))}`).join(" \xB7 ");
|
|
2474
|
-
return /* @__PURE__ */
|
|
2752
|
+
return /* @__PURE__ */ jsx11(Dialog, { open, onOpenChange: (next) => {
|
|
2475
2753
|
if (!next) close();
|
|
2476
|
-
}, children: /* @__PURE__ */
|
|
2754
|
+
}, children: /* @__PURE__ */ jsxs6(DialogContent, { onCloseAutoFocus: (event) => {
|
|
2477
2755
|
event.preventDefault();
|
|
2478
2756
|
if (!handingOff.current) restoreFocus();
|
|
2479
2757
|
}, className: "matrx-alchemy-workspace max-w-5xl", "aria-busy": busy !== null, children: [
|
|
2480
|
-
/* @__PURE__ */
|
|
2481
|
-
/* @__PURE__ */
|
|
2758
|
+
/* @__PURE__ */ jsxs6(DialogHeader, { children: [
|
|
2759
|
+
/* @__PURE__ */ jsxs6(DialogTitle, { children: [
|
|
2482
2760
|
"Prepare ",
|
|
2483
2761
|
state.snapshot.label
|
|
2484
2762
|
] }),
|
|
2485
|
-
/* @__PURE__ */
|
|
2763
|
+
/* @__PURE__ */ jsxs6(DialogDescription, { children: [
|
|
2486
2764
|
state.snapshot.unsavedChanges ? "Includes your unsaved changes. " : "",
|
|
2487
2765
|
"Review and edit this copy. Your original stays unchanged."
|
|
2488
2766
|
] })
|
|
2489
2767
|
] }),
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
scopes.length > 1 ? /* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-body", children: [
|
|
2769
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-workspace-grid", children: [
|
|
2770
|
+
/* @__PURE__ */ jsxs6("section", { className: "matrx-alchemy-main", children: [
|
|
2771
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-toolbar", children: [
|
|
2772
|
+
scopes.length > 1 ? /* @__PURE__ */ jsxs6("label", { children: [
|
|
2495
2773
|
"Scope",
|
|
2496
|
-
/* @__PURE__ */
|
|
2774
|
+
/* @__PURE__ */ jsx11("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx11("option", { value: scope, children: scopeLabels?.[scope] ?? SCOPE_LABEL[scope] }, scope)) })
|
|
2497
2775
|
] }) : null,
|
|
2498
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2499
2777
|
"Detail",
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
/* @__PURE__ */
|
|
2504
|
-
/* @__PURE__ */
|
|
2778
|
+
/* @__PURE__ */ jsxs6("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
|
|
2779
|
+
/* @__PURE__ */ jsx11("option", { value: "full", children: "Full" }),
|
|
2780
|
+
/* @__PURE__ */ jsx11("option", { value: "compact", children: "Compact" }),
|
|
2781
|
+
/* @__PURE__ */ jsx11("option", { value: "brief", children: "Brief" }),
|
|
2782
|
+
/* @__PURE__ */ jsx11("option", { value: "custom", children: "Custom" })
|
|
2505
2783
|
] })
|
|
2506
2784
|
] }),
|
|
2507
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsx11(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: !state.draft.history?.length && !controlsHistory.length || busy !== null, onClick: () => {
|
|
2508
2786
|
setBufferError(null);
|
|
2509
2787
|
if (controlsHistory.length) {
|
|
2510
2788
|
const next = controlsHistory[controlsHistory.length - 1];
|
|
@@ -2513,7 +2791,7 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2513
2791
|
onChange({ ...state, draft: rebuild(state, next), error: void 0 });
|
|
2514
2792
|
} else onChange({ ...state, draft: undoDraft(state.draft), error: void 0 });
|
|
2515
2793
|
}, children: "Undo" }),
|
|
2516
|
-
/* @__PURE__ */
|
|
2794
|
+
/* @__PURE__ */ jsx11(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => {
|
|
2517
2795
|
const next = initialControls(state);
|
|
2518
2796
|
setControls(next);
|
|
2519
2797
|
setControlsHistory([]);
|
|
@@ -2521,64 +2799,64 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2521
2799
|
setBufferError(null);
|
|
2522
2800
|
onChange({ ...state, draft: rebuild(state, next), error: void 0 });
|
|
2523
2801
|
}, children: "Reset" }),
|
|
2524
|
-
/* @__PURE__ */
|
|
2802
|
+
/* @__PURE__ */ jsx11(Button, { type: "button", size: "sm", variant: "outline", className: "matrx-alchemy-workspace-secondary", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
|
|
2525
2803
|
] }),
|
|
2526
|
-
controls.preset === "custom" ? /* @__PURE__ */
|
|
2527
|
-
/* @__PURE__ */
|
|
2528
|
-
[["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__ */
|
|
2804
|
+
controls.preset === "custom" ? /* @__PURE__ */ jsxs6("fieldset", { className: "matrx-alchemy-options", children: [
|
|
2805
|
+
/* @__PURE__ */ jsx11("legend", { children: state.draft.payload.kind === "json" || state.draft.payload.kind === "registered" ? "JSON limits" : "Content limits" }),
|
|
2806
|
+
[["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__ */ jsxs6("label", { children: [
|
|
2529
2807
|
text,
|
|
2530
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsx11("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
2531
2809
|
] }, key))
|
|
2532
2810
|
] }) : null,
|
|
2533
|
-
rows ? /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2811
|
+
rows ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options matrx-alchemy-data-controls", children: [
|
|
2812
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2535
2813
|
"Data selection \xB7 ",
|
|
2536
2814
|
controls.visibleColumns.length,
|
|
2537
2815
|
" columns",
|
|
2538
2816
|
controls.search || controls.sort || controls.top != null || controls.selectedOnly || Object.values(controls.filters).some(Boolean) ? " \xB7 customized" : " \xB7 all rows"
|
|
2539
2817
|
] }),
|
|
2540
|
-
/* @__PURE__ */
|
|
2818
|
+
/* @__PURE__ */ jsx11("div", { className: "matrx-alchemy-data-controls-body", children: /* @__PURE__ */ jsx11(RowControls, { rows, controls, change: changeControls }) })
|
|
2541
2819
|
] }) : null,
|
|
2542
|
-
state.snapshot.sections.length ? /* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2820
|
+
state.snapshot.sections.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
|
|
2821
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2544
2822
|
"Sections \xB7 ",
|
|
2545
2823
|
controls.sections.length,
|
|
2546
2824
|
" included"
|
|
2547
2825
|
] }),
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
/* @__PURE__ */
|
|
2826
|
+
/* @__PURE__ */ jsx11("fieldset", { "aria-label": "Included sections", children: state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs6("label", { children: [
|
|
2827
|
+
/* @__PURE__ */ jsx11("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) }) }),
|
|
2550
2828
|
" ",
|
|
2551
2829
|
section.label
|
|
2552
2830
|
] }, section.id)) })
|
|
2553
2831
|
] }) : null,
|
|
2554
|
-
/* @__PURE__ */
|
|
2832
|
+
/* @__PURE__ */ jsxs6("label", { className: "matrx-alchemy-preview-label", children: [
|
|
2555
2833
|
"Output format",
|
|
2556
|
-
/* @__PURE__ */
|
|
2557
|
-
formats.map((f) => /* @__PURE__ */
|
|
2558
|
-
state.draft.payload.kind === "rows" ? /* @__PURE__ */
|
|
2559
|
-
workspaceAdapters.map((adapter) => /* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ jsxs6("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
|
|
2835
|
+
formats.map((f) => /* @__PURE__ */ jsx11("option", { value: f, children: LABEL[f] }, f)),
|
|
2836
|
+
state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx11("option", { value: "xlsx", children: "Excel workbook" }) : null,
|
|
2837
|
+
workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx11("option", { value: adapter.id, children: adapter.label }, adapter.id))
|
|
2560
2838
|
] })
|
|
2561
2839
|
] }),
|
|
2562
|
-
/* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2840
|
+
/* @__PURE__ */ jsx11("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) }),
|
|
2841
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-coverage", children: [
|
|
2842
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
2565
2843
|
state.snapshot.coverage.included.toLocaleString(),
|
|
2566
2844
|
" included",
|
|
2567
2845
|
state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
|
|
2568
2846
|
" \xB7 ",
|
|
2569
2847
|
state.snapshot.coverage.status
|
|
2570
2848
|
] }),
|
|
2571
|
-
state.snapshot.coverage.reason ? /* @__PURE__ */
|
|
2572
|
-
limitText ? /* @__PURE__ */
|
|
2849
|
+
state.snapshot.coverage.reason ? /* @__PURE__ */ jsx11("span", { children: state.snapshot.coverage.reason }) : null,
|
|
2850
|
+
limitText ? /* @__PURE__ */ jsxs6("span", { children: [
|
|
2573
2851
|
"Limits: ",
|
|
2574
2852
|
limitText
|
|
2575
2853
|
] }) : null,
|
|
2576
|
-
displayedOmissions.length ? /* @__PURE__ */
|
|
2577
|
-
/* @__PURE__ */
|
|
2854
|
+
displayedOmissions.length ? /* @__PURE__ */ jsxs6("details", { children: [
|
|
2855
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2578
2856
|
displayedOmissions.length,
|
|
2579
2857
|
" omissions or adjustments"
|
|
2580
2858
|
] }),
|
|
2581
|
-
/* @__PURE__ */
|
|
2859
|
+
/* @__PURE__ */ jsx11("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs6("li", { children: [
|
|
2582
2860
|
o.path || "/",
|
|
2583
2861
|
": ",
|
|
2584
2862
|
o.reason,
|
|
@@ -2586,79 +2864,86 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2586
2864
|
] }, `${o.path}-${o.reason}-${i}`)) })
|
|
2587
2865
|
] }) : null
|
|
2588
2866
|
] }),
|
|
2589
|
-
bufferError ? /* @__PURE__ */
|
|
2590
|
-
formatError ? /* @__PURE__ */
|
|
2591
|
-
bufferError ? /* @__PURE__ */
|
|
2867
|
+
bufferError ? /* @__PURE__ */ jsx11("p", { id: "alchemy-buffer-error", role: "alert", className: "matrx-alchemy-error", children: bufferError }) : null,
|
|
2868
|
+
formatError ? /* @__PURE__ */ jsx11("p", { role: "alert", className: "matrx-alchemy-error", children: formatError }) : null,
|
|
2869
|
+
bufferError ? /* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", disabled: busy !== null, onClick: () => {
|
|
2592
2870
|
const fallback = editDraft(state.draft, { kind: "text", text: buffer });
|
|
2593
2871
|
setBufferError(null);
|
|
2594
2872
|
onChange({ ...state, draft: fallback, error: void 0 });
|
|
2595
2873
|
setFormat("plain");
|
|
2596
2874
|
}, children: "Use invalid JSON as plain text" }) : null
|
|
2597
2875
|
] }),
|
|
2598
|
-
ai || busy === "capture" || state.error ? /* @__PURE__ */
|
|
2599
|
-
ai ? /* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2876
|
+
ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs6("aside", { children: [
|
|
2877
|
+
ai ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2878
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2601
2879
|
"Start with",
|
|
2602
|
-
/* @__PURE__ */
|
|
2880
|
+
/* @__PURE__ */ jsxs6("select", { "aria-label": "AI preparation recipe", defaultValue: "", onChange: (event) => {
|
|
2603
2881
|
if (event.target.value) setInstruction(event.target.value);
|
|
2604
2882
|
}, children: [
|
|
2605
|
-
/* @__PURE__ */
|
|
2606
|
-
/* @__PURE__ */
|
|
2607
|
-
/* @__PURE__ */
|
|
2608
|
-
/* @__PURE__ */
|
|
2609
|
-
/* @__PURE__ */
|
|
2610
|
-
/* @__PURE__ */
|
|
2611
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "Choose an instruction" }),
|
|
2884
|
+
/* @__PURE__ */ jsx11("option", { value: "Summarize this content concisely. Preserve important facts, names, decisions, and source references.", children: "Summarize" }),
|
|
2885
|
+
/* @__PURE__ */ jsx11("option", { value: "Extract decisions, action items, owners, and due dates. Mark missing details as unspecified.", children: "Extract action items" }),
|
|
2886
|
+
/* @__PURE__ */ jsx11("option", { value: "Prepare a complete handoff for another assistant. Include the objective, relevant facts, constraints, decisions, and unresolved questions.", children: "Assistant handoff" }),
|
|
2887
|
+
/* @__PURE__ */ jsx11("option", { value: "Condense this content by removing repetition and formatting noise. Preserve every unique fact and all identifiers.", children: "Condense without losing facts" }),
|
|
2888
|
+
/* @__PURE__ */ jsx11("option", { value: "Turn this content into a clear structured outline. Keep the original meaning and explicitly flag uncertainty.", children: "Create an outline" }),
|
|
2889
|
+
/* @__PURE__ */ jsx11("option", { value: "Analyze this data. Identify patterns, anomalies, and useful comparisons. Distinguish observations from inferences.", children: "Analyze the data" })
|
|
2612
2890
|
] })
|
|
2613
2891
|
] }),
|
|
2614
|
-
/* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2615
2893
|
"AI instruction",
|
|
2616
|
-
/* @__PURE__ */
|
|
2894
|
+
/* @__PURE__ */ jsx11("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
|
|
2617
2895
|
] }),
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
busy === "ai" ? /* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ jsx11(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" }),
|
|
2897
|
+
busy === "ai" ? /* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => void cancelAi(), children: aiSession.current?.cancel ? "Cancel AI" : "Stop waiting" }) : null
|
|
2620
2898
|
] }) : null,
|
|
2621
|
-
busy === "capture" ? /* @__PURE__ */
|
|
2899
|
+
busy === "capture" ? /* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => {
|
|
2622
2900
|
activeCapture.current?.abort();
|
|
2623
2901
|
activeCapture.current = null;
|
|
2624
2902
|
setBusy(null);
|
|
2625
2903
|
}, children: "Stop loading rows" }) : null,
|
|
2626
|
-
ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */
|
|
2627
|
-
ai ? /* @__PURE__ */
|
|
2628
|
-
state.error ? /* @__PURE__ */
|
|
2904
|
+
ai && aiFailed && aiSession.current?.recover && busy !== "ai" ? /* @__PURE__ */ jsx11(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,
|
|
2905
|
+
ai ? /* @__PURE__ */ jsx11("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,
|
|
2906
|
+
state.error ? /* @__PURE__ */ jsx11("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
|
|
2629
2907
|
] }) : null
|
|
2630
2908
|
] }),
|
|
2631
|
-
pendingControls ? /* @__PURE__ */
|
|
2632
|
-
/* @__PURE__ */
|
|
2633
|
-
/* @__PURE__ */
|
|
2634
|
-
/* @__PURE__ */
|
|
2909
|
+
pendingControls ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2910
|
+
/* @__PURE__ */ jsx11("p", { children: "This control would replace your manual edit." }),
|
|
2911
|
+
/* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
|
|
2912
|
+
/* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
|
|
2635
2913
|
] }) : null,
|
|
2636
|
-
state.sourceStale ? /* @__PURE__ */
|
|
2637
|
-
state.pending ? /* @__PURE__ */
|
|
2638
|
-
/* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2640
|
-
|
|
2914
|
+
state.sourceStale ? /* @__PURE__ */ jsx11("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
|
|
2915
|
+
state.pending ? /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2916
|
+
/* @__PURE__ */ jsx11("p", { children: "A fresh source snapshot is ready." }),
|
|
2917
|
+
state.pending.scope !== state.scope ? /* @__PURE__ */ jsxs6("p", { children: [
|
|
2918
|
+
"Switch from ",
|
|
2919
|
+
scopeLabels?.[state.scope] ?? SCOPE_LABEL[state.scope],
|
|
2920
|
+
" to ",
|
|
2921
|
+
scopeLabels?.[state.pending.scope] ?? SCOPE_LABEL[state.pending.scope],
|
|
2922
|
+
" by regenerating. Your current draft is retained until you choose."
|
|
2923
|
+
] }) : null,
|
|
2924
|
+
/* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-secondary", type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
|
|
2925
|
+
/* @__PURE__ */ jsx11(Button, { className: "matrx-alchemy-workspace-primary", type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
|
|
2641
2926
|
] }) : null,
|
|
2642
|
-
eligibleActions.length ? /* @__PURE__ */
|
|
2643
|
-
/* @__PURE__ */
|
|
2927
|
+
eligibleActions.length ? /* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options matrx-alchemy-destinations", children: [
|
|
2928
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2644
2929
|
"Use prepared content \xB7 ",
|
|
2645
2930
|
eligibleActions.length,
|
|
2646
2931
|
" destinations"
|
|
2647
2932
|
] }),
|
|
2648
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ jsx11("div", { className: "matrx-alchemy-destination-grid", children: eligibleActions.map((action) => /* @__PURE__ */ jsx11("button", { type: "button", className: "matrx-alchemy-palette-row", disabled: busy !== null || Boolean(bufferError || formatError) || !preparedArtifact, onClick: () => void deliverAction(action), children: /* @__PURE__ */ jsx11(DestinationPresentation, { action }) }, action.id)) })
|
|
2649
2934
|
] }) : null,
|
|
2650
|
-
deliveryNotice ? /* @__PURE__ */
|
|
2935
|
+
deliveryNotice ? /* @__PURE__ */ jsx11("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null
|
|
2651
2936
|
] }),
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsxs6(DialogFooter, { children: [
|
|
2938
|
+
/* @__PURE__ */ jsxs6("span", { className: "matrx-alchemy-meta", children: [
|
|
2654
2939
|
buffer.length.toLocaleString(),
|
|
2655
2940
|
" characters \xB7 ~",
|
|
2656
2941
|
estimateTokens(buffer).toLocaleString(),
|
|
2657
2942
|
" tokens"
|
|
2658
2943
|
] }),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsx11(Button, { type: "button", variant: "outline", className: "matrx-alchemy-workspace-secondary", onClick: close, children: "Close" }),
|
|
2945
|
+
/* @__PURE__ */ jsx11(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" }),
|
|
2946
|
+
/* @__PURE__ */ jsx11(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" })
|
|
2662
2947
|
] })
|
|
2663
2948
|
] }) });
|
|
2664
2949
|
}
|
|
@@ -2666,59 +2951,59 @@ function RowControls({ rows, controls, change }) {
|
|
|
2666
2951
|
const filterCount = Object.values(controls.filters).filter(Boolean).length;
|
|
2667
2952
|
const selectionSummary = controls.selectedOnly ? `${controls.selectedIndices.length} selected row${controls.selectedIndices.length === 1 ? "" : "s"}` : "All rows";
|
|
2668
2953
|
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 ");
|
|
2669
|
-
return /* @__PURE__ */
|
|
2670
|
-
/* @__PURE__ */
|
|
2671
|
-
/* @__PURE__ */
|
|
2954
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2955
|
+
/* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-toolbar", children: [
|
|
2956
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2672
2957
|
"Search",
|
|
2673
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsx11("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
|
|
2674
2959
|
] }),
|
|
2675
|
-
/* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2676
2961
|
"Sort",
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2679
|
-
rows.columns.map((column) => /* @__PURE__ */
|
|
2962
|
+
/* @__PURE__ */ jsxs6("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
|
|
2963
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "None" }),
|
|
2964
|
+
rows.columns.map((column) => /* @__PURE__ */ jsx11("option", { value: column.id, children: column.label }, column.id))
|
|
2680
2965
|
] })
|
|
2681
2966
|
] }),
|
|
2682
|
-
/* @__PURE__ */
|
|
2967
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2683
2968
|
"Direction",
|
|
2684
|
-
/* @__PURE__ */
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2969
|
+
/* @__PURE__ */ jsxs6("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
|
|
2970
|
+
/* @__PURE__ */ jsx11("option", { value: "asc", children: "Ascending" }),
|
|
2971
|
+
/* @__PURE__ */ jsx11("option", { value: "desc", children: "Descending" })
|
|
2687
2972
|
] })
|
|
2688
2973
|
] }),
|
|
2689
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2690
2975
|
"Top rows",
|
|
2691
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsx11("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
2692
2977
|
] })
|
|
2693
2978
|
] }),
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
|
|
2980
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2696
2981
|
"Columns and filters",
|
|
2697
2982
|
dataSummary ? ` \u2014 ${dataSummary}` : ""
|
|
2698
2983
|
] }),
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2984
|
+
/* @__PURE__ */ jsx11("fieldset", { "aria-label": "Columns and filters", children: rows.columns.map((column) => /* @__PURE__ */ jsxs6("div", { className: "matrx-alchemy-column", children: [
|
|
2985
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
2986
|
+
/* @__PURE__ */ jsx11("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) }) }),
|
|
2702
2987
|
" ",
|
|
2703
2988
|
column.label
|
|
2704
2989
|
] }),
|
|
2705
|
-
/* @__PURE__ */
|
|
2990
|
+
/* @__PURE__ */ jsx11("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 } }) })
|
|
2706
2991
|
] }, column.id)) })
|
|
2707
2992
|
] }),
|
|
2708
|
-
/* @__PURE__ */
|
|
2709
|
-
/* @__PURE__ */
|
|
2993
|
+
/* @__PURE__ */ jsxs6("details", { className: "matrx-alchemy-options", children: [
|
|
2994
|
+
/* @__PURE__ */ jsxs6("summary", { children: [
|
|
2710
2995
|
"Rows \u2014 ",
|
|
2711
2996
|
selectionSummary
|
|
2712
2997
|
] }),
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2998
|
+
/* @__PURE__ */ jsxs6("fieldset", { "aria-label": "Row selection", children: [
|
|
2999
|
+
/* @__PURE__ */ jsxs6("label", { children: [
|
|
3000
|
+
/* @__PURE__ */ jsx11("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
|
|
2716
3001
|
" Only selected rows"
|
|
2717
3002
|
] }),
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(
|
|
2720
|
-
return /* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
3003
|
+
/* @__PURE__ */ jsx11("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
|
|
3004
|
+
const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell2(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
|
|
3005
|
+
return /* @__PURE__ */ jsxs6("label", { children: [
|
|
3006
|
+
/* @__PURE__ */ jsx11("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) }) }),
|
|
2722
3007
|
" Row ",
|
|
2723
3008
|
index + 1,
|
|
2724
3009
|
summary ? ` \u2014 ${summary}` : ""
|
|
@@ -2739,8 +3024,11 @@ export {
|
|
|
2739
3024
|
MatrxCopyMenu,
|
|
2740
3025
|
applyGroomerPreset,
|
|
2741
3026
|
buildGroomerPresetPayload,
|
|
3027
|
+
createTransferEmailActions,
|
|
2742
3028
|
defaultGroomerSelections,
|
|
2743
3029
|
groomerPresetVariants,
|
|
3030
|
+
tableDataFormat,
|
|
3031
|
+
tableSchemaFormat,
|
|
2744
3032
|
useContentTransferCapabilities,
|
|
2745
3033
|
useContentTransferSurface
|
|
2746
3034
|
};
|