@uipath/apollo-wind 2.68.0 → 2.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/custom/chat-first-experience.cjs +3 -3
- package/dist/components/custom/chat-first-experience.js +3 -3
- package/dist/components/custom/demo-composer.cjs +80 -0
- package/dist/components/custom/demo-composer.d.ts +11 -0
- package/dist/components/custom/demo-composer.js +46 -0
- package/dist/components/custom/panel-flow.cjs +2 -2
- package/dist/components/custom/panel-flow.js +2 -2
- package/dist/components/ui/chat-composer.cjs +429 -0
- package/dist/components/ui/chat-composer.d.ts +157 -0
- package/dist/components/ui/chat-composer.js +359 -0
- package/dist/components/ui/citation.cjs +188 -0
- package/dist/components/ui/citation.d.ts +42 -0
- package/dist/components/ui/citation.js +148 -0
- package/dist/components/ui/code-block.cjs +375 -0
- package/dist/components/ui/code-block.d.ts +38 -0
- package/dist/components/ui/code-block.js +307 -0
- package/dist/components/ui/dropzone-overlay.cjs +142 -0
- package/dist/components/ui/dropzone-overlay.d.ts +27 -0
- package/dist/components/ui/dropzone-overlay.js +105 -0
- package/dist/components/ui/file-upload.cjs +5 -29
- package/dist/components/ui/file-upload.js +2 -26
- package/dist/components/ui/file-validation.cjs +91 -0
- package/dist/components/ui/file-validation.d.ts +24 -0
- package/dist/components/ui/file-validation.js +51 -0
- package/dist/components/ui/hover-card.cjs +15 -8
- package/dist/components/ui/hover-card.d.ts +4 -1
- package/dist/components/ui/hover-card.js +16 -9
- package/dist/components/ui/index.cjs +330 -198
- package/dist/components/ui/index.d.ts +12 -0
- package/dist/components/ui/index.js +12 -0
- package/dist/components/ui/input-group.cjs +1 -1
- package/dist/components/ui/input-group.d.ts +2 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/json-tree-view/JsonTree.cjs +2 -2
- package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
- package/dist/components/ui/json-tree-view/index.cjs +26 -23
- package/dist/components/ui/json-tree-view/index.d.ts +2 -2
- package/dist/components/ui/json-tree-view/index.js +2 -2
- package/dist/components/ui/live-region.cjs +106 -0
- package/dist/components/ui/live-region.d.ts +31 -0
- package/dist/components/ui/live-region.js +72 -0
- package/dist/components/ui/loading-dots.cjs +95 -0
- package/dist/components/ui/loading-dots.d.ts +21 -0
- package/dist/components/ui/loading-dots.js +55 -0
- package/dist/components/ui/markdown.cjs +428 -0
- package/dist/components/ui/markdown.d.ts +55 -0
- package/dist/components/ui/markdown.js +378 -0
- package/dist/components/ui/message-actions.cjs +302 -0
- package/dist/components/ui/message-actions.d.ts +102 -0
- package/dist/components/ui/message-actions.js +241 -0
- package/dist/components/ui/message.cjs +1 -1
- package/dist/components/ui/message.d.ts +2 -0
- package/dist/components/ui/message.js +1 -1
- package/dist/components/ui/sources.cjs +175 -0
- package/dist/components/ui/sources.d.ts +44 -0
- package/dist/components/ui/sources.js +132 -0
- package/dist/components/ui/thinking-indicator.cjs +146 -0
- package/dist/components/ui/thinking-indicator.d.ts +38 -0
- package/dist/components/ui/thinking-indicator.js +106 -0
- package/dist/components/ui/tool-call.cjs +359 -0
- package/dist/components/ui/tool-call.d.ts +75 -0
- package/dist/components/ui/tool-call.js +301 -0
- package/dist/index.cjs +433 -253
- package/dist/index.d.ts +24 -0
- package/dist/index.js +13 -1
- package/dist/lib/index.cjs +8 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -1
- package/dist/lib/url.cjs +54 -0
- package/dist/lib/url.d.ts +8 -0
- package/dist/lib/url.js +17 -0
- package/dist/styles.css +363 -35
- package/dist/tailwind.utilities.css +21 -0
- package/package.json +7 -1
- package/dist/components/custom/chat-composer.cjs +0 -134
- package/dist/components/custom/chat-composer.d.ts +0 -14
- package/dist/components/custom/chat-composer.js +0 -100
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.cjs +0 -0
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.d.ts +0 -0
- /package/dist/{components/ui/json-tree-view → lib}/clipboard.js +0 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
DEFAULT_CODE_BLOCK_STRINGS: ()=>DEFAULT_CODE_BLOCK_STRINGS,
|
|
37
|
+
CodeBlock: ()=>CodeBlock,
|
|
38
|
+
CodeBlockHeader: ()=>CodeBlockHeader
|
|
39
|
+
});
|
|
40
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
41
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
42
|
+
const external_react_namespaceObject = require("react");
|
|
43
|
+
const bash_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/bash.js");
|
|
44
|
+
var bash_js_default = /*#__PURE__*/ __webpack_require__.n(bash_js_namespaceObject);
|
|
45
|
+
const csharp_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/csharp.js");
|
|
46
|
+
var csharp_js_default = /*#__PURE__*/ __webpack_require__.n(csharp_js_namespaceObject);
|
|
47
|
+
const css_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/css.js");
|
|
48
|
+
var css_js_default = /*#__PURE__*/ __webpack_require__.n(css_js_namespaceObject);
|
|
49
|
+
const diff_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/diff.js");
|
|
50
|
+
var diff_js_default = /*#__PURE__*/ __webpack_require__.n(diff_js_namespaceObject);
|
|
51
|
+
const go_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/go.js");
|
|
52
|
+
var go_js_default = /*#__PURE__*/ __webpack_require__.n(go_js_namespaceObject);
|
|
53
|
+
const java_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/java.js");
|
|
54
|
+
var java_js_default = /*#__PURE__*/ __webpack_require__.n(java_js_namespaceObject);
|
|
55
|
+
const javascript_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/javascript.js");
|
|
56
|
+
var javascript_js_default = /*#__PURE__*/ __webpack_require__.n(javascript_js_namespaceObject);
|
|
57
|
+
const json_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/json.js");
|
|
58
|
+
var json_js_default = /*#__PURE__*/ __webpack_require__.n(json_js_namespaceObject);
|
|
59
|
+
const jsx_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/jsx.js");
|
|
60
|
+
var jsx_js_default = /*#__PURE__*/ __webpack_require__.n(jsx_js_namespaceObject);
|
|
61
|
+
const markdown_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/markdown.js");
|
|
62
|
+
var markdown_js_default = /*#__PURE__*/ __webpack_require__.n(markdown_js_namespaceObject);
|
|
63
|
+
const markup_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/markup.js");
|
|
64
|
+
var markup_js_default = /*#__PURE__*/ __webpack_require__.n(markup_js_namespaceObject);
|
|
65
|
+
const powershell_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/powershell.js");
|
|
66
|
+
var powershell_js_default = /*#__PURE__*/ __webpack_require__.n(powershell_js_namespaceObject);
|
|
67
|
+
const python_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/python.js");
|
|
68
|
+
var python_js_default = /*#__PURE__*/ __webpack_require__.n(python_js_namespaceObject);
|
|
69
|
+
const sql_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/sql.js");
|
|
70
|
+
var sql_js_default = /*#__PURE__*/ __webpack_require__.n(sql_js_namespaceObject);
|
|
71
|
+
const tsx_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/tsx.js");
|
|
72
|
+
var tsx_js_default = /*#__PURE__*/ __webpack_require__.n(tsx_js_namespaceObject);
|
|
73
|
+
const typescript_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/typescript.js");
|
|
74
|
+
var typescript_js_default = /*#__PURE__*/ __webpack_require__.n(typescript_js_namespaceObject);
|
|
75
|
+
const vbnet_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/vbnet.js");
|
|
76
|
+
var vbnet_js_default = /*#__PURE__*/ __webpack_require__.n(vbnet_js_namespaceObject);
|
|
77
|
+
const yaml_js_namespaceObject = require("react-syntax-highlighter/dist/esm/languages/prism/yaml.js");
|
|
78
|
+
var yaml_js_default = /*#__PURE__*/ __webpack_require__.n(yaml_js_namespaceObject);
|
|
79
|
+
const prism_light_js_namespaceObject = require("react-syntax-highlighter/dist/esm/prism-light.js");
|
|
80
|
+
var prism_light_js_default = /*#__PURE__*/ __webpack_require__.n(prism_light_js_namespaceObject);
|
|
81
|
+
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
82
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
83
|
+
const clipboard_cjs_namespaceObject = require("../../lib/clipboard.cjs");
|
|
84
|
+
const LANGUAGES = {
|
|
85
|
+
bash: bash_js_default(),
|
|
86
|
+
csharp: csharp_js_default(),
|
|
87
|
+
css: css_js_default(),
|
|
88
|
+
diff: diff_js_default(),
|
|
89
|
+
go: go_js_default(),
|
|
90
|
+
java: java_js_default(),
|
|
91
|
+
javascript: javascript_js_default(),
|
|
92
|
+
json: json_js_default(),
|
|
93
|
+
jsx: jsx_js_default(),
|
|
94
|
+
markdown: markdown_js_default(),
|
|
95
|
+
markup: markup_js_default(),
|
|
96
|
+
powershell: powershell_js_default(),
|
|
97
|
+
python: python_js_default(),
|
|
98
|
+
sql: sql_js_default(),
|
|
99
|
+
tsx: tsx_js_default(),
|
|
100
|
+
typescript: typescript_js_default(),
|
|
101
|
+
vbnet: vbnet_js_default(),
|
|
102
|
+
yaml: yaml_js_default()
|
|
103
|
+
};
|
|
104
|
+
for (const [name, grammar] of Object.entries(LANGUAGES))prism_light_js_default().registerLanguage(name, grammar);
|
|
105
|
+
const LANGUAGE_ALIASES = {
|
|
106
|
+
'c#': 'csharp',
|
|
107
|
+
cjs: "javascript",
|
|
108
|
+
cs: 'csharp',
|
|
109
|
+
golang: 'go',
|
|
110
|
+
htm: 'markup',
|
|
111
|
+
html: 'markup',
|
|
112
|
+
js: "javascript",
|
|
113
|
+
md: 'markdown',
|
|
114
|
+
mjs: "javascript",
|
|
115
|
+
patch: 'diff',
|
|
116
|
+
ps: 'powershell',
|
|
117
|
+
ps1: 'powershell',
|
|
118
|
+
pwsh: 'powershell',
|
|
119
|
+
py: 'python',
|
|
120
|
+
sh: 'bash',
|
|
121
|
+
shell: 'bash',
|
|
122
|
+
svg: 'markup',
|
|
123
|
+
ts: "typescript",
|
|
124
|
+
vb: 'vbnet',
|
|
125
|
+
'vb.net': 'vbnet',
|
|
126
|
+
xml: 'markup',
|
|
127
|
+
yml: 'yaml',
|
|
128
|
+
zsh: 'bash'
|
|
129
|
+
};
|
|
130
|
+
function resolveLanguage(language) {
|
|
131
|
+
const key = language?.trim().toLowerCase();
|
|
132
|
+
if (!key) return;
|
|
133
|
+
const name = LANGUAGE_ALIASES[key] ?? key;
|
|
134
|
+
return name in LANGUAGES ? name : void 0;
|
|
135
|
+
}
|
|
136
|
+
const token = (name)=>`var(--code-${name}, var(--foreground))`;
|
|
137
|
+
const codeBlockTheme = {
|
|
138
|
+
'code[class*="language-"]': {
|
|
139
|
+
color: token('rest'),
|
|
140
|
+
background: 'none',
|
|
141
|
+
fontFamily: 'var(--font-mono)',
|
|
142
|
+
textAlign: 'left',
|
|
143
|
+
wordSpacing: 'normal',
|
|
144
|
+
wordBreak: 'normal',
|
|
145
|
+
tabSize: 2,
|
|
146
|
+
hyphens: 'none'
|
|
147
|
+
},
|
|
148
|
+
'pre[class*="language-"]': {
|
|
149
|
+
color: token('rest'),
|
|
150
|
+
background: 'none',
|
|
151
|
+
fontFamily: 'var(--font-mono)',
|
|
152
|
+
fontSize: '0.8125rem',
|
|
153
|
+
lineHeight: 1.6,
|
|
154
|
+
margin: 0,
|
|
155
|
+
padding: '0.75rem 1rem',
|
|
156
|
+
overflow: 'auto',
|
|
157
|
+
tabSize: 2
|
|
158
|
+
},
|
|
159
|
+
comment: {
|
|
160
|
+
color: 'var(--foreground-muted)',
|
|
161
|
+
fontStyle: 'italic'
|
|
162
|
+
},
|
|
163
|
+
prolog: {
|
|
164
|
+
color: 'var(--foreground-muted)',
|
|
165
|
+
fontStyle: 'italic'
|
|
166
|
+
},
|
|
167
|
+
doctype: {
|
|
168
|
+
color: 'var(--foreground-muted)'
|
|
169
|
+
},
|
|
170
|
+
cdata: {
|
|
171
|
+
color: 'var(--foreground-muted)'
|
|
172
|
+
},
|
|
173
|
+
punctuation: {
|
|
174
|
+
color: token('punctuation')
|
|
175
|
+
},
|
|
176
|
+
operator: {
|
|
177
|
+
color: token('key')
|
|
178
|
+
},
|
|
179
|
+
keyword: {
|
|
180
|
+
color: token('key')
|
|
181
|
+
},
|
|
182
|
+
atrule: {
|
|
183
|
+
color: token('key')
|
|
184
|
+
},
|
|
185
|
+
tag: {
|
|
186
|
+
color: token('key')
|
|
187
|
+
},
|
|
188
|
+
property: {
|
|
189
|
+
color: token('key')
|
|
190
|
+
},
|
|
191
|
+
'attr-name': {
|
|
192
|
+
color: token('key')
|
|
193
|
+
},
|
|
194
|
+
selector: {
|
|
195
|
+
color: token('key')
|
|
196
|
+
},
|
|
197
|
+
string: {
|
|
198
|
+
color: token('string')
|
|
199
|
+
},
|
|
200
|
+
char: {
|
|
201
|
+
color: token('string')
|
|
202
|
+
},
|
|
203
|
+
'attr-value': {
|
|
204
|
+
color: token('string')
|
|
205
|
+
},
|
|
206
|
+
'template-string': {
|
|
207
|
+
color: token('string')
|
|
208
|
+
},
|
|
209
|
+
regex: {
|
|
210
|
+
color: token('string')
|
|
211
|
+
},
|
|
212
|
+
url: {
|
|
213
|
+
color: token('string')
|
|
214
|
+
},
|
|
215
|
+
inserted: {
|
|
216
|
+
color: token('string')
|
|
217
|
+
},
|
|
218
|
+
number: {
|
|
219
|
+
color: token('number')
|
|
220
|
+
},
|
|
221
|
+
unit: {
|
|
222
|
+
color: token('number')
|
|
223
|
+
},
|
|
224
|
+
boolean: {
|
|
225
|
+
color: token('literal')
|
|
226
|
+
},
|
|
227
|
+
constant: {
|
|
228
|
+
color: token('literal')
|
|
229
|
+
},
|
|
230
|
+
symbol: {
|
|
231
|
+
color: token('literal')
|
|
232
|
+
},
|
|
233
|
+
builtin: {
|
|
234
|
+
color: token('literal')
|
|
235
|
+
},
|
|
236
|
+
'class-name': {
|
|
237
|
+
color: token('literal')
|
|
238
|
+
},
|
|
239
|
+
function: {
|
|
240
|
+
color: token('literal')
|
|
241
|
+
},
|
|
242
|
+
entity: {
|
|
243
|
+
color: token('literal')
|
|
244
|
+
},
|
|
245
|
+
deleted: {
|
|
246
|
+
color: 'var(--error, var(--destructive))'
|
|
247
|
+
},
|
|
248
|
+
important: {
|
|
249
|
+
fontWeight: 600
|
|
250
|
+
},
|
|
251
|
+
bold: {
|
|
252
|
+
fontWeight: 600
|
|
253
|
+
},
|
|
254
|
+
italic: {
|
|
255
|
+
fontStyle: 'italic'
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const lineNumberStyle = {
|
|
259
|
+
minWidth: '2.25em',
|
|
260
|
+
paddingRight: '1em',
|
|
261
|
+
color: 'var(--foreground-subtle)',
|
|
262
|
+
textAlign: 'right',
|
|
263
|
+
userSelect: 'none'
|
|
264
|
+
};
|
|
265
|
+
const DEFAULT_CODE_BLOCK_STRINGS = {
|
|
266
|
+
copy: 'Copy code',
|
|
267
|
+
copied: 'Copied',
|
|
268
|
+
plainText: 'Text'
|
|
269
|
+
};
|
|
270
|
+
const COPIED_RESET_MS = 2000;
|
|
271
|
+
const CodeBlockHeader = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ code, language, strings, className, children, ...props }, ref)=>{
|
|
272
|
+
const text = {
|
|
273
|
+
...DEFAULT_CODE_BLOCK_STRINGS,
|
|
274
|
+
...strings
|
|
275
|
+
};
|
|
276
|
+
const [copied, setCopied] = external_react_namespaceObject.useState(false);
|
|
277
|
+
const timer = external_react_namespaceObject.useRef(void 0);
|
|
278
|
+
external_react_namespaceObject.useEffect(()=>()=>clearTimeout(timer.current), []);
|
|
279
|
+
const handleCopy = async ()=>{
|
|
280
|
+
if (!await (0, clipboard_cjs_namespaceObject.copyTextToClipboard)(code)) return;
|
|
281
|
+
setCopied(true);
|
|
282
|
+
clearTimeout(timer.current);
|
|
283
|
+
timer.current = setTimeout(()=>setCopied(false), COPIED_RESET_MS);
|
|
284
|
+
};
|
|
285
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
286
|
+
ref: ref,
|
|
287
|
+
"data-slot": "code-block-header",
|
|
288
|
+
className: (0, index_cjs_namespaceObject.cn)('flex items-center justify-between gap-2 border-b border-border-subtle py-1 pr-1 pl-4', className),
|
|
289
|
+
...props,
|
|
290
|
+
children: [
|
|
291
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
292
|
+
"data-slot": "code-block-language",
|
|
293
|
+
className: "min-w-0 truncate text-xs font-medium text-muted-foreground",
|
|
294
|
+
children: language?.trim() || text.plainText
|
|
295
|
+
}),
|
|
296
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
297
|
+
className: "flex shrink-0 items-center gap-1",
|
|
298
|
+
children: [
|
|
299
|
+
children,
|
|
300
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
301
|
+
"data-slot": "code-block-copy",
|
|
302
|
+
"data-copied": copied || void 0,
|
|
303
|
+
variant: "ghost",
|
|
304
|
+
size: "2xs",
|
|
305
|
+
icon: true,
|
|
306
|
+
"aria-label": text.copy,
|
|
307
|
+
title: copied ? text.copied : text.copy,
|
|
308
|
+
onClick: handleCopy,
|
|
309
|
+
children: copied ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Check, {
|
|
310
|
+
"aria-hidden": true
|
|
311
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Copy, {
|
|
312
|
+
"aria-hidden": true
|
|
313
|
+
})
|
|
314
|
+
}),
|
|
315
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("output", {
|
|
316
|
+
className: "sr-only",
|
|
317
|
+
children: copied ? text.copied : ''
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
]
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
CodeBlockHeader.displayName = 'CodeBlockHeader';
|
|
325
|
+
const code_block_CodeBlockBody = /*#__PURE__*/ external_react_namespaceObject.memo(function({ code, language, wrap, showLineNumbers }) {
|
|
326
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(prism_light_js_default(), {
|
|
327
|
+
language: language ?? 'text',
|
|
328
|
+
style: codeBlockTheme,
|
|
329
|
+
wrapLongLines: wrap,
|
|
330
|
+
showLineNumbers: showLineNumbers,
|
|
331
|
+
lineNumberStyle: lineNumberStyle,
|
|
332
|
+
"data-slot": "code-block-body",
|
|
333
|
+
"data-wrap": wrap,
|
|
334
|
+
tabIndex: wrap ? void 0 : 0,
|
|
335
|
+
className: "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
336
|
+
children: code
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
const CodeBlock = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ code, language, wrap = false, showLineNumbers = false, hideHeader = false, actions, strings, className, ...props }, ref)=>{
|
|
340
|
+
const source = code.replace(/\n$/, '');
|
|
341
|
+
const resolved = resolveLanguage(language);
|
|
342
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
343
|
+
ref: ref,
|
|
344
|
+
"data-slot": "code-block",
|
|
345
|
+
"data-language": resolved ?? 'text',
|
|
346
|
+
className: (0, index_cjs_namespaceObject.cn)('min-w-0 overflow-hidden rounded-lg border border-border-subtle bg-surface-overlay text-foreground', className),
|
|
347
|
+
...props,
|
|
348
|
+
children: [
|
|
349
|
+
!hideHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CodeBlockHeader, {
|
|
350
|
+
code: source,
|
|
351
|
+
language: language,
|
|
352
|
+
strings: strings,
|
|
353
|
+
children: actions
|
|
354
|
+
}),
|
|
355
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(code_block_CodeBlockBody, {
|
|
356
|
+
code: source,
|
|
357
|
+
language: resolved,
|
|
358
|
+
wrap: wrap,
|
|
359
|
+
showLineNumbers: showLineNumbers
|
|
360
|
+
})
|
|
361
|
+
]
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
CodeBlock.displayName = 'CodeBlock';
|
|
365
|
+
exports.CodeBlock = __webpack_exports__.CodeBlock;
|
|
366
|
+
exports.CodeBlockHeader = __webpack_exports__.CodeBlockHeader;
|
|
367
|
+
exports.DEFAULT_CODE_BLOCK_STRINGS = __webpack_exports__.DEFAULT_CODE_BLOCK_STRINGS;
|
|
368
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
369
|
+
"CodeBlock",
|
|
370
|
+
"CodeBlockHeader",
|
|
371
|
+
"DEFAULT_CODE_BLOCK_STRINGS"
|
|
372
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
373
|
+
Object.defineProperty(exports, '__esModule', {
|
|
374
|
+
value: true
|
|
375
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface CodeBlockStrings {
|
|
3
|
+
/** Label of the copy button. */
|
|
4
|
+
copy: string;
|
|
5
|
+
/** Tooltip and status announcement right after a successful copy. */
|
|
6
|
+
copied: string;
|
|
7
|
+
/** Header label when no `language` is given. */
|
|
8
|
+
plainText: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const DEFAULT_CODE_BLOCK_STRINGS: CodeBlockStrings;
|
|
11
|
+
export interface CodeBlockHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
/** The source the copy button writes to the clipboard. */
|
|
13
|
+
code: string;
|
|
14
|
+
/** Shown as the label. Falls back to `strings.plainText`. */
|
|
15
|
+
language?: string;
|
|
16
|
+
strings?: Partial<CodeBlockStrings>;
|
|
17
|
+
}
|
|
18
|
+
/** The label row with the copy button. Extra actions passed as `children` sit before the copy. */
|
|
19
|
+
declare const CodeBlockHeader: React.ForwardRefExoticComponent<CodeBlockHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export interface CodeBlockProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
21
|
+
/** The source to show. A single trailing newline is dropped. */
|
|
22
|
+
code: string;
|
|
23
|
+
/**
|
|
24
|
+
* Prism language name or common alias (`ts`, `js`, `sh`, `py`, `yml`, `html`, ...). Unknown or
|
|
25
|
+
* missing languages render as plain text; the header still shows what was passed.
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
/** Wrap long lines instead of scrolling horizontally. */
|
|
29
|
+
wrap?: boolean;
|
|
30
|
+
showLineNumbers?: boolean;
|
|
31
|
+
/** Hide the label and copy row, e.g. for a one-line snippet. */
|
|
32
|
+
hideHeader?: boolean;
|
|
33
|
+
/** Extra header actions, such as preview or expand, placed before the copy button. */
|
|
34
|
+
actions?: React.ReactNode;
|
|
35
|
+
strings?: Partial<CodeBlockStrings>;
|
|
36
|
+
}
|
|
37
|
+
declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export { CodeBlock, CodeBlockHeader };
|