sourcey 2.0.2
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/LICENSE +23 -0
- package/README.md +254 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +197 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/copy.js +21 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +8 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/scroll-tracker.js +88 -0
- package/dist/client/search.js +164 -0
- package/dist/client/sidebar.js +54 -0
- package/dist/client/tabs.js +51 -0
- package/dist/client/theme-toggle.js +36 -0
- package/dist/components/App.d.ts +15 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/App.js +13 -0
- package/dist/components/App.js.map +1 -0
- package/dist/components/layout/Head.d.ts +2 -0
- package/dist/components/layout/Head.d.ts.map +1 -0
- package/dist/components/layout/Head.js +29 -0
- package/dist/components/layout/Head.js.map +1 -0
- package/dist/components/layout/Header.d.ts +13 -0
- package/dist/components/layout/Header.d.ts.map +1 -0
- package/dist/components/layout/Header.js +38 -0
- package/dist/components/layout/Header.js.map +1 -0
- package/dist/components/layout/Page.d.ts +2 -0
- package/dist/components/layout/Page.d.ts.map +1 -0
- package/dist/components/layout/Page.js +29 -0
- package/dist/components/layout/Page.js.map +1 -0
- package/dist/components/layout/Sidebar.d.ts +9 -0
- package/dist/components/layout/Sidebar.d.ts.map +1 -0
- package/dist/components/layout/Sidebar.js +41 -0
- package/dist/components/layout/Sidebar.js.map +1 -0
- package/dist/components/layout/TableOfContents.d.ts +10 -0
- package/dist/components/layout/TableOfContents.d.ts.map +1 -0
- package/dist/components/layout/TableOfContents.js +12 -0
- package/dist/components/layout/TableOfContents.js.map +1 -0
- package/dist/components/openapi/CodeSamples.d.ts +11 -0
- package/dist/components/openapi/CodeSamples.d.ts.map +1 -0
- package/dist/components/openapi/CodeSamples.js +16 -0
- package/dist/components/openapi/CodeSamples.js.map +1 -0
- package/dist/components/openapi/Definition.d.ts +11 -0
- package/dist/components/openapi/Definition.d.ts.map +1 -0
- package/dist/components/openapi/Definition.js +12 -0
- package/dist/components/openapi/Definition.js.map +1 -0
- package/dist/components/openapi/EndpointBar.d.ts +12 -0
- package/dist/components/openapi/EndpointBar.d.ts.map +1 -0
- package/dist/components/openapi/EndpointBar.js +22 -0
- package/dist/components/openapi/EndpointBar.js.map +1 -0
- package/dist/components/openapi/Introduction.d.ts +6 -0
- package/dist/components/openapi/Introduction.d.ts.map +1 -0
- package/dist/components/openapi/Introduction.js +14 -0
- package/dist/components/openapi/Introduction.js.map +1 -0
- package/dist/components/openapi/Operation.d.ts +13 -0
- package/dist/components/openapi/Operation.d.ts.map +1 -0
- package/dist/components/openapi/Operation.js +23 -0
- package/dist/components/openapi/Operation.js.map +1 -0
- package/dist/components/openapi/Parameters.d.ts +7 -0
- package/dist/components/openapi/Parameters.d.ts.map +1 -0
- package/dist/components/openapi/Parameters.js +10 -0
- package/dist/components/openapi/Parameters.js.map +1 -0
- package/dist/components/openapi/RequestBody.d.ts +17 -0
- package/dist/components/openapi/RequestBody.d.ts.map +1 -0
- package/dist/components/openapi/RequestBody.js +27 -0
- package/dist/components/openapi/RequestBody.js.map +1 -0
- package/dist/components/openapi/Responses.d.ts +14 -0
- package/dist/components/openapi/Responses.d.ts.map +1 -0
- package/dist/components/openapi/Responses.js +60 -0
- package/dist/components/openapi/Responses.js.map +1 -0
- package/dist/components/openapi/Security.d.ts +14 -0
- package/dist/components/openapi/Security.d.ts.map +1 -0
- package/dist/components/openapi/Security.js +32 -0
- package/dist/components/openapi/Security.js.map +1 -0
- package/dist/components/openapi/Tags.d.ts +8 -0
- package/dist/components/openapi/Tags.d.ts.map +1 -0
- package/dist/components/openapi/Tags.js +10 -0
- package/dist/components/openapi/Tags.js.map +1 -0
- package/dist/components/schema/ExampleView.d.ts +11 -0
- package/dist/components/schema/ExampleView.d.ts.map +1 -0
- package/dist/components/schema/ExampleView.js +15 -0
- package/dist/components/schema/ExampleView.js.map +1 -0
- package/dist/components/schema/SchemaDatatype.d.ts +11 -0
- package/dist/components/schema/SchemaDatatype.d.ts.map +1 -0
- package/dist/components/schema/SchemaDatatype.js +36 -0
- package/dist/components/schema/SchemaDatatype.js.map +1 -0
- package/dist/components/schema/SchemaView.d.ts +14 -0
- package/dist/components/schema/SchemaView.d.ts.map +1 -0
- package/dist/components/schema/SchemaView.js +44 -0
- package/dist/components/schema/SchemaView.js.map +1 -0
- package/dist/components/ui/Badge.d.ts +11 -0
- package/dist/components/ui/Badge.d.ts.map +1 -0
- package/dist/components/ui/Badge.js +14 -0
- package/dist/components/ui/Badge.js.map +1 -0
- package/dist/components/ui/Markdown.d.ts +8 -0
- package/dist/components/ui/Markdown.d.ts.map +1 -0
- package/dist/components/ui/Markdown.js +13 -0
- package/dist/components/ui/Markdown.js.map +1 -0
- package/dist/components/ui/SectionLabel.d.ts +10 -0
- package/dist/components/ui/SectionLabel.d.ts.map +1 -0
- package/dist/components/ui/SectionLabel.js +9 -0
- package/dist/components/ui/SectionLabel.js.map +1 -0
- package/dist/config.d.ts +46 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +102 -0
- package/dist/config.js.map +1 -0
- package/dist/core/converter.d.ts +9 -0
- package/dist/core/converter.d.ts.map +1 -0
- package/dist/core/converter.js +29 -0
- package/dist/core/converter.js.map +1 -0
- package/dist/core/loader.d.ts +7 -0
- package/dist/core/loader.d.ts.map +1 -0
- package/dist/core/loader.js +92 -0
- package/dist/core/loader.js.map +1 -0
- package/dist/core/markdown-loader.d.ts +29 -0
- package/dist/core/markdown-loader.d.ts.map +1 -0
- package/dist/core/markdown-loader.js +65 -0
- package/dist/core/markdown-loader.js.map +1 -0
- package/dist/core/navigation.d.ts +51 -0
- package/dist/core/navigation.d.ts.map +1 -0
- package/dist/core/navigation.js +108 -0
- package/dist/core/navigation.js.map +1 -0
- package/dist/core/normalizer.d.ts +7 -0
- package/dist/core/normalizer.d.ts.map +1 -0
- package/dist/core/normalizer.js +472 -0
- package/dist/core/normalizer.js.map +1 -0
- package/dist/core/parser.d.ts +10 -0
- package/dist/core/parser.d.ts.map +1 -0
- package/dist/core/parser.js +34 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/search-indexer.d.ts +25 -0
- package/dist/core/search-indexer.d.ts.map +1 -0
- package/dist/core/search-indexer.js +72 -0
- package/dist/core/search-indexer.js.map +1 -0
- package/dist/core/types.d.ts +236 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +7 -0
- package/dist/core/types.js.map +1 -0
- package/dist/dev-server.d.ts +17 -0
- package/dist/dev-server.d.ts.map +1 -0
- package/dist/dev-server.js +202 -0
- package/dist/dev-server.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/renderer/context.d.ts +46 -0
- package/dist/renderer/context.d.ts.map +1 -0
- package/dist/renderer/context.js +22 -0
- package/dist/renderer/context.js.map +1 -0
- package/dist/renderer/html-builder.d.ts +37 -0
- package/dist/renderer/html-builder.d.ts.map +1 -0
- package/dist/renderer/html-builder.js +87 -0
- package/dist/renderer/html-builder.js.map +1 -0
- package/dist/renderer/static-renderer.d.ts +10 -0
- package/dist/renderer/static-renderer.d.ts.map +1 -0
- package/dist/renderer/static-renderer.js +17 -0
- package/dist/renderer/static-renderer.js.map +1 -0
- package/dist/themes/default/main.css +61 -0
- package/dist/themes/default/sourcey.css +425 -0
- package/dist/utils/code-samples.d.ts +8 -0
- package/dist/utils/code-samples.d.ts.map +1 -0
- package/dist/utils/code-samples.js +84 -0
- package/dist/utils/code-samples.js.map +1 -0
- package/dist/utils/example-generator.d.ts +12 -0
- package/dist/utils/example-generator.d.ts.map +1 -0
- package/dist/utils/example-generator.js +123 -0
- package/dist/utils/example-generator.js.map +1 -0
- package/dist/utils/highlighter.d.ts +10 -0
- package/dist/utils/highlighter.d.ts.map +1 -0
- package/dist/utils/highlighter.js +51 -0
- package/dist/utils/highlighter.js.map +1 -0
- package/dist/utils/html-id.d.ts +6 -0
- package/dist/utils/html-id.d.ts.map +1 -0
- package/dist/utils/html-id.js +11 -0
- package/dist/utils/html-id.js.map +1 -0
- package/dist/utils/http.d.ts +14 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +97 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/markdown.d.ts +9 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +18 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/vite-plugin.d.ts +16 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +92 -0
- package/dist/vite-plugin.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NormalizedOperation } from "../../core/types.js";
|
|
2
|
+
interface CodeSamplesProps {
|
|
3
|
+
operation: NormalizedOperation;
|
|
4
|
+
serverUrl: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Code samples in a light-themed card with language tabs and copy button.
|
|
8
|
+
*/
|
|
9
|
+
export declare function CodeSamplesExamples({ operation, serverUrl }: CodeSamplesProps): import("preact").JSX.Element | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=CodeSamples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSamples.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/CodeSamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,UAAU,gBAAgB;IACxB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,gBAAgB,uCAmD7E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { generateCodeSamples } from "../../utils/code-samples.js";
|
|
3
|
+
import { highlightCode } from "../../utils/highlighter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Code samples in a light-themed card with language tabs and copy button.
|
|
6
|
+
*/
|
|
7
|
+
export function CodeSamplesExamples({ operation, serverUrl }) {
|
|
8
|
+
const samples = generateCodeSamples(operation, serverUrl);
|
|
9
|
+
if (!samples.length)
|
|
10
|
+
return null;
|
|
11
|
+
return (_jsxs("div", { class: "code-samples not-prose rounded-2xl border border-[rgb(var(--color-gray-950)/0.1)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)] p-0.5 bg-[rgb(var(--color-gray-50))] dark:bg-[rgb(var(--color-surface-dark-tint)/0.05)] overflow-hidden", children: [_jsx("div", { class: "flex items-center justify-between gap-2 px-2.5", children: _jsx("div", { class: "code-samples-tabs flex gap-1 overflow-x-auto text-xs leading-6", role: "tablist", children: samples.map((sample, i) => (_jsx("button", { role: "tab", class: `code-samples-tab${i === 0 ? " active" : ""}`, "aria-selected": i === 0 ? "true" : "false", "data-tab-index": String(i), children: _jsx("div", { class: "z-10 flex items-center gap-1.5 rounded-lg px-1.5", children: sample.label ?? sample.lang }) }, i))) }) }), samples.map((sample, i) => {
|
|
12
|
+
const html = highlightCode(sample.source, sample.lang);
|
|
13
|
+
return (_jsx("div", { class: `code-samples-panel${i === 0 ? " active" : ""}`, role: "tabpanel", "data-panel-index": String(i), children: _jsxs("div", { class: "code-block-wrapper relative", children: [_jsx("button", { class: "copy-btn absolute top-3 right-4 z-10 flex items-center justify-center size-[26px] rounded-md backdrop-blur text-[rgb(var(--color-gray-400))] hover:text-[rgb(var(--color-gray-500))] dark:text-[rgb(var(--color-gray-400))] dark:hover:text-[rgb(var(--color-gray-300))]", "data-copy-source": "code", "aria-label": "Copy code", children: _jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "w-4 h-4", children: [_jsx("path", { d: "M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }) }), _jsx("div", { class: "w-full px-4 py-3.5 text-sm leading-6 rounded-[14px] bg-[rgb(var(--color-code-block-light))] dark:bg-[rgb(var(--color-code-block-dark))] overflow-x-auto", style: "font-variant-ligatures: none", children: _jsx("div", { class: "font-mono whitespace-pre text-xs leading-[1.35rem] code-block", dangerouslySetInnerHTML: { __html: html } }) })] }) }, i));
|
|
14
|
+
})] }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CodeSamples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeSamples.js","sourceRoot":"","sources":["../../../src/components/openapi/CodeSamples.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAE,SAAS,EAAE,SAAS,EAAoB;IAC5E,MAAM,OAAO,GAAG,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEjC,OAAO,CACL,eA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AAC,cAAc,EAAC,OAAO,GAAG,EAC5R,eAAM,CAAC,EAAC,2IAA2I,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,KAAK,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,GAAG,IACvO,GACC,EACT,cAAK,KAAK,EAAC,yJAAyJ,EAAC,KAAK,EAAC,8BAA8B,YACvM,cAAK,KAAK,EAAC,+DAA+D,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAI,GACpH,IACF,IAfD,CAAC,CAgBF,CACP,CAAC;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NormalizedSchema } from "../../core/types.js";
|
|
2
|
+
interface DefinitionProps {
|
|
3
|
+
name: string;
|
|
4
|
+
schema: NormalizedSchema;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Schema definition with single-column content + sticky example panel.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Definition({ name, schema }: DefinitionProps): import("preact").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=Definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Definition.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Definition.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,eAAe,gCA+B3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { htmlId } from "../../utils/html-id.js";
|
|
3
|
+
import { SchemaView } from "../schema/SchemaView.js";
|
|
4
|
+
import { ExampleView } from "../schema/ExampleView.js";
|
|
5
|
+
/**
|
|
6
|
+
* Schema definition with single-column content + sticky example panel.
|
|
7
|
+
*/
|
|
8
|
+
export function Definition({ name, schema }) {
|
|
9
|
+
const id = `definition-${htmlId(name)}`;
|
|
10
|
+
return (_jsxs("div", { id: id, class: "py-8 border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]", "data-traverse-target": id, children: [_jsx("a", { id: `/definitions/${name}` }), _jsx("header", { class: "mb-4", children: _jsxs("div", { class: "flex items-baseline gap-2", children: [_jsx("h2", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: name }), _jsx("span", { class: "text-sm text-[rgb(var(--color-gray-500))] font-normal", children: schema.type ?? "object" })] }) }), _jsxs("div", { class: "flex flex-col xl:flex-row gap-8", children: [_jsx("div", { class: "flex-1 min-w-0", children: _jsx(SchemaView, { schema: schema }) }), _jsx("aside", { class: "hidden xl:block w-[28rem] shrink-0 sticky top-[9.5rem] self-start", children: _jsx(ExampleView, { schema: schema, title: "Example" }) })] }), _jsx("div", { class: "xl:hidden mt-6", children: _jsx(ExampleView, { schema: schema, title: "Example" }) })] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Definition.js","sourceRoot":"","sources":["../../../src/components/openapi/Definition.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOvD;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAmB;IAC1D,MAAM,EAAE,GAAG,cAAc,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IAExC,OAAO,CACL,eAAK,EAAE,EAAE,EAAE,EAAE,KAAK,EAAC,4FAA4F,0BAAuB,EAAE,aACtI,YAAG,EAAE,EAAE,gBAAgB,IAAI,EAAE,GAAI,EACjC,iBAAQ,KAAK,EAAC,MAAM,YAClB,eAAK,KAAK,EAAC,2BAA2B,aACpC,aAAI,KAAK,EAAC,4FAA4F,YAAE,IAAI,GAAM,EAClH,eAAM,KAAK,EAAC,uDAAuD,YAAE,MAAM,CAAC,IAAI,IAAI,QAAQ,GAAQ,IAChG,GACC,EAET,eAAK,KAAK,EAAC,iCAAiC,aAE1C,cAAK,KAAK,EAAC,gBAAgB,YACzB,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,GAAI,GAC1B,EAGN,gBAAO,KAAK,EAAC,mEAAmE,YAC9E,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,GACzC,IACJ,EAGN,cAAK,KAAK,EAAC,gBAAgB,YACzB,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAC,SAAS,GAAG,GAC3C,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* endpoint bar showing method, path, and server URL.
|
|
3
|
+
* Displayed at the top of each operation.
|
|
4
|
+
*/
|
|
5
|
+
interface EndpointBarProps {
|
|
6
|
+
method: string;
|
|
7
|
+
path: string;
|
|
8
|
+
serverUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function EndpointBar({ method, path, serverUrl }: EndpointBarProps): import("preact").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=EndpointBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointBar.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/EndpointBar.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,gBAAgB,gCA0CxE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* endpoint bar showing method, path, and server URL.
|
|
4
|
+
* Displayed at the top of each operation.
|
|
5
|
+
*/
|
|
6
|
+
const METHOD_COLORS = {
|
|
7
|
+
get: "bg-green-400/20 dark:bg-green-400/20 text-green-700 dark:text-green-400",
|
|
8
|
+
post: "bg-blue-400/20 dark:bg-blue-400/20 text-blue-700 dark:text-blue-400",
|
|
9
|
+
put: "bg-yellow-400/20 dark:bg-yellow-400/20 text-yellow-700 dark:text-yellow-400",
|
|
10
|
+
delete: "bg-red-400/20 dark:bg-red-400/20 text-red-700 dark:text-red-400",
|
|
11
|
+
patch: "bg-orange-400/20 dark:bg-orange-400/20 text-orange-700 dark:text-orange-400",
|
|
12
|
+
};
|
|
13
|
+
export function EndpointBar({ method, path, serverUrl }) {
|
|
14
|
+
const m = method.toLowerCase();
|
|
15
|
+
const colorClass = METHOD_COLORS[m] ?? "bg-gray-400/20 text-gray-700";
|
|
16
|
+
// Split path into segments for styled rendering
|
|
17
|
+
const segments = path.split("/").filter(Boolean);
|
|
18
|
+
return (_jsx("div", { class: "flex w-full flex-col rounded-2xl border border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)] p-1.5 mb-6", children: _jsx("div", { class: "flex items-center space-x-1.5", children: _jsxs("div", { class: "relative flex-1 flex gap-2 min-w-0 rounded-xl items-center p-1.5 pr-0 overflow-hidden border border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)]", children: [_jsx("div", { class: `rounded-lg font-bold px-1.5 py-0.5 text-sm leading-5 ${colorClass}`, children: method.toUpperCase() }), _jsxs("div", { class: "flex items-center space-x-2 overflow-x-auto flex-1 no-scrollbar", children: [_jsx("div", { class: "flex items-center gap-1 relative", children: _jsx("span", { class: "text-sm text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-400))] font-mono", children: serverUrl }) }), _jsx("div", { class: "flex items-center flex-1 gap-0.5 font-mono pr-1.5", children: segments.map((seg, i) => (_jsxs("span", { class: "flex items-center", children: [_jsx("span", { class: "text-sm text-[rgb(var(--color-gray-400))]", children: "/" }), _jsx("span", { class: `text-sm font-medium ${seg.startsWith("{")
|
|
19
|
+
? "text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]"
|
|
20
|
+
: "text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-50))]"}`, children: seg })] }, i))) })] })] }) }) }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=EndpointBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointBar.js","sourceRoot":"","sources":["../../../src/components/openapi/EndpointBar.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AAEH,MAAM,aAAa,GAA2B;IAC5C,GAAG,EAAE,yEAAyE;IAC9E,IAAI,EAAE,qEAAqE;IAC3E,GAAG,EAAE,6EAA6E;IAClF,MAAM,EAAE,iEAAiE;IACzE,KAAK,EAAE,6EAA6E;CACrF,CAAC;AAQF,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAoB;IACvE,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,8BAA8B,CAAC;IAEtE,gDAAgD;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEjD,OAAO,CACL,cAAK,KAAK,EAAC,mJAAmJ,YAC5J,cAAK,KAAK,EAAC,+BAA+B,YACxC,eAAK,KAAK,EAAC,6LAA6L,aAEtM,cAAK,KAAK,EAAE,wDAAwD,UAAU,EAAE,YAC7E,MAAM,CAAC,WAAW,EAAE,GACjB,EAGN,eAAK,KAAK,EAAC,iEAAiE,aAC1E,cAAK,KAAK,EAAC,kCAAkC,YAC3C,eAAM,KAAK,EAAC,4FAA4F,YACrG,SAAS,GACL,GACH,EACN,cAAK,KAAK,EAAC,mDAAmD,YAC3D,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACxB,gBAAc,KAAK,EAAC,mBAAmB,aACrC,eAAM,KAAK,EAAC,2CAA2C,kBAAS,EAChE,eAAM,KAAK,EAAE,uBACX,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;gDACjB,CAAC,CAAC,8EAA8E;gDAChF,CAAC,CAAC,yEACN,EAAE,YACC,GAAG,GACC,KARE,CAAC,CASL,CACR,CAAC,GACE,IACF,IACF,GACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Introduction.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Introduction.tsx"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,YAAY,iCAyC3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useContext } from "preact/hooks";
|
|
3
|
+
import { SpecContext } from "../../renderer/context.js";
|
|
4
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
5
|
+
/**
|
|
6
|
+
* API introduction: description, contact info, server URLs.
|
|
7
|
+
* Single-column layout; servers shown as a simple list.
|
|
8
|
+
*/
|
|
9
|
+
export function Introduction() {
|
|
10
|
+
const spec = useContext(SpecContext);
|
|
11
|
+
const { info, servers } = spec;
|
|
12
|
+
return (_jsxs("div", { id: "introduction", "data-traverse-target": "introduction", class: "mb-8", children: [info.description && (_jsx("div", { class: "prose prose-gray dark:prose-invert max-w-none", children: _jsx(Markdown, { content: info.description }) })), info.termsOfService && (_jsx("p", { class: "mt-4 text-sm text-[rgb(var(--color-gray-500))]", children: _jsx("a", { href: info.termsOfService, class: "text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]", children: "Terms of Service" }) })), info.contact?.email && (_jsxs("p", { class: "mt-2 text-sm text-[rgb(var(--color-gray-500))]", children: ["Contact: ", _jsx("a", { href: `mailto:${info.contact.email}`, class: "text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]", children: info.contact.email })] })), servers.length > 0 && (_jsxs("div", { class: "mt-6 rounded-xl border border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)] overflow-hidden", children: [_jsxs("div", { class: "px-4 py-2.5 text-xs font-semibold text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-300))] border-b border-[rgb(var(--color-gray-200)/0.7)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)]", children: ["Base URL", servers.length > 1 ? "s" : ""] }), servers.map((s, i) => (_jsxs("div", { class: `flex items-baseline gap-3 px-4 py-2 ${i > 0 ? "border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]" : ""}`, children: [_jsx("code", { class: "font-mono text-sm text-[rgb(var(--color-gray-800))] dark:text-[rgb(var(--color-gray-200))]", children: s.url }), s.description && (_jsx("span", { class: "text-xs text-[rgb(var(--color-gray-500))]", children: s.description }))] }, i)))] }))] }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Introduction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Introduction.js","sourceRoot":"","sources":["../../../src/components/openapi/Introduction.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;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eAAM,KAAK,EAAC,4FAA4F,YAAE,CAAC,CAAC,GAAG,GAAQ,EACtH,CAAC,CAAC,WAAW,IAAI,CAChB,eAAM,KAAK,EAAC,2CAA2C,YAAE,CAAC,CAAC,WAAW,GAAQ,CAC/E,KAJO,CAAC,CAKL,CACP,CAAC,IACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NormalizedOperation } from "../../core/types.js";
|
|
2
|
+
interface OperationProps {
|
|
3
|
+
operation: NormalizedOperation;
|
|
4
|
+
serverUrl: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Single operation with sticky code panel:
|
|
8
|
+
* - Endpoint bar at top
|
|
9
|
+
* - Single-column content (left) + sticky code panel (right, xl+ only)
|
|
10
|
+
*/
|
|
11
|
+
export declare function Operation({ operation: op, serverUrl }: OperationProps): import("preact").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAY/D,UAAU,cAAc;IACtB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,cAAc,gCAsErE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { htmlId } from "../../utils/html-id.js";
|
|
3
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
4
|
+
import { DeprecatedBadge } from "../ui/Badge.js";
|
|
5
|
+
import { SectionLabel } from "../ui/SectionLabel.js";
|
|
6
|
+
import { Parameters } from "./Parameters.js";
|
|
7
|
+
import { RequestBody, RequestBodyExample } from "./RequestBody.js";
|
|
8
|
+
import { ResponsesCopy, ResponsesExamples } from "./Responses.js";
|
|
9
|
+
import { SecurityCopy } from "./Security.js";
|
|
10
|
+
import { CodeSamplesExamples } from "./CodeSamples.js";
|
|
11
|
+
import { EndpointBar } from "./EndpointBar.js";
|
|
12
|
+
/**
|
|
13
|
+
* Single operation with sticky code panel:
|
|
14
|
+
* - Endpoint bar at top
|
|
15
|
+
* - Single-column content (left) + sticky code panel (right, xl+ only)
|
|
16
|
+
*/
|
|
17
|
+
export function Operation({ operation: op, serverUrl }) {
|
|
18
|
+
const id = `operation-${htmlId(op.path)}-${htmlId(op.method)}`;
|
|
19
|
+
const hasParams = op.parameters.length > 0;
|
|
20
|
+
const hasBody = !!op.requestBody;
|
|
21
|
+
return (_jsxs("div", { id: id, class: "py-8 border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]", "data-traverse-target": id, children: [_jsxs("header", { class: "mb-6", children: [op.summary && (_jsx("h2", { class: "text-2xl sm:text-3xl text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] tracking-tight font-bold mb-2", children: _jsx(Markdown, { content: op.summary, inline: true }) })), op.deprecated && _jsx(DeprecatedBadge, {})] }), _jsx(EndpointBar, { method: op.method, path: op.path, serverUrl: serverUrl }), _jsxs("div", { class: "flex flex-col xl:flex-row gap-8", children: [_jsxs("div", { class: "flex-1 min-w-0", children: [op.description && (_jsx("div", { class: "prose prose-gray dark:prose-invert mb-6", children: _jsx(Markdown, { content: op.description }) })), hasBody && (_jsxs("div", { class: "mt-6", children: [_jsx(SectionLabel, { children: "Body" }), _jsx(RequestBody, { body: op.requestBody })] })), hasParams && (_jsxs("div", { class: "mt-6", children: [_jsx(SectionLabel, { children: "Parameters" }), _jsx(Parameters, { parameters: op.parameters })] })), op.responses.length > 0 && (_jsxs("div", { class: "mt-6", children: [_jsx(SectionLabel, { children: "Response" }), _jsx(ResponsesCopy, { responses: op.responses })] })), _jsx(SecurityCopy, { security: op.security })] }), _jsxs("aside", { class: "hidden xl:block w-[28rem] shrink-0 sticky top-[9.5rem] self-start max-h-[calc(100vh-12rem)] overflow-y-auto space-y-4", children: [_jsx(CodeSamplesExamples, { operation: op, serverUrl: serverUrl }), hasBody && _jsx(RequestBodyExample, { body: op.requestBody }), _jsx(ResponsesExamples, { responses: op.responses })] })] }), _jsxs("div", { class: "xl:hidden mt-8 space-y-4", children: [_jsx(CodeSamplesExamples, { operation: op, serverUrl: serverUrl }), hasBody && _jsx(RequestBodyExample, { body: op.requestBody }), _jsx(ResponsesExamples, { responses: op.responses })] })] }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../../src/components/openapi/Operation.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAkB;IACp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CAC1B,eAAK,KAAK,EAAC,MAAM,aACf,KAAC,YAAY,2BAAwB,EACrC,KAAC,aAAa,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,GAAI,IACtC,CACP,EAED,KAAC,YAAY,IAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,GAAI,IACnC,EAGN,iBAAO,KAAK,EAAC,uHAAuH,aAClI,KAAC,mBAAmB,IAAC,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,GAAI,EAC3D,OAAO,IAAI,KAAC,kBAAkB,IAAC,IAAI,EAAE,EAAE,CAAC,WAAY,GAAI,EACzD,KAAC,iBAAiB,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,GAAI,IACxC,IACJ,EAGN,eAAK,KAAK,EAAC,0BAA0B,aACnC,KAAC,mBAAmB,IAAC,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,GAAI,EAC3D,OAAO,IAAI,KAAC,kBAAkB,IAAC,IAAI,EAAE,EAAE,CAAC,WAAY,GAAI,EACzD,KAAC,iBAAiB,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,GAAI,IAC1C,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NormalizedParameter } from "../../core/types.js";
|
|
2
|
+
interface ParametersProps {
|
|
3
|
+
parameters: NormalizedParameter[];
|
|
4
|
+
}
|
|
5
|
+
export declare function Parameters({ parameters }: ParametersProps): import("preact").JSX.Element | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=Parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Parameters.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Parameters.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAK/D,UAAU,eAAe;IACvB,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC;AAED,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,EAAE,eAAe,uCA2BzD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { SchemaDatatype } from "../schema/SchemaDatatype.js";
|
|
3
|
+
import { RequiredBadge, DeprecatedBadge } from "../ui/Badge.js";
|
|
4
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
5
|
+
export function Parameters({ parameters }) {
|
|
6
|
+
if (!parameters.length)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsx("div", { class: "params-list", children: parameters.map((param) => (_jsxs("div", { class: "param-item", children: [_jsxs("div", { class: "param-header", children: [_jsx("code", { class: "param-name", children: param.name }), param.schema && (_jsx("span", { class: "param-type", children: _jsx(SchemaDatatype, { schema: param.schema }) })), param.required && _jsx(RequiredBadge, {}), param.deprecated && _jsx(DeprecatedBadge, {}), _jsx("span", { class: "param-in", children: param.in })] }), param.description && (_jsx("div", { class: "param-description", children: _jsx(Markdown, { content: param.description }) }))] }, `${param.in}-${param.name}`))) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Parameters.js","sourceRoot":"","sources":["../../../src/components/openapi/Parameters.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,MAAM,UAAU,UAAU,CAAC,EAAE,UAAU,EAAmB;IACxD,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEpC,OAAO,CACL,cAAK,KAAK,EAAC,aAAa,YACrB,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzB,eAAuC,KAAK,EAAC,YAAY,aACvD,eAAK,KAAK,EAAC,cAAc,aACvB,eAAM,KAAK,EAAC,YAAY,YAAE,KAAK,CAAC,IAAI,GAAQ,EAC3C,KAAK,CAAC,MAAM,IAAI,CACf,eAAM,KAAK,EAAC,YAAY,YACtB,KAAC,cAAc,IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAI,GACnC,CACR,EACA,KAAK,CAAC,QAAQ,IAAI,KAAC,aAAa,KAAG,EACnC,KAAK,CAAC,UAAU,IAAI,KAAC,eAAe,KAAG,EACxC,eAAM,KAAK,EAAC,UAAU,YAAE,KAAK,CAAC,EAAE,GAAQ,IACpC,EACL,KAAK,CAAC,WAAW,IAAI,CACpB,cAAK,KAAK,EAAC,mBAAmB,YAC5B,KAAC,QAAQ,IAAC,OAAO,EAAE,KAAK,CAAC,WAAW,GAAI,GACpC,CACP,KAhBO,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,IAAI,EAAE,CAiB/B,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NormalizedRequestBody } from "../../core/types.js";
|
|
2
|
+
interface RequestBodyProps {
|
|
3
|
+
body: NormalizedRequestBody;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Request body content (rendered in the main content column).
|
|
7
|
+
*/
|
|
8
|
+
export declare function RequestBody({ body }: RequestBodyProps): import("preact").JSX.Element | null;
|
|
9
|
+
interface RequestBodyExampleProps {
|
|
10
|
+
body: NormalizedRequestBody;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Request body example (rendered in the sticky code panel).
|
|
14
|
+
*/
|
|
15
|
+
export declare function RequestBodyExample({ body }: RequestBodyExampleProps): import("preact").JSX.Element | null;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=RequestBody.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/RequestBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAMjE,UAAU,gBAAgB;IACxB,IAAI,EAAE,qBAAqB,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,gBAAgB,uCAwBrD;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,qBAAqB,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,uBAAuB,uCAQnE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { SchemaView } from "../schema/SchemaView.js";
|
|
3
|
+
import { ExampleView } from "../schema/ExampleView.js";
|
|
4
|
+
import { RequiredBadge } from "../ui/Badge.js";
|
|
5
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
6
|
+
/**
|
|
7
|
+
* Request body content (rendered in the main content column).
|
|
8
|
+
*/
|
|
9
|
+
export function RequestBody({ body }) {
|
|
10
|
+
const mediaTypes = Object.entries(body.content);
|
|
11
|
+
if (!mediaTypes.length)
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsx("div", { children: mediaTypes.map(([mediaType, content]) => (_jsxs("div", { children: [_jsxs("div", { class: "flex items-center gap-2 mb-2", children: [_jsx("div", { class: "font-mono px-2 py-0.5 text-xs font-medium text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-300))]", children: mediaType }), body.required && _jsx(RequiredBadge, {})] }), body.description && (_jsx("div", { class: "mb-4 text-sm text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))]", children: _jsx(Markdown, { content: body.description }) })), content.schema && _jsx(SchemaView, { schema: content.schema })] }, mediaType))) }));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Request body example (rendered in the sticky code panel).
|
|
17
|
+
*/
|
|
18
|
+
export function RequestBodyExample({ body }) {
|
|
19
|
+
const mediaTypes = Object.entries(body.content);
|
|
20
|
+
if (!mediaTypes.length)
|
|
21
|
+
return null;
|
|
22
|
+
const [, content] = mediaTypes[0];
|
|
23
|
+
if (!content.schema)
|
|
24
|
+
return null;
|
|
25
|
+
return _jsx(ExampleView, { schema: content.schema, title: "Request Body" });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=RequestBody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestBody.js","sourceRoot":"","sources":["../../../src/components/openapi/RequestBody.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,EAAoB;IACpD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEpC,OAAO,CACL,wBACG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CACxC,0BACE,eAAK,KAAK,EAAC,8BAA8B,aACvC,cAAK,KAAK,EAAC,oHAAoH,YAC5H,SAAS,GACN,EACL,IAAI,CAAC,QAAQ,IAAI,KAAC,aAAa,KAAG,IAC/B,EACL,IAAI,CAAC,WAAW,IAAI,CACnB,cAAK,KAAK,EAAC,uFAAuF,YAChG,KAAC,QAAQ,IAAC,OAAO,EAAE,IAAI,CAAC,WAAW,GAAI,GACnC,CACP,EACA,OAAO,CAAC,MAAM,IAAI,KAAC,UAAU,IAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAI,KAZjD,SAAS,CAab,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAMD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAA2B;IAClE,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,UAAU,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEpC,MAAM,CAAC,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEjC,OAAO,KAAC,WAAW,IAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAC,cAAc,GAAG,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NormalizedResponse } from "../../core/types.js";
|
|
2
|
+
interface ResponsesProps {
|
|
3
|
+
responses: NormalizedResponse[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Response status list (rendered in the content column).
|
|
7
|
+
*/
|
|
8
|
+
export declare function ResponsesCopy({ responses }: ResponsesProps): import("preact").JSX.Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Response examples (rendered in the sticky code panel).
|
|
11
|
+
*/
|
|
12
|
+
export declare function ResponsesExamples({ responses }: ResponsesProps): import("preact").JSX.Element | null;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=Responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Responses.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Responses.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAM9D,UAAU,cAAc;IACtB,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAUD;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,cAAc,uCA6B1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE,cAAc,uCA0B9D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { httpStatusText } from "../../utils/http.js";
|
|
3
|
+
import { SchemaDatatype } from "../schema/SchemaDatatype.js";
|
|
4
|
+
import { ExampleView } from "../schema/ExampleView.js";
|
|
5
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
6
|
+
function statusColorClass(code) {
|
|
7
|
+
if (code.startsWith("2"))
|
|
8
|
+
return "bg-green-400/20 text-green-700 dark:text-green-400";
|
|
9
|
+
if (code.startsWith("3"))
|
|
10
|
+
return "bg-blue-400/20 text-blue-700 dark:text-blue-400";
|
|
11
|
+
if (code.startsWith("4"))
|
|
12
|
+
return "bg-yellow-400/20 text-yellow-700 dark:text-yellow-400";
|
|
13
|
+
if (code.startsWith("5"))
|
|
14
|
+
return "bg-red-400/20 text-red-700 dark:text-red-400";
|
|
15
|
+
return "bg-gray-400/20 text-gray-700 dark:text-gray-400";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Response status list (rendered in the content column).
|
|
19
|
+
*/
|
|
20
|
+
export function ResponsesCopy({ responses }) {
|
|
21
|
+
if (!responses.length)
|
|
22
|
+
return null;
|
|
23
|
+
return (_jsx("div", { children: responses.map((r) => (_jsxs("div", { class: "py-6 border-b border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))] last:border-b-0", children: [_jsxs("div", { class: "flex items-baseline gap-2 font-mono text-sm", children: [_jsx("span", { class: `px-1.5 py-0.5 rounded-md text-xs font-bold ${statusColorClass(r.statusCode)}`, children: r.statusCode }), _jsx("span", { class: "font-medium text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: httpStatusText(r.statusCode) }), r.content && (_jsx("span", { class: "text-xs text-[rgb(var(--color-gray-500))]", children: renderResponseType(r) }))] }), r.description && (_jsx("div", { class: "mt-2 text-sm text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))]", children: _jsx(Markdown, { content: r.description }) }))] }, r.statusCode))) }));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Response examples (rendered in the sticky code panel).
|
|
27
|
+
*/
|
|
28
|
+
export function ResponsesExamples({ responses }) {
|
|
29
|
+
if (!responses.length)
|
|
30
|
+
return null;
|
|
31
|
+
const examples = responses
|
|
32
|
+
.map((r) => {
|
|
33
|
+
const schema = getResponseSchema(r);
|
|
34
|
+
if (!schema)
|
|
35
|
+
return null;
|
|
36
|
+
return { statusCode: r.statusCode, schema };
|
|
37
|
+
})
|
|
38
|
+
.filter(Boolean);
|
|
39
|
+
if (!examples.length)
|
|
40
|
+
return null;
|
|
41
|
+
// If only one response, show directly
|
|
42
|
+
if (examples.length === 1) {
|
|
43
|
+
return _jsx(ExampleView, { schema: examples[0].schema, title: `${examples[0].statusCode} ${httpStatusText(examples[0].statusCode)}` });
|
|
44
|
+
}
|
|
45
|
+
// Multiple responses: show first by default (tabs handled by client JS)
|
|
46
|
+
return (_jsx("div", { class: "space-y-3", children: examples.map((ex) => (_jsx(ExampleView, { schema: ex.schema, title: `${ex.statusCode} ${httpStatusText(ex.statusCode)}` }, ex.statusCode))) }));
|
|
47
|
+
}
|
|
48
|
+
function renderResponseType(r) {
|
|
49
|
+
const schema = getResponseSchema(r);
|
|
50
|
+
if (!schema)
|
|
51
|
+
return null;
|
|
52
|
+
return _jsx(SchemaDatatype, { schema: schema });
|
|
53
|
+
}
|
|
54
|
+
function getResponseSchema(r) {
|
|
55
|
+
if (!r.content)
|
|
56
|
+
return null;
|
|
57
|
+
const firstMedia = Object.values(r.content)[0];
|
|
58
|
+
return firstMedia?.schema ?? null;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=Responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Responses.js","sourceRoot":"","sources":["../../../src/components/openapi/Responses.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM7C,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,oDAAoD,CAAC;IACtF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,iDAAiD,CAAC;IACnF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,uDAAuD,CAAC;IACzF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,8CAA8C,CAAC;IAChF,OAAO,iDAAiD,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,SAAS,EAAkB;IACzD,IAAI,CAAC,SAAS,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEnC,OAAO,CACL,wBACG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,eAAwB,KAAK,EAAC,4GAA4G,aACxI,eAAK,KAAK,EAAC,6CAA6C,aACtD,eAAM,KAAK,EAAE,8CAA8C,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,YACxF,CAAC,CAAC,UAAU,GACR,EACP,eAAM,KAAK,EAAC,sFAAsF,YAC/F,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,GACxB,EACN,CAAC,CAAC,OAAO,IAAI,CACZ,eAAM,KAAK,EAAC,2CAA2C,YACp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E,GAAG,EAAE,CAAC,UAAU,IAAI,cAAc,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,IAA5F,EAAE,CAAC,UAAU,CAAmF,CACnH,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAqB;IAC/C,MAAM,MAAM,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,GAAI,CAAC;AAC5C,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAqB;IAC9C,IAAI,CAAC,CAAC,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC5B,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,UAAU,EAAE,MAAM,IAAI,IAAI,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SecurityRequirement } from "../../core/types.js";
|
|
2
|
+
interface SecurityProps {
|
|
3
|
+
security: SecurityRequirement[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Per-operation security requirements.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SecurityCopy({ security }: SecurityProps): import("preact").JSX.Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Global authentication/security definitions section.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SecurityDefinitions(): import("preact").JSX.Element | null;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=Security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Security.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,UAAU,aAAa;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,aAAa,uCA4CvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,wCAkElC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { useContext } from "preact/hooks";
|
|
3
|
+
import { SpecContext } from "../../renderer/context.js";
|
|
4
|
+
import { SectionLabel } from "../ui/SectionLabel.js";
|
|
5
|
+
/**
|
|
6
|
+
* Per-operation security requirements.
|
|
7
|
+
*/
|
|
8
|
+
export function SecurityCopy({ security }) {
|
|
9
|
+
const spec = useContext(SpecContext);
|
|
10
|
+
if (!security.length)
|
|
11
|
+
return null;
|
|
12
|
+
const hasEntries = security.some((req) => Object.keys(req).length > 0);
|
|
13
|
+
if (!hasEntries)
|
|
14
|
+
return null;
|
|
15
|
+
return (_jsxs("div", { class: "mt-6", children: [_jsx(SectionLabel, { children: "Authorization" }), _jsx("div", { children: security.map((req, i) => (_jsx("div", { children: Object.entries(req).map(([name, scopes]) => {
|
|
16
|
+
const scheme = spec.securitySchemes[name];
|
|
17
|
+
return (_jsxs("div", { class: "py-4 border-b border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))] last:border-b-0", children: [_jsxs("div", { class: "flex items-baseline gap-2 flex-wrap font-mono text-sm", children: [_jsx("span", { class: "font-semibold text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]", children: name }), scheme && (_jsxs("span", { class: "rounded-md bg-[rgb(var(--color-gray-100)/0.5)] px-2 py-0.5 text-xs font-medium text-[rgb(var(--color-gray-600))] dark:bg-[rgb(var(--color-surface-dark-tint)/0.05)] dark:text-[rgb(var(--color-gray-200))]", children: [scheme.type, scheme.scheme && ` (${scheme.scheme})`, scheme.in && ` in ${scheme.in}`] }))] }), (scheme?.description || scopes.length > 0) && (_jsxs("div", { class: "mt-2 text-sm text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))]", children: [scheme?.description && _jsx("p", { children: scheme.description }), scopes.length > 0 && (_jsxs("p", { class: "mt-1", children: ["Scopes: ", _jsx("code", { class: "text-xs font-medium", children: scopes.join(", ") })] }))] }))] }, name));
|
|
18
|
+
}) }, i))) })] }));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Global authentication/security definitions section.
|
|
22
|
+
*/
|
|
23
|
+
export function SecurityDefinitions() {
|
|
24
|
+
const spec = useContext(SpecContext);
|
|
25
|
+
const schemes = Object.entries(spec.securitySchemes);
|
|
26
|
+
if (!schemes.length)
|
|
27
|
+
return null;
|
|
28
|
+
return (_jsxs("div", { id: "authentication", class: "py-8 border-t border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))]", "data-traverse-target": "authentication", children: [_jsx("h2", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] mb-4", children: "Authentication" }), _jsx("div", { children: schemes.map(([name, scheme]) => (_jsxs("div", { class: "py-4 border-b border-[rgb(var(--color-gray-100))] dark:border-[rgb(var(--color-gray-800))] last:border-b-0", children: [_jsxs("div", { class: "flex items-baseline gap-2 flex-wrap font-mono text-sm", children: [_jsx("span", { class: "font-semibold text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]", children: name }), _jsx("span", { class: "rounded-md bg-[rgb(var(--color-gray-100)/0.5)] px-2 py-0.5 text-xs font-medium text-[rgb(var(--color-gray-600))] dark:bg-[rgb(var(--color-surface-dark-tint)/0.05)] dark:text-[rgb(var(--color-gray-200))]", children: scheme.type })] }), _jsxs("div", { class: "mt-2 text-sm text-[rgb(var(--color-gray-700))] dark:text-[rgb(var(--color-gray-400))]", children: [scheme.description && _jsx("p", { children: scheme.description }), scheme.type === "apiKey" && (_jsxs("p", { class: "mt-1", children: ["API Key: ", _jsx("code", { class: "text-xs font-medium", children: scheme.name }), " in ", scheme.in] })), scheme.type === "http" && (_jsxs("p", { class: "mt-1", children: ["Scheme: ", scheme.scheme, scheme.bearerFormat && ` (${scheme.bearerFormat})`] })), scheme.type === "oauth2" && scheme.flows && (_jsx("div", { class: "mt-2 space-y-2", children: Object.entries(scheme.flows).map(([flowType, flow]) => (_jsxs("div", { children: [_jsx("strong", { class: "text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))]", children: flowType }), flow?.authorizationUrl && (_jsxs("p", { class: "mt-1", children: ["Authorization: ", _jsx("code", { class: "text-xs", children: flow.authorizationUrl })] })), flow?.tokenUrl && (_jsxs("p", { class: "mt-1", children: ["Token: ", _jsx("code", { class: "text-xs", children: flow.tokenUrl })] })), flow?.scopes && Object.keys(flow.scopes).length > 0 && (_jsxs("p", { class: "mt-1", children: ["Scopes:", " ", Object.entries(flow.scopes)
|
|
29
|
+
.map(([s, desc]) => `${s} — ${desc}`)
|
|
30
|
+
.join(", ")] }))] }, flowType))) })), scheme.type === "openIdConnect" && scheme.openIdConnectUrl && (_jsxs("p", { class: "mt-1", children: ["OpenID Connect:", " ", _jsx("a", { href: scheme.openIdConnectUrl, class: "text-[rgb(var(--color-primary))] dark:text-[rgb(var(--color-primary-light))]", children: scheme.openIdConnectUrl })] }))] })] }, name))) })] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=Security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Security.js","sourceRoot":"","sources":["../../../src/components/openapi/Security.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAMrD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAiB;IACtD,MAAM,IAAI,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAErC,IAAI,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,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NormalizedTag } from "../../core/types.js";
|
|
2
|
+
interface TagsProps {
|
|
3
|
+
tags: NormalizedTag[];
|
|
4
|
+
serverUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function Tags({ tags, serverUrl }: TagsProps): import("preact").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=Tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.d.ts","sourceRoot":"","sources":["../../../src/components/openapi/Tags.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKzD,UAAU,SAAS;IACjB,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,SAAS,gCA8BlD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
import { htmlId } from "../../utils/html-id.js";
|
|
3
|
+
import { Markdown } from "../ui/Markdown.js";
|
|
4
|
+
import { Operation } from "./Operation.js";
|
|
5
|
+
export function Tags({ tags, serverUrl }) {
|
|
6
|
+
return (_jsx(_Fragment, { children: tags
|
|
7
|
+
.filter((t) => !t.hidden)
|
|
8
|
+
.map((tag) => (_jsxs("div", { class: "mt-12", children: [_jsxs("div", { id: `tag-${htmlId(tag.name)}`, "data-traverse-target": `tag-${htmlId(tag.name)}`, class: "mb-6", children: [_jsx("h1", { class: "text-xl font-bold text-[rgb(var(--color-gray-900))] dark:text-[rgb(var(--color-gray-200))] mb-2", children: tag.name }), tag.description && (_jsx("div", { class: "prose prose-gray dark:prose-invert text-sm max-w-none", children: _jsx(Markdown, { content: tag.description }) }))] }), tag.operations.map((op) => (_jsx(Operation, { operation: op, serverUrl: serverUrl }, `${op.method}-${op.path}`)))] }, tag.name))) }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tags.js","sourceRoot":"","sources":["../../../src/components/openapi/Tags.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C,MAAM,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAa;IACjD,OAAO,CACL,4BACG,IAAI;aACF,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;aACxB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACZ,eAAoB,KAAK,EAAC,OAAO,aAC/B,eACE,EAAE,EAAE,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,0BACP,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAC/C,KAAK,EAAC,MAAM,aAEZ,aAAI,KAAK,EAAC,iGAAiG,YAAE,GAAG,CAAC,IAAI,GAAM,EAC1H,GAAG,CAAC,WAAW,IAAI,CAClB,cAAK,KAAK,EAAC,uDAAuD,YAChE,KAAC,QAAQ,IAAC,OAAO,EAAE,GAAG,CAAC,WAAW,GAAI,GAClC,CACP,IACG,EACL,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAC1B,KAAC,SAAS,IAER,SAAS,EAAE,EAAE,EACb,SAAS,EAAE,SAAS,IAFf,GAAG,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,EAAE,CAG9B,CACH,CAAC,KAnBM,GAAG,CAAC,IAAI,CAoBZ,CACP,CAAC,GACH,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NormalizedSchema } from "../../core/types.js";
|
|
2
|
+
interface ExampleViewProps {
|
|
3
|
+
schema: NormalizedSchema;
|
|
4
|
+
title?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders a JSON example in a light-themed code card.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ExampleView({ schema, title }: ExampleViewProps): import("preact").JSX.Element | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ExampleView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleView.d.ts","sourceRoot":"","sources":["../../../src/components/schema/ExampleView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,UAAU,gBAAgB;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,gBAAgB,uCAkB9D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { generateExample } from "../../utils/example-generator.js";
|
|
3
|
+
import { highlightCode } from "../../utils/highlighter.js";
|
|
4
|
+
/**
|
|
5
|
+
* Renders a JSON example in a light-themed code card.
|
|
6
|
+
*/
|
|
7
|
+
export function ExampleView({ schema, title }) {
|
|
8
|
+
const example = schema.example ?? generateExample(schema);
|
|
9
|
+
if (example === undefined)
|
|
10
|
+
return null;
|
|
11
|
+
const json = JSON.stringify(example, null, 2);
|
|
12
|
+
const html = highlightCode(json, "json");
|
|
13
|
+
return (_jsxs("div", { class: "not-prose rounded-2xl border border-[rgb(var(--color-gray-950)/0.1)] dark:border-[rgb(var(--color-border-dark-subtle)/0.1)] p-0.5 bg-[rgb(var(--color-gray-50))] dark:bg-[rgb(var(--color-surface-dark-tint)/0.05)] overflow-hidden", children: [title && (_jsx("div", { class: "flex items-center px-2.5 py-1 text-xs font-medium text-[rgb(var(--color-gray-600))] dark:text-[rgb(var(--color-gray-300))]", children: title })), _jsx("div", { class: "w-full px-4 py-3.5 text-sm leading-6 rounded-[14px] bg-[rgb(var(--color-code-block-light))] dark:bg-[rgb(var(--color-code-block-dark))] overflow-x-auto", style: "font-variant-ligatures: none", children: _jsx("div", { class: "font-mono whitespace-pre text-xs leading-[1.35rem]", dangerouslySetInnerHTML: { __html: html } }) })] }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ExampleView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleView.js","sourceRoot":"","sources":["../../../src/components/schema/ExampleView.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAO3D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAoB;IAC7D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACzC,OAAO,CACL,eAAK,KAAK,EAAC,qOAAqO,aAC7O,KAAK,IAAI,CACR,cAAK,KAAK,EAAC,4HAA4H,YACpI,KAAK,GACF,CACP,EACD,cAAK,KAAK,EAAC,yJAAyJ,EAAC,KAAK,EAAC,8BAA8B,YACvM,cAAK,KAAK,EAAC,oDAAoD,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAI,GACzG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NormalizedSchema } from "../../core/types.js";
|
|
2
|
+
interface SchemaDatatypeProps {
|
|
3
|
+
schema: NormalizedSchema;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders type information matching the original Sourcey schema display.
|
|
7
|
+
* Uses .json-property-type, .json-property-format, .json-property-enum, etc.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SchemaDatatype({ schema }: SchemaDatatypeProps): import("preact").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SchemaDatatype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaDatatype.d.ts","sourceRoot":"","sources":["../../../src/components/schema/SchemaDatatype.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,UAAU,mBAAmB;IAC3B,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,gCAkB7D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
2
|
+
import { schemaRange } from "../../utils/http.js";
|
|
3
|
+
/**
|
|
4
|
+
* Renders type information matching the original Sourcey schema display.
|
|
5
|
+
* Uses .json-property-type, .json-property-format, .json-property-enum, etc.
|
|
6
|
+
*/
|
|
7
|
+
export function SchemaDatatype({ schema }) {
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { class: "json-property-type", children: formatBaseType(schema) }), schema.format && (_jsxs("span", { class: "json-property-format", children: [" (", schema.format, ")"] })), renderEnum(schema.enum) ||
|
|
9
|
+
(schema.type === "array" && schema.items?.enum && renderEnum(schema.items.enum)), schemaRange(schema) && (_jsx("span", { class: "json-property-range", children: schemaRange(schema) })), schema.default !== undefined && (_jsx("span", { class: "json-property-default-value", children: String(schema.default) })), schema.nullable && _jsx("span", { class: "json-property-type", children: " | null" })] }));
|
|
10
|
+
}
|
|
11
|
+
function renderEnum(values) {
|
|
12
|
+
if (!values?.length)
|
|
13
|
+
return null;
|
|
14
|
+
return (_jsx("span", { class: "json-property-enum", children: values.map((v, i) => (_jsx("span", { class: "json-property-enum-item", children: String(v) }, i))) }));
|
|
15
|
+
}
|
|
16
|
+
function formatBaseType(schema) {
|
|
17
|
+
if (schema.allOf?.length) {
|
|
18
|
+
return schema.allOf.map(formatBaseType).join(" & ");
|
|
19
|
+
}
|
|
20
|
+
if (schema.oneOf?.length) {
|
|
21
|
+
return schema.oneOf.map(formatBaseType).join(" | ");
|
|
22
|
+
}
|
|
23
|
+
if (schema.anyOf?.length) {
|
|
24
|
+
return schema.anyOf.map(formatBaseType).join(" | ");
|
|
25
|
+
}
|
|
26
|
+
if (schema.type === "array" && schema.items) {
|
|
27
|
+
const itemType = schema.items.refName ?? formatBaseType(schema.items);
|
|
28
|
+
return `Array<${itemType}>`;
|
|
29
|
+
}
|
|
30
|
+
if (schema.refName) {
|
|
31
|
+
return schema.refName;
|
|
32
|
+
}
|
|
33
|
+
const type = Array.isArray(schema.type) ? schema.type.join(" | ") : schema.type;
|
|
34
|
+
return type ?? "any";
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=SchemaDatatype.js.map
|