@djangocfg/ui-tools 2.1.285 → 2.1.286
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/DocsLayout-BCVU6TTX.cjs +2027 -0
- package/dist/DocsLayout-BCVU6TTX.cjs.map +1 -0
- package/dist/DocsLayout-ERETJLLV.mjs +2020 -0
- package/dist/DocsLayout-ERETJLLV.mjs.map +1 -0
- package/dist/{PlaygroundLayout-O52C6HK5.css → DocsLayout-MBFIB4NO.css} +1 -1
- package/dist/{PrettyCode.client-SGDGQTYT.cjs → PrettyCode.client-5GABIN2I.cjs} +57 -35
- package/dist/PrettyCode.client-5GABIN2I.cjs.map +1 -0
- package/dist/{PrettyCode.client-DW5LTG47.mjs → PrettyCode.client-IZTXXYHG.mjs} +57 -35
- package/dist/PrettyCode.client-IZTXXYHG.mjs.map +1 -0
- package/dist/chunk-IULI4XII.cjs +1129 -0
- package/dist/chunk-IULI4XII.cjs.map +1 -0
- package/dist/chunk-VZGQC3NG.mjs +1100 -0
- package/dist/chunk-VZGQC3NG.mjs.map +1 -0
- package/dist/index.cjs +88 -552
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.mjs +25 -496
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/tools/OpenapiViewer/.claude/.sidecar/activity.jsonl +4 -0
- package/src/tools/OpenapiViewer/.claude/.sidecar/map_cache.json +30 -0
- package/src/tools/OpenapiViewer/.claude/.sidecar/usage.json +5 -0
- package/src/tools/OpenapiViewer/.claude/project-map.md +23 -0
- package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +28 -2
- package/src/tools/OpenapiViewer/README.md +104 -51
- package/src/tools/OpenapiViewer/components/DocsLayout/ApiIntroSection.tsx +64 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/DocsView.tsx +137 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc.tsx +268 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/SchemaCopyMenu.tsx +139 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar.tsx +211 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/SlideInPlayground.tsx +101 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/TryItSheet.tsx +57 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/anchor.ts +11 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/grouping.ts +71 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/index.tsx +166 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/schemaFields.ts +121 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/sidebarLabel.ts +60 -0
- package/src/tools/OpenapiViewer/components/index.ts +5 -2
- package/src/tools/OpenapiViewer/components/shared/BodyFormEditor.tsx +422 -0
- package/src/tools/OpenapiViewer/components/shared/EndpointDraftSync.tsx +108 -0
- package/src/tools/OpenapiViewer/components/shared/EndpointResetButton.tsx +50 -0
- package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/RequestPanel.tsx +174 -87
- package/src/tools/OpenapiViewer/components/shared/SendButton.tsx +91 -0
- package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/ui.tsx +5 -4
- package/src/tools/OpenapiViewer/context/PlaygroundContext.tsx +82 -8
- package/src/tools/OpenapiViewer/hooks/useEndpointDraft.ts +142 -0
- package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +126 -13
- package/src/tools/OpenapiViewer/index.tsx +3 -7
- package/src/tools/OpenapiViewer/lazy.tsx +6 -27
- package/src/tools/OpenapiViewer/types.ts +44 -0
- package/src/tools/OpenapiViewer/utils/formatters.ts +2 -23
- package/src/tools/OpenapiViewer/utils/index.ts +3 -1
- package/src/tools/OpenapiViewer/utils/schemaExport.ts +206 -0
- package/src/tools/OpenapiViewer/utils/url.ts +202 -0
- package/src/tools/PrettyCode/PrettyCode.client.tsx +42 -8
- package/src/tools/PrettyCode/index.tsx +6 -0
- package/dist/PlaygroundLayout-DHUATCHB.cjs +0 -798
- package/dist/PlaygroundLayout-DHUATCHB.cjs.map +0 -1
- package/dist/PlaygroundLayout-NONWOVQR.mjs +0 -791
- package/dist/PlaygroundLayout-NONWOVQR.mjs.map +0 -1
- package/dist/PrettyCode.client-DW5LTG47.mjs.map +0 -1
- package/dist/PrettyCode.client-SGDGQTYT.cjs.map +0 -1
- package/dist/chunk-5FKE7OME.cjs +0 -369
- package/dist/chunk-5FKE7OME.cjs.map +0 -1
- package/dist/chunk-BKWDHJKF.mjs +0 -356
- package/dist/chunk-BKWDHJKF.mjs.map +0 -1
- package/src/tools/OpenapiViewer/components/PlaygroundLayout/EndpointList.tsx +0 -228
- package/src/tools/OpenapiViewer/components/PlaygroundLayout/index.tsx +0 -107
- /package/dist/{PlaygroundLayout-O52C6HK5.css.map → DocsLayout-MBFIB4NO.css.map} +0 -0
- /package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/ResponsePanel.tsx +0 -0
package/dist/index.mjs
CHANGED
|
@@ -4,23 +4,19 @@ import './chunk-JWB2EWQO.mjs';
|
|
|
4
4
|
export { ImageViewer } from './chunk-GGKGH5PM.mjs';
|
|
5
5
|
export { generateContentKey, useAudioCache, useBlobUrlCleanup, useImageCache, useMediaCacheStore, useVideoCache, useVideoPlayerSettings } from './chunk-5LBDYFWH.mjs';
|
|
6
6
|
export { CronSchedulerProvider, CustomInput, DayChips, MonthDayGrid, SchedulePreview, ScheduleTypeSelector, TimeSelector, buildCron, humanizeCron, isValidCron, parseCron, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays } from './chunk-PZKAH7WQ.mjs';
|
|
7
|
-
import { PlaygroundProvider
|
|
8
|
-
export { PrettyCode_default as PrettyCode } from './chunk-
|
|
7
|
+
import { PlaygroundProvider } from './chunk-VZGQC3NG.mjs';
|
|
8
|
+
export { MarkdownMessage, Mermaid_default as Mermaid, PrettyCode_default as PrettyCode, useCollapsibleContent } from './chunk-VZGQC3NG.mjs';
|
|
9
9
|
export { JsonTree_default as JsonTree } from './chunk-LFWQ36LJ.mjs';
|
|
10
10
|
import './chunk-SSUOENAZ.mjs';
|
|
11
11
|
export { ArrayFieldItemTemplate, ArrayFieldTemplate, BaseInputTemplate, CheckboxWidget, ColorWidget, ErrorListTemplate, FieldTemplate, JsonSchemaForm, NumberWidget, ObjectFieldTemplate, SelectWidget, SliderWidget, SwitchWidget, TextWidget, getRequiredFields, hasRequiredFields, mergeDefaults, normalizeFormData, safeJsonParse, safeJsonStringify, validateRequiredFields, validateSchema } from './chunk-JUGQNNDC.mjs';
|
|
12
12
|
export { useLottie } from './chunk-6JTB2X72.mjs';
|
|
13
13
|
import { __name } from './chunk-CGILA3WO.mjs';
|
|
14
|
-
import * as
|
|
15
|
-
import
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import { lazy, forwardRef, useRef, useState, useCallback, useImperativeHandle, useEffect, createContext, Suspense, useContext, useMemo } from 'react';
|
|
16
16
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
17
17
|
import { useAppT } from '@djangocfg/i18n';
|
|
18
|
-
import { jsx, jsxs
|
|
19
|
-
import ReactMarkdown from 'react-markdown';
|
|
20
|
-
import remarkGfm from 'remark-gfm';
|
|
21
|
-
import { CopyButton } from '@djangocfg/ui-core/components';
|
|
18
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
22
19
|
import { useResolvedTheme } from '@djangocfg/ui-core/hooks';
|
|
23
|
-
import '@djangocfg/ui-core/styles/palette';
|
|
24
20
|
import { ReactRenderer, useEditor as useEditor$1, EditorContent } from '@tiptap/react';
|
|
25
21
|
import StarterKit from '@tiptap/starter-kit';
|
|
26
22
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
@@ -182,7 +178,7 @@ function LazyWrapper({
|
|
|
182
178
|
}
|
|
183
179
|
__name(LazyWrapper, "LazyWrapper");
|
|
184
180
|
function createLazyComponent(loader, options = {}) {
|
|
185
|
-
const LazyComponent =
|
|
181
|
+
const LazyComponent = React.lazy(loader);
|
|
186
182
|
const WrappedComponent = /* @__PURE__ */ __name((props) => {
|
|
187
183
|
const fallback = typeof options.fallback === "function" ? options.fallback(props) : options.fallback ?? /* @__PURE__ */ jsx(LoadingFallback, {});
|
|
188
184
|
return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(LazyComponent, { ...props }) });
|
|
@@ -191,473 +187,6 @@ function createLazyComponent(loader, options = {}) {
|
|
|
191
187
|
return WrappedComponent;
|
|
192
188
|
}
|
|
193
189
|
__name(createLazyComponent, "createLazyComponent");
|
|
194
|
-
var MermaidClient = lazy(() => import('./Mermaid.client-XFQ74OYN.mjs'));
|
|
195
|
-
var LoadingFallback2 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center min-h-[100px]", children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-6 w-6 border-b-2 border-primary" }) }), "LoadingFallback");
|
|
196
|
-
var Mermaid = /* @__PURE__ */ __name((props) => {
|
|
197
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingFallback2, {}), children: /* @__PURE__ */ jsx(MermaidClient, { ...props }) });
|
|
198
|
-
}, "Mermaid");
|
|
199
|
-
var Mermaid_default = Mermaid;
|
|
200
|
-
function smartTruncate(content, maxLength) {
|
|
201
|
-
if (content.length <= maxLength) {
|
|
202
|
-
return content;
|
|
203
|
-
}
|
|
204
|
-
let breakPoint = maxLength;
|
|
205
|
-
while (breakPoint > maxLength - 50 && breakPoint > 0) {
|
|
206
|
-
const char = content[breakPoint];
|
|
207
|
-
if (char === " " || char === "\n" || char === " ") {
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
breakPoint--;
|
|
211
|
-
}
|
|
212
|
-
if (breakPoint <= maxLength - 50) {
|
|
213
|
-
breakPoint = maxLength;
|
|
214
|
-
}
|
|
215
|
-
let truncated = content.slice(0, breakPoint).trimEnd();
|
|
216
|
-
truncated = fixUnclosedMarkdown(truncated);
|
|
217
|
-
return truncated;
|
|
218
|
-
}
|
|
219
|
-
__name(smartTruncate, "smartTruncate");
|
|
220
|
-
function truncateByLines(content, maxLines) {
|
|
221
|
-
const lines = content.split("\n");
|
|
222
|
-
if (lines.length <= maxLines) {
|
|
223
|
-
return content;
|
|
224
|
-
}
|
|
225
|
-
let truncated = lines.slice(0, maxLines).join("\n").trimEnd();
|
|
226
|
-
truncated = fixUnclosedMarkdown(truncated);
|
|
227
|
-
return truncated;
|
|
228
|
-
}
|
|
229
|
-
__name(truncateByLines, "truncateByLines");
|
|
230
|
-
function fixUnclosedMarkdown(content) {
|
|
231
|
-
let result = content;
|
|
232
|
-
const countOccurrences = /* @__PURE__ */ __name((str, marker) => {
|
|
233
|
-
const escaped = marker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
234
|
-
const matches = str.match(new RegExp(escaped, "g"));
|
|
235
|
-
return matches ? matches.length : 0;
|
|
236
|
-
}, "countOccurrences");
|
|
237
|
-
const boldCount = countOccurrences(result, "**");
|
|
238
|
-
if (boldCount % 2 !== 0) {
|
|
239
|
-
result += "**";
|
|
240
|
-
}
|
|
241
|
-
const withoutBold = result.replace(/\*\*/g, "");
|
|
242
|
-
const italicCount = countOccurrences(withoutBold, "*");
|
|
243
|
-
if (italicCount % 2 !== 0) {
|
|
244
|
-
result += "*";
|
|
245
|
-
}
|
|
246
|
-
const codeCount = countOccurrences(result, "`");
|
|
247
|
-
const tripleCount = countOccurrences(result, "```");
|
|
248
|
-
const singleCodeCount = codeCount - tripleCount * 3;
|
|
249
|
-
if (singleCodeCount % 2 !== 0) {
|
|
250
|
-
result += "`";
|
|
251
|
-
}
|
|
252
|
-
if (tripleCount % 2 !== 0) {
|
|
253
|
-
result += "\n```";
|
|
254
|
-
}
|
|
255
|
-
const strikeCount = countOccurrences(result, "~~");
|
|
256
|
-
if (strikeCount % 2 !== 0) {
|
|
257
|
-
result += "~~";
|
|
258
|
-
}
|
|
259
|
-
const underlineBoldCount = countOccurrences(result, "__");
|
|
260
|
-
if (underlineBoldCount % 2 !== 0) {
|
|
261
|
-
result += "__";
|
|
262
|
-
}
|
|
263
|
-
const withoutUnderlineBold = result.replace(/__/g, "");
|
|
264
|
-
const underlineItalicCount = countOccurrences(withoutUnderlineBold, "_");
|
|
265
|
-
if (underlineItalicCount % 2 !== 0) {
|
|
266
|
-
result += "_";
|
|
267
|
-
}
|
|
268
|
-
return result;
|
|
269
|
-
}
|
|
270
|
-
__name(fixUnclosedMarkdown, "fixUnclosedMarkdown");
|
|
271
|
-
function useCollapsibleContent(content, options = {}) {
|
|
272
|
-
const { maxLength, maxLines, defaultExpanded = false } = options;
|
|
273
|
-
const [isCollapsed, setIsCollapsed] = useState(!defaultExpanded);
|
|
274
|
-
const originalLength = content.length;
|
|
275
|
-
const originalLineCount = content.split("\n").length;
|
|
276
|
-
const { shouldCollapse, truncatedContent } = useMemo(() => {
|
|
277
|
-
if (maxLength === void 0 && maxLines === void 0) {
|
|
278
|
-
return { shouldCollapse: false, truncatedContent: content };
|
|
279
|
-
}
|
|
280
|
-
let needsCollapse = false;
|
|
281
|
-
let result = content;
|
|
282
|
-
if (maxLines !== void 0 && originalLineCount > maxLines) {
|
|
283
|
-
needsCollapse = true;
|
|
284
|
-
result = truncateByLines(result, maxLines);
|
|
285
|
-
}
|
|
286
|
-
if (maxLength !== void 0 && result.length > maxLength) {
|
|
287
|
-
needsCollapse = true;
|
|
288
|
-
result = smartTruncate(result, maxLength);
|
|
289
|
-
}
|
|
290
|
-
return { shouldCollapse: needsCollapse, truncatedContent: result };
|
|
291
|
-
}, [content, maxLength, maxLines, originalLineCount]);
|
|
292
|
-
const displayContent = useMemo(() => {
|
|
293
|
-
if (!shouldCollapse || !isCollapsed) {
|
|
294
|
-
return content;
|
|
295
|
-
}
|
|
296
|
-
return truncatedContent;
|
|
297
|
-
}, [content, truncatedContent, shouldCollapse, isCollapsed]);
|
|
298
|
-
const toggleCollapsed = useCallback(() => {
|
|
299
|
-
setIsCollapsed((prev) => !prev);
|
|
300
|
-
}, []);
|
|
301
|
-
const setCollapsed = useCallback((collapsed) => {
|
|
302
|
-
setIsCollapsed(collapsed);
|
|
303
|
-
}, []);
|
|
304
|
-
return {
|
|
305
|
-
isCollapsed,
|
|
306
|
-
toggleCollapsed,
|
|
307
|
-
setCollapsed,
|
|
308
|
-
displayContent,
|
|
309
|
-
shouldCollapse,
|
|
310
|
-
originalLength,
|
|
311
|
-
originalLineCount
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
__name(useCollapsibleContent, "useCollapsibleContent");
|
|
315
|
-
var extractTextFromChildren = /* @__PURE__ */ __name((children) => {
|
|
316
|
-
if (typeof children === "string") {
|
|
317
|
-
return children;
|
|
318
|
-
}
|
|
319
|
-
if (typeof children === "number") {
|
|
320
|
-
return String(children);
|
|
321
|
-
}
|
|
322
|
-
if (React3__default.isValidElement(children)) {
|
|
323
|
-
const props = children.props;
|
|
324
|
-
return extractTextFromChildren(props.children);
|
|
325
|
-
}
|
|
326
|
-
if (Array.isArray(children)) {
|
|
327
|
-
return children.map(extractTextFromChildren).join("");
|
|
328
|
-
}
|
|
329
|
-
return "";
|
|
330
|
-
}, "extractTextFromChildren");
|
|
331
|
-
var CodeBlock = /* @__PURE__ */ __name(({ code, language, isUser, isCompact = false }) => {
|
|
332
|
-
const theme = useResolvedTheme();
|
|
333
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative group my-3", children: [
|
|
334
|
-
/* @__PURE__ */ jsx(
|
|
335
|
-
CopyButton,
|
|
336
|
-
{
|
|
337
|
-
value: code,
|
|
338
|
-
variant: "ghost",
|
|
339
|
-
className: `
|
|
340
|
-
absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity
|
|
341
|
-
h-8 w-8
|
|
342
|
-
${isUser ? "hover:bg-white/20 text-white" : "hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground"}
|
|
343
|
-
`,
|
|
344
|
-
title: "Copy code"
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
/* @__PURE__ */ jsx(
|
|
348
|
-
PrettyCode_default,
|
|
349
|
-
{
|
|
350
|
-
data: code,
|
|
351
|
-
language,
|
|
352
|
-
className: isCompact ? "text-xs" : "text-sm",
|
|
353
|
-
customBg: isUser ? "bg-white/10" : "bg-muted dark:bg-muted",
|
|
354
|
-
mode: theme,
|
|
355
|
-
isCompact
|
|
356
|
-
}
|
|
357
|
-
)
|
|
358
|
-
] });
|
|
359
|
-
}, "CodeBlock");
|
|
360
|
-
var createMarkdownComponents = /* @__PURE__ */ __name((isUser = false, isCompact = false) => {
|
|
361
|
-
const textSize = isCompact ? "text-xs" : "text-sm";
|
|
362
|
-
const headingBase = isCompact ? "text-sm" : "text-base";
|
|
363
|
-
const headingSm = isCompact ? "text-xs" : "text-sm";
|
|
364
|
-
return {
|
|
365
|
-
// Headings - scaled for chat context
|
|
366
|
-
h1: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h1", { className: `${headingBase} font-bold mb-2 mt-3 first:mt-0`, children }), "h1"),
|
|
367
|
-
h2: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h2", { className: `${headingSm} font-bold mb-2 mt-3 first:mt-0`, children }), "h2"),
|
|
368
|
-
h3: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h3", { className: `${headingSm} font-semibold mb-1 mt-2 first:mt-0`, children }), "h3"),
|
|
369
|
-
h4: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h4", { className: `${headingSm} font-semibold mb-1 mt-2 first:mt-0`, children }), "h4"),
|
|
370
|
-
h5: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h5", { className: `${headingSm} font-medium mb-1 mt-2 first:mt-0`, children }), "h5"),
|
|
371
|
-
h6: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("h6", { className: `${headingSm} font-medium mb-1 mt-2 first:mt-0`, children }), "h6"),
|
|
372
|
-
// Paragraphs - optimized for chat readability
|
|
373
|
-
p: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("p", { className: `${textSize} mb-4 last:mb-0 leading-7 break-words font-light`, children }), "p"),
|
|
374
|
-
// Lists - compact
|
|
375
|
-
ul: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("ul", { className: `list-disc list-inside mb-2 space-y-1 ${textSize}`, children }), "ul"),
|
|
376
|
-
ol: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("ol", { className: `list-decimal list-inside mb-2 space-y-1 ${textSize}`, children }), "ol"),
|
|
377
|
-
li: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("li", { className: "break-words", children }), "li"),
|
|
378
|
-
// Links - appropriate for chat context
|
|
379
|
-
a: /* @__PURE__ */ __name(({ href, children }) => /* @__PURE__ */ jsx(
|
|
380
|
-
"a",
|
|
381
|
-
{
|
|
382
|
-
href,
|
|
383
|
-
className: `${textSize} ${isUser ? "text-white/90 underline hover:text-white" : "text-primary underline hover:text-primary/80"} transition-colors break-all`,
|
|
384
|
-
target: href?.startsWith("http") ? "_blank" : void 0,
|
|
385
|
-
rel: href?.startsWith("http") ? "noopener noreferrer" : void 0,
|
|
386
|
-
children
|
|
387
|
-
}
|
|
388
|
-
), "a"),
|
|
389
|
-
// Code blocks - using CodeBlock component with copy functionality
|
|
390
|
-
pre: /* @__PURE__ */ __name(({ children }) => {
|
|
391
|
-
let codeContent = "";
|
|
392
|
-
let language = "plaintext";
|
|
393
|
-
if (React3__default.isValidElement(children)) {
|
|
394
|
-
const child = children;
|
|
395
|
-
if (child.type === "code" || typeof child.type === "function" && child.type.name === "code") {
|
|
396
|
-
const codeProps = child.props;
|
|
397
|
-
const rawClassName = codeProps.className;
|
|
398
|
-
language = rawClassName?.replace(/language-/, "").trim() || "plaintext";
|
|
399
|
-
codeContent = extractTextFromChildren(codeProps.children).trim();
|
|
400
|
-
} else {
|
|
401
|
-
codeContent = extractTextFromChildren(children).trim();
|
|
402
|
-
}
|
|
403
|
-
} else {
|
|
404
|
-
codeContent = extractTextFromChildren(children).trim();
|
|
405
|
-
}
|
|
406
|
-
if (!codeContent) {
|
|
407
|
-
return /* @__PURE__ */ jsx("div", { className: "my-3 p-3 bg-muted rounded text-sm text-muted-foreground", children: "No content available" });
|
|
408
|
-
}
|
|
409
|
-
if (language === "mermaid") {
|
|
410
|
-
return /* @__PURE__ */ jsx("div", { className: "my-3 max-w-full overflow-x-auto", children: /* @__PURE__ */ jsx(Mermaid_default, { chart: codeContent, className: "max-w-[600px] mx-auto", isCompact }) });
|
|
411
|
-
}
|
|
412
|
-
try {
|
|
413
|
-
return /* @__PURE__ */ jsx(CodeBlock, { code: codeContent, language, isUser, isCompact });
|
|
414
|
-
} catch (error) {
|
|
415
|
-
console.warn("CodeBlock failed, using fallback:", error);
|
|
416
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative group my-3", children: [
|
|
417
|
-
/* @__PURE__ */ jsx(
|
|
418
|
-
CopyButton,
|
|
419
|
-
{
|
|
420
|
-
value: codeContent,
|
|
421
|
-
variant: "ghost",
|
|
422
|
-
className: `
|
|
423
|
-
absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity
|
|
424
|
-
h-8 w-8
|
|
425
|
-
${isUser ? "hover:bg-white/20 text-white" : "hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground"}
|
|
426
|
-
`,
|
|
427
|
-
title: "Copy code"
|
|
428
|
-
}
|
|
429
|
-
),
|
|
430
|
-
/* @__PURE__ */ jsx("pre", { className: `
|
|
431
|
-
p-3 rounded text-xs font-mono overflow-x-auto
|
|
432
|
-
${isUser ? "bg-white/10 text-white" : "bg-muted text-foreground"}
|
|
433
|
-
`, children: /* @__PURE__ */ jsx("code", { children: codeContent }) })
|
|
434
|
-
] });
|
|
435
|
-
}
|
|
436
|
-
}, "pre"),
|
|
437
|
-
// Inline code
|
|
438
|
-
code: /* @__PURE__ */ __name(({ children, className }) => {
|
|
439
|
-
if (className?.includes("language-")) {
|
|
440
|
-
return /* @__PURE__ */ jsx("code", { className, children });
|
|
441
|
-
}
|
|
442
|
-
const codeContent = extractTextFromChildren(children);
|
|
443
|
-
return /* @__PURE__ */ jsx("code", { className: "px-1.5 py-0.5 rounded text-xs font-mono bg-muted text-foreground break-all", children: codeContent });
|
|
444
|
-
}, "code"),
|
|
445
|
-
// Blockquotes
|
|
446
|
-
blockquote: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("blockquote", { className: `${textSize} border-l-2 border-border pl-3 my-2 italic text-muted-foreground break-words`, children }), "blockquote"),
|
|
447
|
-
// Tables - compact for chat
|
|
448
|
-
table: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("div", { className: "overflow-x-auto my-3", children: /* @__PURE__ */ jsx("table", { className: `min-w-full ${textSize} border-collapse`, children }) }), "table"),
|
|
449
|
-
thead: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("thead", { className: "bg-muted/50", children }), "thead"),
|
|
450
|
-
tbody: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("tbody", { children }), "tbody"),
|
|
451
|
-
tr: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("tr", { className: "border-b border-border/50", children }), "tr"),
|
|
452
|
-
th: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("th", { className: "px-2 py-1 text-left font-medium break-words", children }), "th"),
|
|
453
|
-
td: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("td", { className: "px-2 py-1 break-words", children }), "td"),
|
|
454
|
-
// Horizontal rule
|
|
455
|
-
hr: /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("hr", { className: "my-3 border-0 h-px bg-border" }), "hr"),
|
|
456
|
-
// Strong and emphasis
|
|
457
|
-
strong: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", children }), "strong"),
|
|
458
|
-
em: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("em", { className: "italic", children }), "em")
|
|
459
|
-
};
|
|
460
|
-
}, "createMarkdownComponents");
|
|
461
|
-
var hasMarkdownSyntax = /* @__PURE__ */ __name((text) => {
|
|
462
|
-
if (text.trim().includes("\n")) {
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
const markdownPatterns = [
|
|
466
|
-
/^#{1,6}\s/m,
|
|
467
|
-
// Headers
|
|
468
|
-
/\*\*[^*]+\*\*/,
|
|
469
|
-
// Bold
|
|
470
|
-
/\*[^*]+\*/,
|
|
471
|
-
// Italic
|
|
472
|
-
/__[^_]+__/,
|
|
473
|
-
// Bold (underscore)
|
|
474
|
-
/_[^_]+_/,
|
|
475
|
-
// Italic (underscore)
|
|
476
|
-
/\[.+\]\(.+\)/,
|
|
477
|
-
// Links
|
|
478
|
-
/!\[.*\]\(.+\)/,
|
|
479
|
-
// Images
|
|
480
|
-
/```[\s\S]*```/,
|
|
481
|
-
// Code blocks
|
|
482
|
-
/`[^`]+`/,
|
|
483
|
-
// Inline code
|
|
484
|
-
/^\s*[-*+]\s/m,
|
|
485
|
-
// Unordered lists
|
|
486
|
-
/^\s*\d+\.\s/m,
|
|
487
|
-
// Ordered lists
|
|
488
|
-
/^\s*>/m,
|
|
489
|
-
// Blockquotes
|
|
490
|
-
/\|.+\|/,
|
|
491
|
-
// Tables
|
|
492
|
-
/^---+$/m,
|
|
493
|
-
// Horizontal rules
|
|
494
|
-
/~~[^~]+~~/
|
|
495
|
-
// Strikethrough
|
|
496
|
-
];
|
|
497
|
-
return markdownPatterns.some((pattern) => pattern.test(text));
|
|
498
|
-
}, "hasMarkdownSyntax");
|
|
499
|
-
var CollapseToggle = /* @__PURE__ */ __name(({
|
|
500
|
-
isCollapsed,
|
|
501
|
-
onClick,
|
|
502
|
-
readMoreLabel,
|
|
503
|
-
showLessLabel,
|
|
504
|
-
isUser,
|
|
505
|
-
isCompact
|
|
506
|
-
}) => {
|
|
507
|
-
const textSize = isCompact ? "text-xs" : "text-sm";
|
|
508
|
-
return /* @__PURE__ */ jsx(
|
|
509
|
-
"button",
|
|
510
|
-
{
|
|
511
|
-
type: "button",
|
|
512
|
-
onClick,
|
|
513
|
-
className: `
|
|
514
|
-
${textSize} font-medium cursor-pointer
|
|
515
|
-
transition-colors duration-200
|
|
516
|
-
${isUser ? "text-white/80 hover:text-white" : "text-primary hover:text-primary/80"}
|
|
517
|
-
inline-flex items-center gap-1
|
|
518
|
-
mt-1
|
|
519
|
-
`,
|
|
520
|
-
children: isCollapsed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
521
|
-
readMoreLabel,
|
|
522
|
-
/* @__PURE__ */ jsx(
|
|
523
|
-
"svg",
|
|
524
|
-
{
|
|
525
|
-
className: "w-3 h-3",
|
|
526
|
-
fill: "none",
|
|
527
|
-
stroke: "currentColor",
|
|
528
|
-
viewBox: "0 0 24 24",
|
|
529
|
-
children: /* @__PURE__ */ jsx(
|
|
530
|
-
"path",
|
|
531
|
-
{
|
|
532
|
-
strokeLinecap: "round",
|
|
533
|
-
strokeLinejoin: "round",
|
|
534
|
-
strokeWidth: 2,
|
|
535
|
-
d: "M19 9l-7 7-7-7"
|
|
536
|
-
}
|
|
537
|
-
)
|
|
538
|
-
}
|
|
539
|
-
)
|
|
540
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
541
|
-
showLessLabel,
|
|
542
|
-
/* @__PURE__ */ jsx(
|
|
543
|
-
"svg",
|
|
544
|
-
{
|
|
545
|
-
className: "w-3 h-3",
|
|
546
|
-
fill: "none",
|
|
547
|
-
stroke: "currentColor",
|
|
548
|
-
viewBox: "0 0 24 24",
|
|
549
|
-
children: /* @__PURE__ */ jsx(
|
|
550
|
-
"path",
|
|
551
|
-
{
|
|
552
|
-
strokeLinecap: "round",
|
|
553
|
-
strokeLinejoin: "round",
|
|
554
|
-
strokeWidth: 2,
|
|
555
|
-
d: "M5 15l7-7 7 7"
|
|
556
|
-
}
|
|
557
|
-
)
|
|
558
|
-
}
|
|
559
|
-
)
|
|
560
|
-
] })
|
|
561
|
-
}
|
|
562
|
-
);
|
|
563
|
-
}, "CollapseToggle");
|
|
564
|
-
var MarkdownMessage = /* @__PURE__ */ __name(({
|
|
565
|
-
content,
|
|
566
|
-
className = "",
|
|
567
|
-
isUser = false,
|
|
568
|
-
isCompact = false,
|
|
569
|
-
collapsible = false,
|
|
570
|
-
maxLength,
|
|
571
|
-
maxLines,
|
|
572
|
-
readMoreLabel = "Read more...",
|
|
573
|
-
showLessLabel = "Show less",
|
|
574
|
-
defaultExpanded = false,
|
|
575
|
-
onCollapseChange
|
|
576
|
-
}) => {
|
|
577
|
-
const trimmedContent = content.trim();
|
|
578
|
-
const collapsibleOptions = React3__default.useMemo(() => {
|
|
579
|
-
if (!collapsible) return {};
|
|
580
|
-
const effectiveMaxLength = maxLength ?? 1e3;
|
|
581
|
-
const effectiveMaxLines = maxLines ?? 10;
|
|
582
|
-
return { maxLength: effectiveMaxLength, maxLines: effectiveMaxLines, defaultExpanded };
|
|
583
|
-
}, [collapsible, maxLength, maxLines, defaultExpanded]);
|
|
584
|
-
const {
|
|
585
|
-
isCollapsed,
|
|
586
|
-
toggleCollapsed,
|
|
587
|
-
displayContent,
|
|
588
|
-
shouldCollapse
|
|
589
|
-
} = useCollapsibleContent(
|
|
590
|
-
trimmedContent,
|
|
591
|
-
collapsible ? collapsibleOptions : {}
|
|
592
|
-
);
|
|
593
|
-
React3__default.useEffect(() => {
|
|
594
|
-
if (collapsible && shouldCollapse && onCollapseChange) {
|
|
595
|
-
onCollapseChange(isCollapsed);
|
|
596
|
-
}
|
|
597
|
-
}, [isCollapsed, collapsible, shouldCollapse, onCollapseChange]);
|
|
598
|
-
const components = React3__default.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
|
|
599
|
-
const textSizeClass = isCompact ? "text-xs" : "text-sm";
|
|
600
|
-
const proseClass = isCompact ? "prose-xs" : "prose-sm";
|
|
601
|
-
const isPlainText = !hasMarkdownSyntax(displayContent);
|
|
602
|
-
if (isPlainText) {
|
|
603
|
-
return /* @__PURE__ */ jsxs("span", { className: `${textSizeClass} leading-7 break-words whitespace-pre-line font-light ${className}`, children: [
|
|
604
|
-
displayContent,
|
|
605
|
-
collapsible && shouldCollapse && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
606
|
-
isCollapsed && "... ",
|
|
607
|
-
/* @__PURE__ */ jsx(
|
|
608
|
-
CollapseToggle,
|
|
609
|
-
{
|
|
610
|
-
isCollapsed,
|
|
611
|
-
onClick: toggleCollapsed,
|
|
612
|
-
readMoreLabel,
|
|
613
|
-
showLessLabel,
|
|
614
|
-
isUser,
|
|
615
|
-
isCompact
|
|
616
|
-
}
|
|
617
|
-
)
|
|
618
|
-
] })
|
|
619
|
-
] });
|
|
620
|
-
}
|
|
621
|
-
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
622
|
-
/* @__PURE__ */ jsx(
|
|
623
|
-
"div",
|
|
624
|
-
{
|
|
625
|
-
className: `
|
|
626
|
-
prose ${proseClass} max-w-none break-words overflow-hidden ${textSizeClass}
|
|
627
|
-
${isUser ? "prose-invert" : "dark:prose-invert"}
|
|
628
|
-
[&>*]:leading-7
|
|
629
|
-
`,
|
|
630
|
-
style: {
|
|
631
|
-
// Inherit colors from parent - fixes issues with external CSS variables
|
|
632
|
-
"--tw-prose-body": "inherit",
|
|
633
|
-
"--tw-prose-headings": "inherit",
|
|
634
|
-
"--tw-prose-bold": "inherit",
|
|
635
|
-
"--tw-prose-links": "inherit",
|
|
636
|
-
color: "inherit"
|
|
637
|
-
},
|
|
638
|
-
children: /* @__PURE__ */ jsx(
|
|
639
|
-
ReactMarkdown,
|
|
640
|
-
{
|
|
641
|
-
remarkPlugins: [remarkGfm],
|
|
642
|
-
components,
|
|
643
|
-
children: displayContent
|
|
644
|
-
}
|
|
645
|
-
)
|
|
646
|
-
}
|
|
647
|
-
),
|
|
648
|
-
collapsible && shouldCollapse && /* @__PURE__ */ jsx(
|
|
649
|
-
CollapseToggle,
|
|
650
|
-
{
|
|
651
|
-
isCollapsed,
|
|
652
|
-
onClick: toggleCollapsed,
|
|
653
|
-
readMoreLabel,
|
|
654
|
-
showLessLabel,
|
|
655
|
-
isUser,
|
|
656
|
-
isCompact
|
|
657
|
-
}
|
|
658
|
-
)
|
|
659
|
-
] });
|
|
660
|
-
}, "MarkdownMessage");
|
|
661
190
|
var LazyMapContainer = createLazyComponent(
|
|
662
191
|
() => import('./MapContainer-GXQLP5WY.mjs').then((mod) => ({ default: mod.MapContainer })),
|
|
663
192
|
{
|
|
@@ -694,7 +223,7 @@ function CodeLoadingFallback() {
|
|
|
694
223
|
}
|
|
695
224
|
__name(CodeLoadingFallback, "CodeLoadingFallback");
|
|
696
225
|
var LazyPrettyCode = createLazyComponent(
|
|
697
|
-
() => import('./PrettyCode.client-
|
|
226
|
+
() => import('./PrettyCode.client-IZTXXYHG.mjs'),
|
|
698
227
|
{
|
|
699
228
|
displayName: "LazyPrettyCode",
|
|
700
229
|
fallback: /* @__PURE__ */ jsx(CodeLoadingFallback, {})
|
|
@@ -707,15 +236,15 @@ function OpenapiLoadingFallback() {
|
|
|
707
236
|
] }) });
|
|
708
237
|
}
|
|
709
238
|
__name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
|
|
710
|
-
var
|
|
711
|
-
() => import('./
|
|
239
|
+
var LazyDocsLayout = createLazyComponent(
|
|
240
|
+
() => import('./DocsLayout-ERETJLLV.mjs').then((mod) => ({ default: mod.DocsLayout })),
|
|
712
241
|
{
|
|
713
|
-
displayName: "
|
|
242
|
+
displayName: "LazyDocsLayout",
|
|
714
243
|
fallback: /* @__PURE__ */ jsx(OpenapiLoadingFallback, {})
|
|
715
244
|
}
|
|
716
245
|
);
|
|
717
246
|
var LazyOpenapiViewer = /* @__PURE__ */ __name(({ config }) => {
|
|
718
|
-
return /* @__PURE__ */ jsx(PlaygroundProvider, { config, children: /* @__PURE__ */ jsx(
|
|
247
|
+
return /* @__PURE__ */ jsx(PlaygroundProvider, { config, children: /* @__PURE__ */ jsx(LazyDocsLayout, {}) });
|
|
719
248
|
}, "LazyOpenapiViewer");
|
|
720
249
|
LazyOpenapiViewer.displayName = "LazyOpenapiViewer";
|
|
721
250
|
var LazyJsonSchemaForm = createLazyComponent(
|
|
@@ -854,20 +383,20 @@ var LazyCronScheduler = createLazyComponent(
|
|
|
854
383
|
var LottiePlayerClient = lazy(
|
|
855
384
|
() => import('./LottiePlayer.client-B4I6WNZM.mjs').then((mod) => ({ default: mod.LottiePlayer }))
|
|
856
385
|
);
|
|
857
|
-
var
|
|
386
|
+
var LoadingFallback6 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
858
387
|
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-gray-900" }),
|
|
859
388
|
/* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: "Loading player..." })
|
|
860
389
|
] }) }), "LoadingFallback");
|
|
861
390
|
function LottiePlayer(props) {
|
|
862
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(
|
|
391
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingFallback6, {}), children: /* @__PURE__ */ jsx(LottiePlayerClient, { ...props }) });
|
|
863
392
|
}
|
|
864
393
|
__name(LottiePlayer, "LottiePlayer");
|
|
865
|
-
var
|
|
866
|
-
() => import('./
|
|
394
|
+
var DocsLayout = lazy(
|
|
395
|
+
() => import('./DocsLayout-ERETJLLV.mjs').then((mod) => ({ default: mod.DocsLayout }))
|
|
867
396
|
);
|
|
868
|
-
var
|
|
397
|
+
var LoadingFallback7 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: "Loading API Playground..." }) }), "LoadingFallback");
|
|
869
398
|
var Playground = /* @__PURE__ */ __name(({ config }) => {
|
|
870
|
-
return /* @__PURE__ */ jsx(PlaygroundProvider, { config, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(
|
|
399
|
+
return /* @__PURE__ */ jsx(PlaygroundProvider, { config, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingFallback7, {}), children: /* @__PURE__ */ jsx(DocsLayout, {}) }) });
|
|
871
400
|
}, "Playground");
|
|
872
401
|
var OpenapiViewer_default = Playground;
|
|
873
402
|
var CronSchedulerClient = lazy(() => import('./CronScheduler.client-3O3VU4CI.mjs'));
|
|
@@ -1001,7 +530,7 @@ function _readCSSColors() {
|
|
|
1001
530
|
if (typeof document === "undefined") return "";
|
|
1002
531
|
return getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
1003
532
|
}, "get");
|
|
1004
|
-
const
|
|
533
|
+
const hslToHex = /* @__PURE__ */ __name((hsl) => {
|
|
1005
534
|
if (!hsl) return "";
|
|
1006
535
|
const parts = hsl.split(/\s+/).map((s2) => parseFloat(s2.replace("%", "")));
|
|
1007
536
|
if (parts.length < 3 || parts.some(isNaN)) return "";
|
|
@@ -1014,13 +543,13 @@ function _readCSSColors() {
|
|
|
1014
543
|
}, "f");
|
|
1015
544
|
return `#${f(0)}${f(8)}${f(4)}`;
|
|
1016
545
|
}, "hslToHex");
|
|
1017
|
-
const background =
|
|
1018
|
-
const foreground =
|
|
1019
|
-
const card =
|
|
1020
|
-
const border =
|
|
1021
|
-
const mutedForeground =
|
|
546
|
+
const background = hslToHex(get("--background")) || "#0a0a0a";
|
|
547
|
+
const foreground = hslToHex(get("--foreground")) || "#f5f5f5";
|
|
548
|
+
const card = hslToHex(get("--card")) || "#141414";
|
|
549
|
+
const border = hslToHex(get("--border")) || "#262626";
|
|
550
|
+
const mutedForeground = hslToHex(get("--muted-foreground")) || "#858585";
|
|
1022
551
|
const lineHighlight = _adjustBrightness(background, 10);
|
|
1023
|
-
const primary =
|
|
552
|
+
const primary = hslToHex(get("--primary"));
|
|
1024
553
|
const selection = primary ? _adjustBrightness(primary, -40) : "#264F78";
|
|
1025
554
|
return {
|
|
1026
555
|
background,
|
|
@@ -1822,6 +1351,6 @@ function MarkdownToolbar({ editor }) {
|
|
|
1822
1351
|
}
|
|
1823
1352
|
__name(MarkdownToolbar, "MarkdownToolbar");
|
|
1824
1353
|
|
|
1825
|
-
export { CardLoadingFallback, CronScheduler, DiffEditor, Editor, EditorProvider, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownEditor,
|
|
1354
|
+
export { CardLoadingFallback, CronScheduler, DiffEditor, Editor, EditorProvider, LazyCronScheduler, LazyHybridAudioPlayer, LazyHybridCompactPlayer, LazyHybridSimplePlayer, LazyImageViewer, LazyJsonSchemaForm, LazyJsonTree, LazyLottiePlayer, LazyMapContainer, LazyMapView, LazyMermaid, LazyOpenapiViewer, LazyPrettyCode, LazyVideoPlayer, LazyWrapper, LoadingFallback, LottiePlayer, MapLoadingFallback, MarkdownEditor, OpenapiViewer_default as OpenapiViewer, Spinner, createLazyComponent, useEditor, useEditorContext, useLanguage, useMonaco };
|
|
1826
1355
|
//# sourceMappingURL=index.mjs.map
|
|
1827
1356
|
//# sourceMappingURL=index.mjs.map
|