@djangocfg/ui-tools 2.1.318 → 2.1.319
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-ESVQZO3V.mjs → DocsLayout-CTJINVBM.mjs} +235 -267
- package/dist/DocsLayout-CTJINVBM.mjs.map +1 -0
- package/dist/{DocsLayout-KUPDWJ3G.cjs → DocsLayout-XLDB6CJ2.cjs} +273 -305
- package/dist/DocsLayout-XLDB6CJ2.cjs.map +1 -0
- package/dist/{chunk-GBLQTHWT.mjs → chunk-62Y65TGK.mjs} +5 -4
- package/dist/chunk-62Y65TGK.mjs.map +1 -0
- package/dist/{chunk-S44PW6NK.cjs → chunk-TKSFZHCG.cjs} +5 -4
- package/dist/chunk-TKSFZHCG.cjs.map +1 -0
- package/dist/index.cjs +10 -10
- package/dist/index.mjs +4 -4
- package/package.json +6 -6
- package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +30 -0
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/MetaActions.tsx +35 -50
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/index.tsx +49 -22
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Section/index.tsx +1 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/store/index.ts +10 -11
- package/src/tools/OpenapiViewer/components/DocsLayout/SchemaCopyMenu.tsx +25 -5
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/BrandHeader.tsx +18 -33
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/Toolbar.tsx +40 -24
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/index.tsx +8 -14
- package/src/tools/OpenapiViewer/components/DocsLayout/sidebarLabel.ts +1 -4
- package/src/tools/OpenapiViewer/utils/operationToHar.ts +2 -1
- package/src/tools/OpenapiViewer/utils/url.ts +9 -2
- package/dist/DocsLayout-ESVQZO3V.mjs.map +0 -1
- package/dist/DocsLayout-KUPDWJ3G.cjs.map +0 -1
- package/dist/chunk-GBLQTHWT.mjs.map +0 -1
- package/dist/chunk-S44PW6NK.cjs.map +0 -1
- package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/MethodChips.tsx +0 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTKSFZHCG_cjs = require('./chunk-TKSFZHCG.cjs');
|
|
4
4
|
var chunk33AMWFBZ_cjs = require('./chunk-33AMWFBZ.cjs');
|
|
5
5
|
require('./chunk-2SMCH62O.cjs');
|
|
6
6
|
var chunkWGEGR3DF_cjs = require('./chunk-WGEGR3DF.cjs');
|
|
@@ -55,7 +55,7 @@ var extractEndpoints = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((schema, baseUrl
|
|
|
55
55
|
description: response.description || `Response ${code}`,
|
|
56
56
|
contentType: chosenContentType,
|
|
57
57
|
schema: respSchema,
|
|
58
|
-
example: respSchema ?
|
|
58
|
+
example: respSchema ? chunkTKSFZHCG_cjs.sampleSchemaJson(respSchema, { skipWriteOnly: true }, specRoot) : void 0
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -68,13 +68,13 @@ var extractEndpoints = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((schema, baseUrl
|
|
|
68
68
|
type: rawSchema?.type || "object",
|
|
69
69
|
description: op.requestBody.description,
|
|
70
70
|
schema: rawSchema,
|
|
71
|
-
example: rawSchema ?
|
|
71
|
+
example: rawSchema ? chunkTKSFZHCG_cjs.sampleSchemaJson(rawSchema, { skipReadOnly: true }, specRoot) : void 0
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
const endpoint = {
|
|
75
75
|
name: path.split("/").pop() || path,
|
|
76
76
|
method: methodUpper,
|
|
77
|
-
path: baseUrl ?
|
|
77
|
+
path: baseUrl ? chunkTKSFZHCG_cjs.joinUrl(baseUrl, path) : path,
|
|
78
78
|
summary,
|
|
79
79
|
description,
|
|
80
80
|
category,
|
|
@@ -128,11 +128,11 @@ function useOpenApiSchema({
|
|
|
128
128
|
[loadedSchemas, currentSchemaId]
|
|
129
129
|
);
|
|
130
130
|
const dereferencedSchema = React12.useMemo(
|
|
131
|
-
() => currentOpenApiSchema ?
|
|
131
|
+
() => currentOpenApiSchema ? chunkTKSFZHCG_cjs.dereferenceSchema(currentOpenApiSchema) : null,
|
|
132
132
|
[currentOpenApiSchema]
|
|
133
133
|
);
|
|
134
134
|
const resolvedBaseUrl = React12.useMemo(
|
|
135
|
-
() =>
|
|
135
|
+
() => chunkTKSFZHCG_cjs.resolveBaseUrl({
|
|
136
136
|
schemaSource: currentSchema?.baseUrl,
|
|
137
137
|
config: configBaseUrl,
|
|
138
138
|
fromServers: currentOpenApiSchema?.servers?.[0]?.url
|
|
@@ -231,8 +231,8 @@ function useOpenApiSchema({
|
|
|
231
231
|
if (!preloadAll) return [];
|
|
232
232
|
return schemas.map((src) => {
|
|
233
233
|
const raw = loadedSchemas.get(src.id) ?? null;
|
|
234
|
-
const deref = raw ?
|
|
235
|
-
const resolved =
|
|
234
|
+
const deref = raw ? chunkTKSFZHCG_cjs.dereferenceSchema(raw) : null;
|
|
235
|
+
const resolved = chunkTKSFZHCG_cjs.resolveBaseUrl({
|
|
236
236
|
schemaSource: src.baseUrl,
|
|
237
237
|
config: configBaseUrl,
|
|
238
238
|
fromServers: raw?.servers?.[0]?.url
|
|
@@ -443,7 +443,7 @@ chunkWGEGR3DF_cjs.__name(useEndpointDraft, "useEndpointDraft");
|
|
|
443
443
|
|
|
444
444
|
// src/tools/OpenapiViewer/components/shared/EndpointDraftSync.tsx
|
|
445
445
|
function EndpointDraftSync({ schemaId }) {
|
|
446
|
-
const { state, setParameters, setRequestBody, setActiveSchemaId } =
|
|
446
|
+
const { state, setParameters, setRequestBody, setActiveSchemaId } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
447
447
|
const ep = state.selectedEndpoint;
|
|
448
448
|
React12.useEffect(() => {
|
|
449
449
|
setActiveSchemaId(schemaId);
|
|
@@ -597,142 +597,20 @@ function CollapsibleSection({
|
|
|
597
597
|
] });
|
|
598
598
|
}
|
|
599
599
|
chunkWGEGR3DF_cjs.__name(CollapsibleSection, "CollapsibleSection");
|
|
600
|
-
|
|
601
|
-
markdown: {
|
|
602
|
-
title: "Markdown for LLM",
|
|
603
|
-
hint: "Endpoints + params as prose. Smallest."
|
|
604
|
-
},
|
|
605
|
-
compact: {
|
|
606
|
-
title: "Compact JSON",
|
|
607
|
-
hint: "Dereferenced, no examples, minified."
|
|
608
|
-
},
|
|
609
|
-
raw: {
|
|
610
|
-
title: "Raw JSON",
|
|
611
|
-
hint: "Full OpenAPI document with $refs."
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
function SchemaCopyMenu({ schema, endpoints, baseUrl, variant = "button" }) {
|
|
615
|
-
const [sizeCache, setSizeCache] = React12.useState({});
|
|
616
|
-
const [justCopied, setJustCopied] = React12.useState(null);
|
|
617
|
-
const [open, setOpen] = React12.useState(false);
|
|
618
|
-
const isReady = schema !== null && endpoints.length > 0;
|
|
619
|
-
const build = React12.useCallback(
|
|
620
|
-
(flavour) => {
|
|
621
|
-
if (!schema) return "";
|
|
622
|
-
if (flavour === "markdown") return chunkS44PW6NK_cjs.toMarkdown(schema, endpoints, baseUrl);
|
|
623
|
-
if (flavour === "compact") return chunkS44PW6NK_cjs.toCompactJson(schema, baseUrl);
|
|
624
|
-
return chunkS44PW6NK_cjs.toRawJson(schema, baseUrl);
|
|
625
|
-
},
|
|
626
|
-
[schema, endpoints, baseUrl]
|
|
627
|
-
);
|
|
628
|
-
const handleCopy = React12.useCallback(
|
|
629
|
-
async (flavour) => {
|
|
630
|
-
if (!isReady) return;
|
|
631
|
-
const text = build(flavour);
|
|
632
|
-
const label = FLAVOUR_LABELS[flavour].title;
|
|
633
|
-
try {
|
|
634
|
-
await navigator.clipboard.writeText(text);
|
|
635
|
-
const size = chunkS44PW6NK_cjs.formatBytes(text);
|
|
636
|
-
setSizeCache((prev) => ({ ...prev, [flavour]: size }));
|
|
637
|
-
setJustCopied(flavour);
|
|
638
|
-
setTimeout(() => setJustCopied(null), 1500);
|
|
639
|
-
setOpen(false);
|
|
640
|
-
hooks.toast.success(`Copied ${label}`, { description: size });
|
|
641
|
-
} catch (err) {
|
|
642
|
-
const message = err instanceof Error ? err.message : "Clipboard permission denied";
|
|
643
|
-
hooks.toast.error("Copy failed", { description: message });
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
[build, isReady]
|
|
647
|
-
);
|
|
648
|
-
const flavours = React12.useMemo(() => ["markdown", "compact", "raw"], []);
|
|
649
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
650
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuTrigger, { asChild: true, children: variant === "icon" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
651
|
-
components.Button,
|
|
652
|
-
{
|
|
653
|
-
variant: "ghost",
|
|
654
|
-
size: "icon",
|
|
655
|
-
className: "h-7 w-7 shrink-0",
|
|
656
|
-
disabled: !isReady,
|
|
657
|
-
title: "Copy schema for AI",
|
|
658
|
-
"aria-label": "Copy schema for AI",
|
|
659
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3.5 w-3.5" })
|
|
660
|
-
}
|
|
661
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(components.Button, { variant: "outline", size: "sm", className: "h-8 gap-1.5 text-xs", disabled: !isReady, children: [
|
|
662
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3 w-3" }),
|
|
663
|
-
"Copy for AI",
|
|
664
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
665
|
-
] }) }),
|
|
666
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
667
|
-
components.DropdownMenuContent,
|
|
668
|
-
{
|
|
669
|
-
side: "right",
|
|
670
|
-
align: "start",
|
|
671
|
-
sideOffset: 6,
|
|
672
|
-
collisionPadding: 8,
|
|
673
|
-
className: "w-60 max-w-[calc(100vw-16px)]",
|
|
674
|
-
children: [
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuLabel, { className: "text-[10px] uppercase tracking-wider text-muted-foreground/70", children: "Copy schema" }),
|
|
676
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuSeparator, {}),
|
|
677
|
-
flavours.map((f) => {
|
|
678
|
-
const label = FLAVOUR_LABELS[f];
|
|
679
|
-
const size = sizeCache[f];
|
|
680
|
-
const isDone = justCopied === f;
|
|
681
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
682
|
-
components.DropdownMenuItem,
|
|
683
|
-
{
|
|
684
|
-
onClick: (e) => {
|
|
685
|
-
e.preventDefault();
|
|
686
|
-
void handleCopy(f);
|
|
687
|
-
},
|
|
688
|
-
className: "flex flex-col items-start gap-0.5 py-2 cursor-pointer",
|
|
689
|
-
children: [
|
|
690
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2", children: [
|
|
691
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium flex-1", children: label.title }),
|
|
692
|
-
isDone ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-[10px] text-emerald-500", children: [
|
|
693
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }),
|
|
694
|
-
" Copied"
|
|
695
|
-
] }) : size ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-mono text-muted-foreground/70 tabular-nums", children: size }) : null
|
|
696
|
-
] }),
|
|
697
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground/70 leading-snug line-clamp-1", children: label.hint })
|
|
698
|
-
]
|
|
699
|
-
},
|
|
700
|
-
f
|
|
701
|
-
);
|
|
702
|
-
})
|
|
703
|
-
]
|
|
704
|
-
}
|
|
705
|
-
)
|
|
706
|
-
] });
|
|
707
|
-
}
|
|
708
|
-
chunkWGEGR3DF_cjs.__name(SchemaCopyMenu, "SchemaCopyMenu");
|
|
709
|
-
function BrandHeader({ info, endpoints, rawSchema, resolvedBaseUrl }) {
|
|
600
|
+
function BrandHeader({ info }) {
|
|
710
601
|
const apiTitle = info?.title ?? "API Reference";
|
|
711
|
-
const
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
{
|
|
717
|
-
className: "text-[13px] font-semibold text-foreground leading-tight truncate",
|
|
718
|
-
title: apiTitle,
|
|
719
|
-
children: apiTitle
|
|
720
|
-
}
|
|
721
|
-
),
|
|
722
|
-
info?.version && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "font-mono text-[10px] text-muted-foreground/60 leading-tight mt-0.5", children: [
|
|
723
|
-
"v",
|
|
724
|
-
info.version
|
|
725
|
-
] })
|
|
726
|
-
] }),
|
|
727
|
-
copyReady && /* @__PURE__ */ jsxRuntime.jsx(
|
|
728
|
-
SchemaCopyMenu,
|
|
602
|
+
const versionLabel = info?.version ? `v${info.version}` : null;
|
|
603
|
+
const versionNode = versionLabel ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "font-mono text-[10px] text-muted-foreground/60 leading-tight mt-0.5", children: versionLabel }) : null;
|
|
604
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 border-b px-3 py-2.5", children: [
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
606
|
+
"div",
|
|
729
607
|
{
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
variant: "icon"
|
|
608
|
+
className: "text-[13px] font-semibold text-foreground leading-tight truncate",
|
|
609
|
+
title: apiTitle,
|
|
610
|
+
children: apiTitle
|
|
734
611
|
}
|
|
735
|
-
)
|
|
612
|
+
),
|
|
613
|
+
versionNode
|
|
736
614
|
] });
|
|
737
615
|
}
|
|
738
616
|
chunkWGEGR3DF_cjs.__name(BrandHeader, "BrandHeader");
|
|
@@ -762,19 +640,11 @@ function sidebarLabel(ep, groupCommonPrefix) {
|
|
|
762
640
|
const tail = ep.path.slice(groupCommonPrefix.length) || "/";
|
|
763
641
|
return tail;
|
|
764
642
|
}
|
|
765
|
-
return
|
|
643
|
+
return chunkTKSFZHCG_cjs.relativePath(ep.path);
|
|
766
644
|
}
|
|
767
645
|
chunkWGEGR3DF_cjs.__name(sidebarLabel, "sidebarLabel");
|
|
768
|
-
function relativePath2(full) {
|
|
769
|
-
try {
|
|
770
|
-
return new URL(full).pathname;
|
|
771
|
-
} catch {
|
|
772
|
-
return full;
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
chunkWGEGR3DF_cjs.__name(relativePath2, "relativePath");
|
|
776
646
|
function sidebarTooltip(ep) {
|
|
777
|
-
return `${ep.method} ${
|
|
647
|
+
return `${ep.method} ${chunkTKSFZHCG_cjs.relativePath(ep.path)}`;
|
|
778
648
|
}
|
|
779
649
|
chunkWGEGR3DF_cjs.__name(sidebarTooltip, "sidebarTooltip");
|
|
780
650
|
|
|
@@ -851,7 +721,7 @@ function emptyTextFor(query, method, defaultText) {
|
|
|
851
721
|
chunkWGEGR3DF_cjs.__name(emptyTextFor, "emptyTextFor");
|
|
852
722
|
function buildFlatVM(endpoints, selectedVersion, query, method, activeEndpointId) {
|
|
853
723
|
const filtered = filterEndpoints(
|
|
854
|
-
|
|
724
|
+
chunkTKSFZHCG_cjs.deduplicateEndpoints(endpoints, selectedVersion),
|
|
855
725
|
query,
|
|
856
726
|
method
|
|
857
727
|
);
|
|
@@ -868,7 +738,7 @@ function buildSectionsVM(schemas, endpointsBySchema, selectedVersion, query, met
|
|
|
868
738
|
for (const src of schemas) {
|
|
869
739
|
const raw = endpointsBySchema[src.id] ?? [];
|
|
870
740
|
filteredMap[src.id] = filterEndpoints(
|
|
871
|
-
|
|
741
|
+
chunkTKSFZHCG_cjs.deduplicateEndpoints(raw, selectedVersion),
|
|
872
742
|
query,
|
|
873
743
|
method
|
|
874
744
|
);
|
|
@@ -958,29 +828,130 @@ function SidebarBody({ body, onNavigate }) {
|
|
|
958
828
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "py-1.5", children: body.sections.map((section) => /* @__PURE__ */ jsxRuntime.jsx(SchemaSection, { section, onNavigate }, section.sourceId)) });
|
|
959
829
|
}
|
|
960
830
|
chunkWGEGR3DF_cjs.__name(SidebarBody, "SidebarBody");
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
831
|
+
var FLAVOUR_LABELS = {
|
|
832
|
+
markdown: {
|
|
833
|
+
title: "Markdown for LLM",
|
|
834
|
+
hint: "Endpoints + params as prose. Smallest."
|
|
835
|
+
},
|
|
836
|
+
compact: {
|
|
837
|
+
title: "Compact JSON",
|
|
838
|
+
hint: "Dereferenced, no examples, minified."
|
|
839
|
+
},
|
|
840
|
+
raw: {
|
|
841
|
+
title: "Raw JSON",
|
|
842
|
+
hint: "Full OpenAPI document with $refs."
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
function SchemaCopyMenu({ schema, endpoints, baseUrl, variant = "button", side }) {
|
|
846
|
+
const [sizeCache, setSizeCache] = React12.useState({});
|
|
847
|
+
const [justCopied, setJustCopied] = React12.useState(null);
|
|
848
|
+
const [open, setOpen] = React12.useState(false);
|
|
849
|
+
const isReady = schema !== null && endpoints.length > 0;
|
|
850
|
+
const build = React12.useCallback(
|
|
851
|
+
(flavour) => {
|
|
852
|
+
if (!schema) return "";
|
|
853
|
+
if (flavour === "markdown") return chunkTKSFZHCG_cjs.toMarkdown(schema, endpoints, baseUrl);
|
|
854
|
+
if (flavour === "compact") return chunkTKSFZHCG_cjs.toCompactJson(schema, baseUrl);
|
|
855
|
+
return chunkTKSFZHCG_cjs.toRawJson(schema, baseUrl);
|
|
856
|
+
},
|
|
857
|
+
[schema, endpoints, baseUrl]
|
|
858
|
+
);
|
|
859
|
+
const handleCopy = React12.useCallback(
|
|
860
|
+
async (flavour) => {
|
|
861
|
+
if (!isReady) return;
|
|
862
|
+
const text = build(flavour);
|
|
863
|
+
const label = FLAVOUR_LABELS[flavour].title;
|
|
864
|
+
try {
|
|
865
|
+
await navigator.clipboard.writeText(text);
|
|
866
|
+
const size = chunkTKSFZHCG_cjs.formatBytes(text);
|
|
867
|
+
setSizeCache((prev) => ({ ...prev, [flavour]: size }));
|
|
868
|
+
setJustCopied(flavour);
|
|
869
|
+
setTimeout(() => setJustCopied(null), 1500);
|
|
870
|
+
setOpen(false);
|
|
871
|
+
hooks.toast.success(`Copied ${label}`, { description: size });
|
|
872
|
+
} catch (err) {
|
|
873
|
+
const message = err instanceof Error ? err.message : "Clipboard permission denied";
|
|
874
|
+
hooks.toast.error("Copy failed", { description: message });
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
[build, isReady]
|
|
878
|
+
);
|
|
879
|
+
const flavours = React12.useMemo(() => ["markdown", "compact", "raw"], []);
|
|
880
|
+
const resolvedSide = side ?? (variant === "footer" ? "top" : "right");
|
|
881
|
+
const resolvedAlign = variant === "footer" ? "center" : "start";
|
|
882
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components.DropdownMenu, { open, onOpenChange: setOpen, children: [
|
|
883
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuTrigger, { asChild: true, children: variant === "icon" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
884
|
+
components.Button,
|
|
969
885
|
{
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
"
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
)
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
886
|
+
variant: "ghost",
|
|
887
|
+
size: "icon",
|
|
888
|
+
className: "h-7 w-7 shrink-0",
|
|
889
|
+
disabled: !isReady,
|
|
890
|
+
title: "Copy schema for AI",
|
|
891
|
+
"aria-label": "Copy schema for AI",
|
|
892
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3.5 w-3.5" })
|
|
893
|
+
}
|
|
894
|
+
) : variant === "footer" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
895
|
+
components.Button,
|
|
896
|
+
{
|
|
897
|
+
variant: "secondary",
|
|
898
|
+
size: "sm",
|
|
899
|
+
className: "w-full justify-center gap-1.5 text-xs",
|
|
900
|
+
disabled: !isReady,
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3 w-3" }),
|
|
903
|
+
"Copy schema for AI",
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(components.Button, { variant: "outline", size: "sm", className: "h-8 gap-1.5 text-xs", disabled: !isReady, children: [
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3 w-3" }),
|
|
909
|
+
"Copy for AI",
|
|
910
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3 w-3 opacity-60" })
|
|
911
|
+
] }) }),
|
|
912
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
913
|
+
components.DropdownMenuContent,
|
|
914
|
+
{
|
|
915
|
+
side: resolvedSide,
|
|
916
|
+
align: resolvedAlign,
|
|
917
|
+
sideOffset: 6,
|
|
918
|
+
collisionPadding: 8,
|
|
919
|
+
className: "w-60 max-w-[calc(100vw-16px)]",
|
|
920
|
+
children: [
|
|
921
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuLabel, { className: "text-[10px] uppercase tracking-wider text-muted-foreground/70", children: "Copy schema" }),
|
|
922
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.DropdownMenuSeparator, {}),
|
|
923
|
+
flavours.map((f) => {
|
|
924
|
+
const label = FLAVOUR_LABELS[f];
|
|
925
|
+
const size = sizeCache[f];
|
|
926
|
+
const isDone = justCopied === f;
|
|
927
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
928
|
+
components.DropdownMenuItem,
|
|
929
|
+
{
|
|
930
|
+
onClick: (e) => {
|
|
931
|
+
e.preventDefault();
|
|
932
|
+
void handleCopy(f);
|
|
933
|
+
},
|
|
934
|
+
className: "flex flex-col items-start gap-0.5 py-2 cursor-pointer",
|
|
935
|
+
children: [
|
|
936
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full items-center gap-2", children: [
|
|
937
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium flex-1", children: label.title }),
|
|
938
|
+
isDone ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-[10px] text-emerald-500", children: [
|
|
939
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }),
|
|
940
|
+
" Copied"
|
|
941
|
+
] }) : size ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-mono text-muted-foreground/70 tabular-nums", children: size }) : null
|
|
942
|
+
] }),
|
|
943
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground/70 leading-snug line-clamp-1", children: label.hint })
|
|
944
|
+
]
|
|
945
|
+
},
|
|
946
|
+
f
|
|
947
|
+
);
|
|
948
|
+
})
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
)
|
|
952
|
+
] });
|
|
982
953
|
}
|
|
983
|
-
chunkWGEGR3DF_cjs.__name(
|
|
954
|
+
chunkWGEGR3DF_cjs.__name(SchemaCopyMenu, "SchemaCopyMenu");
|
|
984
955
|
function SearchInput({ value, onChange, placeholder }) {
|
|
985
956
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
986
957
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground/50 pointer-events-none" }),
|
|
@@ -1017,28 +988,41 @@ function Toolbar({
|
|
|
1017
988
|
showSchemaSelector,
|
|
1018
989
|
search,
|
|
1019
990
|
onSearchChange,
|
|
1020
|
-
|
|
1021
|
-
|
|
991
|
+
endpoints,
|
|
992
|
+
rawSchema,
|
|
993
|
+
resolvedBaseUrl
|
|
1022
994
|
}) {
|
|
1023
995
|
const schemaOptions = React12__default.default.useMemo(
|
|
1024
996
|
() => schemas.map((s) => ({ value: s.id, label: s.name })),
|
|
1025
997
|
[schemas]
|
|
1026
998
|
);
|
|
999
|
+
const copyReady = rawSchema !== null && rawSchema !== void 0 && endpoints.length > 0;
|
|
1000
|
+
const schemaSelectorNode = showSchemaSelector ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1001
|
+
components.Combobox,
|
|
1002
|
+
{
|
|
1003
|
+
options: schemaOptions,
|
|
1004
|
+
value: currentSchemaId ?? "",
|
|
1005
|
+
onValueChange: (id) => id && onSchemaChange(id),
|
|
1006
|
+
placeholder: "Select API",
|
|
1007
|
+
searchPlaceholder: "Search APIs\u2026",
|
|
1008
|
+
emptyText: "No APIs found",
|
|
1009
|
+
className: "w-full h-8 text-xs"
|
|
1010
|
+
}
|
|
1011
|
+
) : null;
|
|
1012
|
+
const copyMenuNode = copyReady ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
+
SchemaCopyMenu,
|
|
1014
|
+
{
|
|
1015
|
+
schema: rawSchema ?? null,
|
|
1016
|
+
endpoints,
|
|
1017
|
+
baseUrl: resolvedBaseUrl,
|
|
1018
|
+
variant: "footer",
|
|
1019
|
+
side: "bottom"
|
|
1020
|
+
}
|
|
1021
|
+
) : null;
|
|
1027
1022
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "shrink-0 border-b px-3 py-2.5 space-y-2", children: [
|
|
1028
|
-
|
|
1029
|
-
components.Combobox,
|
|
1030
|
-
{
|
|
1031
|
-
options: schemaOptions,
|
|
1032
|
-
value: currentSchemaId ?? "",
|
|
1033
|
-
onValueChange: (id) => id && onSchemaChange(id),
|
|
1034
|
-
placeholder: "Select API",
|
|
1035
|
-
searchPlaceholder: "Search APIs\u2026",
|
|
1036
|
-
emptyText: "No APIs found",
|
|
1037
|
-
className: "w-full h-8 text-xs"
|
|
1038
|
-
}
|
|
1039
|
-
),
|
|
1023
|
+
schemaSelectorNode,
|
|
1040
1024
|
/* @__PURE__ */ jsxRuntime.jsx(SearchInput, { value: search, onChange: onSearchChange }),
|
|
1041
|
-
|
|
1025
|
+
copyMenuNode
|
|
1042
1026
|
] });
|
|
1043
1027
|
}
|
|
1044
1028
|
chunkWGEGR3DF_cjs.__name(Toolbar, "Toolbar");
|
|
@@ -1066,7 +1050,6 @@ function DocsSidebar({
|
|
|
1066
1050
|
resolvedBaseUrl
|
|
1067
1051
|
}) {
|
|
1068
1052
|
const [search, setSearch] = React12.useState("");
|
|
1069
|
-
const [methodFilter, setMethodFilter] = React12.useState("ALL");
|
|
1070
1053
|
const debouncedSearch = useDebouncedValue(search);
|
|
1071
1054
|
const body = React12.useMemo(() => {
|
|
1072
1055
|
if (grouping === "sections") {
|
|
@@ -1075,7 +1058,7 @@ function DocsSidebar({
|
|
|
1075
1058
|
endpointsBySchema ?? {},
|
|
1076
1059
|
selectedVersion,
|
|
1077
1060
|
debouncedSearch,
|
|
1078
|
-
|
|
1061
|
+
"ALL",
|
|
1079
1062
|
activeEndpointId
|
|
1080
1063
|
);
|
|
1081
1064
|
}
|
|
@@ -1083,7 +1066,7 @@ function DocsSidebar({
|
|
|
1083
1066
|
endpoints,
|
|
1084
1067
|
selectedVersion,
|
|
1085
1068
|
debouncedSearch,
|
|
1086
|
-
|
|
1069
|
+
"ALL",
|
|
1087
1070
|
activeEndpointId
|
|
1088
1071
|
);
|
|
1089
1072
|
}, [
|
|
@@ -1093,21 +1076,12 @@ function DocsSidebar({
|
|
|
1093
1076
|
endpoints,
|
|
1094
1077
|
selectedVersion,
|
|
1095
1078
|
debouncedSearch,
|
|
1096
|
-
methodFilter,
|
|
1097
1079
|
activeEndpointId
|
|
1098
1080
|
]);
|
|
1099
1081
|
const hasMultipleSchemas = schemas.length > 1;
|
|
1100
1082
|
const showSchemaSelector = grouping === "selector" && hasMultipleSchemas;
|
|
1101
1083
|
return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: "flex flex-col h-full min-h-0 border-r bg-muted/10", children: [
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1103
|
-
BrandHeader,
|
|
1104
|
-
{
|
|
1105
|
-
info,
|
|
1106
|
-
endpoints,
|
|
1107
|
-
rawSchema,
|
|
1108
|
-
resolvedBaseUrl
|
|
1109
|
-
}
|
|
1110
|
-
),
|
|
1084
|
+
/* @__PURE__ */ jsxRuntime.jsx(BrandHeader, { info }),
|
|
1111
1085
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1112
1086
|
Toolbar,
|
|
1113
1087
|
{
|
|
@@ -1117,8 +1091,9 @@ function DocsSidebar({
|
|
|
1117
1091
|
showSchemaSelector,
|
|
1118
1092
|
search,
|
|
1119
1093
|
onSearchChange: setSearch,
|
|
1120
|
-
|
|
1121
|
-
|
|
1094
|
+
endpoints,
|
|
1095
|
+
rawSchema,
|
|
1096
|
+
resolvedBaseUrl
|
|
1122
1097
|
}
|
|
1123
1098
|
),
|
|
1124
1099
|
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarBody, { body, onNavigate }) })
|
|
@@ -1181,7 +1156,7 @@ function ApiIntroSection({ info, schema, endpoints, resolvedBaseUrl }) {
|
|
|
1181
1156
|
}
|
|
1182
1157
|
)
|
|
1183
1158
|
] }),
|
|
1184
|
-
info.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1159
|
+
info.description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(chunkTKSFZHCG_cjs.MarkdownMessage, { content: info.description }) }),
|
|
1185
1160
|
baseUrlRows.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-6 space-y-2", children: [
|
|
1186
1161
|
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/60", children: "Base URL" }),
|
|
1187
1162
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1.5", children: baseUrlRows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline gap-2 flex-wrap", children: [
|
|
@@ -1217,21 +1192,14 @@ var useEndpointDocStore = zustand.create()(
|
|
|
1217
1192
|
middleware.persist(
|
|
1218
1193
|
(set) => ({
|
|
1219
1194
|
...initialState,
|
|
1220
|
-
toggleSection: /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((endpointId, sectionId) => set((state) => {
|
|
1195
|
+
toggleSection: /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((endpointId, sectionId, defaultOpen) => set((state) => {
|
|
1221
1196
|
const key = sectionKey(endpointId, sectionId);
|
|
1222
1197
|
const current = state.openSections[key];
|
|
1198
|
+
const visible = current === void 0 ? defaultOpen : current;
|
|
1223
1199
|
return {
|
|
1224
1200
|
openSections: {
|
|
1225
1201
|
...state.openSections,
|
|
1226
|
-
|
|
1227
|
-
// first click means "flip from the default". We
|
|
1228
|
-
// assume the default was ``true`` for the most
|
|
1229
|
-
// common case (bodies/responses) and ``false``
|
|
1230
|
-
// otherwise; the Section component tracks this
|
|
1231
|
-
// via its ``defaultOpen`` prop and never calls
|
|
1232
|
-
// toggle on sections whose defaults match the
|
|
1233
|
-
// next state.
|
|
1234
|
-
[key]: current === void 0 ? false : !current
|
|
1202
|
+
[key]: !visible
|
|
1235
1203
|
}
|
|
1236
1204
|
};
|
|
1237
1205
|
}), "toggleSection"),
|
|
@@ -1300,7 +1268,7 @@ function useActiveCodeTab(endpointId, fallback = "curl") {
|
|
|
1300
1268
|
}
|
|
1301
1269
|
chunkWGEGR3DF_cjs.__name(useActiveCodeTab, "useActiveCodeTab");
|
|
1302
1270
|
function LanguageTabs({ activeId, onChange }) {
|
|
1303
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 overflow-x-auto -mx-1 px-1", children:
|
|
1271
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1 overflow-x-auto -mx-1 px-1", children: chunkTKSFZHCG_cjs.CODE_SAMPLE_TARGETS.map((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1304
1272
|
"button",
|
|
1305
1273
|
{
|
|
1306
1274
|
type: "button",
|
|
@@ -1325,18 +1293,18 @@ function useCodeSnippet({
|
|
|
1325
1293
|
}) {
|
|
1326
1294
|
const effectiveBody = body ?? endpoint.requestBody?.example;
|
|
1327
1295
|
const har = React12.useMemo(() => {
|
|
1328
|
-
const h =
|
|
1296
|
+
const h = chunkTKSFZHCG_cjs.buildHarRequest({
|
|
1329
1297
|
endpoint,
|
|
1330
1298
|
body: effectiveBody,
|
|
1331
1299
|
parameters,
|
|
1332
1300
|
headers,
|
|
1333
1301
|
baseUrl
|
|
1334
1302
|
});
|
|
1335
|
-
return baseUrl ? h : { ...h, url:
|
|
1303
|
+
return baseUrl ? h : { ...h, url: chunkTKSFZHCG_cjs.resolveAbsolute(h.url) };
|
|
1336
1304
|
}, [endpoint, effectiveBody, parameters, headers, baseUrl]);
|
|
1337
1305
|
return React12.useMemo(() => {
|
|
1338
|
-
const target =
|
|
1339
|
-
const code =
|
|
1306
|
+
const target = chunkTKSFZHCG_cjs.CODE_SAMPLE_TARGETS.find((t) => t.id === activeId);
|
|
1307
|
+
const code = chunkTKSFZHCG_cjs.renderSnippet(har, activeId);
|
|
1340
1308
|
return {
|
|
1341
1309
|
snippet: code ?? `// Snippet for ${target.label} is unavailable for this request.`,
|
|
1342
1310
|
prism: target.prism
|
|
@@ -1359,7 +1327,7 @@ function CodeSamples({ endpoint, body, parameters, headers, baseUrl }) {
|
|
|
1359
1327
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2.5", children: [
|
|
1360
1328
|
/* @__PURE__ */ jsxRuntime.jsx(LanguageTabs, { activeId, onChange: (id) => setCodeTab(endpointId, id) }),
|
|
1361
1329
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1362
|
-
|
|
1330
|
+
chunkTKSFZHCG_cjs.PrettyCode_default,
|
|
1363
1331
|
{
|
|
1364
1332
|
data: snippet,
|
|
1365
1333
|
language: prism,
|
|
@@ -1390,15 +1358,15 @@ function IconButton({ label, onClick, children, active }) {
|
|
|
1390
1358
|
] });
|
|
1391
1359
|
}
|
|
1392
1360
|
chunkWGEGR3DF_cjs.__name(IconButton, "IconButton");
|
|
1393
|
-
function MetaActions({ anchor,
|
|
1361
|
+
function MetaActions({ anchor, presentSections }) {
|
|
1394
1362
|
const { endpointId } = useEndpointDocContext();
|
|
1395
1363
|
const expandAll = useEndpointDocStore((s) => s.expandAll);
|
|
1396
1364
|
const collapseAll = useEndpointDocStore((s) => s.collapseAll);
|
|
1397
1365
|
const openSections = useEndpointDocStore((s) => s.openSections);
|
|
1398
|
-
const [
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
setTimeout(() =>
|
|
1366
|
+
const [linkCopied, setLinkCopied] = React12.useState(false);
|
|
1367
|
+
const flashLink = React12.useCallback(() => {
|
|
1368
|
+
setLinkCopied(true);
|
|
1369
|
+
setTimeout(() => setLinkCopied(false), 1200);
|
|
1402
1370
|
}, []);
|
|
1403
1371
|
const mostlyOpen = React12.useMemo(() => {
|
|
1404
1372
|
if (presentSections.length === 0) return false;
|
|
@@ -1411,43 +1379,21 @@ function MetaActions({ anchor, endpointMarkdown, presentSections }) {
|
|
|
1411
1379
|
const copyLink = React12.useCallback(() => {
|
|
1412
1380
|
if (typeof window === "undefined") return;
|
|
1413
1381
|
const url = `${window.location.origin}${window.location.pathname}#${anchor}`;
|
|
1414
|
-
void navigator.clipboard?.writeText(url).then(
|
|
1415
|
-
}, [anchor,
|
|
1416
|
-
const copyMarkdown = React12.useCallback(() => {
|
|
1417
|
-
if (typeof window === "undefined") return;
|
|
1418
|
-
void navigator.clipboard?.writeText(endpointMarkdown).then(() => flash("md"));
|
|
1419
|
-
}, [endpointMarkdown, flash]);
|
|
1382
|
+
void navigator.clipboard?.writeText(url).then(flashLink);
|
|
1383
|
+
}, [anchor, flashLink]);
|
|
1420
1384
|
const toggleAll = React12.useCallback(() => {
|
|
1421
1385
|
if (mostlyOpen) collapseAll(endpointId, presentSections);
|
|
1422
1386
|
else expandAll(endpointId, presentSections);
|
|
1423
1387
|
}, [mostlyOpen, collapseAll, expandAll, endpointId, presentSections]);
|
|
1388
|
+
const linkLabel = linkCopied ? "Copied!" : "Copy link to endpoint";
|
|
1389
|
+
const linkIcon = linkCopied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: "h-3.5 w-3.5" });
|
|
1390
|
+
const showToggleAll = presentSections.length >= 2;
|
|
1391
|
+
const toggleAllLabel = mostlyOpen ? "Collapse all sections" : "Expand all sections";
|
|
1392
|
+
const toggleAllIcon = mostlyOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownUp, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "h-3.5 w-3.5" });
|
|
1393
|
+
const toggleAllNode = showToggleAll ? /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: toggleAllLabel, onClick: toggleAll, children: toggleAllIcon }) : null;
|
|
1424
1394
|
return /* @__PURE__ */ jsxRuntime.jsx(components.SafeTooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
1425
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1426
|
-
|
|
1427
|
-
{
|
|
1428
|
-
label: justCopied === "link" ? "Copied!" : "Copy link to endpoint",
|
|
1429
|
-
onClick: copyLink,
|
|
1430
|
-
active: justCopied === "link",
|
|
1431
|
-
children: justCopied === "link" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: "h-3.5 w-3.5" })
|
|
1432
|
-
}
|
|
1433
|
-
),
|
|
1434
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1435
|
-
IconButton,
|
|
1436
|
-
{
|
|
1437
|
-
label: justCopied === "md" ? "Copied!" : "Copy as Markdown (for AI)",
|
|
1438
|
-
onClick: copyMarkdown,
|
|
1439
|
-
active: justCopied === "md",
|
|
1440
|
-
children: justCopied === "md" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileCode2, { className: "h-3.5 w-3.5" })
|
|
1441
|
-
}
|
|
1442
|
-
),
|
|
1443
|
-
presentSections.length >= 2 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1444
|
-
IconButton,
|
|
1445
|
-
{
|
|
1446
|
-
label: mostlyOpen ? "Collapse all sections" : "Expand all sections",
|
|
1447
|
-
onClick: toggleAll,
|
|
1448
|
-
children: mostlyOpen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsDownUp, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "h-3.5 w-3.5" })
|
|
1449
|
-
}
|
|
1450
|
-
)
|
|
1395
|
+
/* @__PURE__ */ jsxRuntime.jsx(IconButton, { label: linkLabel, onClick: copyLink, active: linkCopied, children: linkIcon }),
|
|
1396
|
+
toggleAllNode
|
|
1451
1397
|
] }) });
|
|
1452
1398
|
}
|
|
1453
1399
|
chunkWGEGR3DF_cjs.__name(MetaActions, "MetaActions");
|
|
@@ -1457,7 +1403,7 @@ function PathDisplay({ path }) {
|
|
|
1457
1403
|
{
|
|
1458
1404
|
className: "block font-mono text-lg md:text-xl font-semibold text-foreground leading-tight",
|
|
1459
1405
|
style: { overflowWrap: "anywhere", wordBreak: "break-word" },
|
|
1460
|
-
children:
|
|
1406
|
+
children: chunkTKSFZHCG_cjs.relativePath(path)
|
|
1461
1407
|
}
|
|
1462
1408
|
);
|
|
1463
1409
|
}
|
|
@@ -1469,36 +1415,58 @@ function EndpointHeader({
|
|
|
1469
1415
|
onTryIt,
|
|
1470
1416
|
presentSections
|
|
1471
1417
|
}) {
|
|
1472
|
-
const endpointMd = React12.useMemo(() =>
|
|
1418
|
+
const endpointMd = React12.useMemo(() => chunkTKSFZHCG_cjs.endpointToMarkdown(endpoint), [endpoint]);
|
|
1419
|
+
const [aiCopied, setAiCopied] = React12.useState(false);
|
|
1420
|
+
const onAiCopy = React12.useCallback(() => {
|
|
1421
|
+
if (typeof window === "undefined") return;
|
|
1422
|
+
void navigator.clipboard?.writeText(endpointMd).then(() => {
|
|
1423
|
+
setAiCopied(true);
|
|
1424
|
+
setTimeout(() => setAiCopied(false), 1200);
|
|
1425
|
+
});
|
|
1426
|
+
}, [endpointMd]);
|
|
1427
|
+
const tryItLabel = isLoadedInPlayground ? "Loaded" : "Try it";
|
|
1428
|
+
const aiCopyIcon = aiCopied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-3 w-3" });
|
|
1429
|
+
const aiCopyLabel = aiCopied ? "Copied" : "AI Copy";
|
|
1430
|
+
const descriptionNode = endpoint.description ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground text-sm", children: /* @__PURE__ */ jsxRuntime.jsx(chunkTKSFZHCG_cjs.MarkdownMessage, { content: endpoint.description }) }) : null;
|
|
1473
1431
|
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "space-y-3", children: [
|
|
1474
1432
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 flex-wrap", children: [
|
|
1475
1433
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
1476
1434
|
/* @__PURE__ */ jsxRuntime.jsx(MethodBadge, { method: endpoint.method }),
|
|
1477
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1478
|
-
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx(MetaActions, { anchor, presentSections })
|
|
1436
|
+
] }),
|
|
1437
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
1438
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1439
|
+
components.Button,
|
|
1479
1440
|
{
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1441
|
+
size: "sm",
|
|
1442
|
+
variant: "secondary",
|
|
1443
|
+
onClick: onAiCopy,
|
|
1444
|
+
title: "Copy endpoint as Markdown for AI",
|
|
1445
|
+
"aria-label": "Copy endpoint as Markdown for AI",
|
|
1446
|
+
className: "h-7 text-xs gap-1.5 px-2.5",
|
|
1447
|
+
children: [
|
|
1448
|
+
aiCopyIcon,
|
|
1449
|
+
aiCopyLabel
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1454
|
+
components.Button,
|
|
1455
|
+
{
|
|
1456
|
+
size: "sm",
|
|
1457
|
+
variant: isLoadedInPlayground ? "secondary" : "default",
|
|
1458
|
+
onClick: onTryIt,
|
|
1459
|
+
className: "h-7 text-xs gap-1.5 px-2.5",
|
|
1460
|
+
children: [
|
|
1461
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "h-3 w-3" }),
|
|
1462
|
+
tryItLabel
|
|
1463
|
+
]
|
|
1483
1464
|
}
|
|
1484
1465
|
)
|
|
1485
|
-
] })
|
|
1486
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1487
|
-
components.Button,
|
|
1488
|
-
{
|
|
1489
|
-
size: "sm",
|
|
1490
|
-
variant: isLoadedInPlayground ? "secondary" : "default",
|
|
1491
|
-
onClick: onTryIt,
|
|
1492
|
-
className: "ml-auto h-7 text-xs gap-1.5 px-2.5",
|
|
1493
|
-
children: [
|
|
1494
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "h-3 w-3" }),
|
|
1495
|
-
isLoadedInPlayground ? "Loaded" : "Try it"
|
|
1496
|
-
]
|
|
1497
|
-
}
|
|
1498
|
-
)
|
|
1466
|
+
] })
|
|
1499
1467
|
] }),
|
|
1500
1468
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx(PathDisplay, { path: endpoint.path }) }),
|
|
1501
|
-
|
|
1469
|
+
descriptionNode
|
|
1502
1470
|
] });
|
|
1503
1471
|
}
|
|
1504
1472
|
chunkWGEGR3DF_cjs.__name(EndpointHeader, "EndpointHeader");
|
|
@@ -1931,7 +1899,7 @@ function Section({ id, title, badge, children }) {
|
|
|
1931
1899
|
title,
|
|
1932
1900
|
badge,
|
|
1933
1901
|
open,
|
|
1934
|
-
onToggle: () => toggleSection(endpointId, id)
|
|
1902
|
+
onToggle: () => toggleSection(endpointId, id, defaultOpen)
|
|
1935
1903
|
}
|
|
1936
1904
|
),
|
|
1937
1905
|
open && /* @__PURE__ */ jsxRuntime.jsx("div", { children })
|
|
@@ -2022,7 +1990,7 @@ function buildSchemaSectionVM(entry, selectedVersion, loadedEndpoint) {
|
|
|
2022
1990
|
} else if (entry.error) {
|
|
2023
1991
|
state = { kind: "error", message: entry.error };
|
|
2024
1992
|
} else {
|
|
2025
|
-
const visible =
|
|
1993
|
+
const visible = chunkTKSFZHCG_cjs.deduplicateEndpoints(entry.endpoints, selectedVersion);
|
|
2026
1994
|
state = visible.length === 0 ? { kind: "empty" } : {
|
|
2027
1995
|
kind: "ready",
|
|
2028
1996
|
rows: visible.map((ep) => buildEndpointRow(ep, loadedEndpoint, entry.source.id))
|
|
@@ -2124,7 +2092,7 @@ function SelectorBody({
|
|
|
2124
2092
|
onTryEndpoint
|
|
2125
2093
|
}) {
|
|
2126
2094
|
const visibleEndpoints = React12.useMemo(
|
|
2127
|
-
() =>
|
|
2095
|
+
() => chunkTKSFZHCG_cjs.deduplicateEndpoints(endpoints, selectedVersion),
|
|
2128
2096
|
[endpoints, selectedVersion]
|
|
2129
2097
|
);
|
|
2130
2098
|
const rows = React12.useMemo(
|
|
@@ -2552,7 +2520,7 @@ function ArrayField({
|
|
|
2552
2520
|
}
|
|
2553
2521
|
chunkWGEGR3DF_cjs.__name(ArrayField, "ArrayField");
|
|
2554
2522
|
function EndpointResetButton() {
|
|
2555
|
-
const { state, setParameters, setRequestBody } =
|
|
2523
|
+
const { state, setParameters, setRequestBody } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
2556
2524
|
const ep = state.selectedEndpoint;
|
|
2557
2525
|
const { reset } = useEndpointDraft(state.activeSchemaId, ep);
|
|
2558
2526
|
const hasDraft = Object.keys(state.parameters).length > 0 || state.requestBody.length > 0;
|
|
@@ -2581,7 +2549,7 @@ function EndpointResetButton() {
|
|
|
2581
2549
|
}
|
|
2582
2550
|
chunkWGEGR3DF_cjs.__name(EndpointResetButton, "EndpointResetButton");
|
|
2583
2551
|
function ParamFields({ label, params }) {
|
|
2584
|
-
const { state, setParameters } =
|
|
2552
|
+
const { state, setParameters } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
2585
2553
|
function handleChange(name, value) {
|
|
2586
2554
|
setParameters({ ...state.parameters, [name]: value });
|
|
2587
2555
|
}
|
|
@@ -2621,7 +2589,7 @@ function RequestPanel() {
|
|
|
2621
2589
|
setSelectedApiKey,
|
|
2622
2590
|
setManualApiToken,
|
|
2623
2591
|
sendRequest
|
|
2624
|
-
} =
|
|
2592
|
+
} = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
2625
2593
|
const apiKeyOptions = React12.useMemo(
|
|
2626
2594
|
() => apiKeys.map((k) => ({
|
|
2627
2595
|
value: k.id,
|
|
@@ -2634,12 +2602,12 @@ function RequestPanel() {
|
|
|
2634
2602
|
);
|
|
2635
2603
|
const hasApiKeys = apiKeyOptions.length > 0;
|
|
2636
2604
|
const ep = state.selectedEndpoint;
|
|
2637
|
-
const isJsonValid = state.requestBody ?
|
|
2605
|
+
const isJsonValid = state.requestBody ? chunkTKSFZHCG_cjs.isValidJson(state.requestBody) : true;
|
|
2638
2606
|
const curlCommand = React12.useMemo(() => {
|
|
2639
2607
|
if (!state.requestUrl) return "";
|
|
2640
|
-
const absoluteUrl =
|
|
2641
|
-
const apiKey = state.selectedApiKey ?
|
|
2642
|
-
const hdrs =
|
|
2608
|
+
const absoluteUrl = chunkTKSFZHCG_cjs.resolveAbsolute(state.requestUrl);
|
|
2609
|
+
const apiKey = state.selectedApiKey ? chunkTKSFZHCG_cjs.findApiKeyById(apiKeys, state.selectedApiKey) : null;
|
|
2610
|
+
const hdrs = chunkTKSFZHCG_cjs.parseRequestHeaders(state.requestHeaders);
|
|
2643
2611
|
if (apiKey) hdrs["X-API-Key"] = apiKey.secret || apiKey.id;
|
|
2644
2612
|
let cmd = `curl -X ${state.requestMethod} "${absoluteUrl}"`;
|
|
2645
2613
|
Object.entries(hdrs).forEach(([k, v]) => {
|
|
@@ -2661,13 +2629,13 @@ function RequestPanel() {
|
|
|
2661
2629
|
[ep]
|
|
2662
2630
|
);
|
|
2663
2631
|
state.loading || !state.requestUrl || !isJsonValid;
|
|
2664
|
-
const displayUrl =
|
|
2632
|
+
const displayUrl = chunkTKSFZHCG_cjs.resolveAbsolute(state.requestUrl || ep?.path || "");
|
|
2665
2633
|
const hasBody = ep?.method !== "GET";
|
|
2666
2634
|
const bodyType = ep?.requestBody?.type ?? "";
|
|
2667
2635
|
const hasPathParams = pathParams.length > 0;
|
|
2668
2636
|
const hasQueryParams = queryParams.length > 0;
|
|
2669
2637
|
const hasCurl = Boolean(curlCommand);
|
|
2670
|
-
const epPath = ep ?
|
|
2638
|
+
const epPath = ep ? chunkTKSFZHCG_cjs.relativePath(ep.path) : "";
|
|
2671
2639
|
const urlChanged = displayUrl !== "" && displayUrl !== epPath;
|
|
2672
2640
|
if (!ep) {
|
|
2673
2641
|
return /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { icon: lucideReact.Send, text: "Select an endpoint to build a request" });
|
|
@@ -2757,7 +2725,7 @@ function RequestPanel() {
|
|
|
2757
2725
|
"cURL"
|
|
2758
2726
|
] }),
|
|
2759
2727
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2760
|
-
|
|
2728
|
+
chunkTKSFZHCG_cjs.PrettyCode_default,
|
|
2761
2729
|
{
|
|
2762
2730
|
data: curlCommand,
|
|
2763
2731
|
language: "bash",
|
|
@@ -2942,7 +2910,7 @@ function PrettyView({ treeData, rawText, detected }) {
|
|
|
2942
2910
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-10 text-center text-xs text-muted-foreground", children: "Empty response body" });
|
|
2943
2911
|
}
|
|
2944
2912
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2945
|
-
|
|
2913
|
+
chunkTKSFZHCG_cjs.PrettyCode_default,
|
|
2946
2914
|
{
|
|
2947
2915
|
data: rawText,
|
|
2948
2916
|
language: detected.prism,
|
|
@@ -3118,7 +3086,7 @@ function ViewTabs({ active, onChange, showPreview }) {
|
|
|
3118
3086
|
}
|
|
3119
3087
|
chunkWGEGR3DF_cjs.__name(ViewTabs, "ViewTabs");
|
|
3120
3088
|
function ResponsePanel() {
|
|
3121
|
-
const { state } =
|
|
3089
|
+
const { state } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
3122
3090
|
const { response, loading, selectedEndpoint } = state;
|
|
3123
3091
|
const { treeData, rawText, detected } = useResponseView(response?.data, response?.headers);
|
|
3124
3092
|
const showPreview = detected.kind === "html";
|
|
@@ -3159,15 +3127,15 @@ function ResponsePanel() {
|
|
|
3159
3127
|
}
|
|
3160
3128
|
chunkWGEGR3DF_cjs.__name(ResponsePanel, "ResponsePanel");
|
|
3161
3129
|
function SendButton({ className }) {
|
|
3162
|
-
const { state, sendRequest } =
|
|
3130
|
+
const { state, sendRequest } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
3163
3131
|
const ep = state.selectedEndpoint;
|
|
3164
3132
|
const builder = React12.useMemo(
|
|
3165
|
-
() => ep ? new
|
|
3133
|
+
() => ep ? new chunkTKSFZHCG_cjs.UrlBuilder(ep, state.parameters) : null,
|
|
3166
3134
|
[ep, state.parameters]
|
|
3167
3135
|
);
|
|
3168
3136
|
const missingRequired = builder?.missingRequired() ?? [];
|
|
3169
3137
|
const unsubstituted = builder?.unfilledPlaceholders() ?? [];
|
|
3170
|
-
const isJsonValid = state.requestBody ?
|
|
3138
|
+
const isJsonValid = state.requestBody ? chunkTKSFZHCG_cjs.isValidJson(state.requestBody) : true;
|
|
3171
3139
|
const blockers = [];
|
|
3172
3140
|
if (missingRequired.length > 0) {
|
|
3173
3141
|
blockers.push(
|
|
@@ -3207,7 +3175,7 @@ chunkWGEGR3DF_cjs.__name(SendButton, "SendButton");
|
|
|
3207
3175
|
var WIDTH_NARROW = "clamp(380px, 30vw, 480px)";
|
|
3208
3176
|
var WIDTH_WIDE = "clamp(720px, 60vw, 1280px)";
|
|
3209
3177
|
function SlideInPlayground({ open, onClose }) {
|
|
3210
|
-
const { state } =
|
|
3178
|
+
const { state } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
3211
3179
|
const ep = state.selectedEndpoint;
|
|
3212
3180
|
const showResponse = state.response !== null || state.loading;
|
|
3213
3181
|
const width = showResponse ? WIDTH_WIDE : WIDTH_NARROW;
|
|
@@ -3216,7 +3184,7 @@ function SlideInPlayground({ open, onClose }) {
|
|
|
3216
3184
|
/* @__PURE__ */ jsxRuntime.jsx(components.SidePanel.Title, { children: "Playground" }),
|
|
3217
3185
|
ep && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
|
|
3218
3186
|
/* @__PURE__ */ jsxRuntime.jsx(MethodBadge, { method: ep.method }),
|
|
3219
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "font-mono text-[11px] text-muted-foreground truncate", children:
|
|
3187
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "font-mono text-[11px] text-muted-foreground truncate", children: chunkTKSFZHCG_cjs.relativePath(ep.path) })
|
|
3220
3188
|
] }),
|
|
3221
3189
|
/* @__PURE__ */ jsxRuntime.jsx(components.SidePanel.Close, { className: "ml-auto" })
|
|
3222
3190
|
] }),
|
|
@@ -3240,7 +3208,7 @@ function SlideInPlayground({ open, onClose }) {
|
|
|
3240
3208
|
}
|
|
3241
3209
|
chunkWGEGR3DF_cjs.__name(SlideInPlayground, "SlideInPlayground");
|
|
3242
3210
|
function TryItSheet({ open, onOpenChange }) {
|
|
3243
|
-
const { state } =
|
|
3211
|
+
const { state } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
3244
3212
|
const showResponse = state.response !== null || state.loading;
|
|
3245
3213
|
return /* @__PURE__ */ jsxRuntime.jsx(components.ResponsiveSheet, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(components.ResponsiveSheetContent, { className: "sm:max-w-xl flex flex-col h-full p-0", children: [
|
|
3246
3214
|
/* @__PURE__ */ jsxRuntime.jsx(components.ResponsiveSheetHeader, { className: "px-4 py-3 border-b shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(components.ResponsiveSheetTitle, { className: "text-sm", children: "Playground" }) }),
|
|
@@ -3255,7 +3223,7 @@ function TryItSheet({ open, onOpenChange }) {
|
|
|
3255
3223
|
}
|
|
3256
3224
|
chunkWGEGR3DF_cjs.__name(TryItSheet, "TryItSheet");
|
|
3257
3225
|
var DocsLayout = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
3258
|
-
const { state, config, setSelectedEndpoint } =
|
|
3226
|
+
const { state, config, setSelectedEndpoint } = chunkTKSFZHCG_cjs.usePlaygroundContext();
|
|
3259
3227
|
const isDesktop = hooks.useMediaQuery("(min-width: 1024px)");
|
|
3260
3228
|
const isMobile = !isDesktop;
|
|
3261
3229
|
const grouping = config.schemaGrouping ?? "selector";
|
|
@@ -3466,5 +3434,5 @@ var DocsLayout = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
3466
3434
|
}, "DocsLayout");
|
|
3467
3435
|
|
|
3468
3436
|
exports.DocsLayout = DocsLayout;
|
|
3469
|
-
//# sourceMappingURL=DocsLayout-
|
|
3470
|
-
//# sourceMappingURL=DocsLayout-
|
|
3437
|
+
//# sourceMappingURL=DocsLayout-XLDB6CJ2.cjs.map
|
|
3438
|
+
//# sourceMappingURL=DocsLayout-XLDB6CJ2.cjs.map
|