@luxfi/ui 8.2.7 → 8.2.9

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 (241) hide show
  1. package/dist/3d-model-viewer.cjs +25 -421
  2. package/dist/3d-model-viewer.js +20 -416
  3. package/dist/accordion.cjs +3 -10
  4. package/dist/accordion.js +2 -10
  5. package/dist/advanced-navigation-bar.cjs +5 -401
  6. package/dist/advanced-navigation-bar.js +5 -401
  7. package/dist/ai-agents.cjs +45 -890
  8. package/dist/ai-agents.js +8 -834
  9. package/dist/ai-assistant.cjs +13 -740
  10. package/dist/ai-assistant.js +10 -738
  11. package/dist/ai-chat.cjs +24 -770
  12. package/dist/ai-chat.js +18 -765
  13. package/dist/ai-code.cjs +67 -923
  14. package/dist/ai-code.js +49 -905
  15. package/dist/ai-playground.cjs +25 -801
  16. package/dist/ai-playground.js +18 -795
  17. package/dist/ai-tools.cjs +22 -767
  18. package/dist/ai-tools.js +15 -761
  19. package/dist/ai-vision.cjs +41 -993
  20. package/dist/ai-vision.js +30 -983
  21. package/dist/ai-voice-settings.cjs +35 -1006
  22. package/dist/ai-voice-settings.js +32 -1004
  23. package/dist/ai-voice.cjs +51 -1024
  24. package/dist/ai-voice.js +9 -963
  25. package/dist/alert.cjs +11 -129
  26. package/dist/alert.js +8 -127
  27. package/dist/announcement.cjs +6 -402
  28. package/dist/announcement.js +6 -402
  29. package/dist/app-switcher-navigation-bar.cjs +5 -401
  30. package/dist/app-switcher-navigation-bar.js +5 -401
  31. package/dist/apple-cards-carousel.cjs +84 -480
  32. package/dist/apple-cards-carousel.js +19 -415
  33. package/dist/auth.cjs +10 -387
  34. package/dist/auth.js +7 -385
  35. package/dist/avatar.cjs +2 -9
  36. package/dist/avatar.js +2 -10
  37. package/dist/badge.cjs +8 -228
  38. package/dist/badge.js +5 -210
  39. package/dist/button.cjs +14 -67
  40. package/dist/button.js +12 -65
  41. package/dist/chrome.cjs +29 -493
  42. package/dist/chrome.js +9 -474
  43. package/dist/code-block.cjs +16 -664
  44. package/dist/code-block.js +13 -662
  45. package/dist/code-compare.cjs +28 -1302
  46. package/dist/code-compare.js +18 -1293
  47. package/dist/code-diff.cjs +21 -669
  48. package/dist/code-diff.js +17 -666
  49. package/dist/code-editor.cjs +13 -409
  50. package/dist/code-editor.js +12 -408
  51. package/dist/code-explorer.cjs +14 -456
  52. package/dist/code-explorer.js +13 -456
  53. package/dist/code-preview.cjs +31 -983
  54. package/dist/code-preview.js +23 -976
  55. package/dist/code-snippet.cjs +19 -667
  56. package/dist/code-snippet.js +14 -663
  57. package/dist/code-terminal.cjs +24 -485
  58. package/dist/code-terminal.js +19 -481
  59. package/dist/collapsible.cjs +13 -347
  60. package/dist/collapsible.js +11 -330
  61. package/dist/color-picker.cjs +8 -450
  62. package/dist/color-picker.js +7 -450
  63. package/dist/combobox.cjs +6 -402
  64. package/dist/combobox.js +6 -402
  65. package/dist/communication-navigation-bar.cjs +7 -403
  66. package/dist/communication-navigation-bar.js +5 -401
  67. package/dist/dashboard-navigation-bar.cjs +6 -402
  68. package/dist/dashboard-navigation-bar.js +5 -401
  69. package/dist/dialog-stack.cjs +5 -401
  70. package/dist/dialog-stack.js +5 -401
  71. package/dist/dialog.cjs +13 -70
  72. package/dist/dialog.js +13 -70
  73. package/dist/drawer.cjs +23 -99
  74. package/dist/drawer.js +19 -96
  75. package/dist/e-commerce-navigation-bar.cjs +7 -403
  76. package/dist/e-commerce-navigation-bar.js +5 -401
  77. package/dist/editor.cjs +9 -405
  78. package/dist/editor.js +6 -402
  79. package/dist/iam.cjs +2 -123
  80. package/dist/iam.js +1 -122
  81. package/dist/icon-button.cjs +2 -56
  82. package/dist/icon-button.js +1 -55
  83. package/dist/identity.cjs +28 -242
  84. package/dist/identity.js +20 -235
  85. package/dist/image-crop.cjs +10 -406
  86. package/dist/image-crop.js +7 -403
  87. package/dist/image.cjs +14 -83
  88. package/dist/image.js +13 -67
  89. package/dist/index.cjs +1868 -38770
  90. package/dist/index.js +174 -38320
  91. package/dist/input-group.cjs +3 -10
  92. package/dist/input-group.js +2 -10
  93. package/dist/item.cjs +2 -27
  94. package/dist/item.js +1 -22
  95. package/dist/kanban.cjs +25 -751
  96. package/dist/kanban.js +15 -742
  97. package/dist/limelight-nav.cjs +10 -452
  98. package/dist/limelight-nav.js +9 -452
  99. package/dist/link.cjs +11 -80
  100. package/dist/link.js +6 -60
  101. package/dist/lux.config.cjs +14 -32
  102. package/dist/lux.config.js +3 -26
  103. package/dist/menu.cjs +5 -13
  104. package/dist/menu.js +1 -9
  105. package/dist/message-dock.cjs +5 -401
  106. package/dist/message-dock.js +5 -401
  107. package/dist/mini-calendar.cjs +7 -403
  108. package/dist/mini-calendar.js +6 -402
  109. package/dist/music-player.cjs +30 -528
  110. package/dist/music-player.js +22 -520
  111. package/dist/next.cjs +8 -89
  112. package/dist/next.js +3 -86
  113. package/dist/popover.cjs +17 -74
  114. package/dist/popover.js +16 -73
  115. package/dist/progress-circle.cjs +3 -10
  116. package/dist/progress-circle.js +2 -10
  117. package/dist/provider.cjs +7 -176
  118. package/dist/provider.js +4 -174
  119. package/dist/select.cjs +36 -89
  120. package/dist/select.js +35 -88
  121. package/dist/sidebar.cjs +22 -493
  122. package/dist/sidebar.js +17 -489
  123. package/dist/site/commerce/ui/context.cjs +9 -214
  124. package/dist/site/commerce/ui/context.js +6 -215
  125. package/dist/site/components/analytics.cjs +2 -42
  126. package/dist/site/components/analytics.js +1 -37
  127. package/dist/site/components/auth/callback.cjs +2 -8
  128. package/dist/site/components/auth/callback.js +1 -7
  129. package/dist/site/components/auth/login-panel.cjs +15 -74
  130. package/dist/site/components/auth/login-panel.js +12 -73
  131. package/dist/site/components/auth/login.cjs +2 -6
  132. package/dist/site/components/auth/login.js +1 -5
  133. package/dist/site/components/auth/widget.cjs +2 -6
  134. package/dist/site/components/auth/widget.js +1 -5
  135. package/dist/site/components/commerce/bag-button.cjs +2 -3
  136. package/dist/site/components/commerce/bag-button.js +2 -3
  137. package/dist/site/components/commerce/buy-button.cjs +2 -11
  138. package/dist/site/components/commerce/buy-button.js +1 -10
  139. package/dist/site/components/commerce/checkout-button.cjs +2 -3
  140. package/dist/site/components/commerce/checkout-button.js +2 -3
  141. package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
  142. package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
  143. package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
  144. package/dist/site/components/commerce/checkout-panel/index.js +10 -403
  145. package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
  146. package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
  147. package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
  148. package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
  149. package/dist/site/components/commerce/drawer/index.cjs +15 -289
  150. package/dist/site/components/commerce/drawer/index.js +10 -290
  151. package/dist/site/components/commerce/drawer/micro.cjs +8 -115
  152. package/dist/site/components/commerce/drawer/micro.js +4 -115
  153. package/dist/site/components/commerce/drawer/shell.cjs +2 -10
  154. package/dist/site/components/commerce/drawer/shell.js +2 -10
  155. package/dist/site/components/contact-dialog/index.cjs +6 -69
  156. package/dist/site/components/contact-dialog/index.js +7 -71
  157. package/dist/site/components/drawer-margin.cjs +2 -10
  158. package/dist/site/components/drawer-margin.js +2 -10
  159. package/dist/site/components/footer.cjs +11 -81
  160. package/dist/site/components/footer.js +8 -80
  161. package/dist/site/components/header/desktop.cjs +18 -374
  162. package/dist/site/components/header/desktop.js +12 -355
  163. package/dist/site/components/header/index.cjs +9 -674
  164. package/dist/site/components/header/index.js +8 -657
  165. package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
  166. package/dist/site/components/header/mobile-bag-drawer.js +5 -74
  167. package/dist/site/components/header/mobile-nav-menu-ai.cjs +2 -31
  168. package/dist/site/components/header/mobile-nav-menu-ai.js +1 -26
  169. package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
  170. package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
  171. package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
  172. package/dist/site/components/header/mobile-nav-menu.js +7 -112
  173. package/dist/site/components/header/mobile.cjs +25 -330
  174. package/dist/site/components/header/mobile.js +20 -330
  175. package/dist/site/components/icons/index.cjs +34 -35
  176. package/dist/site/components/icons/index.js +5 -33
  177. package/dist/site/components/index.cjs +118 -1961
  178. package/dist/site/components/index.js +23 -1951
  179. package/dist/site/components/mini-chart/index.cjs +7 -90
  180. package/dist/site/components/mini-chart/index.js +1 -92
  181. package/dist/site/components/mini-chart/wrapper.cjs +7 -76
  182. package/dist/site/components/mini-chart/wrapper.js +4 -77
  183. package/dist/site/components/not-found/index.cjs +9 -819
  184. package/dist/site/components/not-found/index.js +8 -802
  185. package/dist/site/components/security/index.cjs +9 -819
  186. package/dist/site/components/security/index.js +8 -802
  187. package/dist/site/next/analytics/index.cjs +16 -49
  188. package/dist/site/next/analytics/index.js +3 -49
  189. package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
  190. package/dist/site/next/analytics/pixel-analytics.js +4 -8
  191. package/dist/site/next/index.cjs +13 -140
  192. package/dist/site/next/index.js +2 -140
  193. package/dist/site/root-layout/index.cjs +12 -1435
  194. package/dist/site/root-layout/index.css +0 -133
  195. package/dist/site/root-layout/index.js +12 -1416
  196. package/dist/site/site-def/footer/community.cjs +11 -27
  197. package/dist/site/site-def/footer/community.js +2 -18
  198. package/dist/site/site-def/footer/company.d.ts +3 -3
  199. package/dist/site/site-def/footer/index.cjs +38 -218
  200. package/dist/site/site-def/footer/index.js +14 -215
  201. package/dist/site/site-def/index.cjs +28 -620
  202. package/dist/site/site-def/index.js +3 -624
  203. package/dist/table.cjs +20 -338
  204. package/dist/table.js +19 -338
  205. package/dist/tabs.cjs +3 -10
  206. package/dist/tabs.js +1 -9
  207. package/dist/tag.cjs +9 -270
  208. package/dist/tag.js +6 -268
  209. package/dist/tags.cjs +6 -314
  210. package/dist/tags.js +5 -314
  211. package/dist/textarea.cjs +4 -50
  212. package/dist/textarea.js +3 -49
  213. package/dist/tooltip.cjs +15 -34
  214. package/dist/tooltip.js +13 -33
  215. package/dist/vite.cjs +3 -82
  216. package/dist/vite.js +1 -80
  217. package/package.json +1 -1
  218. package/dist/index.css +0 -132
  219. package/dist/site/components/auth/login-panel.css +0 -4
  220. package/dist/site/components/commerce/bag-button.css +0 -4
  221. package/dist/site/components/commerce/checkout-button.css +0 -4
  222. package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
  223. package/dist/site/components/commerce/checkout-panel/index.css +0 -132
  224. package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
  225. package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
  226. package/dist/site/components/commerce/drawer/index.css +0 -132
  227. package/dist/site/components/commerce/drawer/micro.css +0 -4
  228. package/dist/site/components/header/desktop.css +0 -4
  229. package/dist/site/components/header/index.css +0 -132
  230. package/dist/site/components/header/mobile-bag-drawer.css +0 -4
  231. package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
  232. package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
  233. package/dist/site/components/header/mobile-nav-menu.css +0 -132
  234. package/dist/site/components/header/mobile.css +0 -132
  235. package/dist/site/components/icons/index.css +0 -4
  236. package/dist/site/components/index.css +0 -132
  237. package/dist/site/components/not-found/index.css +0 -132
  238. package/dist/site/components/security/index.css +0 -132
  239. package/dist/site/site-def/footer/community.css +0 -4
  240. package/dist/site/site-def/footer/index.css +0 -4
  241. package/dist/site/site-def/index.css +0 -4
