@tangle-network/ui 11.10.0 → 11.11.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.
Files changed (132) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -1
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DOETfnd9.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -16
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-C87nEe2R.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-D4jAfEmj.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -31
  16. package/dist/code-block-B36KVUSN.js +165 -0
  17. package/dist/code-block-B9miUPht.d.ts +23 -0
  18. package/dist/diff-preview-BcK3nRXb.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-BxlPjaTP.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -34
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-Bug33qCl.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -41
  28. package/dist/focus-BcE_SHqz.js +57 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -46
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-BgUHilZm.d.ts +108 -0
  34. package/dist/index-COgqsFAQ.d.ts +42 -0
  35. package/dist/index-CPDET_s1.d.ts +549 -0
  36. package/dist/index-CUhfHT_V.d.ts +204 -0
  37. package/dist/index-Cg6gYAqh.d.ts +73 -0
  38. package/dist/index-Cq-EJzqW.d.ts +16 -0
  39. package/dist/index-DhYmSaLF.d.ts +245 -0
  40. package/dist/index-DjKxO357.d.ts +128 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -472
  43. package/dist/markdown-BGqicV82.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -15
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DrU1AdVk.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -13
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-Cb8GGVKr.js +1239 -0
  55. package/dist/primitives.d.ts +5 -525
  56. package/dist/primitives.js +9 -212
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-BACLbCFl.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -40
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -36
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-Bss73DhB.js +146 -0
  70. package/dist/tabs-BVHR6NkO.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-Djt2q11V.js +109 -0
  74. package/dist/tool-call-step-DNebqhmX.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -23
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BVgO1QBN.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -104
  87. package/dist/utils.js +6 -44
  88. package/package.json +39 -41
  89. package/src/lib/focus.ts +2 -1
  90. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  91. package/dist/button-CMQuQEW_.d.ts +0 -17
  92. package/dist/chunk-34A66VBG.js +0 -214
  93. package/dist/chunk-3OI2QKFD.js +0 -0
  94. package/dist/chunk-3XXBZL53.js +0 -174
  95. package/dist/chunk-42PAH5D2.js +0 -112
  96. package/dist/chunk-4CLN43XT.js +0 -45
  97. package/dist/chunk-55WHV7SS.js +0 -1604
  98. package/dist/chunk-565EATZZ.js +0 -156
  99. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  100. package/dist/chunk-6BGQA4BQ.js +0 -0
  101. package/dist/chunk-BEBXZPHW.js +0 -299
  102. package/dist/chunk-C5WF4WMV.js +0 -734
  103. package/dist/chunk-HFL6R6IF.js +0 -37
  104. package/dist/chunk-HGML45QH.js +0 -104
  105. package/dist/chunk-HMAPIH7L.js +0 -595
  106. package/dist/chunk-K5XFRUS4.js +0 -1401
  107. package/dist/chunk-KFQGHD73.js +0 -198
  108. package/dist/chunk-L57WRIND.js +0 -59
  109. package/dist/chunk-LTEKI7YJ.js +0 -59
  110. package/dist/chunk-M3QZK62R.js +0 -233
  111. package/dist/chunk-ND3ZFXQK.js +0 -179
  112. package/dist/chunk-OEX7NZE3.js +0 -321
  113. package/dist/chunk-OL5GYLHV.js +0 -60
  114. package/dist/chunk-QGFYBNSO.js +0 -133
  115. package/dist/chunk-R7B3UWPF.js +0 -550
  116. package/dist/chunk-R7SUY4E3.js +0 -65
  117. package/dist/chunk-REJESC5U.js +0 -117
  118. package/dist/chunk-RQGKSCEZ.js +0 -0
  119. package/dist/chunk-SNLR2AEA.js +0 -40
  120. package/dist/chunk-WKWBTL2V.js +0 -15
  121. package/dist/chunk-X7CU776B.js +0 -1048
  122. package/dist/chunk-XU3HB5QL.js +0 -127
  123. package/dist/chunk-YTO5V6QS.js +0 -19
  124. package/dist/chunk-YU4E5J2N.js +0 -437
  125. package/dist/chunk-YZ6AK25N.js +0 -886
  126. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  127. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  128. package/dist/document-editor-pane-QHDOBA43.js +0 -13
  129. package/dist/message-BHWbxBtT.d.ts +0 -15
  130. package/dist/parts-dj7AcUg0.d.ts +0 -36
  131. package/dist/run-PfLmDAox.d.ts +0 -41
  132. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -1,17 +0,0 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import * as React from 'react';
