@codesweep-ai/ui 0.2.1-dev.20260830023458.856ea8f

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 (215) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +124 -0
  4. package/dist/BUILD.json +1 -0
  5. package/dist/chart.d.ts +3 -0
  6. package/dist/chart.d.ts.map +1 -0
  7. package/dist/chart.js +3 -0
  8. package/dist/code.d.ts +2 -0
  9. package/dist/code.d.ts.map +1 -0
  10. package/dist/code.js +2 -0
  11. package/dist/components/AgentStatus.d.ts +15 -0
  12. package/dist/components/AgentStatus.d.ts.map +1 -0
  13. package/dist/components/AgentStatus.js +38 -0
  14. package/dist/components/AgentTrace.d.ts +42 -0
  15. package/dist/components/AgentTrace.d.ts.map +1 -0
  16. package/dist/components/AgentTrace.js +140 -0
  17. package/dist/components/AppShell.d.ts +29 -0
  18. package/dist/components/AppShell.d.ts.map +1 -0
  19. package/dist/components/AppShell.js +71 -0
  20. package/dist/components/Button.d.ts +10 -0
  21. package/dist/components/Button.d.ts.map +1 -0
  22. package/dist/components/Button.js +41 -0
  23. package/dist/components/Card.d.ts +19 -0
  24. package/dist/components/Card.d.ts.map +1 -0
  25. package/dist/components/Card.js +96 -0
  26. package/dist/components/CardGroup.d.ts +16 -0
  27. package/dist/components/CardGroup.d.ts.map +1 -0
  28. package/dist/components/CardGroup.js +33 -0
  29. package/dist/components/CardGroupContext.d.ts +14 -0
  30. package/dist/components/CardGroupContext.d.ts.map +1 -0
  31. package/dist/components/CardGroupContext.js +8 -0
  32. package/dist/components/ChartFrame.d.ts +30 -0
  33. package/dist/components/ChartFrame.d.ts.map +1 -0
  34. package/dist/components/ChartFrame.js +96 -0
  35. package/dist/components/ChartTooltip.d.ts +22 -0
  36. package/dist/components/ChartTooltip.d.ts.map +1 -0
  37. package/dist/components/ChartTooltip.js +26 -0
  38. package/dist/components/CheckboxGroup.d.ts +37 -0
  39. package/dist/components/CheckboxGroup.d.ts.map +1 -0
  40. package/dist/components/CheckboxGroup.js +198 -0
  41. package/dist/components/Chip.d.ts +9 -0
  42. package/dist/components/Chip.d.ts.map +1 -0
  43. package/dist/components/Chip.js +31 -0
  44. package/dist/components/CodeBlock.d.ts +30 -0
  45. package/dist/components/CodeBlock.d.ts.map +1 -0
  46. package/dist/components/CodeBlock.js +112 -0
  47. package/dist/components/Dropdown.d.ts +28 -0
  48. package/dist/components/Dropdown.d.ts.map +1 -0
  49. package/dist/components/Dropdown.js +50 -0
  50. package/dist/components/EventLanes.d.ts +93 -0
  51. package/dist/components/EventLanes.d.ts.map +1 -0
  52. package/dist/components/EventLanes.js +445 -0
  53. package/dist/components/FormGroup.d.ts +29 -0
  54. package/dist/components/FormGroup.d.ts.map +1 -0
  55. package/dist/components/FormGroup.js +48 -0
  56. package/dist/components/HighlightText.d.ts +15 -0
  57. package/dist/components/HighlightText.d.ts.map +1 -0
  58. package/dist/components/HighlightText.js +28 -0
  59. package/dist/components/Input.d.ts +35 -0
  60. package/dist/components/Input.d.ts.map +1 -0
  61. package/dist/components/Input.js +61 -0
  62. package/dist/components/Legend.d.ts +21 -0
  63. package/dist/components/Legend.d.ts.map +1 -0
  64. package/dist/components/Legend.js +61 -0
  65. package/dist/components/LightweightMarkdown.d.ts +3 -0
  66. package/dist/components/LightweightMarkdown.d.ts.map +1 -0
  67. package/dist/components/LightweightMarkdown.js +249 -0
  68. package/dist/components/MarkdownMinimap.d.ts +7 -0
  69. package/dist/components/MarkdownMinimap.d.ts.map +1 -0
  70. package/dist/components/MarkdownMinimap.js +84 -0
  71. package/dist/components/MarkdownViewer.d.ts +51 -0
  72. package/dist/components/MarkdownViewer.d.ts.map +1 -0
  73. package/dist/components/MarkdownViewer.js +455 -0
  74. package/dist/components/MermaidDiagram.d.ts +11 -0
  75. package/dist/components/MermaidDiagram.d.ts.map +1 -0
  76. package/dist/components/MermaidDiagram.js +119 -0
  77. package/dist/components/Modal.d.ts +13 -0
  78. package/dist/components/Modal.d.ts.map +1 -0
  79. package/dist/components/Modal.js +91 -0
  80. package/dist/components/Panel.d.ts +13 -0
  81. package/dist/components/Panel.d.ts.map +1 -0
  82. package/dist/components/Panel.js +44 -0
  83. package/dist/components/PulseBadge.d.ts +15 -0
  84. package/dist/components/PulseBadge.d.ts.map +1 -0
  85. package/dist/components/PulseBadge.js +22 -0
  86. package/dist/components/RadioGroup.d.ts +20 -0
  87. package/dist/components/RadioGroup.d.ts.map +1 -0
  88. package/dist/components/RadioGroup.js +63 -0
  89. package/dist/components/RichMarkdownRenderer.d.ts +10 -0
  90. package/dist/components/RichMarkdownRenderer.d.ts.map +1 -0
  91. package/dist/components/RichMarkdownRenderer.js +18 -0
  92. package/dist/components/SearchInput.d.ts +25 -0
  93. package/dist/components/SearchInput.d.ts.map +1 -0
  94. package/dist/components/SearchInput.js +92 -0
  95. package/dist/components/SectionedTree.d.ts +36 -0
  96. package/dist/components/SectionedTree.d.ts.map +1 -0
  97. package/dist/components/SectionedTree.js +173 -0
  98. package/dist/components/SegmentedControl.d.ts +16 -0
  99. package/dist/components/SegmentedControl.d.ts.map +1 -0
  100. package/dist/components/SegmentedControl.js +48 -0
  101. package/dist/components/Skeleton.d.ts +8 -0
  102. package/dist/components/Skeleton.d.ts.map +1 -0
  103. package/dist/components/Skeleton.js +25 -0
  104. package/dist/components/SplitPane.d.ts +16 -0
  105. package/dist/components/SplitPane.d.ts.map +1 -0
  106. package/dist/components/SplitPane.js +118 -0
  107. package/dist/components/StatusBadge.d.ts +15 -0
  108. package/dist/components/StatusBadge.d.ts.map +1 -0
  109. package/dist/components/StatusBadge.js +40 -0
  110. package/dist/components/StreamingText.d.ts +20 -0
  111. package/dist/components/StreamingText.d.ts.map +1 -0
  112. package/dist/components/StreamingText.js +50 -0
  113. package/dist/components/Table.d.ts +62 -0
  114. package/dist/components/Table.d.ts.map +1 -0
  115. package/dist/components/Table.js +256 -0
  116. package/dist/components/ThemeToggle.d.ts +11 -0
  117. package/dist/components/ThemeToggle.d.ts.map +1 -0
  118. package/dist/components/ThemeToggle.js +55 -0
  119. package/dist/components/Toast.d.ts +8 -0
  120. package/dist/components/Toast.d.ts.map +1 -0
  121. package/dist/components/Toast.js +51 -0
  122. package/dist/components/ToastContainer.d.ts +5 -0
  123. package/dist/components/ToastContainer.d.ts.map +1 -0
  124. package/dist/components/ToastContainer.js +29 -0
  125. package/dist/components/Tree.d.ts +50 -0
  126. package/dist/components/Tree.d.ts.map +1 -0
  127. package/dist/components/Tree.js +528 -0
  128. package/dist/components/TreeDnd.d.ts +18 -0
  129. package/dist/components/TreeDnd.d.ts.map +1 -0
  130. package/dist/components/TreeDnd.js +39 -0
  131. package/dist/index.d.ts +50 -0
  132. package/dist/index.d.ts.map +1 -0
  133. package/dist/index.js +35 -0
  134. package/dist/lib/accentToken.d.ts +3 -0
  135. package/dist/lib/accentToken.d.ts.map +1 -0
  136. package/dist/lib/accentToken.js +12 -0
  137. package/dist/lib/chartTheme.d.ts +45 -0
  138. package/dist/lib/chartTheme.d.ts.map +1 -0
  139. package/dist/lib/chartTheme.js +64 -0
  140. package/dist/lib/cn.d.ts +6 -0
  141. package/dist/lib/cn.d.ts.map +1 -0
  142. package/dist/lib/cn.js +11 -0
  143. package/dist/lib/forwardRefToRoot.d.ts +8 -0
  144. package/dist/lib/forwardRefToRoot.d.ts.map +1 -0
  145. package/dist/lib/forwardRefToRoot.js +18 -0
  146. package/dist/lib/markdownUrl.d.ts +5 -0
  147. package/dist/lib/markdownUrl.d.ts.map +1 -0
  148. package/dist/lib/markdownUrl.js +24 -0
  149. package/dist/lib/toast.d.ts +30 -0
  150. package/dist/lib/toast.d.ts.map +1 -0
  151. package/dist/lib/toast.js +34 -0
  152. package/dist/lib/useTheme.d.ts +22 -0
  153. package/dist/lib/useTheme.d.ts.map +1 -0
  154. package/dist/lib/useTheme.js +62 -0
  155. package/dist/markdown/rich.d.ts +10 -0
  156. package/dist/markdown/rich.d.ts.map +1 -0
  157. package/dist/markdown/rich.js +8 -0
  158. package/dist/markdown.d.ts +3 -0
  159. package/dist/markdown.d.ts.map +1 -0
  160. package/dist/markdown.js +2 -0
  161. package/dist/mermaid.d.ts +2 -0
  162. package/dist/mermaid.d.ts.map +1 -0
  163. package/dist/mermaid.js +2 -0
  164. package/dist/minimap.d.ts +2 -0
  165. package/dist/minimap.d.ts.map +1 -0
  166. package/dist/minimap.js +2 -0
  167. package/dist/styles/base.css +98 -0
  168. package/dist/styles/components/agent-status.css +52 -0
  169. package/dist/styles/components/agent-trace.css +206 -0
  170. package/dist/styles/components/app-shell.css +195 -0
  171. package/dist/styles/components/button.css +172 -0
  172. package/dist/styles/components/card-group.css +20 -0
  173. package/dist/styles/components/card.css +200 -0
  174. package/dist/styles/components/chart-frame.css +144 -0
  175. package/dist/styles/components/chart-tooltip.css +54 -0
  176. package/dist/styles/components/checkbox-group.css +281 -0
  177. package/dist/styles/components/chip.css +61 -0
  178. package/dist/styles/components/code-block.css +215 -0
  179. package/dist/styles/components/dropdown.css +131 -0
  180. package/dist/styles/components/event-lanes.css +159 -0
  181. package/dist/styles/components/form-group.css +34 -0
  182. package/dist/styles/components/highlight-text.css +17 -0
  183. package/dist/styles/components/input.css +168 -0
  184. package/dist/styles/components/legend.css +80 -0
  185. package/dist/styles/components/markdown-minimap.css +13 -0
  186. package/dist/styles/components/markdown-viewer.css +354 -0
  187. package/dist/styles/components/mermaid-diagram.css +8 -0
  188. package/dist/styles/components/modal.css +167 -0
  189. package/dist/styles/components/panel.css +126 -0
  190. package/dist/styles/components/pulse-badge.css +56 -0
  191. package/dist/styles/components/radio-group.css +89 -0
  192. package/dist/styles/components/search-input.css +153 -0
  193. package/dist/styles/components/sectioned-tree.css +183 -0
  194. package/dist/styles/components/segmented-control.css +54 -0
  195. package/dist/styles/components/skeleton.css +21 -0
  196. package/dist/styles/components/split-pane.css +78 -0
  197. package/dist/styles/components/status-badge.css +94 -0
  198. package/dist/styles/components/streaming-text.css +38 -0
  199. package/dist/styles/components/table.css +235 -0
  200. package/dist/styles/components/theme-toggle.css +123 -0
  201. package/dist/styles/components/toast-container.css +34 -0
  202. package/dist/styles/components/toast.css +169 -0
  203. package/dist/styles/components/tree.css +375 -0
  204. package/dist/styles/components.css +37 -0
  205. package/dist/styles/core.css +3 -0
  206. package/dist/styles/markdown-content.css +368 -0
  207. package/dist/styles/print.css +55 -0
  208. package/dist/styles/reset.css +202 -0
  209. package/dist/styles/syntax.css +62 -0
  210. package/dist/styles/tokens.css +344 -0
  211. package/dist/styles/utilities.css +7 -0
  212. package/dist/testing/index.d.ts +39 -0
  213. package/dist/testing/index.d.ts.map +1 -0
  214. package/dist/testing/index.js +119 -0
  215. package/package.json +138 -0