@@ -1,1288 +1,13 @@
1
1
  'use client';
2
- import { Box, sx, cn, variants, css, ToggleGroup, ToggleGroupItem, Tabs, TabsList, TabsTrigger, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, ScrollArea } from '@hanzo/ui';
3
- import * as React6 from 'react';
4
- import React6__default, { Children, createElement } from 'react';
5
- import { GitCompare, Plus, Minus, Square, SplitSquareHorizontal, Check, Copy, MoreHorizontal, RotateCcw, Settings, FileText, Minimize2, Maximize2 } from 'lucide-react';
6
- import { TooltipGroup, Tooltip as Tooltip$1, Text, XStack, styled, View } from '@hanzo/gui';
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { useClickAway } from '@uidotdev/usehooks';
9
- import { codeToHtml, bundledLanguages } from 'shiki';
2
+ import { variants, Box, cn, Tabs, TabsList, sx, TabsTrigger, css, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, ScrollArea } from '@hanzo/ui';
3
+ import * as React from 'react';
4
+ import { Check, Copy, MoreHorizontal, RotateCcw, Settings } from 'lucide-react';
5
+ import { Badge } from './badge.js';
6
+ import { Button } from './button.js';
7
+ import { CodeDiff } from './code-diff.js';
8
+ import { CodeSnippet } from './code-snippet.js';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
10
 
