@ai-matrx/design-system 0.18.9 → 0.18.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/content-transfer.cjs +163 -202
- package/dist/content-transfer.cjs.map +1 -1
- package/dist/content-transfer.css +43 -30
- package/dist/content-transfer.d.cts +4 -0
- package/dist/content-transfer.d.ts +4 -0
- package/dist/content-transfer.js +225 -264
- package/dist/content-transfer.js.map +1 -1
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/data-row-inspector.cjs +163 -202
- package/dist/data-table/data-row-inspector.cjs.map +1 -1
- package/dist/data-table/data-row-inspector.js +245 -284
- package/dist/data-table/data-row-inspector.js.map +1 -1
- package/dist/data-table/data-row-window.cjs +163 -202
- package/dist/data-table/data-row-window.cjs.map +1 -1
- package/dist/data-table/data-row-window.js +245 -284
- package/dist/data-table/data-row-window.js.map +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/host.cjs.map +1 -1
- package/dist/data-table/host.d.cts +2 -0
- package/dist/data-table/host.d.ts +2 -0
- package/dist/data-table/host.js.map +1 -1
- package/dist/data-table/index.cjs +1192 -732
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +24 -3
- package/dist/data-table/index.d.ts +24 -3
- package/dist/data-table/index.js +1264 -804
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/pagination.cjs +5 -5
- package/dist/data-table/pagination.cjs.map +1 -1
- package/dist/data-table/pagination.js +5 -5
- package/dist/data-table/pagination.js.map +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -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 +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +4 -0
- package/dist/tokens.css +2 -0
- package/dist/{types-cH8oLqUx.d.ts → types-C2xN6W_q.d.ts} +46 -3
- package/dist/{types-0CNCWvdK.d.cts → types-D_tpuk6m.d.cts} +46 -3
- package/package.json +1 -1
package/dist/content-transfer.js
CHANGED
|
@@ -156,48 +156,6 @@ function XIcon(props) {
|
|
|
156
156
|
/* @__PURE__ */ jsx2("path", { d: "m6 6 12 12" })
|
|
157
157
|
] });
|
|
158
158
|
}
|
|
159
|
-
function radixProps(props) {
|
|
160
|
-
return {
|
|
161
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
162
|
-
viewBox: "0 0 15 15",
|
|
163
|
-
width: 15,
|
|
164
|
-
height: 15,
|
|
165
|
-
fill: "none",
|
|
166
|
-
"aria-hidden": true,
|
|
167
|
-
...props
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function CheckIcon(props) {
|
|
171
|
-
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
172
|
-
"path",
|
|
173
|
-
{
|
|
174
|
-
d: "M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",
|
|
175
|
-
fill: "currentColor",
|
|
176
|
-
fillRule: "evenodd",
|
|
177
|
-
clipRule: "evenodd"
|
|
178
|
-
}
|
|
179
|
-
) });
|
|
180
|
-
}
|
|
181
|
-
function DotFilledIcon(props) {
|
|
182
|
-
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
183
|
-
"path",
|
|
184
|
-
{
|
|
185
|
-
d: "M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",
|
|
186
|
-
fill: "currentColor"
|
|
187
|
-
}
|
|
188
|
-
) });
|
|
189
|
-
}
|
|
190
|
-
function RadixChevronRightIcon(props) {
|
|
191
|
-
return /* @__PURE__ */ jsx2("svg", { ...radixProps(props), children: /* @__PURE__ */ jsx2(
|
|
192
|
-
"path",
|
|
193
|
-
{
|
|
194
|
-
d: "M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",
|
|
195
|
-
fill: "currentColor",
|
|
196
|
-
fillRule: "evenodd",
|
|
197
|
-
clipRule: "evenodd"
|
|
198
|
-
}
|
|
199
|
-
) });
|
|
200
|
-
}
|
|
201
159
|
|
|
202
160
|
// src/portal-container.tsx
|
|
203
161
|
import * as React2 from "react";
|
|
@@ -461,132 +419,45 @@ var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
461
419
|
));
|
|
462
420
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
463
421
|
|
|
464
|
-
// src/
|
|
465
|
-
import * as
|
|
422
|
+
// src/popover.tsx
|
|
423
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
466
424
|
import * as React6 from "react";
|
|
467
|
-
import { jsx as jsx6
|
|
468
|
-
var
|
|
469
|
-
var
|
|
470
|
-
var
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
"data-slot": "dropdown-menu-sub-trigger",
|
|
478
|
-
className: cn(
|
|
479
|
-
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
|
|
480
|
-
inset && "pl-8",
|
|
481
|
-
className
|
|
482
|
-
),
|
|
483
|
-
...props,
|
|
484
|
-
children: [
|
|
485
|
-
children,
|
|
486
|
-
/* @__PURE__ */ jsx6(RadixChevronRightIcon, { className: "ml-auto h-4 w-4" })
|
|
487
|
-
]
|
|
488
|
-
}
|
|
489
|
-
));
|
|
490
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
491
|
-
var DropdownMenuSubContent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
492
|
-
DropdownMenuPrimitive.SubContent,
|
|
493
|
-
{
|
|
494
|
-
ref,
|
|
495
|
-
"data-slot": "dropdown-menu-sub-content",
|
|
496
|
-
className: cn(MENU_SURFACE_CLASS, "shadow-lg", MOTION_POPPER, className),
|
|
497
|
-
...props
|
|
498
|
-
}
|
|
499
|
-
));
|
|
500
|
-
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
501
|
-
var DropdownMenuContent = React6.forwardRef(({ className, sideOffset = 4, container, ...props }, ref) => {
|
|
502
|
-
const portalContainer = usePortalContainer(container);
|
|
503
|
-
return /* @__PURE__ */ jsx6(DropdownMenuPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx6(
|
|
504
|
-
DropdownMenuPrimitive.Content,
|
|
505
|
-
{
|
|
506
|
-
ref,
|
|
507
|
-
"data-slot": "dropdown-menu-content",
|
|
508
|
-
sideOffset,
|
|
509
|
-
className: cn(
|
|
510
|
-
MENU_SURFACE_CLASS,
|
|
511
|
-
"shadow-md",
|
|
512
|
-
MOTION_POPPER,
|
|
513
|
-
className
|
|
514
|
-
),
|
|
515
|
-
...props
|
|
516
|
-
}
|
|
517
|
-
) });
|
|
518
|
-
});
|
|
519
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
520
|
-
var DropdownMenuItem = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
521
|
-
DropdownMenuPrimitive.Item,
|
|
522
|
-
{
|
|
523
|
-
ref,
|
|
524
|
-
"data-slot": "dropdown-menu-item",
|
|
525
|
-
className: cn(MENU_ITEM_CLASS, inset && "pl-8", className),
|
|
526
|
-
...props
|
|
527
|
-
}
|
|
528
|
-
));
|
|
529
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
530
|
-
var DropdownMenuCheckboxItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
531
|
-
DropdownMenuPrimitive.CheckboxItem,
|
|
532
|
-
{
|
|
533
|
-
ref,
|
|
534
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
535
|
-
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
536
|
-
...props,
|
|
537
|
-
children: [
|
|
538
|
-
/* @__PURE__ */ jsx6("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx6(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx6(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
539
|
-
children
|
|
540
|
-
]
|
|
541
|
-
}
|
|
542
|
-
));
|
|
543
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
544
|
-
var DropdownMenuRadioItem = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs3(
|
|
545
|
-
DropdownMenuPrimitive.RadioItem,
|
|
546
|
-
{
|
|
547
|
-
ref,
|
|
548
|
-
"data-slot": "dropdown-menu-radio-item",
|
|
549
|
-
className: cn(MENU_INDICATOR_ITEM_CLASS, className),
|
|
550
|
-
...props,
|
|
551
|
-
children: [
|
|
552
|
-
/* @__PURE__ */ jsx6("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx6(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx6(DotFilledIcon, { className: "h-4 w-4 fill-current" }) }) }),
|
|
553
|
-
children
|
|
554
|
-
]
|
|
555
|
-
}
|
|
556
|
-
));
|
|
557
|
-
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
558
|
-
var DropdownMenuLabel = React6.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
559
|
-
DropdownMenuPrimitive.Label,
|
|
560
|
-
{
|
|
561
|
-
ref,
|
|
562
|
-
"data-slot": "dropdown-menu-label",
|
|
563
|
-
className: cn("px-2 py-1.5 text-sm font-semibold", inset && "pl-8", className),
|
|
564
|
-
...props
|
|
565
|
-
}
|
|
566
|
-
));
|
|
567
|
-
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
568
|
-
var DropdownMenuSeparator = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
569
|
-
DropdownMenuPrimitive.Separator,
|
|
570
|
-
{
|
|
571
|
-
ref,
|
|
572
|
-
"data-slot": "dropdown-menu-separator",
|
|
573
|
-
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
574
|
-
...props
|
|
575
|
-
}
|
|
576
|
-
));
|
|
577
|
-
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
578
|
-
var DropdownMenuShortcut = ({
|
|
579
|
-
className,
|
|
580
|
-
...props
|
|
581
|
-
}) => /* @__PURE__ */ jsx6(
|
|
582
|
-
"span",
|
|
583
|
-
{
|
|
584
|
-
"data-slot": "dropdown-menu-shortcut",
|
|
585
|
-
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
425
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
426
|
+
var Popover = PopoverPrimitive.Root;
|
|
427
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
428
|
+
var PopoverContent = React6.forwardRef(
|
|
429
|
+
({
|
|
430
|
+
className,
|
|
431
|
+
align = "center",
|
|
432
|
+
sideOffset = 4,
|
|
433
|
+
container,
|
|
434
|
+
animated = true,
|
|
586
435
|
...props
|
|
436
|
+
}, ref) => {
|
|
437
|
+
const portalContainer = usePortalContainer(container);
|
|
438
|
+
return /* @__PURE__ */ jsx6(PopoverPrimitive.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx6(
|
|
439
|
+
PopoverPrimitive.Content,
|
|
440
|
+
{
|
|
441
|
+
ref,
|
|
442
|
+
align,
|
|
443
|
+
sideOffset,
|
|
444
|
+
className: cn(
|
|
445
|
+
// Cap to the viewport space Radix measured and scroll — a popover taller
|
|
446
|
+
// than the screen must never trap the user with unreachable content.
|
|
447
|
+
// z must EQUAL the dialog layer (z-[10000]), never exceed it: with equal
|
|
448
|
+
// z, DOM portal order decides, so a dialog opened FROM a popover stacks
|
|
449
|
+
// above it, and a popover opened from a dialog still stacks above the
|
|
450
|
+
// dialog. z-[10001] buried dialogs behind fullscreen popovers.
|
|
451
|
+
"z-[10000] w-72 max-h-[var(--radix-popover-content-available-height)] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
|
|
452
|
+
animated && MOTION_POPPER,
|
|
453
|
+
className
|
|
454
|
+
),
|
|
455
|
+
...props
|
|
456
|
+
}
|
|
457
|
+
) });
|
|
587
458
|
}
|
|
588
459
|
);
|
|
589
|
-
|
|
460
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
590
461
|
|
|
591
462
|
// src/content-transfer/icon.ts
|
|
592
463
|
var ALCHEMY_GLYPH_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 5.5h8v11h-8z"/><path d="M8.5 9.5h8v9h-8z"/><path d="m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z"/></svg>';
|
|
@@ -600,7 +471,7 @@ import {
|
|
|
600
471
|
normalizeTransferJson,
|
|
601
472
|
sealTransferArtifact
|
|
602
473
|
} from "@ai-matrx/kit/content-transfer";
|
|
603
|
-
import { Fragment, jsx as jsx7, jsxs as
|
|
474
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
604
475
|
var resolve = (value) => typeof value === "function" ? value() : value;
|
|
605
476
|
var asPayload = (value) => ({
|
|
606
477
|
kind: "markdown",
|
|
@@ -771,6 +642,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
771
642
|
label: item.label,
|
|
772
643
|
supports: () => true,
|
|
773
644
|
...item.build && !item.onSelect ? {
|
|
645
|
+
placement: "download",
|
|
774
646
|
source: make(
|
|
775
647
|
`export:${item.id}`,
|
|
776
648
|
async () => {
|
|
@@ -842,7 +714,7 @@ function MatrxCopyMenuSession(props) {
|
|
|
842
714
|
const source = (props.primarySource === "table" ? table : void 0) ?? json ?? table ?? structuredAgent ?? human ?? builderVariants[0]?.source;
|
|
843
715
|
if (!source && !actions.length) return null;
|
|
844
716
|
const target = source ?? make("actions", () => ({ kind: "text", text: props.label }));
|
|
845
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
846
718
|
/* @__PURE__ */ jsx7(
|
|
847
719
|
ContentTransferMenu,
|
|
848
720
|
{
|
|
@@ -851,10 +723,11 @@ function MatrxCopyMenuSession(props) {
|
|
|
851
723
|
label: props.label,
|
|
852
724
|
variants,
|
|
853
725
|
actions,
|
|
726
|
+
sourceFormats: Boolean(source),
|
|
854
727
|
hide: [
|
|
855
728
|
...!copyVisible || !source ? ["copy"] : [],
|
|
856
729
|
...!aiVisible || !source ? ["prepare"] : [],
|
|
857
|
-
...!exportVisible
|
|
730
|
+
...!exportVisible ? ["download"] : []
|
|
858
731
|
],
|
|
859
732
|
formatSources: {
|
|
860
733
|
...human ? { plain: human, markdown: humanMarkdown, html: humanMarkdown } : {},
|
|
@@ -963,7 +836,7 @@ function SourceConfiguration({
|
|
|
963
836
|
onOpenChange: (open) => {
|
|
964
837
|
if (!open && !busy) onClose();
|
|
965
838
|
},
|
|
966
|
-
children: /* @__PURE__ */
|
|
839
|
+
children: /* @__PURE__ */ jsxs3(
|
|
967
840
|
DialogContent,
|
|
968
841
|
{
|
|
969
842
|
onCloseAutoFocus: (event) => {
|
|
@@ -972,12 +845,12 @@ function SourceConfiguration({
|
|
|
972
845
|
},
|
|
973
846
|
className: "matrx-alchemy-workspace",
|
|
974
847
|
children: [
|
|
975
|
-
/* @__PURE__ */
|
|
848
|
+
/* @__PURE__ */ jsxs3(DialogHeader, { children: [
|
|
976
849
|
/* @__PURE__ */ jsx7(DialogTitle, { children: title }),
|
|
977
850
|
/* @__PURE__ */ jsx7(DialogDescription, { children: custom?.dialogDescription ?? "Choose the source detail, then prepare, edit, summarize, copy or export it in Alchemy." })
|
|
978
851
|
] }),
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
custom?.options.map((option) => /* @__PURE__ */
|
|
852
|
+
/* @__PURE__ */ jsxs3("div", { className: "matrx-alchemy-main matrx-alchemy-toolbar", children: [
|
|
853
|
+
custom?.options.map((option) => /* @__PURE__ */ jsxs3("label", { children: [
|
|
981
854
|
option.label,
|
|
982
855
|
"hint" in option && option.hint ? /* @__PURE__ */ jsx7("small", { children: option.hint }) : null,
|
|
983
856
|
option.kind === "toggle" ? /* @__PURE__ */ jsx7(
|
|
@@ -997,7 +870,7 @@ function SourceConfiguration({
|
|
|
997
870
|
}),
|
|
998
871
|
children: option.options.map((choice) => /* @__PURE__ */ jsx7("option", { value: choice.value, children: choice.label }, choice.value))
|
|
999
872
|
}
|
|
1000
|
-
) : option.kind === "slider" ? /* @__PURE__ */
|
|
873
|
+
) : option.kind === "slider" ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1001
874
|
/* @__PURE__ */ jsx7(
|
|
1002
875
|
"input",
|
|
1003
876
|
{
|
|
@@ -1013,7 +886,7 @@ function SourceConfiguration({
|
|
|
1013
886
|
}
|
|
1014
887
|
),
|
|
1015
888
|
/* @__PURE__ */ jsx7("span", { children: option.formatValue(Number(values[option.key])) })
|
|
1016
|
-
] }) : /* @__PURE__ */
|
|
889
|
+
] }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1017
890
|
/* @__PURE__ */ jsx7(
|
|
1018
891
|
"input",
|
|
1019
892
|
{
|
|
@@ -1039,7 +912,7 @@ function SourceConfiguration({
|
|
|
1039
912
|
))
|
|
1040
913
|
] })
|
|
1041
914
|
] }, option.key)),
|
|
1042
|
-
groomer ? /* @__PURE__ */
|
|
915
|
+
groomer ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1043
916
|
/* @__PURE__ */ jsx7("div", { children: ["full", "compact", "brief"].map((level) => /* @__PURE__ */ jsx7(
|
|
1044
917
|
Button,
|
|
1045
918
|
{
|
|
@@ -1057,9 +930,9 @@ function SourceConfiguration({
|
|
|
1057
930
|
},
|
|
1058
931
|
level
|
|
1059
932
|
)) }),
|
|
1060
|
-
groomer.sections.map((section) => /* @__PURE__ */
|
|
933
|
+
groomer.sections.map((section) => /* @__PURE__ */ jsxs3("label", { children: [
|
|
1061
934
|
section.title,
|
|
1062
|
-
/* @__PURE__ */
|
|
935
|
+
/* @__PURE__ */ jsxs3(
|
|
1063
936
|
"select",
|
|
1064
937
|
{
|
|
1065
938
|
value: sections[section.id],
|
|
@@ -1077,7 +950,7 @@ function SourceConfiguration({
|
|
|
1077
950
|
] }, section.id))
|
|
1078
951
|
] }) : null
|
|
1079
952
|
] }),
|
|
1080
|
-
/* @__PURE__ */
|
|
953
|
+
/* @__PURE__ */ jsxs3("p", { children: [
|
|
1081
954
|
text.length.toLocaleString(),
|
|
1082
955
|
" characters \xB7 approximately",
|
|
1083
956
|
" ",
|
|
@@ -1085,7 +958,7 @@ function SourceConfiguration({
|
|
|
1085
958
|
" tokens"
|
|
1086
959
|
] }),
|
|
1087
960
|
error || buildError ? /* @__PURE__ */ jsx7("p", { role: "alert", children: error ?? buildError }) : null,
|
|
1088
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsxs3(DialogFooter, { children: [
|
|
1089
962
|
/* @__PURE__ */ jsx7(
|
|
1090
963
|
Button,
|
|
1091
964
|
{
|
|
@@ -1186,9 +1059,9 @@ function groomerPresetVariants(getConfig) {
|
|
|
1186
1059
|
}
|
|
1187
1060
|
|
|
1188
1061
|
// src/content-transfer/index.tsx
|
|
1189
|
-
import { Fragment as Fragment2, jsx as jsx8, jsxs as
|
|
1062
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1190
1063
|
function AlchemyGlyph(props) {
|
|
1191
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", ...props, children: [
|
|
1192
1065
|
/* @__PURE__ */ jsx8("path", { d: "M4.5 5.5h8v11h-8z" }),
|
|
1193
1066
|
/* @__PURE__ */ jsx8("path", { d: "M8.5 9.5h8v9h-8z" }),
|
|
1194
1067
|
/* @__PURE__ */ jsx8("path", { d: "m18.5 3 .65 1.85L21 5.5l-1.85.65L18.5 8l-.65-1.85L16 5.5l1.85-.65z" })
|
|
@@ -1205,14 +1078,61 @@ function ContentTransferSurfaceProvider({ handle, children }) {
|
|
|
1205
1078
|
}
|
|
1206
1079
|
var useContentTransferSurface = () => React8.useContext(SurfaceContext);
|
|
1207
1080
|
function MenuPresentation({ label, hint, icon: Icon }) {
|
|
1208
|
-
return /* @__PURE__ */
|
|
1081
|
+
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1209
1082
|
Icon ? /* @__PURE__ */ jsx8(Icon, { className: "matrx-alchemy-menu-icon" }) : null,
|
|
1210
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1211
1084
|
label,
|
|
1212
1085
|
hint ? /* @__PURE__ */ jsx8("small", { className: "matrx-alchemy-menu-hint", children: hint }) : null
|
|
1213
1086
|
] })
|
|
1214
1087
|
] });
|
|
1215
1088
|
}
|
|
1089
|
+
function PaletteGlyph({ format, ai = false, file = false }) {
|
|
1090
|
+
if (ai) return /* @__PURE__ */ jsxs4("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1091
|
+
/* @__PURE__ */ jsx8("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" }),
|
|
1092
|
+
/* @__PURE__ */ jsx8("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" }),
|
|
1093
|
+
/* @__PURE__ */ jsx8("path", { d: "M12 5v14M8 9h1M15 9h1M8 15h1M15 15h1" })
|
|
1094
|
+
] });
|
|
1095
|
+
if (file) return /* @__PURE__ */ jsxs4("svg", { className: "matrx-alchemy-palette-glyph", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1096
|
+
/* @__PURE__ */ jsx8("path", { d: "M6 3h8l4 4v14H6z" }),
|
|
1097
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 3v5h5M9 13h6M9 17h6" })
|
|
1098
|
+
] });
|
|
1099
|
+
const path = format === "json" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1100
|
+
/* @__PURE__ */ jsx8("path", { d: "M9 4C7 4 7 7 5 7v3c2 0 2 1 2 2s0 2-2 2v3c2 0 2 3 4 3" }),
|
|
1101
|
+
/* @__PURE__ */ jsx8("path", { d: "M15 4c2 0 2 3 4 3v3c-2 0-2 1-2 2s0 2 2 2v3c-2 0-2 3-4 3" })
|
|
1102
|
+
] }) : format === "compact-json" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1103
|
+
/* @__PURE__ */ jsx8("path", { d: "m14 10 7-7" }),
|
|
1104
|
+
/* @__PURE__ */ jsx8("path", { d: "M20 10h-6V4" }),
|
|
1105
|
+
/* @__PURE__ */ jsx8("path", { d: "m3 21 7-7" }),
|
|
1106
|
+
/* @__PURE__ */ jsx8("path", { d: "M4 14h6v6" })
|
|
1107
|
+
] }) : format === "csv" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1108
|
+
/* @__PURE__ */ jsx8("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
|
|
1109
|
+
/* @__PURE__ */ jsx8("path", { d: "M4 10h16M10 4v16" })
|
|
1110
|
+
] }) : format === "tsv" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1111
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1112
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2v6h6M8 13h2M14 13h2M8 17h2M14 17h2" })
|
|
1113
|
+
] }) : format === "xlsx" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1114
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1115
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2v6h6M8 13h8M8 17h8M12 11v8" })
|
|
1116
|
+
] }) : format === "markdown" ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1117
|
+
/* @__PURE__ */ jsx8("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5z" }),
|
|
1118
|
+
/* @__PURE__ */ jsx8("path", { d: "M14 2v6h6M10 13l-2 2 2 2M14 17l2-2-2-2" })
|
|
1119
|
+
] }) : format === "html" ? /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsx8("path", { d: "M15 6h6M3 6h7M3 12h18M3 18h12" }) }) : /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsx8("path", { d: "M4 7V4h16v3M9 20h6M12 4v16" }) });
|
|
1120
|
+
return /* @__PURE__ */ jsx8("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 });
|
|
1121
|
+
}
|
|
1122
|
+
function PaletteRows({ title, items, onRun, extra, ai = false }) {
|
|
1123
|
+
if (!items.length && !extra) return null;
|
|
1124
|
+
return /* @__PURE__ */ jsxs4("section", { className: "matrx-alchemy-palette-section", children: [
|
|
1125
|
+
/* @__PURE__ */ jsx8("h3", { children: title }),
|
|
1126
|
+
items.map((item) => /* @__PURE__ */ jsxs4("button", { type: "button", className: cn("matrx-alchemy-palette-row", ai && "matrx-alchemy-palette-row-ai"), "aria-label": item.ariaLabel, onClick: () => onRun?.(item), children: [
|
|
1127
|
+
item.icon ? /* @__PURE__ */ jsx8(item.icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx8(PaletteGlyph, { ai }),
|
|
1128
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1129
|
+
item.copyLabel ?? item.label,
|
|
1130
|
+
item.hint ? /* @__PURE__ */ jsx8("small", { className: "matrx-alchemy-menu-hint", children: item.hint }) : null
|
|
1131
|
+
] })
|
|
1132
|
+
] }, item.id)),
|
|
1133
|
+
extra
|
|
1134
|
+
] });
|
|
1135
|
+
}
|
|
1216
1136
|
var LABEL = { plain: "Plain text", markdown: "Markdown", html: "Formatted", json: "JSON", "compact-json": "Compact JSON", csv: "CSV", tsv: "Google Sheets", xlsx: "Excel workbook" };
|
|
1217
1137
|
var BUILT_INS = Object.freeze(Object.keys(LABEL).map((id) => ({ id })));
|
|
1218
1138
|
var COPIES = ["plain", "markdown", "html", "json", "compact-json", "csv", "tsv"];
|
|
@@ -1301,7 +1221,7 @@ function ContentTransferMenu(props) {
|
|
|
1301
1221
|
const identityKey = props.capabilities?.identityKey ?? inherited.identityKey;
|
|
1302
1222
|
return /* @__PURE__ */ jsx8(ContentTransferMenuSession, { ...props }, identityKey ?? "anonymous");
|
|
1303
1223
|
}
|
|
1304
|
-
function ContentTransferMenuSession({ source, surface, label, projection, sections, preferences, table, formatSources, variants = EMPTY_VARIANTS, actions = [], capabilities: local, disabled, enabled = true, className, stopPropagation = true, hide = [], controllerRef }) {
|
|
1224
|
+
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 }) {
|
|
1305
1225
|
const triggerRef = React8.useRef(null);
|
|
1306
1226
|
const inherited = React8.useContext(CapabilityContext);
|
|
1307
1227
|
const nearestSurface = React8.useContext(SurfaceContext);
|
|
@@ -1314,6 +1234,8 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1314
1234
|
const workspaceCaptures = React8.useRef(/* @__PURE__ */ new Map());
|
|
1315
1235
|
const externalWorkspaceKeys = React8.useRef(/* @__PURE__ */ new Set());
|
|
1316
1236
|
const [notice, setNotice] = React8.useState(null);
|
|
1237
|
+
const [paletteOpen, setPaletteOpen] = React8.useState(false);
|
|
1238
|
+
const [mode, setMode] = React8.useState("copy");
|
|
1317
1239
|
const scopes = React8.useMemo(() => table?.availableScopes ?? ["target"], [table]);
|
|
1318
1240
|
const initialScope = table?.initialScope ?? "target";
|
|
1319
1241
|
if (!scopes.includes(initialScope)) throw new Error("Alchemy initialScope must be included in availableScopes.");
|
|
@@ -1565,48 +1487,87 @@ function ContentTransferMenuSession({ source, surface, label, projection, sectio
|
|
|
1565
1487
|
}, [captureOne, capturePrimary, fence, initialScope, preferences, providerPreferences, report]);
|
|
1566
1488
|
if (!enabled) return null;
|
|
1567
1489
|
const payload = menuCapture?.snapshot.payload ?? (source && "kind" in source ? source : void 0);
|
|
1568
|
-
const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section)
|
|
1569
|
-
const visibleCopies = COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows");
|
|
1570
|
-
const visibleDownloads = DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows");
|
|
1571
|
-
const visibleAdapters = menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
|
|
1490
|
+
const quickVariants = (section) => variants.filter((v) => v.copyLabel && (v.section ?? "ai") === section);
|
|
1491
|
+
const visibleCopies = sourceFormats ? COPIES.filter((f) => Boolean(formatSources?.[f]) || !["csv", "tsv"].includes(f) || payload?.kind === "rows") : [];
|
|
1492
|
+
const visibleDownloads = sourceFormats ? DOWNLOADS.filter((f) => f !== "xlsx" && Boolean(formatSources?.[f]) || !["csv", "tsv", "xlsx"].includes(f) || payload?.kind === "rows") : [];
|
|
1493
|
+
const visibleAdapters = sourceFormats && menuCapture ? adapters.filter((a) => a.supports(menuCapture.snapshot.payload)) : [];
|
|
1572
1494
|
const visibleActions = menuCapture ? registeredActions.filter((a) => a.supports(menuCapture.snapshot)) : [];
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1495
|
+
const downloadActions = visibleActions.filter((action) => action.placement === "download");
|
|
1496
|
+
const ordinaryActions = visibleActions.filter((action) => action.placement !== "download");
|
|
1497
|
+
const copyAvailable = !hide.includes("copy") && visibleCopies.length + visibleAdapters.length + quickVariants("copy").length > 0;
|
|
1498
|
+
const downloadAvailable = !hide.includes("download") && visibleDownloads.length + visibleAdapters.length + downloadActions.length > 0;
|
|
1499
|
+
const prepareAvailable = !hide.includes("prepare") && (quickVariants("ai").length > 0 || Boolean(primary) || Boolean(nearestWorkspaceKey) || variants.length > 0);
|
|
1500
|
+
const resolvedMode = mode === "copy" && !copyAvailable ? "download" : mode === "download" && !downloadAvailable ? "copy" : mode;
|
|
1501
|
+
const closePalette = () => setPaletteOpen(false);
|
|
1502
|
+
const tile = (id, label2, onClick, options = {}) => {
|
|
1503
|
+
const presentation = options.action;
|
|
1504
|
+
const Icon = presentation?.icon;
|
|
1505
|
+
const fallbackLabel = options.file && !/^download\b/i.test(label2) ? `Download ${label2}` : label2;
|
|
1506
|
+
return /* @__PURE__ */ jsxs4("button", { type: "button", className: "matrx-alchemy-palette-tile", "aria-label": presentation?.ariaLabel ?? (presentation ? fallbackLabel : options.ariaLabel ?? `${resolvedMode === "copy" ? "Copy" : "Download"} ${label2}`), onClick: () => {
|
|
1507
|
+
closePalette();
|
|
1508
|
+
onClick();
|
|
1576
1509
|
}, children: [
|
|
1577
|
-
/* @__PURE__ */ jsx8(
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1510
|
+
Icon ? /* @__PURE__ */ jsx8(Icon, { className: "matrx-alchemy-menu-icon" }) : /* @__PURE__ */ jsx8(PaletteGlyph, { ...!options.custom ? { format: id } : {}, ...options.ai ? { ai: true } : {}, ...options.file ? { file: true } : {} }),
|
|
1511
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1512
|
+
label2,
|
|
1513
|
+
presentation?.hint ? /* @__PURE__ */ jsx8("small", { className: "matrx-alchemy-menu-hint", children: presentation.hint }) : null
|
|
1514
|
+
] })
|
|
1515
|
+
] }, id);
|
|
1516
|
+
};
|
|
1517
|
+
return /* @__PURE__ */ jsxs4("span", { className: cn("matrx-alchemy", className), onClick: stopPropagation ? (event) => event.stopPropagation() : void 0, children: [
|
|
1518
|
+
/* @__PURE__ */ jsxs4(Popover, { open: paletteOpen, onOpenChange: (open) => {
|
|
1519
|
+
setPaletteOpen(open);
|
|
1520
|
+
if (open) {
|
|
1521
|
+
setMode("copy");
|
|
1522
|
+
void preflight();
|
|
1523
|
+
}
|
|
1524
|
+
}, children: [
|
|
1525
|
+
/* @__PURE__ */ jsx8(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx8("button", { ref: triggerRef, type: "button", className: "matrx-alchemy-trigger", disabled, "aria-label": `Copy, transform or export ${sourceLabel}`, title: "Alchemy \u2014 copy, transform, export", children: /* @__PURE__ */ jsx8(AlchemyGlyph, {}) }) }),
|
|
1526
|
+
/* @__PURE__ */ jsxs4(PopoverContent, { align: "end", className: "matrx-alchemy-menu matrx-alchemy-palette", "aria-label": "Alchemy output options", onCloseAutoFocus: () => triggerRef.current?.focus(), children: [
|
|
1527
|
+
copyAvailable && downloadAvailable ? /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-mode", "aria-label": "Output action", children: [
|
|
1528
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Copy mode", "aria-pressed": resolvedMode === "copy", onClick: () => setMode("copy"), children: "Copy" }),
|
|
1529
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "aria-label": "Download mode", "aria-pressed": resolvedMode === "download", onClick: () => setMode("download"), children: "Download" })
|
|
1595
1530
|
] }) : null,
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
] }, `download:${adapter.id}`))
|
|
1531
|
+
menuStatus === "loading" ? /* @__PURE__ */ jsx8("p", { className: "matrx-alchemy-palette-status", children: "Inspecting content\u2026" }) : menuStatus !== "idle" ? /* @__PURE__ */ jsx8("p", { className: "matrx-alchemy-error", children: menuStatus }) : null,
|
|
1532
|
+
resolvedMode === "copy" && copyAvailable ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1533
|
+
/* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1534
|
+
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]}` })),
|
|
1535
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, false), { custom: true }))
|
|
1536
|
+
] }),
|
|
1537
|
+
quickVariants("copy").length ? /* @__PURE__ */ jsx8(PaletteRows, { title: "Quick copy", items: quickVariants("copy"), onRun: (variant) => {
|
|
1538
|
+
closePalette();
|
|
1539
|
+
void transfer("markdown", false, variant);
|
|
1540
|
+
} }) : null
|
|
1607
1541
|
] }) : null,
|
|
1608
|
-
|
|
1609
|
-
|
|
1542
|
+
resolvedMode === "download" && downloadAvailable ? /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-palette-grid", children: [
|
|
1543
|
+
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]}` })),
|
|
1544
|
+
visibleAdapters.map((adapter) => tile(adapter.id, adapter.label, () => void transfer(adapter, true), { custom: true })),
|
|
1545
|
+
downloadActions.map((action) => tile(action.id, action.label, () => void runAction(action), { custom: true, action, file: true }))
|
|
1546
|
+
] }) }) : null,
|
|
1547
|
+
prepareAvailable ? /* @__PURE__ */ jsx8(PaletteRows, { title: "Prepare", ai: true, items: quickVariants("ai"), onRun: (variant) => {
|
|
1548
|
+
closePalette();
|
|
1549
|
+
void transfer("markdown", false, variant);
|
|
1550
|
+
}, extra: /* @__PURE__ */ jsxs4("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1551
|
+
closePalette();
|
|
1552
|
+
void openWorkspace();
|
|
1553
|
+
}, children: [
|
|
1554
|
+
/* @__PURE__ */ jsx8(PaletteGlyph, { ai: true }),
|
|
1555
|
+
/* @__PURE__ */ jsx8("span", { children: "Prepare for AI\u2026" })
|
|
1556
|
+
] }) }) : null,
|
|
1557
|
+
prepareAvailable && (nearestWorkspaceKey || variants.length) ? /* @__PURE__ */ jsx8(PaletteRows, { title: "Context", items: [], extra: /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1558
|
+
nearestWorkspaceKey && nearestSurface ? /* @__PURE__ */ jsx8("button", { type: "button", className: "matrx-alchemy-palette-row", onClick: () => {
|
|
1559
|
+
closePalette();
|
|
1560
|
+
void openWorkspace(nearestWorkspaceKey, { source: nearestSurface, label: nearestSurface.surfaceName });
|
|
1561
|
+
}, children: /* @__PURE__ */ jsx8("span", { children: "Prepare this surface\u2026" }) }) : null,
|
|
1562
|
+
variants.map((variant) => /* @__PURE__ */ jsx8("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": variant.ariaLabel, onClick: () => {
|
|
1563
|
+
closePalette();
|
|
1564
|
+
void openWorkspace(variantWorkspaceKeys.get(variant.id), variant);
|
|
1565
|
+
}, children: /* @__PURE__ */ jsx8(MenuPresentation, { ...variant, label: `Prepare ${variant.label}\u2026` }) }, variant.id))
|
|
1566
|
+
] }) }) : null,
|
|
1567
|
+
ordinaryActions.length ? /* @__PURE__ */ jsx8(PaletteRows, { title: "Actions", items: [], extra: ordinaryActions.map((action) => /* @__PURE__ */ jsx8("button", { type: "button", className: "matrx-alchemy-palette-row", "aria-label": action.ariaLabel, onClick: () => {
|
|
1568
|
+
closePalette();
|
|
1569
|
+
void runAction(action);
|
|
1570
|
+
}, children: /* @__PURE__ */ jsx8(MenuPresentation, { ...action, label: action.label }) }, action.id)) }) : null
|
|
1610
1571
|
] })
|
|
1611
1572
|
] }),
|
|
1612
1573
|
notice ? /* @__PURE__ */ jsx8("span", { className: "matrx-alchemy-notice", role: "status", children: notice }) : null,
|
|
@@ -1869,31 +1830,31 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1869
1830
|
const limitText = Object.entries(state.preferences.limits).filter(([, value]) => value != null).map(([key, value]) => `${key.replace(/^max/, "max ")} ${Number(value).toLocaleString()}`).join(" \xB7 ");
|
|
1870
1831
|
return /* @__PURE__ */ jsx8(Dialog, { open, onOpenChange: (next) => {
|
|
1871
1832
|
if (!next) close();
|
|
1872
|
-
}, children: /* @__PURE__ */
|
|
1833
|
+
}, children: /* @__PURE__ */ jsxs4(DialogContent, { onCloseAutoFocus: (event) => {
|
|
1873
1834
|
event.preventDefault();
|
|
1874
1835
|
restoreFocus();
|
|
1875
1836
|
}, className: "matrx-alchemy-workspace max-w-5xl", "aria-busy": busy !== null, children: [
|
|
1876
|
-
/* @__PURE__ */
|
|
1877
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsxs4(DialogHeader, { children: [
|
|
1838
|
+
/* @__PURE__ */ jsxs4(DialogTitle, { children: [
|
|
1878
1839
|
"Prepare ",
|
|
1879
1840
|
state.snapshot.label
|
|
1880
1841
|
] }),
|
|
1881
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ jsxs4(DialogDescription, { children: [
|
|
1882
1843
|
"Captured ",
|
|
1883
1844
|
state.snapshot.unsavedChanges ? "from your unsaved draft" : "as an immutable snapshot",
|
|
1884
1845
|
". Your source is never edited."
|
|
1885
1846
|
] })
|
|
1886
1847
|
] }),
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
/* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
scopes.length > 1 ? /* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-workspace-grid", children: [
|
|
1849
|
+
/* @__PURE__ */ jsxs4("section", { className: "matrx-alchemy-main", children: [
|
|
1850
|
+
/* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-toolbar", children: [
|
|
1851
|
+
scopes.length > 1 ? /* @__PURE__ */ jsxs4("label", { children: [
|
|
1891
1852
|
"Scope",
|
|
1892
1853
|
/* @__PURE__ */ jsx8("select", { "aria-label": "Transfer scope", value: state.scope, disabled: busy !== null, onChange: (e) => void requestCapture(e.target.value), children: scopes.map((scope) => /* @__PURE__ */ jsx8("option", { value: scope, children: SCOPE_LABEL[scope] }, scope)) })
|
|
1893
1854
|
] }) : null,
|
|
1894
|
-
/* @__PURE__ */
|
|
1855
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1895
1856
|
"Detail",
|
|
1896
|
-
/* @__PURE__ */
|
|
1857
|
+
/* @__PURE__ */ jsxs4("select", { "aria-label": "Detail preset", value: controls.preset, onChange: (e) => changeControls({ ...controls, preset: e.target.value }), children: [
|
|
1897
1858
|
/* @__PURE__ */ jsx8("option", { value: "full", children: "Full" }),
|
|
1898
1859
|
/* @__PURE__ */ jsx8("option", { value: "compact", children: "Compact" }),
|
|
1899
1860
|
/* @__PURE__ */ jsx8("option", { value: "brief", children: "Brief" }),
|
|
@@ -1919,24 +1880,24 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1919
1880
|
}, children: "Reset" }),
|
|
1920
1881
|
/* @__PURE__ */ jsx8(Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void requestCapture(state.scope), children: "Refresh source" })
|
|
1921
1882
|
] }),
|
|
1922
|
-
controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */
|
|
1883
|
+
controls.preset === "custom" && (state.draft.payload.kind === "json" || state.draft.payload.kind === "registered") ? /* @__PURE__ */ jsxs4("fieldset", { className: "matrx-alchemy-options", children: [
|
|
1923
1884
|
/* @__PURE__ */ jsx8("legend", { children: "JSON limits" }),
|
|
1924
|
-
[["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */
|
|
1885
|
+
[["maxDepth", "Maximum depth"], ["maxStringChars", "Maximum string characters"], ["maxArrayItems", "Maximum array items"]].map(([key, text]) => /* @__PURE__ */ jsxs4("label", { children: [
|
|
1925
1886
|
text,
|
|
1926
1887
|
/* @__PURE__ */ jsx8("input", { type: "number", min: "0", value: controls[key] ?? "", onChange: (e) => changeControls({ ...controls, [key]: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
1927
1888
|
] }, key))
|
|
1928
1889
|
] }) : null,
|
|
1929
1890
|
rows ? /* @__PURE__ */ jsx8(RowControls, { rows, controls, change: changeControls }) : null,
|
|
1930
|
-
state.snapshot.sections.length ? /* @__PURE__ */
|
|
1891
|
+
state.snapshot.sections.length ? /* @__PURE__ */ jsxs4("fieldset", { className: "matrx-alchemy-options", children: [
|
|
1931
1892
|
/* @__PURE__ */ jsx8("legend", { children: "Sections" }),
|
|
1932
|
-
state.snapshot.sections.map((section) => /* @__PURE__ */
|
|
1893
|
+
state.snapshot.sections.map((section) => /* @__PURE__ */ jsxs4("label", { children: [
|
|
1933
1894
|
/* @__PURE__ */ jsx8("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) }) }),
|
|
1934
1895
|
" ",
|
|
1935
1896
|
section.label
|
|
1936
1897
|
] }, section.id))
|
|
1937
1898
|
] }) : null,
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
1899
|
+
/* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-coverage", children: [
|
|
1900
|
+
/* @__PURE__ */ jsxs4("span", { children: [
|
|
1940
1901
|
state.snapshot.coverage.included.toLocaleString(),
|
|
1941
1902
|
" included",
|
|
1942
1903
|
state.snapshot.coverage.total == null ? "" : ` of ${state.snapshot.coverage.total.toLocaleString()}`,
|
|
@@ -1944,16 +1905,16 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1944
1905
|
state.snapshot.coverage.status
|
|
1945
1906
|
] }),
|
|
1946
1907
|
state.snapshot.coverage.reason ? /* @__PURE__ */ jsx8("span", { children: state.snapshot.coverage.reason }) : null,
|
|
1947
|
-
limitText ? /* @__PURE__ */
|
|
1908
|
+
limitText ? /* @__PURE__ */ jsxs4("span", { children: [
|
|
1948
1909
|
"Limits: ",
|
|
1949
1910
|
limitText
|
|
1950
1911
|
] }) : null,
|
|
1951
|
-
displayedOmissions.length ? /* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
1912
|
+
displayedOmissions.length ? /* @__PURE__ */ jsxs4("details", { children: [
|
|
1913
|
+
/* @__PURE__ */ jsxs4("summary", { children: [
|
|
1953
1914
|
displayedOmissions.length,
|
|
1954
1915
|
" omissions or adjustments"
|
|
1955
1916
|
] }),
|
|
1956
|
-
/* @__PURE__ */ jsx8("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */
|
|
1917
|
+
/* @__PURE__ */ jsx8("ul", { children: displayedOmissions.map((o, i) => /* @__PURE__ */ jsxs4("li", { children: [
|
|
1957
1918
|
o.path || "/",
|
|
1958
1919
|
": ",
|
|
1959
1920
|
o.reason,
|
|
@@ -1961,9 +1922,9 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1961
1922
|
] }, `${o.path}-${o.reason}-${i}`)) })
|
|
1962
1923
|
] }) : null
|
|
1963
1924
|
] }),
|
|
1964
|
-
/* @__PURE__ */
|
|
1925
|
+
/* @__PURE__ */ jsxs4("label", { className: "matrx-alchemy-preview-label", children: [
|
|
1965
1926
|
"Output format",
|
|
1966
|
-
/* @__PURE__ */
|
|
1927
|
+
/* @__PURE__ */ jsxs4("select", { "aria-label": "Output format", value: format, onChange: (e) => setFormat(e.target.value), children: [
|
|
1967
1928
|
formats.map((f) => /* @__PURE__ */ jsx8("option", { value: f, children: LABEL[f] }, f)),
|
|
1968
1929
|
state.draft.payload.kind === "rows" ? /* @__PURE__ */ jsx8("option", { value: "xlsx", children: "Excel workbook" }) : null,
|
|
1969
1930
|
workspaceAdapters.map((adapter) => /* @__PURE__ */ jsx8("option", { value: adapter.id, children: adapter.label }, adapter.id))
|
|
@@ -1979,9 +1940,9 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1979
1940
|
setFormat("plain");
|
|
1980
1941
|
}, children: "Use invalid JSON as plain text" }) : null
|
|
1981
1942
|
] }),
|
|
1982
|
-
ai || busy === "capture" || state.error ? /* @__PURE__ */
|
|
1983
|
-
ai ? /* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
1943
|
+
ai || busy === "capture" || state.error ? /* @__PURE__ */ jsxs4("aside", { children: [
|
|
1944
|
+
ai ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1945
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
1985
1946
|
"AI instruction",
|
|
1986
1947
|
/* @__PURE__ */ jsx8("textarea", { value: instruction, onChange: (e) => setInstruction(e.target.value), placeholder: "Tell AI how to prepare this content" })
|
|
1987
1948
|
] }),
|
|
@@ -1998,20 +1959,20 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
1998
1959
|
state.error ? /* @__PURE__ */ jsx8("p", { role: "alert", className: "matrx-alchemy-error", children: state.error }) : null
|
|
1999
1960
|
] }) : null
|
|
2000
1961
|
] }),
|
|
2001
|
-
pendingControls ? /* @__PURE__ */
|
|
1962
|
+
pendingControls ? /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2002
1963
|
/* @__PURE__ */ jsx8("p", { children: "This control would replace your manual edit." }),
|
|
2003
1964
|
/* @__PURE__ */ jsx8(Button, { type: "button", variant: "outline", onClick: () => setPendingControls(null), children: "Keep edited draft" }),
|
|
2004
1965
|
/* @__PURE__ */ jsx8(Button, { type: "button", onClick: applyPendingControls, children: "Rebuild from source" })
|
|
2005
1966
|
] }) : null,
|
|
2006
1967
|
state.sourceStale ? /* @__PURE__ */ jsx8("p", { role: "alert", className: "matrx-alchemy-decision", children: "The source changed since this draft. Use Refresh source to review the latest data." }) : null,
|
|
2007
|
-
state.pending ? /* @__PURE__ */
|
|
1968
|
+
state.pending ? /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-decision", role: "alert", children: [
|
|
2008
1969
|
/* @__PURE__ */ jsx8("p", { children: "A fresh source snapshot is ready." }),
|
|
2009
1970
|
/* @__PURE__ */ jsx8(Button, { type: "button", variant: "outline", onClick: () => resolveCapture("keep"), children: "Keep current snapshot and draft" }),
|
|
2010
1971
|
/* @__PURE__ */ jsx8(Button, { type: "button", onClick: () => resolveCapture("regenerate"), children: "Regenerate from fresh source" })
|
|
2011
1972
|
] }) : null,
|
|
2012
1973
|
deliveryNotice ? /* @__PURE__ */ jsx8("p", { role: "status", className: "matrx-alchemy-meta", children: deliveryNotice }) : null,
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ jsxs4(DialogFooter, { children: [
|
|
1975
|
+
/* @__PURE__ */ jsxs4("span", { className: "matrx-alchemy-meta", children: [
|
|
2015
1976
|
buffer.length.toLocaleString(),
|
|
2016
1977
|
" characters \xB7 ~",
|
|
2017
1978
|
estimateTokens(buffer).toLocaleString(),
|
|
@@ -2024,35 +1985,35 @@ function PreparationWorkspace({ restoreFocus, open, state, scopes, onClose, onCh
|
|
|
2024
1985
|
] }) });
|
|
2025
1986
|
}
|
|
2026
1987
|
function RowControls({ rows, controls, change }) {
|
|
2027
|
-
return /* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
1988
|
+
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1989
|
+
/* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-toolbar", children: [
|
|
1990
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2030
1991
|
"Search",
|
|
2031
1992
|
/* @__PURE__ */ jsx8("input", { value: controls.search, onChange: (e) => change({ ...controls, search: e.target.value }) })
|
|
2032
1993
|
] }),
|
|
2033
|
-
/* @__PURE__ */
|
|
1994
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2034
1995
|
"Sort",
|
|
2035
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsxs4("select", { value: controls.sort, onChange: (e) => change({ ...controls, sort: e.target.value }), children: [
|
|
2036
1997
|
/* @__PURE__ */ jsx8("option", { value: "", children: "None" }),
|
|
2037
1998
|
rows.columns.map((column) => /* @__PURE__ */ jsx8("option", { value: column.id, children: column.label }, column.id))
|
|
2038
1999
|
] })
|
|
2039
2000
|
] }),
|
|
2040
|
-
/* @__PURE__ */
|
|
2001
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2041
2002
|
"Direction",
|
|
2042
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ jsxs4("select", { value: controls.direction, disabled: !controls.sort, onChange: (e) => change({ ...controls, direction: e.target.value }), children: [
|
|
2043
2004
|
/* @__PURE__ */ jsx8("option", { value: "asc", children: "Ascending" }),
|
|
2044
2005
|
/* @__PURE__ */ jsx8("option", { value: "desc", children: "Descending" })
|
|
2045
2006
|
] })
|
|
2046
2007
|
] }),
|
|
2047
|
-
/* @__PURE__ */
|
|
2008
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2048
2009
|
"Top rows",
|
|
2049
2010
|
/* @__PURE__ */ jsx8("input", { type: "number", min: "0", value: controls.top ?? "", onChange: (e) => change({ ...controls, top: Number.isNaN(e.target.valueAsNumber) ? null : e.target.valueAsNumber }) })
|
|
2050
2011
|
] })
|
|
2051
2012
|
] }),
|
|
2052
|
-
/* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsxs4("fieldset", { className: "matrx-alchemy-options", children: [
|
|
2053
2014
|
/* @__PURE__ */ jsx8("legend", { children: "Columns and filters" }),
|
|
2054
|
-
rows.columns.map((column) => /* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2015
|
+
rows.columns.map((column) => /* @__PURE__ */ jsxs4("div", { className: "matrx-alchemy-column", children: [
|
|
2016
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2056
2017
|
/* @__PURE__ */ jsx8("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) }) }),
|
|
2057
2018
|
" ",
|
|
2058
2019
|
column.label
|
|
@@ -2060,15 +2021,15 @@ function RowControls({ rows, controls, change }) {
|
|
|
2060
2021
|
/* @__PURE__ */ jsx8("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 } }) })
|
|
2061
2022
|
] }, column.id))
|
|
2062
2023
|
] }),
|
|
2063
|
-
/* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ jsxs4("fieldset", { className: "matrx-alchemy-options", children: [
|
|
2064
2025
|
/* @__PURE__ */ jsx8("legend", { children: "Rows" }),
|
|
2065
|
-
/* @__PURE__ */
|
|
2026
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
2066
2027
|
/* @__PURE__ */ jsx8("input", { type: "checkbox", checked: controls.selectedOnly, onChange: (e) => change({ ...controls, selectedOnly: e.target.checked }) }),
|
|
2067
2028
|
" Only selected rows"
|
|
2068
2029
|
] }),
|
|
2069
2030
|
/* @__PURE__ */ jsx8("div", { className: "matrx-alchemy-row-list", children: rows.rows.map((row, index) => {
|
|
2070
2031
|
const summary = rows.columns.filter((column) => column.visible).slice(0, 2).map((column) => String(readTransferCell(row, column) ?? "")).filter(Boolean).join(" \xB7 ");
|
|
2071
|
-
return /* @__PURE__ */
|
|
2032
|
+
return /* @__PURE__ */ jsxs4("label", { children: [
|
|
2072
2033
|
/* @__PURE__ */ jsx8("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) }) }),
|
|
2073
2034
|
" Row ",
|
|
2074
2035
|
index + 1,
|