apiuikit 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/CodeSamples-CXtSA6EK.js +4298 -0
- package/dist/CodeSamples-D7dq1xEM.cjs +50 -0
- package/dist/apiuikit.cjs.js +1 -1
- package/dist/apiuikit.es.js +30 -22
- package/dist/config/config.d.ts +48 -0
- package/dist/contexts/useSpec.d.ts +3 -0
- package/dist/helpers/jsonPointer.d.ts +5 -0
- package/dist/helpers/llmsTxt.d.ts +51 -0
- package/dist/helpers/specAdapters.d.ts +32 -0
- package/dist/helpers/toMarkdown.d.ts +5 -6
- package/dist/hooks/useDocumentProviderValue.d.ts +3 -1
- package/dist/index-BJ0X8yP3.cjs +133 -0
- package/dist/{index-DM2MTkYV.js → index-BMRPdMaB.js} +1 -1
- package/dist/{index-EeGvEXPN.cjs → index-BoAORjov.cjs} +1 -1
- package/dist/{index-B5IBIM-V.cjs → index-CZjVUeK4.cjs} +1 -1
- package/dist/index-DCDYBZcY.js +1461 -0
- package/dist/index-DwzxTmOd.js +13614 -0
- package/dist/index-d8kJa7YD.cjs +4 -0
- package/dist/{index-iXpNcBcP.js → index-ib-tk7y5.js} +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/markdown-assets/protoToJsonSchema-CBPWaboT.js +6193 -0
- package/dist/markdown-assets/protoToJsonSchema-CgkcluFJ.js +83 -0
- package/dist/markdown.cjs +91 -0
- package/dist/markdown.d.ts +8 -0
- package/dist/markdown.es.js +2101 -0
- package/dist/{protoToJsonSchema-CcEvAEt4.js → protoToJsonSchema-Btyc_WLL.js} +112 -108
- package/dist/{protoToJsonSchema-BNZrP3Fa.cjs → protoToJsonSchema-wxazjeYy.cjs} +10 -10
- package/dist/{protobufSchemaParser-BaWs_7UI.js → protobufSchemaParser-9KjS7p8W.js} +2 -2
- package/dist/{protobufSchemaParser-7sU6XBEb.cjs → protobufSchemaParser-G1NujZ28.cjs} +1 -1
- package/dist/shims/utilInspect.d.ts +2 -0
- package/package.json +8 -3
- package/dist/components/Navigation/tests/spineTicks.test.d.ts +0 -1
- package/dist/components/schema/tests/SchemaTab.test.d.ts +0 -1
- package/dist/components/schema/tests/schemaUtils.test.d.ts +0 -1
- package/dist/components/tests/Authorization.test.d.ts +0 -1
- package/dist/components/tests/Bindings.test.d.ts +0 -1
- package/dist/components/tests/ChannelAddress.test.d.ts +0 -1
- package/dist/components/tests/CodeBlock.test.d.ts +0 -1
- package/dist/components/tests/CodeSamples.test.d.ts +0 -1
- package/dist/components/tests/CopyMarkdownButton.test.d.ts +0 -1
- package/dist/components/tests/ErrorBoundary.test.d.ts +0 -1
- package/dist/components/tests/MarkdownExportMenu.test.d.ts +0 -1
- package/dist/components/tests/RenderExtensions.test.d.ts +0 -1
- package/dist/containers/AsyncAPI/tests/AsyncAPI.test.d.ts +0 -1
- package/dist/containers/AsyncAPI/tests/AsyncAPIErrorBoundary.test.d.ts +0 -1
- package/dist/containers/AsyncAPI/tests/AsyncAPIRenderer.test.d.ts +0 -1
- package/dist/containers/AsyncAPI/tests/searchHighlight.test.d.ts +0 -1
- package/dist/containers/OpenAPI/tests/OpenAPI.test.d.ts +0 -1
- package/dist/containers/OpenAPI/tests/OpenAPIErrorBoundary.test.d.ts +0 -1
- package/dist/containers/OpenAPI/tests/OpenAPIRenderer.test.d.ts +0 -1
- package/dist/containers/Path/tests/PathOperation.test.d.ts +0 -1
- package/dist/containers/Path/tests/Paths.test.d.ts +0 -1
- package/dist/helpers/avro/tests/avroToJsonSchema.test.d.ts +0 -1
- package/dist/helpers/protobuf/tests/protoToJsonSchema.test.d.ts +0 -1
- package/dist/helpers/protobuf/tests/protobufSchemaParser.test.d.ts +0 -1
- package/dist/helpers/tests/codeSamples.test.d.ts +0 -1
- package/dist/helpers/tests/exampleSchema.test.d.ts +0 -1
- package/dist/helpers/tests/openapiSearchIndex.test.d.ts +0 -1
- package/dist/helpers/tests/resolveDocument.test.d.ts +0 -1
- package/dist/helpers/tests/schemaFormat.test.d.ts +0 -1
- package/dist/helpers/tests/toMarkdown.test.d.ts +0 -1
- package/dist/index-BqogUhNO.js +0 -19011
- package/dist/index-mYBY1Eu8.cjs +0 -177
- package/dist/public/tests/sections.test.d.ts +0 -1
- package/dist/stories/AsyncAPI.stories.d.ts +0 -14
- package/dist/stories/AsyncAPIRenderer.stories.d.ts +0 -17
- package/dist/stories/Authorization.stories.d.ts +0 -13
- package/dist/stories/Bindings.stories.d.ts +0 -12
- package/dist/stories/ChannelAddress.stories.d.ts +0 -13
- package/dist/stories/CodeBlock.stories.d.ts +0 -11
- package/dist/stories/Examples.stories.d.ts +0 -11
- package/dist/stories/Information.stories.d.ts +0 -9
- package/dist/stories/Message.stories.d.ts +0 -11
- package/dist/stories/Messages.stories.d.ts +0 -11
- package/dist/stories/Operation.stories.d.ts +0 -10
- package/dist/stories/Operations.stories.d.ts +0 -16
- package/dist/stories/SchemaTab.stories.d.ts +0 -12
- package/dist/stories/SchemaTree.stories.d.ts +0 -24
- package/dist/stories/SearchPanel.stories.d.ts +0 -16
- package/dist/stories/Server.stories.d.ts +0 -12
- package/dist/stories/TabToggle.stories.d.ts +0 -10
- package/dist/stories/Tabs.stories.d.ts +0 -11
- package/dist/stories/documentContextDecorator.d.ts +0 -25
- package/dist/stories/noCanvasDocsPage.d.ts +0 -9
- package/dist/utils/tests/hasRef.test.d.ts +0 -1
- package/dist/utils/tests/theme.test.d.ts +0 -1
- package/dist/utils/tests/useElementRect.test.d.ts +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MarkdownTarget } from '../config/config';
|
|
2
|
+
import { DocumentTarget } from './specAdapters';
|
|
3
|
+
export type { DocumentTarget };
|
|
4
|
+
export interface LlmsTxtLink {
|
|
5
|
+
label: string;
|
|
6
|
+
url: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface LlmsTxtOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Absolute base URL of the docs site, e.g. `"https://docs.acme.com"`. Used
|
|
12
|
+
* to build a default URL per entry; ignore it entirely by passing `url`.
|
|
13
|
+
*/
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The URL serving an entry as Markdown. Return `null` to leave an entry out
|
|
17
|
+
* of the index. Defaults to `${baseUrl}/${slug}.md`, which is a guess at
|
|
18
|
+
* your routes: pass this whenever they differ, which is most of the time.
|
|
19
|
+
*/
|
|
20
|
+
url?: (entry: DocumentTarget) => string | null | undefined;
|
|
21
|
+
/** Overrides the document's own `info.title`. */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** Overrides the document's own `info.description`. */
|
|
24
|
+
summary?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Extra links for the trailing "Optional" section: the source spec, a
|
|
27
|
+
* changelog, a support page. Serving the raw spec here (e.g.
|
|
28
|
+
* `https://docs.acme.com/openapi.yaml`) is worth doing, since an agent can
|
|
29
|
+
* consume it directly instead of reading prose.
|
|
30
|
+
*/
|
|
31
|
+
optional?: LlmsTxtLink[];
|
|
32
|
+
}
|
|
33
|
+
/** URL-safe slug from a target key: `"get /pets/{petId}"` to `"get-pets-petid"`. */
|
|
34
|
+
export declare function targetSlug(key: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Every linkable item in a document: OpenAPI endpoints, AsyncAPI operations.
|
|
37
|
+
* Each carries the `target` to hand `documentToMarkdown`, so generating a file
|
|
38
|
+
* per entry is a loop over this list.
|
|
39
|
+
*/
|
|
40
|
+
export declare function listDocumentTargets(document: unknown): DocumentTarget[];
|
|
41
|
+
/**
|
|
42
|
+
* Serializes a document to Markdown. Pass a `target` from
|
|
43
|
+
* `listDocumentTargets` for a single endpoint/operation, or omit it for the
|
|
44
|
+
* whole document.
|
|
45
|
+
*/
|
|
46
|
+
export declare function documentToMarkdown(document: unknown, target?: MarkdownTarget): string;
|
|
47
|
+
/**
|
|
48
|
+
* Builds an `llms.txt` index for a document, in the llmstxt.org format: an H1
|
|
49
|
+
* name, a blockquote summary, then one described link per endpoint/operation.
|
|
50
|
+
*/
|
|
51
|
+
export declare function documentToLlmsTxt(document: unknown, options?: LlmsTxtOptions): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { MarkdownTarget } from '../config/config';
|
|
2
|
+
/** One linkable item in a document: an OpenAPI endpoint, an AsyncAPI operation, ... */
|
|
3
|
+
export interface DocumentTarget {
|
|
4
|
+
/** Stable identifier, unique within the document. `"get /pets"`, `"sendLightMeasurement"`. */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Human-readable label for a link or heading. `"GET /pets"`. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** The document's own one-line summary for this item, when it has one. */
|
|
9
|
+
summary?: string;
|
|
10
|
+
/** Passed to `documentToMarkdown`, and the same shape `config.markdown.url` receives. */
|
|
11
|
+
target: MarkdownTarget;
|
|
12
|
+
}
|
|
13
|
+
interface SpecAdapter {
|
|
14
|
+
/** Spec name, used in error messages. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Whether this adapter handles the document, sniffed from its version key. */
|
|
17
|
+
matches: (doc: Record<string, unknown>) => boolean;
|
|
18
|
+
/** What the linkable items are called collectively, e.g. "Endpoints". */
|
|
19
|
+
sectionTitle: string;
|
|
20
|
+
title: (doc: unknown) => string;
|
|
21
|
+
summary: (doc: unknown) => string | undefined;
|
|
22
|
+
targets: (doc: unknown) => DocumentTarget[];
|
|
23
|
+
toMarkdown: (doc: unknown, target?: MarkdownTarget) => string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Picks the adapter for a document by sniffing its version key (`openapi`,
|
|
27
|
+
* `swagger`, `asyncapi`), the same discriminant the renderers use to choose a
|
|
28
|
+
* component. Throws rather than guessing: silently treating an unrecognized
|
|
29
|
+
* document as one spec would emit confidently wrong output.
|
|
30
|
+
*/
|
|
31
|
+
export declare function adapterFor(document: unknown): SpecAdapter;
|
|
32
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AsyncAPIDocumentData } from '../types/schema';
|
|
2
2
|
import { HttpMethod, OpenAPIDocumentData } from '../types/openapi';
|
|
3
|
-
|
|
4
|
-
export declare function asyncApiToMarkdown(doc: AsyncAPIDocumentData, deref
|
|
3
|
+
import { Deref } from './jsonPointer';
|
|
4
|
+
export declare function asyncApiToMarkdown(doc: AsyncAPIDocumentData, deref?: Deref): string;
|
|
5
5
|
/** Builds a self-contained Markdown snippet for a single AsyncAPI operation:
|
|
6
6
|
* doc info + servers, followed by that one operation's section (see
|
|
7
7
|
* `operationSectionToMarkdown`). Used by the per-operation copy button, as
|
|
8
8
|
* opposed to `asyncApiToMarkdown`'s whole-document export. */
|
|
9
|
-
export declare function asyncApiOperationToMarkdown(doc: AsyncAPIDocumentData, key: string, deref
|
|
10
|
-
export declare function openApiToMarkdown(doc: OpenAPIDocumentData, deref
|
|
9
|
+
export declare function asyncApiOperationToMarkdown(doc: AsyncAPIDocumentData, key: string, deref?: Deref): string;
|
|
10
|
+
export declare function openApiToMarkdown(doc: OpenAPIDocumentData, deref?: Deref): string;
|
|
11
11
|
/**
|
|
12
12
|
* Builds a self-contained Markdown snippet for a single OpenAPI endpoint:
|
|
13
13
|
* doc info + servers (so the snippet stands alone without the rest of the
|
|
@@ -16,5 +16,4 @@ export declare function openApiToMarkdown(doc: OpenAPIDocumentData, deref: Deref
|
|
|
16
16
|
* Endpoints side panel (Paths.tsx), as opposed to `openApiToMarkdown`'s
|
|
17
17
|
* whole-document export.
|
|
18
18
|
*/
|
|
19
|
-
export declare function openApiEndpointToMarkdown(doc: OpenAPIDocumentData, method: HttpMethod, path: string, deref
|
|
20
|
-
export {};
|
|
19
|
+
export declare function openApiEndpointToMarkdown(doc: OpenAPIDocumentData, method: HttpMethod, path: string, deref?: Deref): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigInterface } from '../config';
|
|
2
|
+
import { MarkdownUrlResolver } from '../config/config';
|
|
2
3
|
import { SpecType } from '../contexts';
|
|
3
4
|
/**
|
|
4
5
|
* Builds the shared DocumentContext value (deref resolver, portal/root refs,
|
|
@@ -13,13 +14,14 @@ export declare function useDocumentProviderValue<S extends SpecType, D extends o
|
|
|
13
14
|
contextValue: {
|
|
14
15
|
specType: S;
|
|
15
16
|
document: D;
|
|
16
|
-
deref: (
|
|
17
|
+
deref: import('../helpers/jsonPointer').Deref;
|
|
17
18
|
portalHost: HTMLDivElement | null;
|
|
18
19
|
rootElement: HTMLDivElement | null;
|
|
19
20
|
defaultSchemaExpanded: boolean;
|
|
20
21
|
depthColors: string[];
|
|
21
22
|
showExtensions: boolean;
|
|
22
23
|
showCodeSamples: boolean;
|
|
24
|
+
markdownUrl: MarkdownUrlResolver | undefined;
|
|
23
25
|
};
|
|
24
26
|
themeVars: Record<string, string>;
|
|
25
27
|
setPortalHost: import('react').Dispatch<import('react').SetStateAction<HTMLDivElement | null>>;
|