11
- var SKELETON_CLASSES = "lux-skeleton rounded-sm";
12
- var Skeleton = React6.forwardRef(
13
- function Skeleton2(props, ref) {
14
- const { loading = true, asChild, className, children, style, ...rest } = props;
15
- if (!loading) {
16
- if (asChild && React6.isValidElement(children)) return children;
17
- return /* @__PURE__ */ jsx(Box, { ref, className, style, ...rest, children });
18
- }
19
- return /* @__PURE__ */ jsx(
20
- "div",
21
- {
22
- ref,
23
- "data-loading": true,
24
- ...sx(
25
- SKELETON_CLASSES,
26
- asChild || children ? "[&_*]:invisible" : "min-h-5",
27
- className
28
- ),
29
- style,
30
- ...rest,
31
- children
32
- }
33
- );
34
- }
35
- );
36
- React6.forwardRef(
37
- function SkeletonCircle2(props, ref) {
38
- const { size = 40, loading = true, className, ...rest } = props;
39
- const dimension = typeof size === "number" ? `${size}px` : size;
40
- return /* @__PURE__ */ jsx(
41
- Skeleton,
42
- {
43
- ref,
44
- loading,
45
- ...sx("rounded-full shrink-0", className),
46
- style: { width: dimension, height: dimension, ...rest.style },
47
- ...rest
48
- }
49
- );
50
- }
51
- );
52
- React6.forwardRef(
53
- function SkeletonText2(props, ref) {
54
- const { noOfLines = 3, loading = true, className, ...rest } = props;
55
- return /* @__PURE__ */ jsx(Box, { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
56
- Skeleton,
57
- {
58
- loading,
59
- ...sx(cn("h-4", index === noOfLines - 1 && "max-w-[80%]"))
60
- },
61
- index
62
- )) });
63
- }
64
- );
65
- var ink = (children, Wrap = Text, props = {}) => {
66
- let hasText = false;
67
- Children.forEach(children, (child) => {
68
- if (typeof child === "string" || typeof child === "number") hasText = true;
69
- });
70
- if (!hasText) return children;
71
- return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
72
- };
73
- var TOUCH_PX = 1024;
74
- function useBelow(px) {
75
- const [below, setBelow] = React6.useState(false);
76
- React6.useEffect(() => {
77
- const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
78
- const apply = () => setBelow(mql.matches);
79
- apply();
80
- mql.addEventListener("change", apply);
81
- return () => mql.removeEventListener("change", apply);
82
- }, [px]);
83
- return below;
84
- }
85
- var useIsTouch = () => useBelow(TOUCH_PX);
86
- function mapPlacement(p) {
87
- if (!p) return void 0;
88
- return p;
89
- }
90
- var Tooltip = React6.forwardRef(
91
- function Tooltip2(props, ref) {
92
- const {
93
- showArrow: showArrowProp,
94
- onOpenChange,
95
- variant,
96
- selected,
97
- children,
98
- disabled,
99
- disableOnMobile,
100
- content,
101
- contentProps,
102
- defaultOpen = false,
103
- triggerProps,
104
- closeDelay = 100,
105
- openDelay = 100,
106
- interactive,
107
- positioning
108
- } = props;
109
- const [open, setOpen] = React6.useState(defaultOpen);
110
- const timeoutRef = React6.useRef(null);
111
- const isMobile = useIsTouch();
112
- const handleOpenChange = React6.useCallback((nextOpen) => {
113
- setOpen(nextOpen);
114
- onOpenChange?.({ open: nextOpen });
115
- }, [onOpenChange]);
116
- const handleOpenChangeManual = React6.useCallback((nextOpen) => {
117
- timeoutRef.current && window.clearTimeout(timeoutRef.current);
118
- timeoutRef.current = window.setTimeout(() => {
119
- setOpen(nextOpen);
120
- onOpenChange?.({ open: nextOpen });
121
- }, nextOpen ? openDelay : closeDelay);
122
- }, [closeDelay, openDelay, onOpenChange]);
123
- const handleClickAway = React6.useCallback(() => {
124
- if (open) handleOpenChangeManual(false);
125
- }, [open, handleOpenChangeManual]);
126
- const triggerRef = useClickAway(handleClickAway);
127
- const handleTriggerClick = React6.useCallback(() => {
128
- handleOpenChangeManual(!open);
129
- }, [handleOpenChangeManual, open]);
130
- const handleContentClick = React6.useCallback((event) => {
131
- event.stopPropagation();
132
- if (interactive) {
133
- const closestLink = event.target?.closest("a");
134
- if (closestLink) {
135
- handleOpenChangeManual(false);
136
- }
137
- }
138
- }, [interactive, handleOpenChangeManual]);
139
- React6.useEffect(() => {
140
- return () => {
141
- if (timeoutRef.current) {
142
- clearTimeout(timeoutRef.current);
143
- }
144
- };
145
- }, []);
146
- if (disabled || disableOnMobile && isMobile) return children;
147
- const defaultShowArrow = variant === "popover" ? false : true;
148
- const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
149
- const isPopover = variant === "popover";
150
- const placement = mapPlacement(positioning?.placement) ?? "top";
151
- const offset = positioning?.offset?.mainAxis ?? 4;
152
- return /* @__PURE__ */ jsx(TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxs(
153
- Tooltip$1,
154
- {
155
- open,
156
- onOpenChange: handleOpenChange,
157
- delay: { open: openDelay, close: closeDelay },
158
- placement,
159
- offset,
160
- unstyled: true,
161
- children: [
162
- /* @__PURE__ */ jsx(
163
- Tooltip$1.Trigger,
164
- {
165
- ref: triggerRef,
166
- asChild: true,
167
- ...isMobile ? { onClick: handleTriggerClick } : {},
168
- ...triggerProps,
169
- children
170
- }
171
- ),
172
- /* @__PURE__ */ jsxs(
173
- Tooltip$1.Content,
174
- {
175
- ref,
176
- unstyled: true,
177
- zIndex: 9999,
178
- overflow: "hidden",
179
- borderRadius: 8,
180
- paddingHorizontal: 12,
181
- paddingVertical: 8,
182
- maxWidth: isPopover ? 384 : 320,
183
- backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
184
- transition: "quick",
185
- enterStyle: { opacity: 0, scale: 0.95 },
186
- exitStyle: { opacity: 0, scale: 0.95 },
187
- ...isPopover ? {
188
- borderWidth: 1,
189
- borderColor: "var(--color-border-divider)",
190
- shadowColor: "var(--shadow-popover)"
191
- } : {},
192
- onClick: interactive ? handleContentClick : void 0,
193
- ...selected ? { "data-selected": true } : {},
194
- ...contentProps,
195
- children: [
196
- showArrow && /* @__PURE__ */ jsx(
197
- Tooltip$1.Arrow,
198
- {
199
- unstyled: true,
200
- backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
201
- }
202
- ),
203
- ink(content, void 0, {
204
- fontSize: 14,
205
- color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
206
- })
207
- ]
208
- }
209
- )
210
- ]
211
- }
212
- ) });
213
- }
214
- );
215
- function TruncatedTextTooltip({ label, children }) {
216
- return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
217
- }
218
- var SIZE = {
219
- sm: { padding: 4, height: 18, minHeight: 18 },
220
- md: { paddingHorizontal: 4, paddingVertical: 2, minHeight: 24 },
221
- lg: { paddingHorizontal: 8, paddingVertical: 4, minHeight: 28 }
222
- };
223
- var SIZE_TEXT = {
224
- sm: { fontSize: 12, fontWeight: "500" },
225
- md: { fontSize: 14, fontWeight: "500" },
226
- lg: { fontSize: 14, fontWeight: "600" }
227
- };
228
- var COLOR_PALETTE = {
229
- gray: { bg: "var(--color-badge-gray-bg)", fg: "var(--color-badge-gray-fg)" },
230
- green: { bg: "var(--color-badge-green-bg)", fg: "var(--color-badge-green-fg)" },
231
- red: { bg: "var(--color-badge-red-bg)", fg: "var(--color-badge-red-fg)" },
232
- purple: { bg: "var(--color-badge-purple-bg)", fg: "var(--color-badge-purple-fg)" },
233
- orange: { bg: "var(--color-badge-orange-bg)", fg: "var(--color-badge-orange-fg)" },
234
- blue: { bg: "var(--color-badge-blue-bg)", fg: "var(--color-badge-blue-fg)" },
235
- yellow: { bg: "var(--color-badge-yellow-bg)", fg: "var(--color-badge-yellow-fg)" },
236
- teal: { bg: "var(--color-badge-teal-bg)", fg: "var(--color-badge-teal-fg)" },
237
- cyan: { bg: "var(--color-badge-cyan-bg)", fg: "var(--color-badge-cyan-fg)" },
238
- pink: { bg: "var(--color-badge-pink-bg)", fg: "var(--color-badge-pink-fg)" },
239
- purple_alt: { bg: "var(--color-badge-purple-alt-bg)", fg: "var(--color-badge-purple-alt-fg)" },
240
- blue_alt: { bg: "var(--color-badge-blue-alt-bg)", fg: "var(--color-badge-blue-alt-fg)" },
241
- bright_gray: { bg: "var(--color-badge-bright-gray-bg)", fg: "var(--color-badge-bright-gray-fg)" },
242
- bright_green: { bg: "var(--color-badge-bright-green-bg)", fg: "var(--color-badge-bright-green-fg)" },
243
- bright_red: { bg: "var(--color-badge-bright-red-bg)", fg: "var(--color-badge-bright-red-fg)" },
244
- bright_blue: { bg: "var(--color-badge-bright-blue-bg)", fg: "var(--color-badge-bright-blue-fg)" },
245
- bright_yellow: { bg: "var(--color-badge-bright-yellow-bg)", fg: "var(--color-badge-bright-yellow-fg)" },
246
- bright_teal: { bg: "var(--color-badge-bright-teal-bg)", fg: "var(--color-badge-bright-teal-fg)" },
247
- bright_cyan: { bg: "var(--color-badge-bright-cyan-bg)", fg: "var(--color-badge-bright-cyan-fg)" },
248
- bright_orange: { bg: "var(--color-badge-bright-orange-bg)", fg: "var(--color-badge-bright-orange-fg)" },
249
- bright_purple: { bg: "var(--color-badge-bright-purple-bg)", fg: "var(--color-badge-bright-purple-fg)" },
250
- bright_pink: { bg: "var(--color-badge-bright-pink-bg)", fg: "var(--color-badge-bright-pink-fg)" }
251
- };
252
- var TONE = {
253
- subtle: (p) => ({ backgroundColor: p.bg, color: p.fg, borderWidth: 0 }),
254
- solid: (p) => ({ backgroundColor: p.fg, color: p.bg, borderWidth: 0 }),
255
- outline: (p) => ({
256
- backgroundColor: "transparent",
257
- color: p.fg,
258
- borderWidth: 1,
259
- borderColor: p.fg
260
- })
261
- };
262
- var Badge = React6__default.forwardRef(
263
- function Badge2(props, ref) {
264
- const {
265
- loading,
266
- startElement,
267
- children,
268
- truncated = false,
269
- endElement,
270
- variant = "subtle",
271
- size = "md",
272
- colorPalette = "gray",
273
- className,
274
- style: badgeStyle,
275
- ...rest
276
- } = props;
277
- const palette = COLOR_PALETTE[colorPalette];
278
- const tone = TONE[variant](palette);
279
- const child = children ? (
280
- // `ellipsis` is gui Text's own built-in variant for single-line
281
- // truncation — it expands to the same overflow/text-overflow/
282
- // white-space/max-width rule Tailwind's `text-ellipsis` did, but
283
- // through the component's own variants (guaranteed to compile),
284
- // rather than naming each longhand as a separate style prop.
285
- /* @__PURE__ */ jsx(Text, { ellipsis: true, ...SIZE_TEXT[size], color: tone.color, children })
286
- ) : null;
287
- const childrenElement = truncated ? /* @__PURE__ */ jsx(TruncatedTextTooltip, { label: children, children: child }) : child;
288
- const badgeElement = /* @__PURE__ */ jsxs(
289
- XStack,
290
- {
291
- ref,
292
- render: /* @__PURE__ */ jsx("span", {}),
293
- display: "inline-flex",
294
- alignItems: "center",
295
- alignSelf: "flex-start",
296
- borderRadius: 2,
297
- gap: 4,
298
- maxWidth: "100%",
299
- userSelect: "text",
300
- ...SIZE[size],
301
- ...tone,
302
- className,
303
- style: badgeStyle,
304
- ...rest,
305
- children: [
306
- startElement,
307
- childrenElement,
308
- endElement
309
- ]
310
- }
311
- );
312
- if (loading) {
313
- return /* @__PURE__ */ jsx(Skeleton, { loading, asChild: true, children: badgeElement });
314
- }
315
- return badgeElement;
316
- }
317
- );
318
- var SpinnerFrame = styled(View, {
319
- name: "ButtonSpinner",
320
- render: /* @__PURE__ */ jsx("span", {}),
321
- width: 16,
322
- height: 16,
323
- borderRadius: 1e3,
324
- borderWidth: 2,
325
- borderColor: "currentColor",
326
- borderBottomColor: "transparent",
327
- borderLeftColor: "transparent"
328
- });
329
- function Spinner({ className }) {
330
- return /* @__PURE__ */ jsx(
331
- SpinnerFrame,
332
- {
333
- role: "status",
334
- "aria-label": "Loading",
335
- className: [
336
- "animate-spin",
337
- className
338
- ].filter(Boolean).join(" ")
339
- }
340
- );
341
- }
342
- var ButtonFrame = styled(View, {
343
- name: "LuxButton",
344
- render: /* @__PURE__ */ jsx("button", { type: "button" }),
345
- role: "button",
346
- tabIndex: 0,
347
- cursor: "pointer",
348
- userSelect: "none",
349
- display: "inline-flex",
350
- alignItems: "center",
351
- justifyContent: "center",
352
- gap: 0,
353
- overflow: "hidden",
354
- borderRadius: 6,
355
- // Whitespace nowrap via className since hanzogui doesn't have a direct token
356
- // Transition via className
357
- variants: {
358
- size: {
359
- "2xs": { paddingHorizontal: 8, height: 20, minWidth: 20, fontSize: 12, borderRadius: 4, gap: 4 },
360
- xs: { paddingHorizontal: 8, height: 24, minWidth: 24, fontSize: 14, borderRadius: 4, gap: 4 },
361
- sm: { paddingHorizontal: 12, height: 32, minWidth: 32, fontSize: 14, borderRadius: 6, gap: 4 },
362
- md: { paddingHorizontal: 12, height: 40, minWidth: 40, fontSize: 16, borderRadius: 6, gap: 8 }
363
- },
364
- disabled: {
365
- true: {
366
- opacity: 0.2,
367
- cursor: "not-allowed",
368
- pointerEvents: "none"
369
- }
370
- }
371
- },
372
- defaultVariants: {
373
- size: "md"
374
- }
375
- });
376
- var VARIANT_CLASSES = {
377
- solid: [
378
- "bg-[var(--color-button-solid-bg)] text-[var(--color-button-solid-text)]",
379
- "hover:bg-[var(--color-hover)]",
380
- "data-[expanded]:bg-[var(--color-hover)]"
381
- ].join(" "),
382
- solid_danger: [
383
- "bg-[var(--color-button-danger-bg)] text-[var(--color-button-danger-fg)]",
384
- "hover:bg-[var(--color-button-danger-bg-hover)]",
385
- "data-[expanded]:bg-[var(--color-button-danger-bg-hover)]"
386
- ].join(" "),
387
- outline: [
388
- "border-2 border-solid bg-transparent",
389
- "text-[var(--color-button-outline-fg)] border-[var(--color-button-outline-fg)]",
390
- "hover:bg-transparent hover:text-[var(--color-hover)] hover:border-[var(--color-hover)]"
391
- ].join(" "),
392
- outline_danger: [
393
- "border-2 border-solid bg-transparent",
394
- "text-[var(--color-button-danger-bg)] border-[var(--color-button-danger-bg)]",
395
- "hover:bg-transparent hover:text-[var(--color-button-danger-bg-hover)] hover:border-[var(--color-button-danger-bg-hover)]"
396
- ].join(" "),
397
- dropdown: [
398
- "border-2 border-solid bg-transparent",
399
- "text-[var(--color-button-dropdown-fg)] border-[var(--color-button-dropdown-border)]",
400
- "hover:bg-transparent hover:text-[var(--color-hover)] hover:border-[var(--color-hover)]",
401
- "data-[expanded]:bg-transparent data-[expanded]:text-[var(--color-hover)] data-[expanded]:border-[var(--color-hover)]",
402
- "data-[selected]:bg-[var(--color-selected-control-bg)] data-[selected]:text-[var(--color-selected-control-text)] data-[selected]:border-transparent",
403
- "data-[selected]:hover:bg-[var(--color-selected-control-bg)]",
404
- "data-[selected]:hover:text-[var(--color-hover)] data-[selected]:hover:border-transparent",
405
- "data-[selected]:data-[expanded]:text-[var(--color-hover)]"
406
- ].join(" "),
407
- header: [
408
- "bg-transparent border-2 border-solid",
409
- "text-[var(--color-button-header-fg)] border-[var(--color-button-header-border)]",
410
- "hover:bg-transparent hover:text-[var(--color-hover)] hover:border-[var(--color-hover)]",
411
- "data-[selected]:bg-[var(--color-button-header-bg-selected)]",
412
- "data-[selected]:text-[var(--color-button-header-fg-selected)] data-[selected]:border-transparent data-[selected]:border-0",
413
- "data-[selected]:hover:bg-[var(--color-button-header-bg-selected)] data-[selected]:hover:text-[var(--color-hover)]",
414
- "data-[selected]:data-[expanded]:text-[var(--color-hover)]",
415
- "data-[selected]:data-[highlighted]:bg-[var(--color-button-header-bg-highlighted)]",
416
- "data-[selected]:data-[highlighted]:text-[var(--color-button-header-fg-highlighted)]",
417
- "data-[selected]:data-[highlighted]:border-transparent data-[selected]:data-[highlighted]:border-0",
418
- "data-[selected]:data-[highlighted]:hover:bg-[var(--color-button-header-bg-highlighted)]",
419
- "data-[selected]:data-[highlighted]:hover:text-[var(--color-hover)]",
420
- "data-[selected]:data-[highlighted]:data-[expanded]:text-[var(--color-hover)]"
421
- ].join(" "),
422
- hero: [
423
- "bg-[var(--color-button-hero-bg)] text-[var(--color-button-hero-fg)]",
424
- "hover:bg-[var(--color-button-hero-bg-hover)] hover:text-[var(--color-button-hero-fg-hover)]",
425
- "data-[selected]:bg-[var(--color-button-hero-bg-selected)] data-[selected]:text-[var(--color-button-hero-fg-selected)]",
426
- "data-[selected]:hover:bg-[var(--color-button-hero-bg-selected)] data-[selected]:hover:text-[var(--color-hover)]",
427
- "data-[selected]:data-[expanded]:text-[var(--color-hover)]"
428
- ].join(" "),
429
- segmented: [
430
- "bg-transparent border-2 border-solid rounded-none",
431
- "text-[var(--color-button-segmented-fg)] border-[var(--color-selected-control-bg)]",
432
- "hover:text-[var(--color-hover)]",
433
- "data-[selected]:bg-[var(--color-selected-control-bg)] data-[selected]:text-[var(--color-selected-control-text)]",
434
- "data-[selected]:hover:bg-[var(--color-selected-control-bg)] data-[selected]:hover:text-[var(--color-selected-control-text)]",
435
- "[&:not(:last-child)]:border-r-0 data-[selected]:[&:not(:last-child)]:border-r-2",
436
- "data-[selected]+*:border-l-0",
437
- "first:rounded-l-md last:rounded-r-md"
438
- ].join(" "),
439
- plain: "bg-transparent text-inherit border-none hover:bg-transparent",
440
- subtle: [
441
- "bg-[var(--color-button-subtle-bg)] text-[var(--color-button-subtle-fg)]",
442
- "hover:bg-[var(--color-button-subtle-bg)] hover:text-[var(--color-hover)]",
443
- "disabled:bg-[var(--color-button-subtle-bg)] disabled:text-[var(--color-button-subtle-fg)]"
444
- ].join(" "),
445
- link: [
446
- "bg-transparent text-[var(--color-link-primary)] border-none font-normal",
447
- "px-0 h-auto",
448
- "hover:bg-transparent hover:text-[var(--color-link-primary-hover)]",
449
- "disabled:text-[var(--color-text-secondary)]"
450
- ].join(" "),
451
- icon_secondary: [
452
- "bg-transparent text-[var(--color-icon-secondary)] border-none",
453
- "hover:text-[var(--color-hover)]",
454
- "data-[selected]:bg-[var(--color-selected-control-bg)] data-[selected]:text-[var(--color-selected-control-text)]",
455
- "data-[selected]:hover:bg-[var(--color-selected-control-bg)] data-[selected]:hover:text-[var(--color-hover)]",
456
- "data-[selected]:data-[expanded]:text-[var(--color-hover)]",
457
- "data-[expanded]:text-[var(--color-hover)]"
458
- ].join(" "),
459
- icon_background: [
460
- "bg-[var(--color-button-icon-background-bg)] text-[var(--color-icon-secondary)] border-none",
461
- "hover:text-[var(--color-hover)]",
462
- "data-[selected]:bg-[var(--color-selected-control-bg)] data-[selected]:text-[var(--color-selected-control-text)]",
463
- "data-[selected]:hover:bg-[var(--color-selected-control-bg)] data-[selected]:hover:text-[var(--color-hover)]",
464
- "data-[selected]:data-[expanded]:text-[var(--color-hover)]",
465
- "data-[expanded]:text-[var(--color-hover)]"
466
- ].join(" "),
467
- pagination: [
468
- "border-2 border-solid bg-transparent",
469
- "text-[var(--color-button-pagination-fg)] border-[var(--color-button-pagination-border)]",
470
- "hover:bg-transparent hover:text-[var(--color-hover)] hover:border-[var(--color-hover)]",
471
- "data-[selected]:bg-[var(--color-selected-control-bg)] data-[selected]:text-[var(--color-selected-control-text)] data-[selected]:border-transparent",
472
- "data-[selected]:hover:bg-[var(--color-selected-control-bg)]",
473
- "data-[selected]:hover:text-[var(--color-selected-control-text)] data-[selected]:hover:border-transparent"
474
- ].join(" ")
475
- };
476
- var BASE_CLASSES = "font-semibold whitespace-nowrap transition-colors duration-150";
477
- var SP = 4;
478
- function buildShimStyle(props) {
479
- const s = { ...props.style };
480
- if (props.mt !== void 0) s.marginTop = typeof props.mt === "number" ? `${props.mt * SP}px` : props.mt;
481
- if (props.ml !== void 0) s.marginLeft = typeof props.ml === "number" ? `${props.ml * SP}px` : props.ml;
482
- if (props.mr !== void 0) s.marginRight = typeof props.mr === "number" ? `${props.mr * SP}px` : props.mr;
483
- if (props.px !== void 0) {
484
- const v = typeof props.px === "number" ? `${props.px * SP}px` : props.px;
485
- s.paddingLeft = v;
486
- s.paddingRight = v;
487
- }
488
- if (props.py !== void 0) {
489
- const v = typeof props.py === "number" ? `${props.py * SP}px` : props.py;
490
- s.paddingTop = v;
491
- s.paddingBottom = v;
492
- }
493
- if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
494
- if (props.gap !== void 0) s.gap = typeof props.gap === "number" ? `${props.gap * SP}px` : props.gap;
495
- if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
496
- if (props.columnGap !== void 0) s.columnGap = typeof props.columnGap === "number" ? `${props.columnGap * SP}px` : props.columnGap;
497
- if (props.gridColumn !== void 0) s.gridColumn = typeof props.gridColumn === "number" ? String(props.gridColumn) : props.gridColumn;
498
- if (props.gridRow) s.gridRow = props.gridRow;
499
- if (props.justifySelf) s.justifySelf = props.justifySelf;
500
- if (props.alignSelf) s.alignSelf = props.alignSelf;
501
- if (props.h) s.height = props.h;
502
- if (props.w) s.width = props.w;
503
- if (props.display) s.display = props.display;
504
- if (props.borderBottomRightRadius !== void 0) s.borderBottomRightRadius = typeof props.borderBottomRightRadius === "number" ? `${props.borderBottomRightRadius}px` : props.borderBottomRightRadius;
505
- if (props.borderTopRightRadius !== void 0) s.borderTopRightRadius = typeof props.borderTopRightRadius === "number" ? `${props.borderTopRightRadius}px` : props.borderTopRightRadius;
506
- return Object.keys(s).length > 0 ? s : void 0;
507
- }
508
- var Button = React6.forwardRef(
509
- function Button2(props, ref) {
510
- const {
511
- className,
512
- variant = "solid",
513
- size = "md",
514
- asChild = false,
515
- loading = false,
516
- loadingText,
517
- loadingSkeleton = false,
518
- expanded,
519
- selected,
520
- highlighted,
521
- disabled,
522
- children,
523
- style: styleProp,
524
- // Strip Chakra style props
525
- mt,
526
- ml,
527
- mr,
528
- px,
529
- py,
530
- fontWeight,
531
- gap,
532
- flexShrink,
533
- columnGap,
534
- gridColumn,
535
- gridRow,
536
- justifySelf,
537
- alignSelf,
538
- textStyle: _textStyle,
539
- h,
540
- w,
541
- display,
542
- borderBottomRightRadius,
543
- borderTopRightRadius,
544
- ...rest
545
- } = props;
546
- const mergedStyle = buildShimStyle({
547
- style: styleProp,
548
- mt,
549
- ml,
550
- mr,
551
- px,
552
- py,
553
- fontWeight,
554
- gap,
555
- flexShrink,
556
- columnGap,
557
- gridColumn,
558
- gridRow,
559
- justifySelf,
560
- alignSelf,
561
- h,
562
- w,
563
- display,
564
- borderBottomRightRadius,
565
- borderTopRightRadius
566
- });
567
- const dataAttrs = {};
568
- if (expanded) dataAttrs["data-expanded"] = true;
569
- if (selected) dataAttrs["data-selected"] = true;
570
- if (highlighted) dataAttrs["data-highlighted"] = true;
571
- if (loadingSkeleton) dataAttrs["data-loading-skeleton"] = true;
572
- const isDisabled = !loadingSkeleton && (loading || disabled);
573
- const inner = loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
574
- /* @__PURE__ */ jsx(Spinner, {}),
575
- loadingText != null && /* @__PURE__ */ jsx("span", { style: { marginLeft: 8 }, children: loadingText })
576
- ] }) : children;
577
- const variantClass = VARIANT_CLASSES[variant] ?? VARIANT_CLASSES.solid;
578
- const combinedClassName = [BASE_CLASSES, variantClass, className].filter(Boolean).join(" ");
579
- const button = /* @__PURE__ */ jsx(
580
- ButtonFrame,
581
- {
582
- ref,
583
- size,
584
- disabled: isDisabled || void 0,
585
- asChild: asChild || void 0,
586
- className: combinedClassName,
587
- style: mergedStyle,
588
- ...dataAttrs,
589
- ...rest,
590
- children: inner
591
- }
592
- );
593
- if (loadingSkeleton) {
594
- return /* @__PURE__ */ jsx(Skeleton, { loading: loadingSkeleton, asChild: true, ref, children: button });
595
- }
596
- return button;
597
- }
598
- );
599
- React6.forwardRef(
600
- function ButtonGroup2(props, ref) {
601
- const { className, ...rest } = props;
602
- return /* @__PURE__ */ jsx(
603
- Box,
604
- {
605
- ref,
606
- className: ["inline-flex", className].filter(Boolean).join(" "),
607
- role: "group",
608
- ...rest
609
- }
610
- );
611
- }
612
- );
613
- React6.forwardRef(
614
- function ButtonGroupRadio2(props, ref) {
615
- const {
616
- children,
617
- onChange,
618
- variant = "segmented",
619
- defaultValue,
620
- loading = false,
621
- equalWidth = false,
622
- className,
623
- ...rest
624
- } = props;
625
- const firstChildValue = React6.useMemo(() => {
626
- const firstChild = Array.isArray(children) ? children[0] : void 0;
627
- return typeof firstChild?.props.value === "string" ? firstChild.props.value : void 0;
628
- }, [children]);
629
- const [value, setValue] = React6.useState(defaultValue ?? firstChildValue);
630
- const handleItemClick = React6.useCallback((event) => {
631
- const v = event.currentTarget.value;
632
- setValue(v);
633
- onChange?.(v);
634
- }, [onChange]);
635
- const clonedChildren = React6.Children.map(children, (child) => {
636
- return React6.cloneElement(child, {
637
- onClick: handleItemClick,
638
- selected: value === child.props.value,
639
- variant
640
- });
641
- });
642
- const childrenLength = React6.Children.count(children);
643
- return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsx(
644
- Box,
645
- {
646
- ref,
647
- className: [
648
- "inline-flex gap-0",
649
- equalWidth ? "grid" : "",
650
- className
651
- ].filter(Boolean).join(" "),
652
- style: equalWidth ? { gridTemplateColumns: `repeat(${childrenLength}, 1fr)` } : void 0,
653
- role: "group",
654
- ...rest,
655
- children: clonedChildren
656
- }
657
- ) });
658
- }
659
- );
660
- var codeDiffVariants = variants(
661
- "relative overflow-hidden rounded-lg border bg-muted/50",
662
- {
663
- variants: {
664
- theme: {
665
- dark: "bg-[var(--color-bg-primary)] border-[var(--color-border-divider)]",
666
- light: "bg-[var(--color-bg-body)] border-[var(--color-border-divider)]",
667
- github: "bg-white border-[var(--color-border-divider)]",
668
- "github-dark": "bg-[var(--color-bg-primary)] border-[var(--color-border-divider)]"
669
- },
670
- size: {
671
- sm: "text-xs",
672
- default: "text-sm",
673
- lg: "text-base"
674
- }
675
- },
676
- defaultVariants: {
677
- theme: "dark",
678
- size: "default"
679
- }
680
- }
681
- );
682
- var DiffLine = React6.memo(
683
- ({
684
- change,
685
- showLineNumbers,
686
- isUnified = false,
687
- highlightedContent
688
- }) => {
689
- const getLineClasses = () => {
690
- const base = "group relative flex min-h-[1.5rem] items-center py-0.5";
691
- if (isUnified) {
692
- switch (change.type) {
693
- case "add":
694
- return cn(base, "bg-[var(--lux-state-success)]/10 border-l-2 border-l-green-500");
695
- case "remove":
696
- return cn(base, "bg-[var(--lux-state-error)]/10 border-l-2 border-l-red-500");
697
- default:
698
- return cn(base, "hover:bg-muted/50");
699
- }
700
- }
701
- return cn(base, "hover:bg-muted/50");
702
- };
703
- const getLinePrefix = () => {
704
- if (!isUnified) return null;
705
- switch (change.type) {
706
- case "add":
707
- return /* @__PURE__ */ jsx(Plus, { style: css("h-3 w-3 text-[var(--lux-state-success)] mr-2 flex-shrink-0") });
708
- case "remove":
709
- return /* @__PURE__ */ jsx(Minus, { style: css("h-3 w-3 text-[var(--lux-state-error)] mr-2 flex-shrink-0") });
710
- default:
711
- return /* @__PURE__ */ jsx(Box, { tag: "span", className: "w-3 mr-2 flex-shrink-0" });
712
- }
713
- };
714
- return /* @__PURE__ */ jsx(Box, { className: getLineClasses(), children: /* @__PURE__ */ jsxs(Box, { className: "flex items-center px-4 w-full", children: [
715
- showLineNumbers && /* @__PURE__ */ jsx(Box, { className: "flex items-center gap-2 mr-4", children: !isUnified ? /* @__PURE__ */ jsxs(Fragment, { children: [
716
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "inline-block w-8 select-none text-right text-xs text-muted-foreground", children: change.oldLineNumber || "" }),
717
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "inline-block w-8 select-none text-right text-xs text-muted-foreground", children: change.newLineNumber || "" })
718
- ] }) : /* @__PURE__ */ jsx(Box, { tag: "span", className: "inline-block w-8 select-none text-right text-xs text-muted-foreground", children: change.lineNumber }) }),
719
- getLinePrefix(),
720
- /* @__PURE__ */ jsx(
721
- Box,
722
- {
723
- className: "flex-1 overflow-x-auto font-mono",
724
- dangerouslySetInnerHTML: {
725
- __html: highlightedContent || change.content
726
- }
727
- }
728
- )
729
- ] }) });
730
- }
731
- );
732
- DiffLine.displayName = "DiffLine";
733
- function generateDiff(oldCode, newCode) {
734
- const oldLines = oldCode.split("\n");
735
- const newLines = newCode.split("\n");
736
- const changes = [];
737
- let oldIndex = 0;
738
- let newIndex = 0;
739
- let lineNumber = 1;
740
- while (oldIndex < oldLines.length || newIndex < newLines.length) {
741
- const oldLine = oldLines[oldIndex];
742
- const newLine = newLines[newIndex];
743
- if (oldIndex >= oldLines.length) {
744
- changes.push({
745
- type: "add",
746
- lineNumber: lineNumber++,
747
- content: newLine,
748
- newLineNumber: newIndex + 1
749
- });
750
- newIndex++;
751
- } else if (newIndex >= newLines.length) {
752
- changes.push({
753
- type: "remove",
754
- lineNumber: lineNumber++,
755
- content: oldLine,
756
- oldLineNumber: oldIndex + 1
757
- });
758
- oldIndex++;
759
- } else if (oldLine === newLine) {
760
- changes.push({
761
- type: "unchanged",
762
- lineNumber: lineNumber++,
763
- content: oldLine,
764
- oldLineNumber: oldIndex + 1,
765
- newLineNumber: newIndex + 1
766
- });
767
- oldIndex++;
768
- newIndex++;
769
- } else {
770
- changes.push({
771
- type: "remove",
772
- lineNumber: lineNumber++,
773
- content: oldLine,
774
- oldLineNumber: oldIndex + 1
775
- });
776
- changes.push({
777
- type: "add",
778
- lineNumber: lineNumber++,
779
- content: newLine,
780
- newLineNumber: newIndex + 1
781
- });
782
- oldIndex++;
783
- newIndex++;
784
- }
785
- }
786
- return changes;
787
- }
788
- var CodeDiff = React6.forwardRef(
789
- ({
790
- className,
791
- theme,
792
- size,
793
- oldCode,
794
- newCode,
795
- language = "text",
796
- filename,
797
- oldFilename,
798
- newFilename,
799
- showLineNumbers = true,
800
- showCopyButton = true,
801
- maxHeight = "500px",
802
- defaultView = "unified",
803
- collapseUnchanged = false,
804
- contextLines = 3,
805
- ...props
806
- }, ref) => {
807
- const [view, setView] = React6.useState(defaultView);
808
- const [copied, setCopied] = React6.useState(false);
809
- const [isLoading, setIsLoading] = React6.useState(true);
810
- const [highlightedOldCode, setHighlightedOldCode] = React6.useState("");
811
- const [highlightedNewCode, setHighlightedNewCode] = React6.useState("");
812
- const [changes, setChanges] = React6.useState([]);
813
- const themeMap = {
814
- dark: "github-dark",
815
- light: "github-light",
816
- github: "github-light",
817
- "github-dark": "github-dark"
818
- };
819
- React6.useEffect(() => {
820
- const highlightCode = async () => {
821
- setIsLoading(true);
822
- try {
823
- const [oldHighlighted, newHighlighted] = await Promise.all([
824
- codeToHtml(oldCode, {
825
- lang: language,
826
- theme: themeMap[theme || "dark"]
827
- }),
828
- codeToHtml(newCode, {
829
- lang: language,
830
- theme: themeMap[theme || "dark"]
831
- })
832
- ]);
833
- const extractContent = (html) => {
834
- const tempDiv = document.createElement("div");
835
- tempDiv.innerHTML = html;
836
- const codeElement = tempDiv.querySelector("code");
837
- return codeElement?.innerHTML || html;
838
- };
839
- setHighlightedOldCode(extractContent(oldHighlighted));
840
- setHighlightedNewCode(extractContent(newHighlighted));
841
- const diffChanges = generateDiff(oldCode, newCode);
842
- setChanges(diffChanges);
843
- } catch (error) {
844
- console.error("Failed to highlight code:", error);
845
- setHighlightedOldCode(oldCode);
846
- setHighlightedNewCode(newCode);
847
- setChanges(generateDiff(oldCode, newCode));
848
- } finally {
849
- setIsLoading(false);
850
- }
851
- };
852
- highlightCode();
853
- }, [oldCode, newCode, language, theme]);
854
- const copyToClipboard = React6.useCallback(async () => {
855
- try {
856
- const diffText = view === "unified" ? changes.map((change) => {
857
- const prefix = change.type === "add" ? "+" : change.type === "remove" ? "-" : " ";
858
- return `${prefix}${change.content}`;
859
- }).join("\n") : `--- ${oldFilename || "old"}
860
- +++ ${newFilename || "new"}
861
- ${oldCode}
862
-
863
- ${newCode}`;
864
- await navigator.clipboard.writeText(diffText);
865
- setCopied(true);
866
- setTimeout(() => setCopied(false), 2e3);
867
- } catch (error) {
868
- console.error("Failed to copy diff:", error);
869
- }
870
- }, [changes, view, oldCode, newCode, oldFilename, newFilename]);
871
- const filteredChanges = React6.useMemo(() => {
872
- if (!collapseUnchanged) return changes;
873
- const result = [];
874
- let i = 0;
875
- while (i < changes.length) {
876
- const change = changes[i];
877
- if (change.type !== "unchanged") {
878
- result.push(change);
879
- i++;
880
- continue;
881
- }
882
- const unchangedStart = i;
883
- while (i < changes.length && changes[i].type === "unchanged") {
884
- i++;
885
- }
886
- const unchangedCount = i - unchangedStart;
887
- if (unchangedCount <= contextLines * 2) {
888
- for (let j = unchangedStart; j < i; j++) {
889
- result.push(changes[j]);
890
- }
891
- } else {
892
- for (let j = unchangedStart; j < unchangedStart + contextLines; j++) {
893
- result.push(changes[j]);
894
- }
895
- result.push({
896
- type: "unchanged",
897
- lineNumber: -1,
898
- content: `... ${unchangedCount - contextLines * 2} unchanged lines ...`
899
- });
900
- for (let j = i - contextLines; j < i; j++) {
901
- result.push(changes[j]);
902
- }
903
- }
904
- }
905
- return result;
906
- }, [changes, collapseUnchanged, contextLines]);
907
- const stats = React6.useMemo(() => {
908
- const additions = changes.filter((c) => c.type === "add").length;
909
- const deletions = changes.filter((c) => c.type === "remove").length;
910
- return { additions, deletions };
911
- }, [changes]);
912
- const renderUnifiedView = () => {
913
- const oldLines = highlightedOldCode.split("\n");
914
- const newLines = highlightedNewCode.split("\n");
915
- return /* @__PURE__ */ jsx(Box, { className: "font-mono", children: filteredChanges.map((change, index) => {
916
- if (change.lineNumber === -1) {
917
- return /* @__PURE__ */ jsx(
918
- Box,
919
- {
920
- className: "flex items-center justify-center py-2 text-muted-foreground bg-muted/30",
921
- children: /* @__PURE__ */ jsx(Box, { tag: "span", className: "text-xs", children: change.content })
922
- },
923
- index
924
- );
925
- }
926
- let highlightedContent = change.content;
927
- if (change.type === "add" && change.newLineNumber) {
928
- highlightedContent = newLines[change.newLineNumber - 1] || change.content;
929
- } else if (change.type === "remove" && change.oldLineNumber) {
930
- highlightedContent = oldLines[change.oldLineNumber - 1] || change.content;
931
- } else if (change.type === "unchanged" && change.oldLineNumber) {
932
- highlightedContent = oldLines[change.oldLineNumber - 1] || change.content;
933
- }
934
- return /* @__PURE__ */ jsx(
935
- DiffLine,
936
- {
937
- change,
938
- showLineNumbers,
939
- isUnified: true,
940
- highlightedContent
941
- },
942
- index
943
- );
944
- }) });
945
- };
946
- const renderSplitView = () => {
947
- const oldLines = highlightedOldCode.split("\n");
948
- const newLines = highlightedNewCode.split("\n");
949
- return /* @__PURE__ */ jsxs(Box, { className: "grid grid-cols-2 gap-0", children: [
950
- /* @__PURE__ */ jsxs(Box, { className: "border-r", children: [
951
- /* @__PURE__ */ jsx(Box, { className: "border-b px-4 py-2 bg-[var(--lux-state-error)]/10", children: /* @__PURE__ */ jsx(Box, { tag: "span", className: "text-sm font-medium text-[var(--lux-state-error)] dark:text-[var(--lux-state-error)]", children: oldFilename || filename || "Old" }) }),
952
- /* @__PURE__ */ jsx(Box, { className: "font-mono", children: oldLines.map((line, index) => /* @__PURE__ */ jsx(
953
- DiffLine,
954
- {
955
- change: {
956
- type: "remove",
957
- lineNumber: index + 1,
958
- content: line,
959
- oldLineNumber: index + 1
960
- },
961
- showLineNumbers,
962
- highlightedContent: line
963
- },
964
- `old-${index}`
965
- )) })
966
- ] }),
967
- /* @__PURE__ */ jsxs("div", { children: [
968
- /* @__PURE__ */ jsx(Box, { className: "border-b px-4 py-2 bg-[var(--lux-state-success)]/10", children: /* @__PURE__ */ jsx(Box, { tag: "span", className: "text-sm font-medium text-[var(--lux-state-success)] dark:text-[var(--lux-state-success)]", children: newFilename || filename || "New" }) }),
969
- /* @__PURE__ */ jsx(Box, { className: "font-mono", children: newLines.map((line, index) => /* @__PURE__ */ jsx(
970
- DiffLine,
971
- {
972
- change: {
973
- type: "add",
974
- lineNumber: index + 1,
975
- content: line,
976
- newLineNumber: index + 1
977
- },
978
- showLineNumbers,
979
- highlightedContent: line
980
- },
981
- `new-${index}`
982
- )) })
983
- ] })
984
- ] });
985
- };
986
- return /* @__PURE__ */ jsxs(
987
- Box,
988
- {
989
- ref,
990
- className: cn(codeDiffVariants({ theme, size, className })),
991
- ...props,
992
- children: [
993
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center justify-between border-b px-4 py-2", children: [
994
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-4", children: [
995
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
996
- /* @__PURE__ */ jsx(GitCompare, { style: css("h-4 w-4 text-muted-foreground") }),
997
- filename && /* @__PURE__ */ jsx(Box, { tag: "span", className: "text-sm font-medium", children: filename }),
998
- language && /* @__PURE__ */ jsx(Badge, { colorPalette: "gray", ...sx("text-xs"), children: language })
999
- ] }),
1000
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1001
- /* @__PURE__ */ jsxs(Box, { tag: "span", className: "flex items-center gap-1", children: [
1002
- /* @__PURE__ */ jsx(Plus, { style: css("h-3 w-3 text-[var(--lux-state-success)]") }),
1003
- stats.additions
1004
- ] }),
1005
- /* @__PURE__ */ jsxs(Box, { tag: "span", className: "flex items-center gap-1", children: [
1006
- /* @__PURE__ */ jsx(Minus, { style: css("h-3 w-3 text-[var(--lux-state-error)]") }),
1007
- stats.deletions
1008
- ] })
1009
- ] })
1010
- ] }),
1011
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
1012
- /* @__PURE__ */ jsxs(
1013
- ToggleGroup,
1014
- {
1015
- type: "single",
1016
- value: view,
1017
- onValueChange: (value) => value && setView(value),
1018
- size: "sm",
1019
- children: [
1020
- /* @__PURE__ */ jsx(ToggleGroupItem, { value: "unified", "aria-label": "Unified view", children: /* @__PURE__ */ jsx(Square, { style: css("h-3 w-3") }) }),
1021
- /* @__PURE__ */ jsx(ToggleGroupItem, { value: "split", "aria-label": "Split view", children: /* @__PURE__ */ jsx(SplitSquareHorizontal, { style: css("h-3 w-3") }) })
1022
- ]
1023
- }
1024
- ),
1025
- showCopyButton && /* @__PURE__ */ jsxs(
1026
- Button,
1027
- {
1028
- variant: "ghost",
1029
- size: "sm",
1030
- onClick: copyToClipboard,
1031
- ...sx("h-8 w-8 p-0"),
1032
- children: [
1033
- copied ? /* @__PURE__ */ jsx(Check, { style: css("h-3.5 w-3.5 text-[var(--lux-state-success)]") }) : /* @__PURE__ */ jsx(Copy, { style: css("h-3.5 w-3.5") }),
1034
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "sr-only", children: copied ? "Copied" : "Copy diff" })
1035
- ]
1036
- }
1037
- )
1038
- ] })
1039
- ] }),
1040
- /* @__PURE__ */ jsx(Box, { className: "overflow-auto", style: { maxHeight }, children: isLoading ? /* @__PURE__ */ jsx(Box, { className: "p-4 space-y-2", children: Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-4", children: [
1041
- showLineNumbers && /* @__PURE__ */ jsx(Skeleton, { ...sx("h-4 w-8") }),
1042
- /* @__PURE__ */ jsx(Skeleton, { ...sx("h-4 flex-1") })
1043
- ] }, i)) }) : view === "unified" ? renderUnifiedView() : renderSplitView() })
1044
- ]
1045
- }
1046
- );
1047
- }
1048
- );
1049
- CodeDiff.displayName = "CodeDiff";
1050
- var codeSnippetVariants = variants("relative group", {
1051
- variants: {
1052
- variant: {
1053
- default: "rounded-lg border bg-muted/50",
1054
- inline: "inline-block rounded-md bg-muted px-2 py-1",
1055
- minimal: "bg-transparent"
1056
- },
1057
- theme: {
1058
- dark: "bg-[var(--color-bg-primary)] border-[var(--color-border-divider)]",
1059
- light: "bg-[var(--color-bg-body)] border-[var(--color-border-divider)]",
1060
- github: "bg-white border-[var(--color-border-divider)]",
1061
- "github-dark": "bg-[var(--color-bg-primary)] border-[var(--color-border-divider)]",
1062
- terminal: "bg-black border-[var(--lux-state-success)]/30 text-[var(--lux-state-success)]",
1063
- retro: "bg-[var(--lux-state-notice)] border-[var(--lux-state-notice)] text-[var(--lux-state-notice)]"
1064
- },
1065
- size: {
1066
- xs: "text-xs",
1067
- sm: "text-sm",
1068
- default: "text-sm",
1069
- lg: "text-base"
1070
- }
1071
- },
1072
- defaultVariants: {
1073
- variant: "default",
1074
- theme: "dark",
1075
- size: "default"
1076
- }
1077
- });
1078
- var CodeSnippet = React6.forwardRef(
1079
- ({
1080
- className,
1081
- variant,
1082
- theme,
1083
- size,
1084
- code,
1085
- language = "text",
1086
- filename,
1087
- showLineNumbers = false,
1088
- highlightLines = [],
1089
- showCopyButton = true,
1090
- showLanguageBadge = true,
1091
- showHeader = true,
1092
- maxHeight,
1093
- expandable = false,
1094
- collapsedHeight = "200px",
1095
- wrapLines = false,
1096
- startLineNumber = 1,
1097
- ...props
1098
- }, ref) => {
1099
- const [highlightedCode, setHighlightedCode] = React6.useState("");
1100
- const [copied, setCopied] = React6.useState(false);
1101
- const [isLoading, setIsLoading] = React6.useState(true);
1102
- const [isExpanded, setIsExpanded] = React6.useState(!expandable);
1103
- const themeMap = {
1104
- dark: "github-dark",
1105
- light: "github-light",
1106
- github: "github-light",
1107
- "github-dark": "github-dark",
1108
- terminal: "github-dark",
1109
- retro: "github-light"
1110
- };
1111
- React6.useEffect(() => {
1112
- const highlightCode = async () => {
1113
- setIsLoading(true);
1114
- try {
1115
- const supportedLang = Object.keys(bundledLanguages).includes(language);
1116
- const highlighted = await codeToHtml(code, {
1117
- lang: supportedLang ? language : "text",
1118
- theme: themeMap[theme || "dark"]
1119
- });
1120
- const tempDiv = document.createElement("div");
1121
- tempDiv.innerHTML = highlighted;
1122
- const codeElement = tempDiv.querySelector("code");
1123
- setHighlightedCode(codeElement?.innerHTML || highlighted);
1124
- } catch (error) {
1125
- console.error("Failed to highlight code:", error);
1126
- const escaped = code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1127
- setHighlightedCode(escaped);
1128
- } finally {
1129
- setIsLoading(false);
1130
- }
1131
- };
1132
- highlightCode();
1133
- }, [code, language, theme]);
1134
- const copyToClipboard = React6.useCallback(async () => {
1135
- try {
1136
- await navigator.clipboard.writeText(code);
1137
- setCopied(true);
1138
- setTimeout(() => setCopied(false), 2e3);
1139
- } catch (error) {
1140
- console.error("Failed to copy code:", error);
1141
- }
1142
- }, [code]);
1143
- const lines = highlightedCode.split("\n").filter((line, index, array) => {
1144
- return line.trim() !== "" || index < array.length - 1;
1145
- });
1146
- const renderInline = () => /* @__PURE__ */ jsx(
1147
- Box,
1148
- {
1149
- tag: "code",
1150
- className: cn(
1151
- codeSnippetVariants({ variant, theme, size }),
1152
- "font-mono",
1153
- className
1154
- ),
1155
- dangerouslySetInnerHTML: { __html: highlightedCode }
1156
- }
1157
- );
1158
- const renderBlock = () => /* @__PURE__ */ jsxs(
1159
- Box,
1160
- {
1161
- ref,
1162
- className: cn(
1163
- codeSnippetVariants({ variant, theme, size }),
1164
- "overflow-hidden",
1165
- className
1166
- ),
1167
- ...props,
1168
- children: [
1169
- showHeader && (filename || language || showCopyButton || expandable) && /* @__PURE__ */ jsxs(Box, { className: "flex items-center justify-between border-b px-4 py-2 bg-muted/30", children: [
1170
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-2", children: [
1171
- filename && /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1.5", children: [
1172
- /* @__PURE__ */ jsx(FileText, { style: css("h-3.5 w-3.5 text-muted-foreground") }),
1173
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "text-sm font-medium", children: filename })
1174
- ] }),
1175
- showLanguageBadge && language && /* @__PURE__ */ jsx(Badge, { colorPalette: "gray", ...sx("text-xs"), children: language })
1176
- ] }),
1177
- /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-1", children: [
1178
- expandable && /* @__PURE__ */ jsxs(
1179
- Button,
1180
- {
1181
- variant: "ghost",
1182
- size: "sm",
1183
- onClick: () => setIsExpanded(!isExpanded),
1184
- ...sx("h-8 w-8 p-0"),
1185
- children: [
1186
- isExpanded ? /* @__PURE__ */ jsx(Minimize2, { style: css("h-3.5 w-3.5") }) : /* @__PURE__ */ jsx(Maximize2, { style: css("h-3.5 w-3.5") }),
1187
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "sr-only", children: isExpanded ? "Collapse" : "Expand" })
1188
- ]
1189
- }
1190
- ),
1191
- showCopyButton && /* @__PURE__ */ jsxs(
1192
- Button,
1193
- {
1194
- variant: "ghost",
1195
- size: "sm",
1196
- onClick: copyToClipboard,
1197
- ...sx("h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity"),
1198
- children: [
1199
- copied ? /* @__PURE__ */ jsx(Check, { style: css("h-3.5 w-3.5 text-[var(--lux-state-success)]") }) : /* @__PURE__ */ jsx(Copy, { style: css("h-3.5 w-3.5") }),
1200
- /* @__PURE__ */ jsx(Box, { tag: "span", className: "sr-only", children: copied ? "Copied" : "Copy code" })
1201
- ]
1202
- }
1203
- )
1204
- ] })
1205
- ] }),
1206
- /* @__PURE__ */ jsx(
1207
- Box,
1208
- {
1209
- className: cn("overflow-auto", !wrapLines && "overflow-x-auto"),
1210
- style: {
1211
- maxHeight: isExpanded ? maxHeight : collapsedHeight
1212
- },
1213
- children: isLoading ? /* @__PURE__ */ jsx(Box, { className: "p-4 space-y-2", children: Array.from({ length: Math.min(lines.length || 5, 10) }).map(
1214
- (_, i) => /* @__PURE__ */ jsxs(Box, { className: "flex items-center gap-4", children: [
1215
- showLineNumbers && /* @__PURE__ */ jsx(Skeleton, { ...sx("h-4 w-8") }),
1216
- /* @__PURE__ */ jsx(Skeleton, { ...sx("h-4 flex-1") })
1217
- ] }, i)
1218
- ) }) : /* @__PURE__ */ jsx(Box, { className: "font-mono", children: lines.map((line, index) => {
1219
- const lineNumber = index + startLineNumber;
1220
- const isHighlighted = highlightLines.includes(lineNumber);
1221
- return /* @__PURE__ */ jsxs(
1222
- Box,
1223
- {
1224
- className: cn(
1225
- "group relative flex min-h-[1.5rem] items-center px-4 py-0.5",
1226
- isHighlighted && "bg-[var(--color-link-primary)]/10 border-l-2 border-l-blue-500",
1227
- !wrapLines && "whitespace-nowrap"
1228
- ),
1229
- children: [
1230
- showLineNumbers && /* @__PURE__ */ jsx(Box, { tag: "span", className: "mr-4 inline-block w-8 select-none text-right text-xs text-muted-foreground", children: lineNumber }),
1231
- /* @__PURE__ */ jsx(
1232
- Box,
1233
- {
1234
- className: cn(
1235
- "flex-1",
1236
- wrapLines ? "whitespace-pre-wrap break-words" : "overflow-x-auto"
1237
- ),
1238
- dangerouslySetInnerHTML: { __html: line }
1239
- }
1240
- )
1241
- ]
1242
- },
1243
- index
1244
- );
1245
- }) })
1246
- }
1247
- ),
1248
- expandable && !isExpanded && /* @__PURE__ */ jsx(Box, { className: "absolute bottom-0 left-0 right-0 h-8 bg-gradient-to-t from-background to-transparent pointer-events-none" }),
1249
- variant === "minimal" && showCopyButton && /* @__PURE__ */ jsx(
1250
- Button,
1251
- {
1252
- variant: "ghost",
1253
- size: "sm",
1254
- onClick: copyToClipboard,
1255
- ...sx("absolute top-2 right-2 h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity"),
1256
- children: copied ? /* @__PURE__ */ jsx(Check, { style: css("h-3.5 w-3.5 text-[var(--lux-state-success)]") }) : /* @__PURE__ */ jsx(Copy, { style: css("h-3.5 w-3.5") })
1257
- }
1258
- )
1259
- ]
1260
- }
1261
- );
1262
- if (variant === "inline") {
1263
- return renderInline();
1264
- }
1265
- return renderBlock();
1266
- }
1267
- );
1268
- CodeSnippet.displayName = "CodeSnippet";
1269
- var InlineCode = React6.forwardRef(({ children, language, className, ...props }, ref) => {
1270
- return /* @__PURE__ */ jsx(
1271
- CodeSnippet,
1272
- {
1273
- ref,
1274
- code: children,
1275
- language,
1276
- variant: "inline",
1277
- showCopyButton: false,
1278
- showLanguageBadge: false,
1279
- showHeader: false,
1280
- className,
1281
- ...props
1282
- }
1283
- );
1284
- });
1285
- InlineCode.displayName = "InlineCode";
1286
11
  var codeCompareVariants = variants(
1287
12
  "relative flex flex-col overflow-hidden rounded-lg border bg-background",
1288
13
  {
@@ -1303,7 +28,7 @@ var codeCompareVariants = variants(
1303
28
  }
1304
29
  }
1305
30
  );
