@mastra/playground-ui 2.0.4-alpha.0 → 2.0.4
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/index.es.js +85 -12
- package/dist/index.es.js.map +1 -1
- package/package.json +3 -3
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';
|
|
@@ -6146,9 +6147,58 @@ const Collapsible = CollapsiblePrimitive.Root;
|
|
|
6146
6147
|
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
6147
6148
|
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
6148
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
|
+
|
|
6149
6198
|
function WorkflowConditionNode({ data }) {
|
|
6150
6199
|
const { conditions } = data;
|
|
6151
6200
|
const [open, setOpen] = useState(true);
|
|
6201
|
+
const [openDialog, setOpenDialog] = useState(false);
|
|
6152
6202
|
const type = conditions[0]?.type;
|
|
6153
6203
|
const isCollapsible = (conditions.some((condition) => condition.fnString) || conditions?.length > 1) && type !== "else";
|
|
6154
6204
|
return /* @__PURE__ */ jsxs(
|
|
@@ -6183,17 +6233,40 @@ function WorkflowConditionNode({ data }) {
|
|
|
6183
6233
|
)
|
|
6184
6234
|
] }),
|
|
6185
6235
|
type === "else" ? null : /* @__PURE__ */ jsx(CollapsibleContent, { className: "flex flex-col gap-2", children: conditions.map((condition, index) => {
|
|
6186
|
-
return condition.fnString ? /* @__PURE__ */
|
|
6187
|
-
"
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
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: [
|
|
6197
6270
|
index === 0 ? null : /* @__PURE__ */ jsx(
|
|
6198
6271
|
Text,
|
|
6199
6272
|
{
|