@@ -0,0 +1,455 @@
1
+ "use client";
2
+ "use client";
3
+ import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
4
+ import { Button as t } from "./Button.js";
5
+ import { Skeleton as n } from "./Skeleton.js";
6
+ import { escapeMarkdownHtml as r, sanitizeMarkdownUrl as i } from "../lib/markdownUrl.js";
7
+ import { MarkdownMinimap as a } from "./MarkdownMinimap.js";
8
+ import { LightweightMarkdown as o } from "./LightweightMarkdown.js";
9
+ import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
+ import { AlertCircle as ee, AlertTriangle as f, Check as te, CircleAlert as p, Copy as ne, Inbox as re, Info as m, Lightbulb as h, ListTree as ie, OctagonAlert as g, PanelLeftClose as _, PanelLeftOpen as v, PanelRightClose as ae, PanelRightOpen as oe } from "lucide-react";
11
+ import { Fragment as se, jsx as y, jsxs as b } from "react/jsx-runtime";
12
+ //#region src/components/MarkdownViewer.tsx
13
+ function ce(e) {
14
+ return e.toLowerCase().replace(/[^\p{L}\p{M}\p{N}\p{Pc} -]/gu, "").replace(/ /g, "-");
15
+ }
16
+ function x(e) {
17
+ return typeof e == "string" ? e : typeof e == "number" ? String(e) : e ? Array.isArray(e) ? e.map(x).join("") : typeof e == "object" && "props" in e ? x(e.props.children) : "" : "";
18
+ }
19
+ var le = 200, S = 120, C = 400, ue = 12, de = 12, fe = 120, pe = 100, me = 50;
20
+ function w(e, t, n) {
21
+ let r = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop;
22
+ e.scrollTo({
23
+ top: r,
24
+ behavior: n
25
+ });
26
+ }
27
+ var he = 2e3, ge = {
28
+ NOTE: {
29
+ icon: m,
30
+ title: "Note"
31
+ },
32
+ TIP: {
33
+ icon: h,
34
+ title: "Tip"
35
+ },
36
+ IMPORTANT: {
37
+ icon: p,
38
+ title: "Important"
39
+ },
40
+ WARNING: {
41
+ icon: f,
42
+ title: "Warning"
43
+ },
44
+ CAUTION: {
45
+ icon: g,
46
+ title: "Caution"
47
+ }
48
+ };
49
+ function _e({ src: e, alt: t, resolve: n, ...r }) {
50
+ let [i, a] = d(e);
51
+ return c(() => {
52
+ if (!e || e.startsWith("data:") || e.startsWith("http://") || e.startsWith("https://")) {
53
+ a(e);
54
+ return;
55
+ }
56
+ let t = !1, r = n(e);
57
+ return r instanceof Promise ? r.then((n) => {
58
+ t || a(n ?? e);
59
+ }) : a(r ?? e), () => {
60
+ t = !0;
61
+ };
62
+ }, [e, n]), i ? /* @__PURE__ */ y("img", {
63
+ src: i,
64
+ alt: t,
65
+ loading: "lazy",
66
+ ...r
67
+ }) : null;
68
+ }
69
+ function T({ viewerProps: e, Renderer: o }) {
70
+ let { content: f, outline: p = !1, minimap: m = !1, outlineCollapsed: h, minimapCollapsed: g, onLinkClick: T, onImageSrc: E, codeRenderers: D, onHeadingNavigate: O, initialHeading: k, inline: A = !1, density: ve = "default", className: j, loading: M, error: N, errorMessage: P, onRetry: F, emptyMessage: ye = "No content.", emptyHint: I, emptyAction: L } = e, R = A ? !1 : p, z = A ? !1 : m;
71
+ if (M) return /* @__PURE__ */ b("div", {
72
+ "data-component": "MarkdownViewer",
73
+ "data-testid": "markdownviewer-loading",
74
+ className: `cs-component-markdown-viewer-33 ${j ?? ""}`,
75
+ children: [
76
+ /* @__PURE__ */ y(n, {
77
+ variant: "text",
78
+ width: "60%",
79
+ height: "1.5em"
80
+ }),
81
+ Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ y(n, {
82
+ variant: "text",
83
+ width: `${85 - t % 4 * 5}%`
84
+ }, `__p-${t}`)),
85
+ /* @__PURE__ */ y("div", { style: { height: "var(--space-4)" } }),
86
+ /* @__PURE__ */ y(n, {
87
+ variant: "text",
88
+ width: "40%",
89
+ height: "1.25em"
90
+ }),
91
+ Array.from({ length: 4 }).map((e, t) => /* @__PURE__ */ y(n, {
92
+ variant: "text",
93
+ width: `${80 - t % 3 * 5}%`
94
+ }, `__p2-${t}`))
95
+ ]
96
+ });
97
+ if (N) return /* @__PURE__ */ b("div", {
98
+ "data-component": "MarkdownViewer",
99
+ "data-testid": "markdownviewer-error",
100
+ className: `cs-component-markdown-viewer-55 ${j ?? ""}`,
101
+ children: [
102
+ /* @__PURE__ */ y(ee, { className: "cs-component-markdown-viewer-58 " }),
103
+ /* @__PURE__ */ y("div", {
104
+ className: "cs-component-markdown-viewer-59 ",
105
+ children: P ?? "Something went wrong"
106
+ }),
107
+ (typeof N == "string" ? N : N?.message) && /* @__PURE__ */ y("div", {
108
+ className: "cs-component-markdown-viewer-62 ",
109
+ children: typeof N == "string" ? N : N.message
110
+ }),
111
+ F && /* @__PURE__ */ y(t, {
112
+ variant: "secondary",
113
+ size: "sm",
114
+ onClick: F,
115
+ children: "Retry"
116
+ })
117
+ ]
118
+ });
119
+ if (!f || f.trim() === "") return /* @__PURE__ */ b("div", {
120
+ "data-component": "MarkdownViewer",
121
+ "data-testid": "markdownviewer-empty",
122
+ className: `cs-component-markdown-viewer-55 ${j ?? ""}`,
123
+ children: [
124
+ /* @__PURE__ */ y(re, { className: "cs-component-markdown-viewer-71 " }),
125
+ /* @__PURE__ */ y("div", {
126
+ className: "cs-component-markdown-viewer-59 ",
127
+ children: ye
128
+ }),
129
+ I && /* @__PURE__ */ y("div", {
130
+ className: "cs-component-markdown-viewer-62 ",
131
+ children: I
132
+ }),
133
+ L && /* @__PURE__ */ y(t, {
134
+ variant: "secondary",
135
+ size: "sm",
136
+ onClick: L.onClick,
137
+ children: L.label
138
+ })
139
+ ]
140
+ });
141
+ let B = u(null), [V, H] = d(h ?? !1), [U, W] = d(g ?? !1), [G, K] = d(null), [q, J] = d(null), Y = u(null);
142
+ c(() => {
143
+ if (!G) return;
144
+ let e = Y.current;
145
+ if (!e) return;
146
+ let t = e.querySelector(`[data-heading-id="${CSS.escape(G)}"]`);
147
+ if (!t) return;
148
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
149
+ r.top < n.top ? e.scrollTop -= n.top - r.top : r.bottom > n.bottom && (e.scrollTop += r.bottom - n.bottom);
150
+ }, [G]);
151
+ let [X, be] = d(le), Z = u(null);
152
+ c(() => {
153
+ let e = (e) => {
154
+ if (!Z.current) return;
155
+ let t = e.clientX - Z.current.startX;
156
+ be(Math.min(C, Math.max(S, Z.current.startWidth + t)));
157
+ }, t = () => {
158
+ Z.current && (Z.current = null, document.body.style.cursor = "", document.body.style.userSelect = "");
159
+ };
160
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
161
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
162
+ };
163
+ }, []);
164
+ let Q = l(() => {
165
+ let e = [], t = f.split("\n"), n = !1, r = "", i = 0;
166
+ for (let a of t) {
167
+ let t = a.trim().match(/^(`{3,}|~{3,})(.*)?$/);
168
+ if (t) {
169
+ let e = t[1][0], a = t[1].length;
170
+ n ? e === r && a >= i && !t[2]?.trim() && (n = !1) : (n = !0, r = e, i = a);
171
+ continue;
172
+ }
173
+ if (n) continue;
174
+ let o = a.match(/^(#{1,6})\s+(.+)$/);
175
+ o && e.push({
176
+ level: o[1].length,
177
+ text: o[2].replace(/[*_`~]/g, ""),
178
+ slug: ce(o[2].replace(/[*_`~]/g, ""))
179
+ });
180
+ }
181
+ return e;
182
+ }, [f]), xe = l(() => Q.length > 0 ? Math.min(...Q.map((e) => e.level)) : 1, [Q]);
183
+ c(() => {
184
+ let e = B.current;
185
+ if (!e || !R) return;
186
+ let t, n = () => {
187
+ clearTimeout(t), t = setTimeout(() => {
188
+ let t = e.getBoundingClientRect(), n = e.querySelectorAll("h1, h2, h3, h4, h5, h6"), r = null;
189
+ n.forEach((e) => {
190
+ e.getBoundingClientRect().top <= t.top + pe && (r = e.id);
191
+ }), r !== null && K(r);
192
+ }, me);
193
+ };
194
+ return e.addEventListener("scroll", n), n(), () => {
195
+ e.removeEventListener("scroll", n), clearTimeout(t);
196
+ };
197
+ }, [R]);
198
+ let Se = s((e) => {
199
+ let t = B.current;
200
+ if (!t) return;
201
+ let n = t.querySelector(`#${CSS.escape(e)}`);
202
+ n && (w(t, n, "instant"), K(e), O?.(e));
203
+ }, [O]);
204
+ c(() => {
205
+ if (!k) return;
206
+ let e = B.current;
207
+ if (!e) return;
208
+ let t = setTimeout(() => {
209
+ let t = e.querySelector(`#${CSS.escape(k)}`);
210
+ t && (w(e, t, "instant"), K(k));
211
+ }, 0);
212
+ return () => clearTimeout(t);
213
+ }, [k]);
214
+ let $ = s((e, t) => {
215
+ navigator.clipboard.writeText(e), J(t), setTimeout(() => J(null), he);
216
+ }, []), Ce = l(() => {
217
+ let e = 0;
218
+ return {
219
+ p: ({ children: e }) => /* @__PURE__ */ y("p", {
220
+ "data-markdown-paragraph": "",
221
+ children: e
222
+ }),
223
+ ul: ({ children: e }) => /* @__PURE__ */ y("ul", {
224
+ "data-markdown-list": "unordered",
225
+ children: e
226
+ }),
227
+ ol: ({ children: e }) => /* @__PURE__ */ y("ol", {
228
+ "data-markdown-list": "ordered",
229
+ children: e
230
+ }),
231
+ pre: ({ children: t }) => {
232
+ let n = Array.isArray(t) ? t[0] : t, r = "", i = "";
233
+ if (n && typeof n == "object" && "props" in n) {
234
+ let e = n.props, t = (e.className || "").match(/language-(\w+)/);
235
+ t && (r = t[1]), i = x(e.children);
236
+ }
237
+ if (D && r && D[r]) {
238
+ let e = D[r];
239
+ return /* @__PURE__ */ y(e, { code: i });
240
+ }
241
+ let a = `code-block-${++e}`, o = q === a;
242
+ return /* @__PURE__ */ b("div", {
243
+ className: "md-code-block",
244
+ children: [/* @__PURE__ */ b("div", {
245
+ className: "md-code-block__header",
246
+ children: [r ? /* @__PURE__ */ y("span", {
247
+ className: "text-label-upper",
248
+ children: r
249
+ }) : /* @__PURE__ */ y("span", {}), /* @__PURE__ */ y("button", {
250
+ onClick: () => $(i, a),
251
+ className: "cs-component-markdown-viewer-111 ",
252
+ "aria-label": o ? "Copied!" : "Copy code to clipboard",
253
+ children: y(o ? te : ne, { className: "cs-component-markdown-viewer-112 " })
254
+ })]
255
+ }), /* @__PURE__ */ y("div", {
256
+ className: "md-code-block__body",
257
+ children: /* @__PURE__ */ y("pre", { children: t })
258
+ })]
259
+ });
260
+ },
261
+ a: ({ href: e, children: t, node: n, ...r }) => {
262
+ let a = i(e ?? "");
263
+ return a.startsWith("http://") || a.startsWith("https://") ? /* @__PURE__ */ y("a", {
264
+ href: a,
265
+ target: "_blank",
266
+ rel: "noopener noreferrer",
267
+ ...r,
268
+ children: t
269
+ }) : a.startsWith("#") ? /* @__PURE__ */ y("a", {
270
+ href: a,
271
+ onClick: (e) => {
272
+ e.preventDefault();
273
+ let t = a.slice(1), n = B.current;
274
+ if (n) {
275
+ let e = n.querySelector(`#${CSS.escape(t)}`);
276
+ e && (w(n, e, "instant"), K(t));
277
+ }
278
+ },
279
+ ...r,
280
+ children: t
281
+ }) : T ? /* @__PURE__ */ y("a", {
282
+ href: a,
283
+ onClick: (e) => {
284
+ e.preventDefault(), T(a);
285
+ },
286
+ ...r,
287
+ children: t
288
+ }) : /* @__PURE__ */ y("a", {
289
+ href: a,
290
+ ...r,
291
+ children: t
292
+ });
293
+ },
294
+ blockquote: ({ children: e }) => {
295
+ let t = Array.isArray(e) ? e : [e], n = "", r = [];
296
+ for (let e = 0; e < t.length; e++) {
297
+ let i = t[e];
298
+ if (i && typeof i == "object" && "props" in i && i.props.children) {
299
+ let a = x(i.props.children);
300
+ if (!n && a.trim()) {
301
+ n = a.trim(), r = t.slice(e + 1);
302
+ break;
303
+ }
304
+ }
305
+ }
306
+ let i = n.match(/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*([\s\S]*)?$/);
307
+ if (i) {
308
+ let t = i[1], n = ge[t];
309
+ if (!n) return /* @__PURE__ */ y("blockquote", {
310
+ "data-markdown-blockquote": "",
311
+ children: e
312
+ });
313
+ let a = n.icon, o = t.toLowerCase(), s = i[2]?.trim();
314
+ return /* @__PURE__ */ b("div", {
315
+ "data-markdown-blockquote": "",
316
+ className: `md-alert md-alert--${o}`,
317
+ children: [/* @__PURE__ */ b("div", {
318
+ className: "md-alert__title",
319
+ children: [/* @__PURE__ */ y(a, { className: "cs-component-markdown-viewer-112 " }), n.title]
320
+ }), /* @__PURE__ */ b("div", {
321
+ className: "md-alert__body",
322
+ children: [s && /* @__PURE__ */ y("p", { children: s }), r]
323
+ })]
324
+ });
325
+ }
326
+ return /* @__PURE__ */ y("blockquote", {
327
+ "data-markdown-blockquote": "",
328
+ children: e
329
+ });
330
+ },
331
+ input: ({ type: e, checked: t, node: n, ...r }) => /* @__PURE__ */ y("input", {
332
+ type: e,
333
+ checked: t,
334
+ "aria-label": e === "checkbox" ? t ? "Completed task" : "Incomplete task" : void 0,
335
+ ...r
336
+ }),
337
+ ...E ? { img: ({ src: e, alt: t, node: n, ...r }) => /* @__PURE__ */ y(_e, {
338
+ src: e,
339
+ alt: t ?? "",
340
+ resolve: E,
341
+ ...r
342
+ }) } : {}
343
+ };
344
+ }, [
345
+ q,
346
+ $,
347
+ T,
348
+ E,
349
+ D
350
+ ]);
351
+ return /* @__PURE__ */ b("div", {
352
+ "data-component": "MarkdownViewer",
353
+ className: A ? j ?? "" : `cs-component-markdown-viewer-133 ${j ?? ""}`,
354
+ children: [
355
+ R && !V && /* @__PURE__ */ b(se, { children: [/* @__PURE__ */ b("div", {
356
+ className: "cs-component-markdown-viewer-136 ",
357
+ style: { width: X },
358
+ children: [/* @__PURE__ */ b("div", {
359
+ className: "cs-component-markdown-viewer-137 ",
360
+ children: [/* @__PURE__ */ b("div", {
361
+ className: "cs-component-markdown-viewer-138 ",
362
+ children: [/* @__PURE__ */ y(ie, { className: "cs-component-markdown-viewer-112 " }), "Outline"]
363
+ }), /* @__PURE__ */ y("button", {
364
+ onClick: () => H(!0),
365
+ className: "cs-component-markdown-viewer-139 ",
366
+ "aria-label": "Collapse outline",
367
+ children: /* @__PURE__ */ y(_, { className: "cs-component-markdown-viewer-112 " })
368
+ })]
369
+ }), /* @__PURE__ */ y("nav", {
370
+ ref: Y,
371
+ className: "cs-component-markdown-viewer-140 ",
372
+ children: Q.map((e, t) => /* @__PURE__ */ y("button", {
373
+ "data-heading-id": e.slug,
374
+ onClick: () => Se(e.slug),
375
+ className: `cs-component-markdown-viewer-144 ${G === e.slug ? "cs-component-markdown-viewer-145 " : "cs-component-markdown-viewer-146 "}`,
376
+ style: { paddingLeft: `${(e.level - xe) * ue + de}px` },
377
+ children: e.text
378
+ }, `${e.slug}-${t}`))
379
+ })]
380
+ }), /* @__PURE__ */ y("div", {
381
+ className: "cs-component-markdown-viewer-150 ",
382
+ onPointerDown: (e) => {
383
+ e.preventDefault(), Z.current = {
384
+ startX: e.clientX,
385
+ startWidth: X
386
+ }, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
387
+ },
388
+ children: /* @__PURE__ */ y("div", { className: "cs-component-markdown-viewer-153 " })
389
+ })] }),
390
+ R && V && /* @__PURE__ */ y("div", {
391
+ className: "cs-component-markdown-viewer-154 ",
392
+ children: /* @__PURE__ */ y("button", {
393
+ onClick: () => H(!1),
394
+ className: "cs-component-markdown-viewer-155 ",
395
+ "aria-label": "Expand outline",
396
+ children: /* @__PURE__ */ y(v, { className: "cs-component-markdown-viewer-112 " })
397
+ })
398
+ }),
399
+ /* @__PURE__ */ y("div", {
400
+ ref: B,
401
+ className: A ? "cs-component-markdown-viewer-156" : "cs-component-markdown-viewer-157 ",
402
+ children: /* @__PURE__ */ y("article", {
403
+ "data-markdown-content": "",
404
+ className: `${A ? "markdown-content" : "markdown-content cs-component-markdown-viewer-159"}${ve === "dense" ? " markdown-content--dense" : ""}`,
405
+ children: /* @__PURE__ */ y(o, {
406
+ ...e,
407
+ content: r(f),
408
+ components: Ce
409
+ })
410
+ })
411
+ }),
412
+ z && U && /* @__PURE__ */ y("div", {
413
+ className: "cs-component-markdown-viewer-160 ",
414
+ children: /* @__PURE__ */ y("button", {
415
+ onClick: () => W(!1),
416
+ className: "cs-component-markdown-viewer-155 ",
417
+ "aria-label": "Expand minimap",
418
+ children: /* @__PURE__ */ y(oe, { className: "cs-component-markdown-viewer-112 " })
419
+ })
420
+ }),
421
+ z && /* @__PURE__ */ b("div", {
422
+ className: "cs-component-markdown-viewer-161 ",
423
+ style: { width: U ? 0 : fe },
424
+ children: [/* @__PURE__ */ b("div", {
425
+ className: "cs-component-markdown-viewer-162 ",
426
+ children: [/* @__PURE__ */ y("span", {
427
+ className: "cs-component-markdown-viewer-163 ",
428
+ children: "Minimap"
429
+ }), /* @__PURE__ */ y("button", {
430
+ onClick: () => W(!0),
431
+ className: "cs-component-markdown-viewer-139 ",
432
+ "aria-label": "Collapse minimap",
433
+ children: /* @__PURE__ */ y(ae, { className: "cs-component-markdown-viewer-112 " })
434
+ })]
435
+ }), /* @__PURE__ */ y("div", {
436
+ className: "cs-component-markdown-viewer-164 ",
437
+ children: /* @__PURE__ */ y(a, { contentRef: B })
438
+ })]
439
+ })
440
+ ]
441
+ });
442
+ }
443
+ function E(t) {
444
+ function n(e) {
445
+ return T({
446
+ viewerProps: e,
447
+ Renderer: t
448
+ });
449
+ }
450
+ let r = e(n);
451
+ return r.displayName = "MarkdownViewer", r;
452
+ }
453
+ var D = E(o);
454
+ //#endregion
455
+ export { D as MarkdownViewer, E as createMarkdownViewer };
@@ -0,0 +1,11 @@
1
+ interface MermaidDiagramProps {
2
+ chart: string;
3
+ /** Apply the CodeSweep hand-drawn "sketch" styling to Mermaid's output. */
4
+ sketch?: boolean;
5
+ /** With `sketch`, use the handwriting font (Caveat) for node labels. */
6
+ sketchHandwriting?: boolean;
7
+ className?: string;
8
+ }
9
+ export declare const MermaidDiagram: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<MermaidDiagramProps & import("react").RefAttributes<HTMLDivElement>>>;
10
+ export {};
11
+ //# sourceMappingURL=MermaidDiagram.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MermaidDiagram.d.ts","sourceRoot":"","sources":["../../src/components/MermaidDiagram.tsx"],"names":[],"mappings":"AAOA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoND,eAAO,MAAM,cAAc,qJAE1B,CAAC"}
@@ -0,0 +1,119 @@
1
+ "use client";
2
+ "use client";
3
+ import { forwardRefToRoot as e } from "../lib/forwardRefToRoot.js";
4
+ import { cn as t } from "../lib/cn.js";
5
+ import { memo as n, useEffect as r, useId as i, useRef as a, useState as o } from "react";
6
+ import { AlertTriangle as s } from "lucide-react";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ //#region src/components/MermaidDiagram.tsx
9
+ async function u() {
10
+ try {
11
+ let e = (await import("mermaid")).default;
12
+ return !e || typeof e.initialize != "function" || typeof e.render != "function" ? null : e;
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+ function d() {
18
+ return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "default";
19
+ }
20
+ function f(e, t, n) {
21
+ let r = e.querySelector("svg");
22
+ if (!r) return;
23
+ let i = "http://www.w3.org/2000/svg", a = `sketch-${t}`, o = r.querySelector("defs");
24
+ if (o || (o = document.createElementNS(i, "defs"), r.insertBefore(o, r.firstChild)), !o.querySelector(`#${a}`)) {
25
+ let e = document.createElementNS(i, "filter");
26
+ e.setAttribute("id", a), e.setAttribute("x", "-10%"), e.setAttribute("y", "-10%"), e.setAttribute("width", "120%"), e.setAttribute("height", "120%");
27
+ let t = document.createElementNS(i, "feTurbulence");
28
+ t.setAttribute("type", "fractalNoise"), t.setAttribute("baseFrequency", "0.02"), t.setAttribute("numOctaves", "2"), t.setAttribute("result", "noise");
29
+ let n = document.createElementNS(i, "feDisplacementMap");
30
+ n.setAttribute("in", "SourceGraphic"), n.setAttribute("in2", "noise"), n.setAttribute("scale", "2"), e.appendChild(t), e.appendChild(n), o.appendChild(e);
31
+ }
32
+ r.querySelectorAll("rect, circle, ellipse, polygon, path, line").forEach((e) => {
33
+ let t = e, n = t.tagName.toLowerCase();
34
+ t.style.stroke = "var(--color-accent)", t.style.strokeWidth = "1.5", t.style.filter = `url(#${a})`, n !== "path" && n !== "line" && (t.style.fill = "var(--color-accent-bg)");
35
+ }), r.querySelectorAll("text, .nodeLabel, .edgeLabel").forEach((e) => {
36
+ e.style.fontFamily = n ? "cursive" : "var(--font-family-mono)";
37
+ });
38
+ }
39
+ function p({ chart: e, sketch: n = !1, sketchHandwriting: p = !1, className: m }) {
40
+ let h = a(null), g = a(void 0), [_, v] = o(""), [y, b] = o(null), x = i().replace(/:/g, "-");
41
+ return r(() => {
42
+ let t = !1, n = async () => {
43
+ if (!e.trim()) {
44
+ b({
45
+ kind: "invalid-chart",
46
+ message: "Empty diagram"
47
+ });
48
+ return;
49
+ }
50
+ try {
51
+ let n = await u();
52
+ if (t) return;
53
+ if (!n) {
54
+ b({
55
+ kind: "missing-dependency",
56
+ message: "Mermaid is unavailable. Install the optional \"mermaid\" peer dependency."
57
+ }), v("");
58
+ return;
59
+ }
60
+ n.initialize({
61
+ startOnLoad: !1,
62
+ theme: d(),
63
+ securityLevel: "strict",
64
+ htmlLabels: !1
65
+ });
66
+ let r = `mermaid${x}`, { svg: i, bindFunctions: a } = await n.render(r, e);
67
+ t || (g.current = a, v(i), b(null));
68
+ } catch (e) {
69
+ t || (b({
70
+ kind: "render",
71
+ message: e instanceof Error ? e.message : "Failed to render diagram"
72
+ }), v(""));
73
+ }
74
+ };
75
+ n();
76
+ let r = new MutationObserver((e) => {
77
+ for (let t of e) t.attributeName === "data-theme" && n();
78
+ });
79
+ return r.observe(document.documentElement, { attributes: !0 }), () => {
80
+ t = !0, r.disconnect();
81
+ };
82
+ }, [e, x]), r(() => {
83
+ !_ || !h.current || (n && f(h.current, x, p), g.current?.(h.current));
84
+ }, [
85
+ n,
86
+ p,
87
+ _,
88
+ x
89
+ ]), y ? /* @__PURE__ */ l("div", {
90
+ "data-component": "MermaidDiagram",
91
+ "data-error-kind": y.kind,
92
+ role: "alert",
93
+ "data-mermaid-rendered": "false",
94
+ className: t("md-mermaid-error", m),
95
+ children: [
96
+ /* @__PURE__ */ l("div", {
97
+ className: "md-mermaid-error__header",
98
+ children: [/* @__PURE__ */ c(s, { className: "cs-component-mermaid-diagram-68 " }), /* @__PURE__ */ c("span", { children: "Diagram Error" })]
99
+ }),
100
+ /* @__PURE__ */ c("div", {
101
+ className: "md-mermaid-error__message",
102
+ children: y.message
103
+ }),
104
+ /* @__PURE__ */ c("pre", {
105
+ className: "md-mermaid-error__code",
106
+ children: e
107
+ })
108
+ ]
109
+ }) : /* @__PURE__ */ c("div", {
110
+ ref: h,
111
+ "data-component": "MermaidDiagram",
112
+ "data-mermaid-rendered": _ ? "true" : "false",
113
+ className: t("md-mermaid", n && "md-mermaid--sketch", m),
114
+ dangerouslySetInnerHTML: { __html: _ }
115
+ });
116
+ }
117
+ var m = n(e(p));
118
+ //#endregion
119
+ export { m as MermaidDiagram };
@@ -0,0 +1,13 @@
1
+ interface ModalProps {
2
+ title: string;
3
+ children: React.ReactNode;
4
+ actions?: React.ReactNode;
5
+ onClose: () => void;
6
+ maxWidth?: string;
7
+ className?: string;
8
+ /** Element to focus when the dialog opens. Defaults to its first focusable element. */
9
+ initialFocus?: React.RefObject<HTMLElement | null>;
10
+ }
11
+ export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
12
+ export {};
13
+ //# sourceMappingURL=Modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAOA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACpD;AAED,eAAO,MAAM,KAAK,uGA6IhB,CAAC"}