1306
- var CodeCompare = React6.forwardRef(
31
+ var CodeCompare = React.forwardRef(
1307
32
  ({
1308
33
  className,
1309
34
  layout,
@@ -1320,20 +45,20 @@ var CodeCompare = React6.forwardRef(
1320
45
  syncScroll = true,
1321
46
  ...props
1322
47
  }, ref) => {
1323
- const [view, setView] = React6.useState(defaultView);
1324
- const [selectedFiles, setSelectedFiles] = React6.useState(() => {
48
+ const [view, setView] = React.useState(defaultView);
49
+ const [selectedFiles, setSelectedFiles] = React.useState(() => {
1325
50
  if (files.length >= 2) {
1326
51
  return [files[0].id, files[1].id];
1327
52
  }
1328
53
  return files.length > 0 ? [files[0].id] : [];
1329
54
  });
1330
- const [mergeState, setMergeState] = React6.useState({
55
+ const [mergeState, setMergeState] = React.useState({
1331
56
  resolved: {},
1332
57
  conflicts: conflictMarkers
1333
58
  });
1334
- const [copied, setCopied] = React6.useState(false);
1335
- const scrollRefs = React6.useRef({});
1336
- const handleScroll = React6.useCallback(
59
+ const [copied, setCopied] = React.useState(false);
60
+ const scrollRefs = React.useRef({});
61
+ const handleScroll = React.useCallback(
1337
62
  (sourceId, scrollTop) => {
1338
63
  if (!syncScroll) return;
1339
64
  Object.entries(scrollRefs.current).forEach(([id, ref2]) => {
@@ -1344,7 +69,7 @@ var CodeCompare = React6.forwardRef(
1344
69
  },
1345
70
  [syncScroll]
1346
71
  );
1347
- const copyComparison = React6.useCallback(async () => {
72
+ const copyComparison = React.useCallback(async () => {
1348
73
  const comparison = selectedFiles.map((fileId) => {
1349
74
  const file = files.find((f) => f.id === fileId);
1350
75
  return file ? `=== ${file.filename} ===
@@ -1358,7 +83,7 @@ ${file.content}` : "";
1358
83
  console.error("Failed to copy comparison:", error);
1359
84
  }
1360
85
  }, [files, selectedFiles]);
1361
- const resolveConflict = React6.useCallback(
86
+ const resolveConflict = React.useCallback(
1362
87
  (conflictIndex, resolution) => {
1363
88
  setMergeState((prev) => ({
1364
89
  ...prev,
@@ -1371,7 +96,7 @@ ${file.content}` : "";
1371
96
  },
1372
97
  [onMergeConflict]
1373
98
  );
1374
- const getFileStats = React6.useCallback(
99
+ const getFileStats = React.useCallback(
1375
100
  (file1, file2) => {
1376
101
  const lines1 = file1.content.split("\n");
1377
102
  const lines2 = file2.content.split("\n");