@mastra/playground-ui 40.0.2-alpha.2 → 40.1.0-alpha.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.
@@ -0,0 +1,171 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const jsxRuntime = require('react/jsx-runtime');
6
+ const lucideReact = require('lucide-react');
7
+ const React = require('react');
8
+ const Badge = require('../../Badge-Cwp7HH1E.cjs');
9
+ const Button = require('../../Button-66ghjQV8.cjs');
10
+ const markdownRenderer = require('../../markdown-renderer-Ca-WbDb4.cjs');
11
+ const Txt = require('../../Txt-BT8_EkuZ.cjs');
12
+ const icons_Icon = require('../../icons/Icon.cjs.js');
13
+ const hooks_useCopyToClipboard = require('../../hooks/use-copy-to-clipboard.cjs.js');
14
+ const utils_cn = require('../../cn-vA5sWo9W.cjs');
15
+
16
+ const DEFAULT_COLLAPSED_HEIGHT = 220;
17
+ const PlanContext = React.createContext(null);
18
+ const usePlanContext = () => {
19
+ const context = React.useContext(PlanContext);
20
+ if (!context) {
21
+ throw new Error("Plan compound components must be rendered inside <Plan>.");
22
+ }
23
+ return context;
24
+ };
25
+ function Plan({ children, collapsedHeight = DEFAULT_COLLAPSED_HEIGHT, className, ...props }) {
26
+ const [isExpanded, setIsExpanded] = React.useState(false);
27
+ const toggleExpanded = () => {
28
+ setIsExpanded((current) => !current);
29
+ };
30
+ const contextValue = {
31
+ collapsedHeight,
32
+ isExpanded,
33
+ toggleExpanded
34
+ };
35
+ return /* @__PURE__ */ jsxRuntime.jsx(PlanContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan", className: utils_cn.cn("w-full overflow-hidden rounded-xl bg-surface3", className), ...props, children }) });
36
+ }
37
+ function PlanHeader({ children, className, ...props }) {
38
+ return /* @__PURE__ */ jsxRuntime.jsx(
39
+ "div",
40
+ {
41
+ "data-slot": "plan-header",
42
+ className: utils_cn.cn("flex min-h-10 items-center justify-between gap-3 px-4 pt-3", className),
43
+ ...props,
44
+ children
45
+ }
46
+ );
47
+ }
48
+ function PlanLabel({ children = "Plan", className, ...props }) {
49
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "plan-label", className: utils_cn.cn("flex min-w-0 items-center gap-2", className), ...props, children: [
50
+ /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "text-icon3", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ClipboardList, {}) }),
51
+ /* @__PURE__ */ jsxRuntime.jsx(Txt.Txt, { as: "span", variant: "ui-sm", className: "text-neutral4", children })
52
+ ] });
53
+ }
54
+ function PlanHeaderActions({ children, className, ...props }) {
55
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-header-actions", className: utils_cn.cn("flex shrink-0 items-center gap-1", className), ...props, children });
56
+ }
57
+ function PlanStatus({ children, variant = "default", ...props }) {
58
+ return /* @__PURE__ */ jsxRuntime.jsx(Badge.Badge, { ...props, variant, size: "xs", icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1 rounded-full bg-current" }), children });
59
+ }
60
+ function PlanCopyButton({ content, ...props }) {
61
+ const { isCopied, handleCopy } = hooks_useCopyToClipboard.useCopyToClipboard({
62
+ text: content,
63
+ copiedDuration: 1500,
64
+ showToast: false
65
+ });
66
+ return /* @__PURE__ */ jsxRuntime.jsx(
67
+ Button.Button,
68
+ {
69
+ ...props,
70
+ type: "button",
71
+ variant: "ghost",
72
+ size: "icon-sm",
73
+ tooltip: "Copy plan",
74
+ "aria-label": "Copy plan",
75
+ onClick: handleCopy,
76
+ children: isCopied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, {})
77
+ }
78
+ );
79
+ }
80
+ function PlanBody({ children, className, ...props }) {
81
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-body", className: utils_cn.cn("px-5 pt-4 pb-5", className), ...props, children });
82
+ }
83
+ function PlanIntro({ children, className, ...props }) {
84
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-intro", className: utils_cn.cn("mb-5 space-y-1", className), ...props, children });
85
+ }
86
+ function PlanTitle({ children, className, ...props }) {
87
+ return /* @__PURE__ */ jsxRuntime.jsx(Txt.Txt, { ...props, as: "h3", variant: "header-sm", className: utils_cn.cn("font-semibold text-neutral7", className), children });
88
+ }
89
+ const getFileName = (path) => {
90
+ const segments = path.split(/[\\/]/).filter(Boolean);
91
+ return segments[segments.length - 1] ?? path;
92
+ };
93
+ function PlanPath({ children, className, ...props }) {
94
+ return /* @__PURE__ */ jsxRuntime.jsx(
95
+ Txt.Txt,
96
+ {
97
+ ...props,
98
+ as: "p",
99
+ variant: "ui-xs",
100
+ font: "mono",
101
+ title: children,
102
+ className: utils_cn.cn("max-w-full overflow-hidden truncate text-neutral3", className),
103
+ children: getFileName(children)
104
+ }
105
+ );
106
+ }
107
+ function PlanMain({ children, className, ...props }) {
108
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-main", className: utils_cn.cn("relative", className), ...props, children });
109
+ }
110
+ function PlanContent({ children, className, style, ...props }) {
111
+ const { collapsedHeight, isExpanded } = usePlanContext();
112
+ return /* @__PURE__ */ jsxRuntime.jsx(
113
+ "div",
114
+ {
115
+ "data-slot": "plan-content",
116
+ className: utils_cn.cn("relative", !isExpanded && "overflow-hidden", className),
117
+ style: !isExpanded ? { ...style, maxHeight: collapsedHeight } : style,
118
+ ...props,
119
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-neutral6 [&_code]:bg-surface4 [&_h1]:text-header-md [&_h1]:leading-header-md [&_h2]:text-header-sm [&_h2]:leading-header-sm [&_h3]:text-ui-lg [&_h3]:leading-ui-lg [&_p]:text-ui-md [&_p]:leading-6", children: /* @__PURE__ */ jsxRuntime.jsx(markdownRenderer.MarkdownRenderer, { children }) })
120
+ }
121
+ );
122
+ }
123
+ function PlanFile({ children, className, ...props }) {
124
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "plan-file", className, ...props, children: [
125
+ /* @__PURE__ */ jsxRuntime.jsx(Txt.Txt, { as: "p", variant: "ui-xs", className: "mb-2 text-neutral3", children: "Plan file" }),
126
+ /* @__PURE__ */ jsxRuntime.jsx(Txt.Txt, { as: "p", variant: "ui-sm", className: "break-all font-mono text-neutral6", children })
127
+ ] });
128
+ }
129
+ function PlanControls({ children, className, ...props }) {
130
+ const hasActions = Boolean(children);
131
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-controls", className: utils_cn.cn("relative z-10 mt-4 flex justify-center", className), ...props, children: hasActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid w-full max-w-sm grid-cols-[1fr_auto_1fr] items-center gap-2 px-10", children }) : /* @__PURE__ */ jsxRuntime.jsx(PlanExpandButton, {}) });
132
+ }
133
+ function PlanActionGroup({ children, className, ...props }) {
134
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "plan-action-group", className: utils_cn.cn("flex justify-start gap-2 empty:hidden", className), ...props, children });
135
+ }
136
+ function PlanExpandButton(props) {
137
+ const { isExpanded, toggleExpanded } = usePlanContext();
138
+ return /* @__PURE__ */ jsxRuntime.jsxs(
139
+ Button.Button,
140
+ {
141
+ ...props,
142
+ type: "button",
143
+ variant: "primary",
144
+ size: "sm",
145
+ "aria-label": isExpanded ? "Collapse plan" : "Expand plan",
146
+ onClick: toggleExpanded,
147
+ children: [
148
+ isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minimize2, {}) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, {}),
149
+ isExpanded ? "Collapse plan" : "Expand plan"
150
+ ]
151
+ }
152
+ );
153
+ }
154
+
155
+ exports.Plan = Plan;
156
+ exports.PlanActionGroup = PlanActionGroup;
157
+ exports.PlanBody = PlanBody;
158
+ exports.PlanContent = PlanContent;
159
+ exports.PlanControls = PlanControls;
160
+ exports.PlanCopyButton = PlanCopyButton;
161
+ exports.PlanExpandButton = PlanExpandButton;
162
+ exports.PlanFile = PlanFile;
163
+ exports.PlanHeader = PlanHeader;
164
+ exports.PlanHeaderActions = PlanHeaderActions;
165
+ exports.PlanIntro = PlanIntro;
166
+ exports.PlanLabel = PlanLabel;
167
+ exports.PlanMain = PlanMain;
168
+ exports.PlanPath = PlanPath;
169
+ exports.PlanStatus = PlanStatus;
170
+ exports.PlanTitle = PlanTitle;
171
+ //# sourceMappingURL=plan.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.cjs.js","sources":["../../../src/ds/components/ai/plan/plan.tsx"],"sourcesContent":["import { CheckIcon, ClipboardList, CopyIcon, Maximize2, Minimize2 } from 'lucide-react';\nimport { createContext, useContext, useState } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { Badge } from '@/ds/components/Badge';\nimport { Button } from '@/ds/components/Button';\nimport { MarkdownRenderer } from '@/ds/components/MarkdownRenderer';\nimport { Txt } from '@/ds/components/Txt';\nimport { Icon } from '@/ds/icons/Icon';\nimport { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard';\nimport { cn } from '@/lib/utils';\n\nconst DEFAULT_COLLAPSED_HEIGHT = 220;\n\ninterface PlanContextValue {\n collapsedHeight: number;\n isExpanded: boolean;\n toggleExpanded: () => void;\n}\n\nconst PlanContext = createContext<PlanContextValue | null>(null);\n\nconst usePlanContext = () => {\n const context = useContext(PlanContext);\n\n if (!context) {\n throw new Error('Plan compound components must be rendered inside <Plan>.');\n }\n\n return context;\n};\n\nexport interface PlanProps extends ComponentProps<'div'> {\n collapsedHeight?: number;\n}\n\nexport function Plan({ children, collapsedHeight = DEFAULT_COLLAPSED_HEIGHT, className, ...props }: PlanProps) {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const toggleExpanded = () => {\n setIsExpanded(current => !current);\n };\n\n const contextValue = {\n collapsedHeight,\n isExpanded,\n toggleExpanded,\n };\n\n return (\n <PlanContext.Provider value={contextValue}>\n <div data-slot=\"plan\" className={cn('w-full overflow-hidden rounded-xl bg-surface3', className)} {...props}>\n {children}\n </div>\n </PlanContext.Provider>\n );\n}\n\nexport type PlanHeaderProps = ComponentProps<'div'>;\n\nexport function PlanHeader({ children, className, ...props }: PlanHeaderProps) {\n return (\n <div\n data-slot=\"plan-header\"\n className={cn('flex min-h-10 items-center justify-between gap-3 px-4 pt-3', className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport type PlanLabelProps = ComponentProps<'div'>;\n\nexport function PlanLabel({ children = 'Plan', className, ...props }: PlanLabelProps) {\n return (\n <div data-slot=\"plan-label\" className={cn('flex min-w-0 items-center gap-2', className)} {...props}>\n <Icon size=\"sm\" className=\"text-icon3\">\n <ClipboardList />\n </Icon>\n <Txt as=\"span\" variant=\"ui-sm\" className=\"text-neutral4\">\n {children}\n </Txt>\n </div>\n );\n}\n\nexport type PlanHeaderActionsProps = ComponentProps<'div'>;\n\nexport function PlanHeaderActions({ children, className, ...props }: PlanHeaderActionsProps) {\n return (\n <div data-slot=\"plan-header-actions\" className={cn('flex shrink-0 items-center gap-1', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanStatusProps = Omit<ComponentProps<typeof Badge>, 'icon' | 'size'>;\n\nexport function PlanStatus({ children, variant = 'default', ...props }: PlanStatusProps) {\n return (\n <Badge {...props} variant={variant} size=\"xs\" icon={<span className=\"size-1 rounded-full bg-current\" />}>\n {children}\n </Badge>\n );\n}\n\nexport interface PlanCopyButtonProps extends Omit<\n ComponentProps<typeof Button>,\n 'aria-label' | 'children' | 'onClick' | 'size' | 'tooltip' | 'type' | 'variant'\n> {\n content: string;\n}\n\nexport function PlanCopyButton({ content, ...props }: PlanCopyButtonProps) {\n const { isCopied, handleCopy } = useCopyToClipboard({\n text: content,\n copiedDuration: 1500,\n showToast: false,\n });\n\n return (\n <Button\n {...props}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n tooltip=\"Copy plan\"\n aria-label=\"Copy plan\"\n onClick={handleCopy}\n >\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n </Button>\n );\n}\n\nexport type PlanBodyProps = ComponentProps<'div'>;\n\nexport function PlanBody({ children, className, ...props }: PlanBodyProps) {\n return (\n <div data-slot=\"plan-body\" className={cn('px-5 pt-4 pb-5', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanIntroProps = ComponentProps<'div'>;\n\nexport function PlanIntro({ children, className, ...props }: PlanIntroProps) {\n return (\n <div data-slot=\"plan-intro\" className={cn('mb-5 space-y-1', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface PlanTitleProps extends Omit<ComponentProps<typeof Txt>, 'as' | 'children' | 'variant'> {\n children: ReactNode;\n}\n\nexport function PlanTitle({ children, className, ...props }: PlanTitleProps) {\n return (\n <Txt {...props} as=\"h3\" variant=\"header-sm\" className={cn('font-semibold text-neutral7', className)}>\n {children}\n </Txt>\n );\n}\n\nexport interface PlanPathProps extends Omit<\n ComponentProps<typeof Txt>,\n 'as' | 'children' | 'font' | 'title' | 'variant'\n> {\n children: string;\n}\n\nconst getFileName = (path: string) => {\n const segments = path.split(/[\\\\/]/).filter(Boolean);\n return segments[segments.length - 1] ?? path;\n};\n\nexport function PlanPath({ children, className, ...props }: PlanPathProps) {\n return (\n <Txt\n {...props}\n as=\"p\"\n variant=\"ui-xs\"\n font=\"mono\"\n title={children}\n className={cn('max-w-full overflow-hidden truncate text-neutral3', className)}\n >\n {getFileName(children)}\n </Txt>\n );\n}\n\nexport type PlanMainProps = ComponentProps<'div'>;\n\nexport function PlanMain({ children, className, ...props }: PlanMainProps) {\n return (\n <div data-slot=\"plan-main\" className={cn('relative', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface PlanContentProps extends Omit<ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\nexport function PlanContent({ children, className, style, ...props }: PlanContentProps) {\n const { collapsedHeight, isExpanded } = usePlanContext();\n\n return (\n <div\n data-slot=\"plan-content\"\n className={cn('relative', !isExpanded && 'overflow-hidden', className)}\n style={!isExpanded ? { ...style, maxHeight: collapsedHeight } : style}\n {...props}\n >\n <div className=\"text-neutral6 [&_code]:bg-surface4 [&_h1]:text-header-md [&_h1]:leading-header-md [&_h2]:text-header-sm [&_h2]:leading-header-sm [&_h3]:text-ui-lg [&_h3]:leading-ui-lg [&_p]:text-ui-md [&_p]:leading-6\">\n <MarkdownRenderer>{children}</MarkdownRenderer>\n </div>\n </div>\n );\n}\n\nexport interface PlanFileProps extends Omit<ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\nexport function PlanFile({ children, className, ...props }: PlanFileProps) {\n return (\n <div data-slot=\"plan-file\" className={className} {...props}>\n <Txt as=\"p\" variant=\"ui-xs\" className=\"mb-2 text-neutral3\">\n Plan file\n </Txt>\n <Txt as=\"p\" variant=\"ui-sm\" className=\"break-all font-mono text-neutral6\">\n {children}\n </Txt>\n </div>\n );\n}\n\nexport type PlanControlsProps = ComponentProps<'div'>;\n\nexport function PlanControls({ children, className, ...props }: PlanControlsProps) {\n const hasActions = Boolean(children);\n\n return (\n <div data-slot=\"plan-controls\" className={cn('relative z-10 mt-4 flex justify-center', className)} {...props}>\n {hasActions ? (\n <div className=\"grid w-full max-w-sm grid-cols-[1fr_auto_1fr] items-center gap-2 px-10\">{children}</div>\n ) : (\n <PlanExpandButton />\n )}\n </div>\n );\n}\n\nexport type PlanActionGroupProps = ComponentProps<'div'>;\n\nexport function PlanActionGroup({ children, className, ...props }: PlanActionGroupProps) {\n return (\n <div data-slot=\"plan-action-group\" className={cn('flex justify-start gap-2 empty:hidden', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanExpandButtonProps = Omit<\n ComponentProps<typeof Button>,\n 'aria-label' | 'children' | 'onClick' | 'size' | 'type' | 'variant'\n>;\n\nexport function PlanExpandButton(props: PlanExpandButtonProps) {\n const { isExpanded, toggleExpanded } = usePlanContext();\n\n return (\n <Button\n {...props}\n type=\"button\"\n variant=\"primary\"\n size=\"sm\"\n aria-label={isExpanded ? 'Collapse plan' : 'Expand plan'}\n onClick={toggleExpanded}\n >\n {isExpanded ? <Minimize2 /> : <Maximize2 />}\n {isExpanded ? 'Collapse plan' : 'Expand plan'}\n </Button>\n );\n}\n"],"names":["createContext","useContext","useState","cn","jsx","jsxs","Icon","ClipboardList","Txt","Badge","useCopyToClipboard","Button","CheckIcon","CopyIcon","MarkdownRenderer","Minimize2","Maximize2"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,wBAAA,GAA2B,GAAA;AAQjC,MAAM,WAAA,GAAcA,oBAAuC,IAAI,CAAA;AAE/D,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAUC,iBAAW,WAAW,CAAA;AAEtC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,0DAA0D,CAAA;AAAA,EAC5E;AAEA,EAAA,OAAO,OAAA;AACT,CAAA;AAMO,SAAS,IAAA,CAAK,EAAE,QAAA,EAAU,eAAA,GAAkB,0BAA0B,SAAA,EAAW,GAAG,OAAM,EAAc;AAC7G,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAIC,eAAS,KAAK,CAAA;AAElD,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,aAAA,CAAc,CAAA,OAAA,KAAW,CAAC,OAAO,CAAA;AAAA,EACnC,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe;AAAA,IACnB,eAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,sCACG,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,YAAA,EAC3B,yCAAC,KAAA,EAAA,EAAI,WAAA,EAAU,MAAA,EAAO,SAAA,EAAWC,YAAG,+CAAA,EAAiD,SAAS,GAAI,GAAG,KAAA,EAClG,UACH,C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B,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,OAAM,EAAyB;AACvF,EAAA,uBACEA,cAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,mBAAA,EAAoB,SAAA,EAAWD,WAAA,CAAG,uCAAA,EAAyC,SAAS,CAAA,EAAI,GAAG,KAAA,EACvG,QAAA,EACH,CAAA;AAEJ;AAOO,SAAS,iBAAiB,KAAA,EAA8B;AAC7D,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAe,GAAI,cAAA,EAAe;AAEtD,EAAA,uBACEE,eAAA;AAAA,IAACM,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,IAAA,EAAK,QAAA;AAAA,MACL,OAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAK,IAAA;AAAA,MACL,YAAA,EAAY,aAAa,eAAA,GAAkB,aAAA;AAAA,MAC3C,OAAA,EAAS,cAAA;AAAA,MAER,QAAA,EAAA;AAAA,QAAA,UAAA,mBAAaP,cAAA,CAACW,qBAAA,EAAA,EAAU,CAAA,mBAAKX,cAAA,CAACY,qBAAA,EAAA,EAAU,CAAA;AAAA,QACxC,aAAa,eAAA,GAAkB;AAAA;AAAA;AAAA,GAClC;AAEJ;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export * from '../../src/ds/components/ai/plan/index'
2
+ export {}
@@ -0,0 +1,152 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { CheckIcon, CopyIcon, Minimize2, Maximize2, ClipboardList } from 'lucide-react';
3
+ import { useState, createContext, useContext } from 'react';
4
+ import { B as Badge } from '../../Badge-Ba_ltDdC.js';
5
+ import { B as Button } from '../../Button-Bq0VuEbC.js';
6
+ import { M as MarkdownRenderer } from '../../markdown-renderer-Bcrk5ZJO.js';
7
+ import { T as Txt } from '../../Txt-p33XTnu8.js';
8
+ import { Icon } from '../../icons/Icon.es.js';
9
+ import { useCopyToClipboard } from '../../hooks/use-copy-to-clipboard.es.js';
10
+ import { c as cn } from '../../cn-BakJzhuv.js';
11
+
12
+ const DEFAULT_COLLAPSED_HEIGHT = 220;
13
+ const PlanContext = createContext(null);
14
+ const usePlanContext = () => {
15
+ const context = useContext(PlanContext);
16
+ if (!context) {
17
+ throw new Error("Plan compound components must be rendered inside <Plan>.");
18
+ }
19
+ return context;
20
+ };
21
+ function Plan({ children, collapsedHeight = DEFAULT_COLLAPSED_HEIGHT, className, ...props }) {
22
+ const [isExpanded, setIsExpanded] = useState(false);
23
+ const toggleExpanded = () => {
24
+ setIsExpanded((current) => !current);
25
+ };
26
+ const contextValue = {
27
+ collapsedHeight,
28
+ isExpanded,
29
+ toggleExpanded
30
+ };
31
+ return /* @__PURE__ */ jsx(PlanContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { "data-slot": "plan", className: cn("w-full overflow-hidden rounded-xl bg-surface3", className), ...props, children }) });
32
+ }
33
+ function PlanHeader({ children, className, ...props }) {
34
+ return /* @__PURE__ */ jsx(
35
+ "div",
36
+ {
37
+ "data-slot": "plan-header",
38
+ className: cn("flex min-h-10 items-center justify-between gap-3 px-4 pt-3", className),
39
+ ...props,
40
+ children
41
+ }
42
+ );
43
+ }
44
+ function PlanLabel({ children = "Plan", className, ...props }) {
45
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "plan-label", className: cn("flex min-w-0 items-center gap-2", className), ...props, children: [
46
+ /* @__PURE__ */ jsx(Icon, { size: "sm", className: "text-icon3", children: /* @__PURE__ */ jsx(ClipboardList, {}) }),
47
+ /* @__PURE__ */ jsx(Txt, { as: "span", variant: "ui-sm", className: "text-neutral4", children })
48
+ ] });
49
+ }
50
+ function PlanHeaderActions({ children, className, ...props }) {
51
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-header-actions", className: cn("flex shrink-0 items-center gap-1", className), ...props, children });
52
+ }
53
+ function PlanStatus({ children, variant = "default", ...props }) {
54
+ return /* @__PURE__ */ jsx(Badge, { ...props, variant, size: "xs", icon: /* @__PURE__ */ jsx("span", { className: "size-1 rounded-full bg-current" }), children });
55
+ }
56
+ function PlanCopyButton({ content, ...props }) {
57
+ const { isCopied, handleCopy } = useCopyToClipboard({
58
+ text: content,
59
+ copiedDuration: 1500,
60
+ showToast: false
61
+ });
62
+ return /* @__PURE__ */ jsx(
63
+ Button,
64
+ {
65
+ ...props,
66
+ type: "button",
67
+ variant: "ghost",
68
+ size: "icon-sm",
69
+ tooltip: "Copy plan",
70
+ "aria-label": "Copy plan",
71
+ onClick: handleCopy,
72
+ children: isCopied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
73
+ }
74
+ );
75
+ }
76
+ function PlanBody({ children, className, ...props }) {
77
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-body", className: cn("px-5 pt-4 pb-5", className), ...props, children });
78
+ }
79
+ function PlanIntro({ children, className, ...props }) {
80
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-intro", className: cn("mb-5 space-y-1", className), ...props, children });
81
+ }
82
+ function PlanTitle({ children, className, ...props }) {
83
+ return /* @__PURE__ */ jsx(Txt, { ...props, as: "h3", variant: "header-sm", className: cn("font-semibold text-neutral7", className), children });
84
+ }
85
+ const getFileName = (path) => {
86
+ const segments = path.split(/[\\/]/).filter(Boolean);
87
+ return segments[segments.length - 1] ?? path;
88
+ };
89
+ function PlanPath({ children, className, ...props }) {
90
+ return /* @__PURE__ */ jsx(
91
+ Txt,
92
+ {
93
+ ...props,
94
+ as: "p",
95
+ variant: "ui-xs",
96
+ font: "mono",
97
+ title: children,
98
+ className: cn("max-w-full overflow-hidden truncate text-neutral3", className),
99
+ children: getFileName(children)
100
+ }
101
+ );
102
+ }
103
+ function PlanMain({ children, className, ...props }) {
104
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-main", className: cn("relative", className), ...props, children });
105
+ }
106
+ function PlanContent({ children, className, style, ...props }) {
107
+ const { collapsedHeight, isExpanded } = usePlanContext();
108
+ return /* @__PURE__ */ jsx(
109
+ "div",
110
+ {
111
+ "data-slot": "plan-content",
112
+ className: cn("relative", !isExpanded && "overflow-hidden", className),
113
+ style: !isExpanded ? { ...style, maxHeight: collapsedHeight } : style,
114
+ ...props,
115
+ children: /* @__PURE__ */ jsx("div", { className: "text-neutral6 [&_code]:bg-surface4 [&_h1]:text-header-md [&_h1]:leading-header-md [&_h2]:text-header-sm [&_h2]:leading-header-sm [&_h3]:text-ui-lg [&_h3]:leading-ui-lg [&_p]:text-ui-md [&_p]:leading-6", children: /* @__PURE__ */ jsx(MarkdownRenderer, { children }) })
116
+ }
117
+ );
118
+ }
119
+ function PlanFile({ children, className, ...props }) {
120
+ return /* @__PURE__ */ jsxs("div", { "data-slot": "plan-file", className, ...props, children: [
121
+ /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-xs", className: "mb-2 text-neutral3", children: "Plan file" }),
122
+ /* @__PURE__ */ jsx(Txt, { as: "p", variant: "ui-sm", className: "break-all font-mono text-neutral6", children })
123
+ ] });
124
+ }
125
+ function PlanControls({ children, className, ...props }) {
126
+ const hasActions = Boolean(children);
127
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-controls", className: cn("relative z-10 mt-4 flex justify-center", className), ...props, children: hasActions ? /* @__PURE__ */ jsx("div", { className: "grid w-full max-w-sm grid-cols-[1fr_auto_1fr] items-center gap-2 px-10", children }) : /* @__PURE__ */ jsx(PlanExpandButton, {}) });
128
+ }
129
+ function PlanActionGroup({ children, className, ...props }) {
130
+ return /* @__PURE__ */ jsx("div", { "data-slot": "plan-action-group", className: cn("flex justify-start gap-2 empty:hidden", className), ...props, children });
131
+ }
132
+ function PlanExpandButton(props) {
133
+ const { isExpanded, toggleExpanded } = usePlanContext();
134
+ return /* @__PURE__ */ jsxs(
135
+ Button,
136
+ {
137
+ ...props,
138
+ type: "button",
139
+ variant: "primary",
140
+ size: "sm",
141
+ "aria-label": isExpanded ? "Collapse plan" : "Expand plan",
142
+ onClick: toggleExpanded,
143
+ children: [
144
+ isExpanded ? /* @__PURE__ */ jsx(Minimize2, {}) : /* @__PURE__ */ jsx(Maximize2, {}),
145
+ isExpanded ? "Collapse plan" : "Expand plan"
146
+ ]
147
+ }
148
+ );
149
+ }
150
+
151
+ export { Plan, PlanActionGroup, PlanBody, PlanContent, PlanControls, PlanCopyButton, PlanExpandButton, PlanFile, PlanHeader, PlanHeaderActions, PlanIntro, PlanLabel, PlanMain, PlanPath, PlanStatus, PlanTitle };
152
+ //# sourceMappingURL=plan.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.es.js","sources":["../../../src/ds/components/ai/plan/plan.tsx"],"sourcesContent":["import { CheckIcon, ClipboardList, CopyIcon, Maximize2, Minimize2 } from 'lucide-react';\nimport { createContext, useContext, useState } from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { Badge } from '@/ds/components/Badge';\nimport { Button } from '@/ds/components/Button';\nimport { MarkdownRenderer } from '@/ds/components/MarkdownRenderer';\nimport { Txt } from '@/ds/components/Txt';\nimport { Icon } from '@/ds/icons/Icon';\nimport { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard';\nimport { cn } from '@/lib/utils';\n\nconst DEFAULT_COLLAPSED_HEIGHT = 220;\n\ninterface PlanContextValue {\n collapsedHeight: number;\n isExpanded: boolean;\n toggleExpanded: () => void;\n}\n\nconst PlanContext = createContext<PlanContextValue | null>(null);\n\nconst usePlanContext = () => {\n const context = useContext(PlanContext);\n\n if (!context) {\n throw new Error('Plan compound components must be rendered inside <Plan>.');\n }\n\n return context;\n};\n\nexport interface PlanProps extends ComponentProps<'div'> {\n collapsedHeight?: number;\n}\n\nexport function Plan({ children, collapsedHeight = DEFAULT_COLLAPSED_HEIGHT, className, ...props }: PlanProps) {\n const [isExpanded, setIsExpanded] = useState(false);\n\n const toggleExpanded = () => {\n setIsExpanded(current => !current);\n };\n\n const contextValue = {\n collapsedHeight,\n isExpanded,\n toggleExpanded,\n };\n\n return (\n <PlanContext.Provider value={contextValue}>\n <div data-slot=\"plan\" className={cn('w-full overflow-hidden rounded-xl bg-surface3', className)} {...props}>\n {children}\n </div>\n </PlanContext.Provider>\n );\n}\n\nexport type PlanHeaderProps = ComponentProps<'div'>;\n\nexport function PlanHeader({ children, className, ...props }: PlanHeaderProps) {\n return (\n <div\n data-slot=\"plan-header\"\n className={cn('flex min-h-10 items-center justify-between gap-3 px-4 pt-3', className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport type PlanLabelProps = ComponentProps<'div'>;\n\nexport function PlanLabel({ children = 'Plan', className, ...props }: PlanLabelProps) {\n return (\n <div data-slot=\"plan-label\" className={cn('flex min-w-0 items-center gap-2', className)} {...props}>\n <Icon size=\"sm\" className=\"text-icon3\">\n <ClipboardList />\n </Icon>\n <Txt as=\"span\" variant=\"ui-sm\" className=\"text-neutral4\">\n {children}\n </Txt>\n </div>\n );\n}\n\nexport type PlanHeaderActionsProps = ComponentProps<'div'>;\n\nexport function PlanHeaderActions({ children, className, ...props }: PlanHeaderActionsProps) {\n return (\n <div data-slot=\"plan-header-actions\" className={cn('flex shrink-0 items-center gap-1', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanStatusProps = Omit<ComponentProps<typeof Badge>, 'icon' | 'size'>;\n\nexport function PlanStatus({ children, variant = 'default', ...props }: PlanStatusProps) {\n return (\n <Badge {...props} variant={variant} size=\"xs\" icon={<span className=\"size-1 rounded-full bg-current\" />}>\n {children}\n </Badge>\n );\n}\n\nexport interface PlanCopyButtonProps extends Omit<\n ComponentProps<typeof Button>,\n 'aria-label' | 'children' | 'onClick' | 'size' | 'tooltip' | 'type' | 'variant'\n> {\n content: string;\n}\n\nexport function PlanCopyButton({ content, ...props }: PlanCopyButtonProps) {\n const { isCopied, handleCopy } = useCopyToClipboard({\n text: content,\n copiedDuration: 1500,\n showToast: false,\n });\n\n return (\n <Button\n {...props}\n type=\"button\"\n variant=\"ghost\"\n size=\"icon-sm\"\n tooltip=\"Copy plan\"\n aria-label=\"Copy plan\"\n onClick={handleCopy}\n >\n {isCopied ? <CheckIcon /> : <CopyIcon />}\n </Button>\n );\n}\n\nexport type PlanBodyProps = ComponentProps<'div'>;\n\nexport function PlanBody({ children, className, ...props }: PlanBodyProps) {\n return (\n <div data-slot=\"plan-body\" className={cn('px-5 pt-4 pb-5', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanIntroProps = ComponentProps<'div'>;\n\nexport function PlanIntro({ children, className, ...props }: PlanIntroProps) {\n return (\n <div data-slot=\"plan-intro\" className={cn('mb-5 space-y-1', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface PlanTitleProps extends Omit<ComponentProps<typeof Txt>, 'as' | 'children' | 'variant'> {\n children: ReactNode;\n}\n\nexport function PlanTitle({ children, className, ...props }: PlanTitleProps) {\n return (\n <Txt {...props} as=\"h3\" variant=\"header-sm\" className={cn('font-semibold text-neutral7', className)}>\n {children}\n </Txt>\n );\n}\n\nexport interface PlanPathProps extends Omit<\n ComponentProps<typeof Txt>,\n 'as' | 'children' | 'font' | 'title' | 'variant'\n> {\n children: string;\n}\n\nconst getFileName = (path: string) => {\n const segments = path.split(/[\\\\/]/).filter(Boolean);\n return segments[segments.length - 1] ?? path;\n};\n\nexport function PlanPath({ children, className, ...props }: PlanPathProps) {\n return (\n <Txt\n {...props}\n as=\"p\"\n variant=\"ui-xs\"\n font=\"mono\"\n title={children}\n className={cn('max-w-full overflow-hidden truncate text-neutral3', className)}\n >\n {getFileName(children)}\n </Txt>\n );\n}\n\nexport type PlanMainProps = ComponentProps<'div'>;\n\nexport function PlanMain({ children, className, ...props }: PlanMainProps) {\n return (\n <div data-slot=\"plan-main\" className={cn('relative', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport interface PlanContentProps extends Omit<ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\nexport function PlanContent({ children, className, style, ...props }: PlanContentProps) {\n const { collapsedHeight, isExpanded } = usePlanContext();\n\n return (\n <div\n data-slot=\"plan-content\"\n className={cn('relative', !isExpanded && 'overflow-hidden', className)}\n style={!isExpanded ? { ...style, maxHeight: collapsedHeight } : style}\n {...props}\n >\n <div className=\"text-neutral6 [&_code]:bg-surface4 [&_h1]:text-header-md [&_h1]:leading-header-md [&_h2]:text-header-sm [&_h2]:leading-header-sm [&_h3]:text-ui-lg [&_h3]:leading-ui-lg [&_p]:text-ui-md [&_p]:leading-6\">\n <MarkdownRenderer>{children}</MarkdownRenderer>\n </div>\n </div>\n );\n}\n\nexport interface PlanFileProps extends Omit<ComponentProps<'div'>, 'children'> {\n children: string;\n}\n\nexport function PlanFile({ children, className, ...props }: PlanFileProps) {\n return (\n <div data-slot=\"plan-file\" className={className} {...props}>\n <Txt as=\"p\" variant=\"ui-xs\" className=\"mb-2 text-neutral3\">\n Plan file\n </Txt>\n <Txt as=\"p\" variant=\"ui-sm\" className=\"break-all font-mono text-neutral6\">\n {children}\n </Txt>\n </div>\n );\n}\n\nexport type PlanControlsProps = ComponentProps<'div'>;\n\nexport function PlanControls({ children, className, ...props }: PlanControlsProps) {\n const hasActions = Boolean(children);\n\n return (\n <div data-slot=\"plan-controls\" className={cn('relative z-10 mt-4 flex justify-center', className)} {...props}>\n {hasActions ? (\n <div className=\"grid w-full max-w-sm grid-cols-[1fr_auto_1fr] items-center gap-2 px-10\">{children}</div>\n ) : (\n <PlanExpandButton />\n )}\n </div>\n );\n}\n\nexport type PlanActionGroupProps = ComponentProps<'div'>;\n\nexport function PlanActionGroup({ children, className, ...props }: PlanActionGroupProps) {\n return (\n <div data-slot=\"plan-action-group\" className={cn('flex justify-start gap-2 empty:hidden', className)} {...props}>\n {children}\n </div>\n );\n}\n\nexport type PlanExpandButtonProps = Omit<\n ComponentProps<typeof Button>,\n 'aria-label' | 'children' | 'onClick' | 'size' | 'type' | 'variant'\n>;\n\nexport function PlanExpandButton(props: PlanExpandButtonProps) {\n const { isExpanded, toggleExpanded } = usePlanContext();\n\n return (\n <Button\n {...props}\n type=\"button\"\n variant=\"primary\"\n size=\"sm\"\n aria-label={isExpanded ? 'Collapse plan' : 'Expand plan'}\n onClick={toggleExpanded}\n >\n {isExpanded ? <Minimize2 /> : <Maximize2 />}\n {isExpanded ? 'Collapse plan' : 'Expand plan'}\n </Button>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAYA,MAAM,wBAAA,GAA2B,GAAA;AAQjC,MAAM,WAAA,GAAc,cAAuC,IAAI,CAAA;AAE/D,MAAM,iBAAiB,MAAM;AAC3B,EAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AAEtC,EAAA,IAAI,CAAC,OAAA,EAAS;AACZ,IAAA,MAAM,IAAI,MAAM,0DAA0D,CAAA;AAAA,EAC5E;AAEA,EAAA,OAAO,OAAA;AACT,CAAA;AAMO,SAAS,IAAA,CAAK,EAAE,QAAA,EAAU,eAAA,GAAkB,0BAA0B,SAAA,EAAW,GAAG,OAAM,EAAc;AAC7G,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,KAAK,CAAA;AAElD,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,aAAA,CAAc,CAAA,OAAA,KAAW,CAAC,OAAO,CAAA;AAAA,EACnC,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe;AAAA,IACnB,eAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,2BACG,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,YAAA,EAC3B,8BAAC,KAAA,EAAA,EAAI,WAAA,EAAU,MAAA,EAAO,SAAA,EAAW,GAAG,+CAAA,EAAiD,SAAS,GAAI,GAAG,KAAA,EAClG,UACH,CAAA,EACF,CAAA;AAEJ;AAIO,SAAS,WAAW,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,OAAM,EAAoB;AAC7E,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,aAAA;AAAA,MACV,SAAA,EAAW,E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KAAA,EAA8B;AAC7D,EAAA,MAAM,EAAE,UAAA,EAAY,cAAA,EAAe,GAAI,cAAA,EAAe;AAEtD,EAAA,uBACE,IAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,IAAA,EAAK,QAAA;AAAA,MACL,OAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAK,IAAA;AAAA,MACL,YAAA,EAAY,aAAa,eAAA,GAAkB,aAAA;AAAA,MAC3C,OAAA,EAAS,cAAA;AAAA,MAER,QAAA,EAAA;AAAA,QAAA,UAAA,mBAAa,GAAA,CAAC,SAAA,EAAA,EAAU,CAAA,mBAAK,GAAA,CAAC,SAAA,EAAA,EAAU,CAAA;AAAA,QACxC,aAAa,eAAA,GAAkB;AAAA;AAAA;AAAA,GAClC;AAEJ;;;;"}
@@ -0,0 +1,86 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import Markdown from 'react-markdown';
3
+ import remarkGfm from 'remark-gfm';
4
+ import { C as Code } from './code-C5KVVzOZ.js';
5
+ import { C as CopyButton } from './copy-button-CJjjhHKN.js';
6
+ import { c as cn } from './cn-BakJzhuv.js';
7
+
8
+ function MarkdownRenderer({ children }) {
9
+ const processedText = children.replace(/\\n/g, "\n");
10
+ return /* @__PURE__ */ jsx(Markdown, { remarkPlugins: [remarkGfm], components: COMPONENTS, className: "space-y-3", children: processedText });
11
+ }
12
+ const CodeBlock = ({ children, className, language, ...restProps }) => {
13
+ const code = typeof children === "string" ? children : childrenTakeAllStringContents(children);
14
+ const preClass = cn(
15
+ "overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]",
16
+ className
17
+ );
18
+ return /* @__PURE__ */ jsxs("div", { className: "group/code relative mb-4", children: [
19
+ /* @__PURE__ */ jsx(Code, { code, lang: language, className: preClass, ...restProps }),
20
+ /* @__PURE__ */ jsx("div", { className: "invisible absolute right-2 top-2 flex gap-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100", children: /* @__PURE__ */ jsx(CopyButton, { content: code, copyMessage: "Copied code to clipboard" }) })
21
+ ] });
22
+ };
23
+ function childrenTakeAllStringContents(element) {
24
+ if (typeof element === "string") {
25
+ return element;
26
+ }
27
+ if (element?.props?.children) {
28
+ let children = element.props.children;
29
+ if (Array.isArray(children)) {
30
+ return children.map((child) => childrenTakeAllStringContents(child)).join("");
31
+ } else {
32
+ return childrenTakeAllStringContents(children);
33
+ }
34
+ }
35
+ return "";
36
+ }
37
+ const COMPONENTS = {
38
+ h1: ({ children, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold", ...props, children }),
39
+ h2: ({ children, ...props }) => /* @__PURE__ */ jsx("h2", { className: "font-semibold text-xl", ...props, children }),
40
+ h3: ({ children, ...props }) => /* @__PURE__ */ jsx("h3", { className: "font-semibold text-lg", ...props, children }),
41
+ h4: ({ children, ...props }) => /* @__PURE__ */ jsx("h4", { className: "font-semibold text-base", ...props, children }),
42
+ h5: ({ children, ...props }) => /* @__PURE__ */ jsx("h5", { className: "font-medium", ...props, children }),
43
+ strong: ({ children, ...props }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", ...props, children }),
44
+ a: ({ children, ...props }) => /* @__PURE__ */ jsx("a", { className: "underline underline-offset-2", ...props, children }),
45
+ blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-neutral6 pl-4", ...props, children }),
46
+ code: ({ children, className, ...rest }) => {
47
+ const match = /language-(\w+)/.exec(className || "");
48
+ return match ? /* @__PURE__ */ jsx(CodeBlock, { className, language: match[1], ...rest, children }) : /* @__PURE__ */ jsx(
49
+ "code",
50
+ {
51
+ className: cn(
52
+ "font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"
53
+ ),
54
+ ...rest,
55
+ children
56
+ }
57
+ );
58
+ },
59
+ pre: ({ children }) => children,
60
+ ol: ({ children, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-2 pl-6", ...props, children }),
61
+ ul: ({ children, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-disc space-y-2 pl-6", ...props, children }),
62
+ li: ({ children, ...props }) => /* @__PURE__ */ jsx("li", { className: "my-1.5", ...props, children }),
63
+ table: ({ children, ...props }) => /* @__PURE__ */ jsx("table", { className: "w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20", ...props, children }),
64
+ th: ({ children, ...props }) => /* @__PURE__ */ jsx(
65
+ "th",
66
+ {
67
+ className: "border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right",
68
+ ...props,
69
+ children
70
+ }
71
+ ),
72
+ td: ({ children, ...props }) => /* @__PURE__ */ jsx(
73
+ "td",
74
+ {
75
+ className: "border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right",
76
+ ...props,
77
+ children
78
+ }
79
+ ),
80
+ tr: ({ children, ...props }) => /* @__PURE__ */ jsx("tr", { className: "m-0 border-t p-0 even:bg-surface4", ...props, children }),
81
+ p: ({ children, ...props }) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap leading-relaxed", ...props, children }),
82
+ hr: ({ ...props }) => /* @__PURE__ */ jsx("hr", { className: "border-neutral6/20", ...props })
83
+ };
84
+
85
+ export { MarkdownRenderer as M };
86
+ //# sourceMappingURL=markdown-renderer-Bcrk5ZJO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-renderer-Bcrk5ZJO.js","sources":["../src/ds/components/MarkdownRenderer/markdown-renderer.tsx"],"sourcesContent":["import React from 'react';\nimport Markdown from 'react-markdown';\nimport type { Components } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\n\nimport { Code } from '@/ds/components/Code';\nimport { CopyButton } from '@/ds/components/CopyButton';\nimport { cn } from '@/lib/utils';\n\nexport type MarkdownRendererProps = {\n children: string;\n};\n\nexport function MarkdownRenderer({ children }: MarkdownRendererProps) {\n const processedText = children.replace(/\\\\n/g, '\\n');\n\n return (\n <Markdown remarkPlugins={[remarkGfm]} components={COMPONENTS} className=\"space-y-3\">\n {processedText}\n </Markdown>\n );\n}\n\ninterface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {\n children: React.ReactNode;\n className?: string;\n language: string;\n}\n\nconst CodeBlock = ({ children, className, language, ...restProps }: CodeBlockProps) => {\n const code = typeof children === 'string' ? children : childrenTakeAllStringContents(children);\n\n const preClass = cn(\n 'overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]',\n className,\n );\n\n return (\n <div className=\"group/code relative mb-4\">\n <Code code={code} lang={language} className={preClass} {...restProps} />\n\n <div className=\"invisible absolute right-2 top-2 flex gap-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100\">\n <CopyButton content={code} copyMessage=\"Copied code to clipboard\" />\n </div>\n </div>\n );\n};\n\nfunction childrenTakeAllStringContents(element: any): string {\n if (typeof element === 'string') {\n return element;\n }\n\n if (element?.props?.children) {\n let children = element.props.children;\n\n if (Array.isArray(children)) {\n return children.map(child => childrenTakeAllStringContents(child)).join('');\n } else {\n return childrenTakeAllStringContents(children);\n }\n }\n\n return '';\n}\n\n// Create component wrappers with className\nconst COMPONENTS: Components = {\n h1: ({ children, ...props }) => (\n <h1 className=\"text-2xl font-semibold\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }) => (\n <h2 className=\"font-semibold text-xl\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }) => (\n <h3 className=\"font-semibold text-lg\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }) => (\n <h4 className=\"font-semibold text-base\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }) => (\n <h5 className=\"font-medium\" {...props}>\n {children}\n </h5>\n ),\n strong: ({ children, ...props }) => (\n <strong className=\"font-semibold\" {...props}>\n {children}\n </strong>\n ),\n a: ({ children, ...props }) => (\n <a className=\"underline underline-offset-2\" {...props}>\n {children}\n </a>\n ),\n blockquote: ({ children, ...props }) => (\n <blockquote className=\"border-l-2 border-neutral6 pl-4\" {...props}>\n {children}\n </blockquote>\n ),\n code: ({ children, className, ...rest }: any) => {\n const match = /language-(\\w+)/.exec(className || '');\n return match ? (\n <CodeBlock className={className} language={match[1]} {...rest}>\n {children}\n </CodeBlock>\n ) : (\n <code\n className={cn(\n 'font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5',\n )}\n {...rest}\n >\n {children}\n </code>\n );\n },\n pre: ({ children }: any) => children,\n ol: ({ children, ...props }) => (\n <ol className=\"list-decimal space-y-2 pl-6\" {...props}>\n {children}\n </ol>\n ),\n ul: ({ children, ...props }) => (\n <ul className=\"list-disc space-y-2 pl-6\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }) => (\n <li className=\"my-1.5\" {...props}>\n {children}\n </li>\n ),\n table: ({ children, ...props }) => (\n <table className=\"w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20\" {...props}>\n {children}\n </table>\n ),\n th: ({ children, ...props }) => (\n <th\n className=\"border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right\"\n {...props}\n >\n {children}\n </th>\n ),\n td: ({ children, ...props }) => (\n <td\n className=\"border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right\"\n {...props}\n >\n {children}\n </td>\n ),\n tr: ({ children, ...props }) => (\n <tr className=\"m-0 border-t p-0 even:bg-surface4\" {...props}>\n {children}\n </tr>\n ),\n p: ({ children, ...props }) => (\n <p className=\"whitespace-pre-wrap leading-relaxed\" {...props}>\n {children}\n </p>\n ),\n hr: ({ ...props }) => <hr className=\"border-neutral6/20\" {...props} />,\n};\n\nexport default MarkdownRenderer;\n"],"names":[],"mappings":";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,EAAG,SAAA,EAAU,QAAA,EAAU,GAAG,OACxB,QAAA,EACH,CAAA;AAAA,EAEF,KAAA,EAAO,CAAC,EAAE,QAAA,EAAU,GAAG,KAAA,EAAM,qBAC3B,GAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAU,6EAAA,EAA+E,GAAG,OAChG,QAAA,EACH,CAAA;AAAA,EAEF,IAAI,CAAC,EAAE,QAAA,EAAU,GAAG,OAAM,qBACxB,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,iHAAA;AAAA,MACT,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAAA,EAEF,IAAI,CAAC,EAAE,QAAA,EAAU,GAAG,OAAM,qBACxB,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,uGAAA;AAAA,MACT,GAAG,KAAA;AAAA,MAEH;AAAA;AAAA,GACH;AAAA,EAEF,EAAA,EAAI,CAAC,EAAE,QAAA,EAAU,GAAG,KAAA,EAAM,qBACxB,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,mCAAA,EAAqC,GAAG,OACnD,QAAA,EACH,CAAA;AAAA,EAEF,CAAA,EAAG,CAAC,EAAE,QAAA,EAAU,GAAG,KAAA,EAAM,qBACvB,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,qCAAA,EAAuC,GAAG,OACpD,QAAA,EACH,CAAA;AAAA,EAEF,EAAA,EAAI,CAAC,EAAE,GAAG,KAAA,EAAM,qBAAM,GAAA,CAAC,IAAA,EAAA,EAAG,SAAA,EAAU,oBAAA,EAAsB,GAAG,KAAA,EAAO;AACtE,CAAA;;;;"}
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ const jsxRuntime = require('react/jsx-runtime');
4
+ const Markdown = require('react-markdown');
5
+ const remarkGfm = require('remark-gfm');
6
+ const code = require('./code-B3WONxnA.cjs');
7
+ const copyButton = require('./copy-button-DN9mi_LV.cjs');
8
+ const utils_cn = require('./cn-vA5sWo9W.cjs');
9
+
10
+ function MarkdownRenderer({ children }) {
11
+ const processedText = children.replace(/\\n/g, "\n");
12
+ return /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins: [remarkGfm], components: COMPONENTS, className: "space-y-3", children: processedText });
13
+ }
14
+ const CodeBlock = ({ children, className, language, ...restProps }) => {
15
+ const code$1 = typeof children === "string" ? children : childrenTakeAllStringContents(children);
16
+ const preClass = utils_cn.cn(
17
+ "overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]",
18
+ className
19
+ );
20
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group/code relative mb-4", children: [
21
+ /* @__PURE__ */ jsxRuntime.jsx(code.Code, { code: code$1, lang: language, className: preClass, ...restProps }),
22
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "invisible absolute right-2 top-2 flex gap-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100", children: /* @__PURE__ */ jsxRuntime.jsx(copyButton.CopyButton, { content: code$1, copyMessage: "Copied code to clipboard" }) })
23
+ ] });
24
+ };
25
+ function childrenTakeAllStringContents(element) {
26
+ if (typeof element === "string") {
27
+ return element;
28
+ }
29
+ if (element?.props?.children) {
30
+ let children = element.props.children;
31
+ if (Array.isArray(children)) {
32
+ return children.map((child) => childrenTakeAllStringContents(child)).join("");
33
+ } else {
34
+ return childrenTakeAllStringContents(children);
35
+ }
36
+ }
37
+ return "";
38
+ }
39
+ const COMPONENTS = {
40
+ h1: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl font-semibold", ...props, children }),
41
+ h2: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-semibold text-xl", ...props, children }),
42
+ h3: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-lg", ...props, children }),
43
+ h4: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-semibold text-base", ...props, children }),
44
+ h5: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("h5", { className: "font-medium", ...props, children }),
45
+ strong: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-semibold", ...props, children }),
46
+ a: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("a", { className: "underline underline-offset-2", ...props, children }),
47
+ blockquote: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("blockquote", { className: "border-l-2 border-neutral6 pl-4", ...props, children }),
48
+ code: ({ children, className, ...rest }) => {
49
+ const match = /language-(\w+)/.exec(className || "");
50
+ return match ? /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { className, language: match[1], ...rest, children }) : /* @__PURE__ */ jsxRuntime.jsx(
51
+ "code",
52
+ {
53
+ className: utils_cn.cn(
54
+ "font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5"
55
+ ),
56
+ ...rest,
57
+ children
58
+ }
59
+ );
60
+ },
61
+ pre: ({ children }) => children,
62
+ ol: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "list-decimal space-y-2 pl-6", ...props, children }),
63
+ ul: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "list-disc space-y-2 pl-6", ...props, children }),
64
+ li: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "my-1.5", ...props, children }),
65
+ table: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { className: "w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20", ...props, children }),
66
+ th: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
67
+ "th",
68
+ {
69
+ className: "border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right",
70
+ ...props,
71
+ children
72
+ }
73
+ ),
74
+ td: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
75
+ "td",
76
+ {
77
+ className: "border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right",
78
+ ...props,
79
+ children
80
+ }
81
+ ),
82
+ tr: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "m-0 border-t p-0 even:bg-surface4", ...props, children }),
83
+ p: ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-wrap leading-relaxed", ...props, children }),
84
+ hr: ({ ...props }) => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "border-neutral6/20", ...props })
85
+ };
86
+
87
+ exports.MarkdownRenderer = MarkdownRenderer;
88
+ //# sourceMappingURL=markdown-renderer-Ca-WbDb4.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-renderer-Ca-WbDb4.cjs","sources":["../src/ds/components/MarkdownRenderer/markdown-renderer.tsx"],"sourcesContent":["import React from 'react';\nimport Markdown from 'react-markdown';\nimport type { Components } from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\n\nimport { Code } from '@/ds/components/Code';\nimport { CopyButton } from '@/ds/components/CopyButton';\nimport { cn } from '@/lib/utils';\n\nexport type MarkdownRendererProps = {\n children: string;\n};\n\nexport function MarkdownRenderer({ children }: MarkdownRendererProps) {\n const processedText = children.replace(/\\\\n/g, '\\n');\n\n return (\n <Markdown remarkPlugins={[remarkGfm]} components={COMPONENTS} className=\"space-y-3\">\n {processedText}\n </Markdown>\n );\n}\n\ninterface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {\n children: React.ReactNode;\n className?: string;\n language: string;\n}\n\nconst CodeBlock = ({ children, className, language, ...restProps }: CodeBlockProps) => {\n const code = typeof children === 'string' ? children : childrenTakeAllStringContents(children);\n\n const preClass = cn(\n 'overflow-x-scroll rounded-md border bg-surface1/50 p-4 font-mono text-sm [scrollbar-width:none]',\n className,\n );\n\n return (\n <div className=\"group/code relative mb-4\">\n <Code code={code} lang={language} className={preClass} {...restProps} />\n\n <div className=\"invisible absolute right-2 top-2 flex gap-1 rounded-lg p-1 opacity-0 transition-all duration-200 group-hover/code:visible group-hover/code:opacity-100\">\n <CopyButton content={code} copyMessage=\"Copied code to clipboard\" />\n </div>\n </div>\n );\n};\n\nfunction childrenTakeAllStringContents(element: any): string {\n if (typeof element === 'string') {\n return element;\n }\n\n if (element?.props?.children) {\n let children = element.props.children;\n\n if (Array.isArray(children)) {\n return children.map(child => childrenTakeAllStringContents(child)).join('');\n } else {\n return childrenTakeAllStringContents(children);\n }\n }\n\n return '';\n}\n\n// Create component wrappers with className\nconst COMPONENTS: Components = {\n h1: ({ children, ...props }) => (\n <h1 className=\"text-2xl font-semibold\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }) => (\n <h2 className=\"font-semibold text-xl\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }) => (\n <h3 className=\"font-semibold text-lg\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }) => (\n <h4 className=\"font-semibold text-base\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }) => (\n <h5 className=\"font-medium\" {...props}>\n {children}\n </h5>\n ),\n strong: ({ children, ...props }) => (\n <strong className=\"font-semibold\" {...props}>\n {children}\n </strong>\n ),\n a: ({ children, ...props }) => (\n <a className=\"underline underline-offset-2\" {...props}>\n {children}\n </a>\n ),\n blockquote: ({ children, ...props }) => (\n <blockquote className=\"border-l-2 border-neutral6 pl-4\" {...props}>\n {children}\n </blockquote>\n ),\n code: ({ children, className, ...rest }: any) => {\n const match = /language-(\\w+)/.exec(className || '');\n return match ? (\n <CodeBlock className={className} language={match[1]} {...rest}>\n {children}\n </CodeBlock>\n ) : (\n <code\n className={cn(\n 'font-mono [:not(pre)>&]:rounded-md [:not(pre)>&]:bg-surface1/50 [:not(pre)>&]:px-1 [:not(pre)>&]:py-0.5',\n )}\n {...rest}\n >\n {children}\n </code>\n );\n },\n pre: ({ children }: any) => children,\n ol: ({ children, ...props }) => (\n <ol className=\"list-decimal space-y-2 pl-6\" {...props}>\n {children}\n </ol>\n ),\n ul: ({ children, ...props }) => (\n <ul className=\"list-disc space-y-2 pl-6\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }) => (\n <li className=\"my-1.5\" {...props}>\n {children}\n </li>\n ),\n table: ({ children, ...props }) => (\n <table className=\"w-full border-collapse overflow-y-auto rounded-md border border-neutral6/20\" {...props}>\n {children}\n </table>\n ),\n th: ({ children, ...props }) => (\n <th\n className=\"border border-neutral6/20 px-4 py-2 text-left font-bold [[align=center]]:text-center [[align=right]]:text-right\"\n {...props}\n >\n {children}\n </th>\n ),\n td: ({ children, ...props }) => (\n <td\n className=\"border border-neutral6/20 px-4 py-2 text-left [[align=center]]:text-center [[align=right]]:text-right\"\n {...props}\n >\n {children}\n </td>\n ),\n tr: ({ children, ...props }) => (\n <tr className=\"m-0 border-t p-0 even:bg-surface4\" {...props}>\n {children}\n </tr>\n ),\n p: ({ children, ...props }) => (\n <p className=\"whitespace-pre-wrap leading-relaxed\" {...props}>\n {children}\n </p>\n ),\n hr: ({ ...props }) => <hr className=\"border-neutral6/20\" {...props} />,\n};\n\nexport default MarkdownRenderer;\n"],"names":["jsx","code","cn","jsxs","Code","CopyButton"],"mappings":";;;;;;;;;AAaO,SAAS,gBAAA,CAAiB,EAAE,QAAA,EAAS,EAA0B;AACpE,EAAA,MAAM,aAAA,GAAgB,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,IAAI,CAAA;AAEnD,EAAA,uBACEA,cAAA,CAAC,QAAA,EAAA,EAAS,aAAA,EAAe,CAAC,SAAS,GAAG,UAAA,EAAY,UAAA,EAAY,SAAA,EAAU,WAAA,EACrE,QAAA,EAAA,aAAA,EACH,CAAA;AAEJ;AAQA,MAAM,SAAA,GAAY,CAAC,EAAE,QAAA,EAAU,WAAW,QAAA,EAAU,GAAG,WAAU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