@mastra/playground-ui 2.0.3 → 2.0.4-alpha.1
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/dist/components/ui/scroll-area.d.ts +5 -1
- package/dist/index.es.js +127 -36
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
3
|
+
interface ScrollAreaProps extends React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {
|
|
4
|
+
viewPortClassName?: string;
|
|
5
|
+
maxHeight?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
8
|
declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
9
|
export { ScrollArea, ScrollBar };
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { MessagePrimitive, ActionBarPrimitive, BranchPickerPrimitive, ThreadPrimitive, ComposerPrimitive, useExternalStoreRuntime, AssistantRuntimeProvider } from '@assistant-ui/react';
|
|
3
|
-
import { CheckIcon, CopyIcon, ChevronLeftIcon, ChevronRightIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Braces, Clock1, ChevronDown, XIcon, Check, LoaderCircle, ChevronUpIcon, ChevronDownIcon, ExternalLinkIcon, Footprints, CircleCheck, CircleX, AlertCircleIcon,
|
|
3
|
+
import { CheckIcon, CopyIcon, ChevronLeftIcon, ChevronRightIcon, ArrowUp, Copy, Search, RefreshCcwIcon, ChevronRight, SortAsc, SortDesc, Braces, Clock1, ChevronDown, XIcon, Check, LoaderCircle, ChevronUpIcon, ChevronDownIcon, ExternalLinkIcon, X, Footprints, CircleCheck, CircleX, AlertCircleIcon, Plus, CalendarIcon, Loader2 } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { forwardRef, memo, useState, useEffect, createContext, useContext, useRef, useMemo, useCallback, Suspense, Fragment as Fragment$1 } from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -29,6 +29,7 @@ import '@xyflow/react/dist/style.css';
|
|
|
29
29
|
import Dagre from '@dagrejs/dagre';
|
|
30
30
|
import { Highlight, themes } from 'prism-react-renderer';
|
|
31
31
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
32
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
32
33
|
import jsonSchemaToZod from 'json-schema-to-zod';
|
|
33
34
|
import { parse } from 'superjson';
|
|
34
35
|
import * as z from 'zod';
|
|
@@ -3431,7 +3432,8 @@ function MastraRuntimeProvider({
|
|
|
3431
3432
|
const [messages, setMessages] = useState([]);
|
|
3432
3433
|
const [currentThreadId, setCurrentThreadId] = useState(threadId);
|
|
3433
3434
|
useEffect(() => {
|
|
3434
|
-
|
|
3435
|
+
const hasNewInitialMessages = initialMessages && initialMessages?.length > messages?.length;
|
|
3436
|
+
if (messages.length === 0 || currentThreadId !== threadId || hasNewInitialMessages && currentThreadId === threadId) {
|
|
3435
3437
|
if (initialMessages && threadId && memory) {
|
|
3436
3438
|
setMessages(initialMessages);
|
|
3437
3439
|
setCurrentThreadId(threadId);
|
|
@@ -3497,6 +3499,10 @@ function MastraRuntimeProvider({
|
|
|
3497
3499
|
role: "assistant",
|
|
3498
3500
|
content: [{ type: "text", text: assistantMessage }]
|
|
3499
3501
|
};
|
|
3502
|
+
const lastMessage = currentConversation[currentConversation.length - 1];
|
|
3503
|
+
if (lastMessage.id) {
|
|
3504
|
+
return currentConversation;
|
|
3505
|
+
}
|
|
3500
3506
|
if (!assistantMessageAdded) {
|
|
3501
3507
|
assistantMessageAdded = true;
|
|
3502
3508
|
return [...currentConversation, message2];
|
|
@@ -3509,7 +3515,9 @@ function MastraRuntimeProvider({
|
|
|
3509
3515
|
} finally {
|
|
3510
3516
|
reader.releaseLock();
|
|
3511
3517
|
setIsRunning(false);
|
|
3512
|
-
|
|
3518
|
+
setTimeout(() => {
|
|
3519
|
+
refreshThreadList?.();
|
|
3520
|
+
}, 500);
|
|
3513
3521
|
}
|
|
3514
3522
|
} catch (error) {
|
|
3515
3523
|
console.error("Error occurred in MastraRuntimeProvider", error);
|
|
@@ -4083,11 +4091,22 @@ const MastraResizablePanel = ({
|
|
|
4083
4091
|
] });
|
|
4084
4092
|
};
|
|
4085
4093
|
|
|
4086
|
-
const ScrollArea = React.forwardRef(
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4094
|
+
const ScrollArea = React.forwardRef(
|
|
4095
|
+
({ className, children, viewPortClassName, maxHeight, ...props }, ref) => {
|
|
4096
|
+
return /* @__PURE__ */ jsxs(ScrollAreaPrimitive.Root, { ref, className: cn("relative overflow-hidden", className), ...props, children: [
|
|
4097
|
+
/* @__PURE__ */ jsx(
|
|
4098
|
+
ScrollAreaPrimitive.Viewport,
|
|
4099
|
+
{
|
|
4100
|
+
className: cn("h-full w-full rounded-[inherit] [&>div]:!block", viewPortClassName),
|
|
4101
|
+
style: maxHeight ? { maxHeight } : void 0,
|
|
4102
|
+
children
|
|
4103
|
+
}
|
|
4104
|
+
),
|
|
4105
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
4106
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
4107
|
+
] });
|
|
4108
|
+
}
|
|
4109
|
+
);
|
|
4091
4110
|
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
4092
4111
|
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4093
4112
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
@@ -4273,7 +4292,7 @@ function Traces({ traces }) {
|
|
|
4273
4292
|
return !prevTracesId.has(traceId);
|
|
4274
4293
|
};
|
|
4275
4294
|
const currentTraceParentSpan = currentTrace?.find((span) => span.parentSpanId === void 0) || currentTrace?.[0];
|
|
4276
|
-
return /* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-
|
|
4295
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-_325px)]", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
4277
4296
|
/* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10 bg-[#0F0F0F]", style: { outline: "1px solid 0_0%_20.4%" }, children: /* @__PURE__ */ jsxs(TableRow, { className: "border-gray-6 border-b-[0.1px] text-[0.8125rem]", children: [
|
|
4278
4297
|
/* @__PURE__ */ jsx(TableHead, { className: "text-mastra-el-3 h-10", children: "Trace" }),
|
|
4279
4298
|
/* @__PURE__ */ jsxs(TableHead, { className: "text-mastra-el-3 flex items-center gap-1 h-10", children: [
|
|
@@ -4850,7 +4869,7 @@ function AgentTracesInner({
|
|
|
4850
4869
|
const { isOpen: open } = useContext(TraceContext);
|
|
4851
4870
|
if (firstCallLoading) {
|
|
4852
4871
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 relative overflow-hidden h-full", children: [
|
|
4853
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-
|
|
4872
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-_325px)]", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
4854
4873
|
/* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10 bg-[#0F0F0F]", children: /* @__PURE__ */ jsxs(TableRow, { className: "border-gray-6 border-b-[0.1px] text-[0.8125rem]", children: [
|
|
4855
4874
|
/* @__PURE__ */ jsx(TableHead, { className: "text-mastra-el-3 h-10", children: "Trace" }),
|
|
4856
4875
|
/* @__PURE__ */ jsxs(TableHead, { className: "text-mastra-el-3 flex items-center gap-1 h-10", children: [
|
|
@@ -4867,12 +4886,12 @@ function AgentTracesInner({
|
|
|
4867
4886
|
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full" }) })
|
|
4868
4887
|
] }) })
|
|
4869
4888
|
] }) }),
|
|
4870
|
-
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: "min-w-[
|
|
4889
|
+
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: "min-w-[325px]" })
|
|
4871
4890
|
] });
|
|
4872
4891
|
}
|
|
4873
4892
|
if (!traces || traces.length === 0) {
|
|
4874
4893
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 h-full relative overflow-hidden", children: [
|
|
4875
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-
|
|
4894
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-_325px)]", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
4876
4895
|
/* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10 bg-[#0F0F0F]", children: /* @__PURE__ */ jsxs(TableRow, { className: "border-gray-6 border-b-[0.1px] text-[0.8125rem]", children: [
|
|
4877
4896
|
/* @__PURE__ */ jsx(TableHead, { className: "text-mastra-el-3 h-10", children: "Trace" }),
|
|
4878
4897
|
/* @__PURE__ */ jsxs(TableHead, { className: "text-mastra-el-3 flex items-center gap-1 h-10", children: [
|
|
@@ -4884,12 +4903,12 @@ function AgentTracesInner({
|
|
|
4884
4903
|
] }) }),
|
|
4885
4904
|
/* @__PURE__ */ jsx(TableBody, { className: "border-b border-gray-6", children: /* @__PURE__ */ jsx(TableRow, { className: "border-b-gray-6 border-b-[0.1px] text-[0.8125rem]", children: /* @__PURE__ */ jsx(TableCell, { colSpan: 4, className: "h-24 text-center", children: error?.message || "No traces found" }) }) })
|
|
4886
4905
|
] }) }),
|
|
4887
|
-
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: "min-w-[
|
|
4906
|
+
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: "min-w-[325px]" })
|
|
4888
4907
|
] });
|
|
4889
4908
|
}
|
|
4890
4909
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 h-full relative overflow-hidden", children: [
|
|
4891
4910
|
/* @__PURE__ */ jsx(Traces, { traces }),
|
|
4892
|
-
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[
|
|
4911
|
+
/* @__PURE__ */ jsx(SidebarItems$1, { sidebarChild, className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]") })
|
|
4893
4912
|
] });
|
|
4894
4913
|
}
|
|
4895
4914
|
function SidebarItems$1({ sidebarChild, className }) {
|
|
@@ -4902,9 +4921,9 @@ function SidebarItems$1({ sidebarChild, className }) {
|
|
|
4902
4921
|
"absolute right-0 top-0 h-full z-20 overflow-x-scroll border-l-[0.5px] bg-mastra-bg-1 bg-[#121212]",
|
|
4903
4922
|
className
|
|
4904
4923
|
),
|
|
4905
|
-
defaultWidth: open ? 60 :
|
|
4906
|
-
minimumWidth: open ? 50 :
|
|
4907
|
-
maximumWidth: open ? 90 :
|
|
4924
|
+
defaultWidth: open ? 60 : 20,
|
|
4925
|
+
minimumWidth: open ? 50 : 20,
|
|
4926
|
+
maximumWidth: open ? 90 : 60,
|
|
4908
4927
|
children: [
|
|
4909
4928
|
open && /* @__PURE__ */ jsx(
|
|
4910
4929
|
"div",
|
|
@@ -5550,7 +5569,7 @@ function WorkflowTracesInner({
|
|
|
5550
5569
|
const { isOpen: open } = useContext(TraceContext);
|
|
5551
5570
|
if (firstCallLoading) {
|
|
5552
5571
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 h-full relative overflow-hidden", children: [
|
|
5553
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-
|
|
5572
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-_325px)]", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
5554
5573
|
/* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10 bg-[#0F0F0F]", children: /* @__PURE__ */ jsxs(TableRow, { className: "border-gray-6 border-b-[0.1px] text-[0.8125rem]", children: [
|
|
5555
5574
|
/* @__PURE__ */ jsx(TableHead, { className: "text-mastra-el-3 h-10", children: "Trace" }),
|
|
5556
5575
|
/* @__PURE__ */ jsxs(TableHead, { className: "text-mastra-el-3 flex items-center gap-1 h-10", children: [
|
|
@@ -5567,12 +5586,12 @@ function WorkflowTracesInner({
|
|
|
5567
5586
|
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-full" }) })
|
|
5568
5587
|
] }) })
|
|
5569
5588
|
] }) }),
|
|
5570
|
-
/* @__PURE__ */ jsx(SidebarItems, { sidebarChild, className: "min-w-[
|
|
5589
|
+
/* @__PURE__ */ jsx(SidebarItems, { sidebarChild, className: "min-w-[325px]" })
|
|
5571
5590
|
] });
|
|
5572
5591
|
}
|
|
5573
5592
|
if (!traces || traces.length === 0) {
|
|
5574
5593
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 h-full relative overflow-hidden", children: [
|
|
5575
|
-
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-
|
|
5594
|
+
/* @__PURE__ */ jsx("div", { className: "h-full w-[calc(100%_-_325px)]", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
5576
5595
|
/* @__PURE__ */ jsx(TableHeader, { className: "sticky top-0 z-10 bg-[#0F0F0F]", children: /* @__PURE__ */ jsxs(TableRow, { className: "border-gray-6 border-b-[0.1px] text-[0.8125rem]", children: [
|
|
5577
5596
|
/* @__PURE__ */ jsx(TableHead, { className: "text-mastra-el-3 h-10", children: "Trace" }),
|
|
5578
5597
|
/* @__PURE__ */ jsxs(TableHead, { className: "text-mastra-el-3 flex items-center gap-1 h-10", children: [
|
|
@@ -5584,12 +5603,12 @@ function WorkflowTracesInner({
|
|
|
5584
5603
|
] }) }),
|
|
5585
5604
|
/* @__PURE__ */ jsx(TableBody, { className: "border-b border-gray-6", children: /* @__PURE__ */ jsx(TableRow, { className: "border-b-gray-6 border-b-[0.1px] text-[0.8125rem]", children: /* @__PURE__ */ jsx(TableCell, { colSpan: 4, className: "h-24 text-center", children: error?.message || "No traces found" }) }) })
|
|
5586
5605
|
] }) }),
|
|
5587
|
-
/* @__PURE__ */ jsx(SidebarItems, { sidebarChild, className: "min-w-[
|
|
5606
|
+
/* @__PURE__ */ jsx(SidebarItems, { sidebarChild, className: "min-w-[325px]" })
|
|
5588
5607
|
] });
|
|
5589
5608
|
}
|
|
5590
5609
|
return /* @__PURE__ */ jsxs("main", { className: "flex-1 h-full relative overflow-hidden", children: [
|
|
5591
5610
|
/* @__PURE__ */ jsx(Traces, { traces }),
|
|
5592
|
-
/* @__PURE__ */ jsx(SidebarItems, { className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[
|
|
5611
|
+
/* @__PURE__ */ jsx(SidebarItems, { className: cn(open ? "grid grid-cols-2 w-[60%]" : "min-w-[325px]"), sidebarChild })
|
|
5593
5612
|
] });
|
|
5594
5613
|
}
|
|
5595
5614
|
function SidebarItems({ sidebarChild, className }) {
|
|
@@ -5602,9 +5621,9 @@ function SidebarItems({ sidebarChild, className }) {
|
|
|
5602
5621
|
"absolute right-0 top-0 h-full z-20 overflow-x-scroll border-l-[0.5px] bg-mastra-bg-1 bg-[#121212]",
|
|
5603
5622
|
className
|
|
5604
5623
|
),
|
|
5605
|
-
defaultWidth: open ? 60 :
|
|
5606
|
-
minimumWidth: open ? 50 :
|
|
5607
|
-
maximumWidth: open ? 90 :
|
|
5624
|
+
defaultWidth: open ? 60 : 20,
|
|
5625
|
+
minimumWidth: open ? 50 : 20,
|
|
5626
|
+
maximumWidth: open ? 90 : 60,
|
|
5608
5627
|
children: [
|
|
5609
5628
|
open && /* @__PURE__ */ jsx(
|
|
5610
5629
|
"div",
|
|
@@ -6128,9 +6147,58 @@ const Collapsible = CollapsiblePrimitive.Root;
|
|
|
6128
6147
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
6129
6148
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
6130
6149
|
|
|
6150
|
+
const Dialog = DialogPrimitive.Root;
|
|
6151
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
6152
|
+
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6153
|
+
DialogPrimitive.Overlay,
|
|
6154
|
+
{
|
|
6155
|
+
ref,
|
|
6156
|
+
className: cn(
|
|
6157
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
6158
|
+
className
|
|
6159
|
+
),
|
|
6160
|
+
...props
|
|
6161
|
+
}
|
|
6162
|
+
));
|
|
6163
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
6164
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
6165
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
6166
|
+
/* @__PURE__ */ jsxs(
|
|
6167
|
+
DialogPrimitive.Content,
|
|
6168
|
+
{
|
|
6169
|
+
ref,
|
|
6170
|
+
className: cn(
|
|
6171
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
6172
|
+
className
|
|
6173
|
+
),
|
|
6174
|
+
...props,
|
|
6175
|
+
children: [
|
|
6176
|
+
children,
|
|
6177
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
6178
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
6179
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
6180
|
+
] })
|
|
6181
|
+
]
|
|
6182
|
+
}
|
|
6183
|
+
)
|
|
6184
|
+
] }));
|
|
6185
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
6186
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6187
|
+
DialogPrimitive.Title,
|
|
6188
|
+
{
|
|
6189
|
+
ref,
|
|
6190
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
6191
|
+
...props
|
|
6192
|
+
}
|
|
6193
|
+
));
|
|
6194
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
6195
|
+
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
6196
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
6197
|
+
|
|
6131
6198
|
function WorkflowConditionNode({ data }) {
|
|
6132
6199
|
const { conditions } = data;
|
|
6133
6200
|
const [open, setOpen] = useState(true);
|
|
6201
|
+
const [openDialog, setOpenDialog] = useState(false);
|
|
6134
6202
|
const type = conditions[0]?.type;
|
|
6135
6203
|
const isCollapsible = (conditions.some((condition) => condition.fnString) || conditions?.length > 1) && type !== "else";
|
|
6136
6204
|
return /* @__PURE__ */ jsxs(
|
|
@@ -6165,17 +6233,40 @@ function WorkflowConditionNode({ data }) {
|
|
|
6165
6233
|
)
|
|
6166
6234
|
] }),
|
|
6167
6235
|
type === "else" ? null : /* @__PURE__ */ jsx(CollapsibleContent, { className: "flex flex-col gap-2", children: conditions.map((condition, index) => {
|
|
6168
|
-
return condition.fnString ? /* @__PURE__ */
|
|
6169
|
-
"
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6236
|
+
return condition.fnString ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6237
|
+
/* @__PURE__ */ jsx(Highlight, { theme: themes.oneDark, code: String(condition.fnString).trim(), language: "javascript", children: ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx(
|
|
6238
|
+
"pre",
|
|
6239
|
+
{
|
|
6240
|
+
className: `${className} relative font-mono text-sm overflow-x-auto p-3 w-full cursor-pointer rounded-lg mt-2`,
|
|
6241
|
+
style: {
|
|
6242
|
+
...style,
|
|
6243
|
+
backgroundColor: "transparent",
|
|
6244
|
+
border: "1px solid #343434",
|
|
6245
|
+
maxHeight: "9.62rem"
|
|
6246
|
+
},
|
|
6247
|
+
onClick: () => setOpenDialog(true),
|
|
6248
|
+
children: tokens.map((line, i) => /* @__PURE__ */ jsxs("div", { ...getLineProps({ line }), children: [
|
|
6249
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block mr-2 text-muted-foreground", children: i + 1 }),
|
|
6250
|
+
line.map((token, key) => /* @__PURE__ */ jsx("span", { ...getTokenProps({ token }) }, key))
|
|
6251
|
+
] }, i))
|
|
6252
|
+
}
|
|
6253
|
+
) }),
|
|
6254
|
+
/* @__PURE__ */ jsx(Dialog, { open: openDialog, onOpenChange: setOpenDialog, children: /* @__PURE__ */ jsx(DialogContent, { className: "max-w-[30rem] bg-[#121212] p-[0.5rem]", children: /* @__PURE__ */ jsx(ScrollArea, { className: "w-full p-2", maxHeight: "400px", children: /* @__PURE__ */ jsx(Highlight, { theme: themes.oneDark, code: String(condition.fnString).trim(), language: "javascript", children: ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx(
|
|
6255
|
+
"pre",
|
|
6256
|
+
{
|
|
6257
|
+
className: `${className} relative font-mono text-sm overflow-x-auto p-3 w-full rounded-lg mt-2 dark:bg-zinc-800`,
|
|
6258
|
+
style: {
|
|
6259
|
+
...style,
|
|
6260
|
+
backgroundColor: "#121212",
|
|
6261
|
+
padding: "0 0.75rem 0 0"
|
|
6262
|
+
},
|
|
6263
|
+
children: tokens.map((line, i) => /* @__PURE__ */ jsxs("div", { ...getLineProps({ line }), children: [
|
|
6264
|
+
/* @__PURE__ */ jsx("span", { className: "inline-block mr-2 text-muted-foreground", children: i + 1 }),
|
|
6265
|
+
line.map((token, key) => /* @__PURE__ */ jsx("span", { ...getTokenProps({ token }) }, key))
|
|
6266
|
+
] }, i))
|
|
6267
|
+
}
|
|
6268
|
+
) }) }) }) })
|
|
6269
|
+
] }, `${condition.fnString}-${index}`) : /* @__PURE__ */ jsx(Fragment$1, { children: condition.ref?.step ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
6179
6270
|
index === 0 ? null : /* @__PURE__ */ jsx(
|
|
6180
6271
|
Text,
|
|
6181
6272
|
{
|