3
-
4
- declare const buttonVariants: (props?: ({
5
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "sandbox" | null | undefined;
6
- size?: "default" | "sm" | "lg" | "xl" | "icon" | null | undefined;
7
- } & class_variance_authority_types.ClassProp) | undefined) => string;
8
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
9
- variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | "sandbox" | null;
10
- size?: "default" | "sm" | "lg" | "xl" | "icon" | null;
11
- asChild?: boolean;
12
- loading?: boolean;
13
- children?: React.ReactNode;
14
- }
15
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
16
-
17
- export { Button as B, type ButtonProps as a, buttonVariants as b };
@@ -1,214 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-RQHJBTEU.js";
4
-
5
- // src/primitives/avatar.tsx
6
- import * as AvatarPrimitive from "@radix-ui/react-avatar";
7
- import * as React from "react";
8
- import { jsx } from "react/jsx-runtime";
9
- var Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
10
- AvatarPrimitive.Root,
11
- {
12
- ref,
13
- className: cn(
14
- "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
15
- className
16
- ),
17
- ...props
18
- }
19
- ));
20
- Avatar.displayName = AvatarPrimitive.Root.displayName;
21
- var AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
22
- AvatarPrimitive.Image,
23
- {
24
- ref,
25
- className: cn("aspect-square h-full w-full", className),
26
- ...props
27
- }
28
- ));
29
- AvatarImage.displayName = AvatarPrimitive.Image.displayName;
30
- var AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
31
- AvatarPrimitive.Fallback,
32
- {
33
- ref,
34
- className: cn(
35
- "flex h-full w-full items-center justify-center rounded-full bg-muted font-medium text-sm",
36
- className
37
- ),
38
- ...props
39
- }
40
- ));
41
- AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
42
-
43
- // src/primitives/dropdown-menu.tsx
44
- import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
45
- import { Check, ChevronRight, Circle } from "lucide-react";
46
- import * as React2 from "react";
47
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
48
- var DropdownMenu = DropdownMenuPrimitive.Root;
49
- var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
50
- var DropdownMenuGroup = DropdownMenuPrimitive.Group;
51
- var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
52
- var DropdownMenuSub = DropdownMenuPrimitive.Sub;
53
- var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
54
- var DropdownMenuSubTrigger = React2.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
55
- DropdownMenuPrimitive.SubTrigger,
56
- {
57
- ref,
58
- className: cn(
59
- "flex cursor-default select-none items-center rounded-md px-2 py-1.5 text-sm outline-none",
60
- "focus:bg-accent data-[state=open]:bg-muted/50",
61
- inset && "pl-8",
62
- className
63
- ),
64
- ...props,
65
- children: [
66
- children,
67
- /* @__PURE__ */ jsx2(ChevronRight, { className: "ml-auto h-4 w-4" })
68
- ]
69
- }
70
- ));
71
- DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
72
- var DropdownMenuSubContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
73
- DropdownMenuPrimitive.SubContent,
74
- {
75
- ref,
76
- className: cn(
77
- "z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-card p-1 text-foreground shadow-[var(--shadow-card)]",
78
- "data-[state=closed]:animate-out data-[state=open]:animate-in",
79
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
80
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
81
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
82
- "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
83
- className
84
- ),
85
- ...props
86
- }
87
- ));
88
- DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
89
- var DropdownMenuContent = React2.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx2(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx2(
90
- DropdownMenuPrimitive.Content,
91
- {
92
- ref,
93
- sideOffset,
94
- className: cn(
95
- "z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-card p-1 text-foreground shadow-[var(--shadow-card)]",
96
- "data-[state=closed]:animate-out data-[state=open]:animate-in",
97
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
98
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
99
- "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
100
- "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
101
- className
102
- ),
103
- ...props
104
- }
105
- ) }));
106
- DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
107
- var DropdownMenuItem = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx2(
108
- DropdownMenuPrimitive.Item,
109
- {
110
- ref,
111
- className: cn(
112
- "relative flex cursor-pointer select-none items-center rounded-md px-2 py-1.5 text-sm outline-none transition-colors",
113
- "focus:bg-muted/50 focus:text-foreground",
114
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
115
- inset && "pl-8",
116
- className
117
- ),
118
- ...props
119
- }
120
- ));
121
- DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
122
- var DropdownMenuCheckboxItem = React2.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
123
- DropdownMenuPrimitive.CheckboxItem,
124
- {
125
- ref,
126
- className: cn(
127
- "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none transition-colors",
128
- "focus:bg-muted/50 focus:text-foreground",
129
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
130
- className
131
- ),
132
- checked,
133
- ...props,
134
- children: [
135
- /* @__PURE__ */ jsx2("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx2(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx2(Check, { className: "h-4 w-4" }) }) }),
136
- children
137
- ]
138
- }
139
- ));
140
- DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
141
- var DropdownMenuRadioItem = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
142
- DropdownMenuPrimitive.RadioItem,
143
- {
144
- ref,
145
- className: cn(
146
- "relative flex cursor-pointer select-none items-center rounded-md py-1.5 pr-2 pl-8 text-sm outline-none transition-colors",
147
- "focus:bg-muted/50 focus:text-foreground",
148
- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
149
- className
150
- ),
151
- ...props,
152
- children: [
153
- /* @__PURE__ */ jsx2("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx2(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx2(Circle, { className: "h-2 w-2 fill-current" }) }) }),
154
- children
155
- ]
156
- }
157
- ));
158
- DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
159
- var DropdownMenuLabel = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx2(
160
- DropdownMenuPrimitive.Label,
161
- {
162
- ref,
163
- className: cn(
164
- "px-2 py-1.5 font-semibold text-sm",
165
- inset && "pl-8",
166
- className
167
- ),
168
- ...props
169
- }
170
- ));
171
- DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
172
- var DropdownMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
173
- DropdownMenuPrimitive.Separator,
174
- {
175
- ref,
176
- className: cn("-mx-1 my-1 h-px bg-border", className),
177
- ...props
178
- }
179
- ));
180
- DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
181
- var DropdownMenuShortcut = ({
182
- className,
183
- ...props
184
- }) => {
185
- return /* @__PURE__ */ jsx2(
186
- "span",
187
- {
188
- className: cn("ml-auto text-xs tracking-widest opacity-60", className),
189
- ...props
190
- }
191
- );
192
- };
193
- DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
194
-
195
- export {
196
- Avatar,
197
- AvatarImage,
198
- AvatarFallback,
199
- DropdownMenu,
200
- DropdownMenuTrigger,
201
- DropdownMenuGroup,
202
- DropdownMenuPortal,
203
- DropdownMenuSub,
204
- DropdownMenuRadioGroup,
205
- DropdownMenuSubTrigger,
206
- DropdownMenuSubContent,
207
- DropdownMenuContent,
208
- DropdownMenuItem,
209
- DropdownMenuCheckboxItem,
210
- DropdownMenuRadioItem,
211
- DropdownMenuLabel,
212
- DropdownMenuSeparator,
213
- DropdownMenuShortcut
214
- };
File without changes
@@ -1,174 +0,0 @@
1
- import {
2
- focusRing
3
- } from "./chunk-WKWBTL2V.js";
4
- import {
5
- cn
6
- } from "./chunk-RQHJBTEU.js";
7
-
8
- // src/markdown/code-block.tsx
9
- import {
10
- memo,
11
- useCallback,
12
- useEffect,
13
- useRef,
14
- useState
15
- } from "react";
16
- import SyntaxHighlighter from "react-syntax-highlighter";
17
- import { Check, Copy } from "lucide-react";
18
- import { jsx, jsxs } from "react/jsx-runtime";
19
- function getSyntaxTheme() {
20
- const el = typeof document !== "undefined" ? document.documentElement : null;
21
- const v = (name, fallback) => el ? getComputedStyle(el).getPropertyValue(name).trim() || fallback : fallback;
22
- const comment = v("--syntax-comment", "#6B7094");
23
- const keyword = v("--syntax-keyword", "#A78FFF");
24
- const string = v("--syntax-string", "#10b981");
25
- const fn = v("--syntax-function", "#6D9FFF");
26
- const number = v("--syntax-number", "#FFB347");
27
- const meta = v("--syntax-meta", "#8263FF");
28
- const error = v("--syntax-error", "#FF4D6D");
29
- const variable = v("--syntax-variable", "#C4C0D8");
30
- const fg = v("--syntax-foreground", "#E8E6F6");
31
- return {
32
- "hljs-comment": { color: comment, fontStyle: "italic" },
33
- "hljs-quote": { color: comment, fontStyle: "italic" },
34
- "hljs-doctag": { color: comment },
35
- "hljs-keyword": { color: keyword },
36
- "hljs-selector-tag": { color: keyword },
37
- "hljs-literal": { color: keyword },
38
- "hljs-type": { color: keyword },
39
- "hljs-class": { color: keyword },
40
- "hljs-string": { color: string },
41
- "hljs-template-tag": { color: string },
42
- "hljs-template-variable": { color: string },
43
- "hljs-addition": { color: string },
44
- "hljs-regexp": { color: string },
45
- "hljs-title": { color: fn },
46
- "hljs-section": { color: fn },
47
- "hljs-built_in": { color: fn },
48
- "hljs-name": { color: fn },
49
- "hljs-function": { color: fn },
50
- "hljs-selector-id": { color: fn },
51
- "hljs-selector-class": { color: fn },
52
- "hljs-attribute": { color: fn },
53
- "hljs-number": { color: number },
54
- "hljs-symbol": { color: number },
55
- "hljs-bullet": { color: number },
56
- "hljs-link": { color: number, textDecoration: "underline" },
57
- "hljs-meta": { color: meta },
58
- "hljs-selector-pseudo": { color: meta },
59
- "hljs-deletion": { color: error },
60
- "hljs-params": { color: variable },
61
- "hljs-variable": { color: variable },
62
- "hljs-tag": { color: variable },
63
- "hljs-attr": { color: variable },
64
- "hljs-subst": { color: variable },
65
- "hljs-strong": { fontWeight: "bold" },
66
- "hljs-emphasis": { fontStyle: "italic" },
67
- "hljs": { color: fg, background: "transparent" }
68
- };
69
- }
70
- var LIGHT_THEMES = /* @__PURE__ */ new Set(["vault", "dawn"]);
71
- function detectLightTheme() {
72
- return typeof document !== "undefined" && LIGHT_THEMES.has(document.documentElement.getAttribute("data-sandbox-theme") ?? "");
73
- }
74
- function useIsLightTheme() {
75
- const [isLight, setIsLight] = useState(detectLightTheme);
76
- useEffect(() => {
77
- if (typeof document === "undefined") return;
78
- setIsLight(detectLightTheme());
79
- const observer = new MutationObserver(() => setIsLight(detectLightTheme()));
80
- observer.observe(document.documentElement, {
81
- attributes: true,
82
- attributeFilter: ["data-sandbox-theme"]
83
- });
84
- return () => observer.disconnect();
85
- }, []);
86
- return isLight;
87
- }
88
- var CodeBlock = memo(
89
- ({ code, language, label, showLineNumbers = false, light: lightProp, className, children, ...props }) => {
90
- const isLight = useIsLightTheme();
91
- const light = lightProp ?? isLight;
92
- const theme = getSyntaxTheme();
93
- const bg = "bg-card border-border";
94
- const headerBg = light ? "bg-muted/50 border-border" : "bg-background border-border";
95
- const langColor = "text-muted-foreground";
96
- const headerLabel = label ?? language;
97
- return /* @__PURE__ */ jsxs(
98
- "div",
99
- {
100
- className: cn("group relative overflow-hidden rounded-lg border font-mono", bg, className),
101
- ...props,
102
- children: [
103
- headerLabel && /* @__PURE__ */ jsxs("div", { className: cn("flex items-center justify-between border-b px-3 py-1", headerBg), children: [
104
- /* @__PURE__ */ jsx("span", { className: cn("text-[calc(var(--font-size-xs)-1px)] font-mono font-medium uppercase tracking-widest", langColor), children: headerLabel }),
105
- children
106
- ] }),
107
- !headerLabel && children && /* @__PURE__ */ jsx("div", { className: "absolute right-2 top-2 z-10 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100", children }),
108
- /* @__PURE__ */ jsx(
109
- SyntaxHighlighter,
110
- {
111
- language: language ?? "text",
112
- style: theme,
113
- showLineNumbers,
114
- lineNumberStyle: {
115
- color: light ? "#8B92B8" : "#4A4D6A",
116
- minWidth: "2.5em",
117
- paddingRight: "1em"
118
- },
119
- customStyle: {
120
- margin: 0,
121
- padding: "var(--code-padding-y, 0.625rem) var(--code-padding-x, 0.75rem)",
122
- background: "transparent",
123
- fontSize: "var(--code-font-size, 0.8125rem)",
124
- lineHeight: "var(--code-line-height, 1.5)",
125
- overflowX: "auto"
126
- },
127
- codeTagProps: { style: { fontFamily: "var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)" } },
128
- wrapLines: false,
129
- children: code
130
- }
131
- )
132
- ]
133
- }
134
- );
135
- }
136
- );
137
- CodeBlock.displayName = "CodeBlock";
138
- var CopyButton = memo(({ text }) => {
139
- const [copied, setCopied] = useState(false);
140
- const timerRef = useRef(null);
141
- useEffect(() => {
142
- return () => {
143
- if (timerRef.current) clearTimeout(timerRef.current);
144
- };
145
- }, []);
146
- const handleCopy = useCallback(async () => {
147
- try {
148
- await navigator.clipboard.writeText(text);
149
- setCopied(true);
150
- if (timerRef.current) clearTimeout(timerRef.current);
151
- timerRef.current = setTimeout(() => setCopied(false), 2e3);
152
- } catch (err) {
153
- console.warn("Clipboard write failed:", err);
154
- }
155
- }, [text]);
156
- return /* @__PURE__ */ jsx(
157
- "button",
158
- {
159
- onClick: handleCopy,
160
- className: cn(
161
- "flex items-center justify-center w-6 h-6 rounded-md bg-muted border border-border hover:border-[var(--border-strong)] transition-colors",
162
- focusRing
163
- ),
164
- title: "Copy to clipboard",
165
- children: copied ? /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 text-emerald-500" }) : /* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5 text-muted-foreground" })
166
- }
167
- );
168
- });
169
- CopyButton.displayName = "CopyButton";
170
-
171
- export {
172
- CodeBlock,
173
- CopyButton
174
- };
@@ -1,112 +0,0 @@
1
- import {
2
- focusRing
3
- } from "./chunk-WKWBTL2V.js";
4
- import {
5
- cn
6
- } from "./chunk-RQHJBTEU.js";
7
-
8
- // src/primitives/button.tsx
9
- import { Slot } from "@radix-ui/react-slot";
10
- import { cva } from "class-variance-authority";
11
- import * as React from "react";
12
- import { jsx, jsxs } from "react/jsx-runtime";
13
- var buttonVariants = cva(
14
- `inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg font-medium text-sm transition-all ${focusRing} disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,
15
- {
16
- variants: {
17
- variant: {
18
- default: "bg-primary text-primary-foreground hover:bg-primary/90 active:scale-[0.97] duration-[var(--transition-fast)]",
19
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 active:scale-[0.97] duration-[var(--transition-fast)]",
20
- outline: "border border-border bg-card hover:bg-muted active:scale-[0.97] duration-[var(--transition-fast)] text-foreground",
21
- secondary: "bg-muted border border-border text-foreground hover:bg-muted/80 active:scale-[0.97] duration-[var(--transition-fast)]",
22
- ghost: "hover:bg-muted hover:text-foreground duration-[var(--transition-fast)] text-muted-foreground border border-transparent",
23
- link: "text-primary underline-offset-4 hover:underline",
24
- sandbox: "bg-[var(--btn-primary-bg)] text-[var(--btn-primary-text)] border border-[var(--border-accent)] hover:bg-[var(--btn-primary-hover)] active:scale-[0.97] duration-[var(--transition-fast)]"
25
- },
26
- size: {
27
- default: "h-[var(--control-height)] px-4 py-2",
28
- sm: "h-8 rounded-md px-3 text-xs",
29
- lg: "h-11 rounded-lg px-7 text-sm",
30
- xl: "h-13 rounded-xl px-9 text-base",
31
- icon: "h-[var(--control-height)] w-[var(--control-height)]"
32
- }
33
- },
34
- defaultVariants: {
35
- variant: "default",
36
- size: "default"
37
- }
38
- }
39
- );
40
- var Button = React.forwardRef(
41
- ({
42
- className,
43
- variant,
44
- size,
45
- asChild = false,
46
- loading = false,
47
- disabled,
48
- children,
49
- ...props
50
- }, ref) => {
51
- const Comp = asChild ? Slot : "button";
52
- if (asChild) {
53
- return /* @__PURE__ */ jsx(
54
- Comp,
55
- {
56
- className: cn(buttonVariants({ variant, size, className })),
57
- ref,
58
- ...props,
59
- children
60
- }
61
- );
62
- }
63
- return /* @__PURE__ */ jsxs(
64
- Comp,
65
- {
66
- className: cn(buttonVariants({ variant, size, className })),
67
- ref,
68
- disabled: disabled || loading,
69
- ...props,
70
- children: [
71
- loading && /* @__PURE__ */ jsxs(
72
- "svg",
73
- {
74
- className: "mr-2 -ml-1 h-4 w-4 animate-spin",
75
- fill: "none",
76
- viewBox: "0 0 24 24",
77
- children: [
78
- /* @__PURE__ */ jsx("title", { children: "Loading spinner" }),
79
- /* @__PURE__ */ jsx(
80
- "circle",
81
- {
82
- className: "opacity-25",
83
- cx: "12",
84
- cy: "12",
85
- r: "10",
86
- stroke: "currentColor",
87
- strokeWidth: "4"
88
- }
89
- ),
90
- /* @__PURE__ */ jsx(
91
- "path",
92
- {
93
- className: "opacity-75",
94
- fill: "currentColor",
95
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
96
- }
97
- )
98
- ]
99
- }
100
- ),
101
- children
102
- ]
103
- }
104
- );
105
- }
106
- );
107
- Button.displayName = "Button";
108
-
109
- export {
110
- buttonVariants,
111
- Button
112
- };
@@ -1,45 +0,0 @@
1
- // src/utils/format.ts
2
- function formatDuration(ms) {
3
- if (ms < 1e3) return "<1s";
4
- const seconds = Math.floor(ms / 1e3);
5
- if (seconds < 60) return `${seconds}s`;
6
- const minutes = Math.floor(seconds / 60);
7
- const remaining = seconds % 60;
8
- return remaining > 0 ? `${minutes}m ${remaining}s` : `${minutes}m`;
9
- }
10
- function truncateText(text, max) {
11
- const cleaned = text.replace(/\s+/g, " ").trim();
12
- if (cleaned.length <= max) return cleaned;
13
- return cleaned.slice(0, max).trim() + "...";
14
- }
15
- function formatUptime(ms) {
16
- if (!Number.isFinite(ms) || ms < 0) return "\u2014";
17
- const totalSeconds = Math.floor(ms / 1e3);
18
- if (totalSeconds < 60) return `${totalSeconds}s`;
19
- const minutes = Math.floor(totalSeconds / 60);
20
- const seconds = totalSeconds % 60;
21
- if (minutes < 60) return `${minutes}m ${seconds}s`;
22
- const hours = Math.floor(minutes / 60);
23
- const remMinutes = minutes % 60;
24
- if (hours < 24) return `${hours}h ${remMinutes}m`;
25
- const days = Math.floor(hours / 24);
26
- const remHours = hours % 24;
27
- return `${days}d ${remHours}h`;
28
- }
29
- function formatBytes(bytes) {
30
- if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
31
- if (bytes < 1024) return `${Math.round(bytes)} B`;
32
- const kb = bytes / 1024;
33
- if (kb < 1024) return `${kb < 10 ? kb.toFixed(1) : Math.round(kb)} KB`;
34
- const mb = kb / 1024;
35
- if (mb < 1024) return `${mb < 10 ? mb.toFixed(1) : Math.round(mb)} MB`;
36
- const gb = mb / 1024;
37
- return `${gb < 10 ? gb.toFixed(2) : gb.toFixed(1)} GB`;
38
- }
39
-
40
- export {
41
- formatDuration,
42
- truncateText,
43
- formatUptime,
44
- formatBytes
45
- };