apiuikit 0.2.1 → 0.5.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 +47 -3
- package/dist/LinkedInExtension-6xekO5bX.cjs +1 -0
- package/dist/LinkedInExtension-BL-4T9tt.js +21 -0
- package/dist/LogoExtension-BOYrY_RE.cjs +1 -0
- package/dist/LogoExtension-HOlSsQf-.js +27 -0
- package/dist/XExtension-GyRtdHLL.js +23 -0
- package/dist/XExtension-jAiATfg-.cjs +1 -0
- package/dist/apiuikit.cjs.js +1 -1
- package/dist/apiuikit.css +1 -1
- package/dist/apiuikit.es.js +16 -9
- package/dist/components/Bindings.d.ts +3 -1
- package/dist/components/InfoMetadata.d.ts +7 -1
- package/dist/components/Navigation.d.ts +11 -4
- package/dist/components/RenderExtensions.d.ts +15 -0
- package/dist/components/SearchPanel.d.ts +9 -0
- package/dist/components/schema/SchemaNode.d.ts +10 -1
- package/dist/components/schema/SchemaTab.d.ts +8 -1
- package/dist/components/schema/SchemaTree.d.ts +5 -1
- package/dist/components/schema/SchemaTreeRow.d.ts +2 -1
- package/dist/components/tests/Authorization.test.d.ts +1 -0
- package/dist/components/tests/RenderExtensions.test.d.ts +1 -0
- package/dist/config/config.d.ts +3 -0
- package/dist/containers/AsyncAPI/AsyncAPI.d.ts +12 -6
- package/dist/containers/AsyncAPI/AsyncAPIDocumentProvider.d.ts +12 -0
- package/dist/containers/AsyncAPI/AsyncAPIRenderer.d.ts +9 -0
- package/dist/containers/AsyncAPI/tests/searchHighlight.test.d.ts +1 -0
- package/dist/containers/Messages/MessageDetails.d.ts +3 -1
- package/dist/containers/Messages/Messages.d.ts +3 -1
- package/dist/containers/Operation/Operation.d.ts +3 -1
- package/dist/containers/Operation/Operations.d.ts +3 -1
- package/dist/containers/Schema/Schemas.d.ts +6 -1
- package/dist/containers/Server/Server.d.ts +8 -1
- package/dist/containers/Server/Servers.d.ts +7 -3
- package/dist/contexts/useSpec.d.ts +2 -0
- package/dist/helpers/protobuf/lazyProtoToJsonSchema.d.ts +14 -0
- package/dist/helpers/schemaFormat.d.ts +3 -0
- package/dist/helpers/searchIndex.d.ts +18 -0
- package/dist/helpers/textHighlight.d.ts +2 -0
- package/dist/hooks/useSpecSearch.d.ts +13 -0
- package/dist/icons/Search.d.ts +3 -0
- package/dist/icons/Server.d.ts +4 -3
- package/dist/index-BG6colCU.js +11473 -0
- package/dist/{index-DqcOEYz_.cjs → index-BcNlIoEF.cjs} +1 -1
- package/dist/index-Bmw7IyyF.cjs +73 -0
- package/dist/{index-yG3rYT_D.js → index-CEf0X0H_.js} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/protoToJsonSchema-BcqPKXqK.js +6174 -0
- package/dist/protoToJsonSchema-C43lKcgx.cjs +83 -0
- package/dist/protobufSchemaParser-BQVXzHsQ.js +55 -0
- package/dist/protobufSchemaParser-sEw46uRx.cjs +1 -0
- package/dist/public/sections.d.ts +45 -0
- package/dist/public/tests/sections.test.d.ts +1 -0
- package/dist/stories/AsyncAPI.stories.d.ts +6 -0
- package/dist/stories/AsyncAPIRenderer.stories.d.ts +6 -0
- package/dist/stories/Authorization.stories.d.ts +13 -0
- package/dist/stories/Bindings.stories.d.ts +12 -0
- package/dist/stories/ChannelAddress.stories.d.ts +13 -0
- package/dist/stories/CodeBlock.stories.d.ts +11 -0
- package/dist/stories/Examples.stories.d.ts +11 -0
- package/dist/stories/Information.stories.d.ts +1 -0
- package/dist/stories/Message.stories.d.ts +11 -0
- package/dist/stories/Messages.stories.d.ts +11 -0
- package/dist/stories/Operation.stories.d.ts +10 -0
- package/dist/stories/Operations.stories.d.ts +16 -0
- package/dist/stories/SchemaTab.stories.d.ts +12 -0
- package/dist/stories/SchemaTree.stories.d.ts +1 -0
- package/dist/stories/SearchPanel.stories.d.ts +16 -0
- package/dist/stories/Server.stories.d.ts +4 -1
- package/dist/stories/TabToggle.stories.d.ts +10 -0
- package/dist/stories/Tabs.stories.d.ts +11 -0
- package/dist/stories/documentContextDecorator.d.ts +25 -0
- package/dist/stories/noCanvasDocsPage.d.ts +9 -0
- package/package.json +5 -4
- package/dist/index-BYmrdiVi.cjs +0 -155
- package/dist/index-DfH4J5EL.js +0 -15436
- package/dist/stories/Button.d.ts +0 -14
- package/dist/stories/Button.stories.d.ts +0 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/config/config.d.ts
CHANGED
|
@@ -11,11 +11,14 @@ export interface ShowConfig {
|
|
|
11
11
|
sidebar?: boolean;
|
|
12
12
|
info?: boolean;
|
|
13
13
|
servers?: boolean;
|
|
14
|
+
search?: boolean;
|
|
14
15
|
operations?: boolean;
|
|
15
16
|
messages?: boolean;
|
|
16
17
|
messageExamples?: boolean;
|
|
17
18
|
schemas?: boolean;
|
|
18
19
|
errors?: boolean;
|
|
20
|
+
/** Whether to render known x-* spec extensions (see the `x-tensions` catalog). Defaults to true. */
|
|
21
|
+
extensions?: boolean;
|
|
19
22
|
}
|
|
20
23
|
export interface ExpandConfig {
|
|
21
24
|
messageExamples?: boolean;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { ConfigInterface } from '../../config';
|
|
2
2
|
import { AsyncAPIDocumentData } from '../../types/schema';
|
|
3
|
-
export
|
|
3
|
+
export interface IAsyncAPIProps {
|
|
4
|
+
/** A pre-resolved AsyncAPI 3.0 document object, or one that still contains `$ref`s. */
|
|
4
5
|
asyncapi: AsyncAPIDocumentData;
|
|
6
|
+
/** UI configuration: theme, which sections to show, sidebar options, and more. */
|
|
5
7
|
config?: ConfigInterface;
|
|
6
|
-
|
|
7
|
-
kind
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** Informational hint that `asyncapi` has already been fully dereferenced upstream, not a contract: `$ref`s left in place are still resolved either way. */
|
|
9
|
+
kind?: "resolved";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Renders a full AsyncAPI documentation page: sidebar navigation, search,
|
|
13
|
+
* servers, operations, messages, and schemas. Pass a pre-resolved (or
|
|
14
|
+
* `$ref`-carrying) document object; for raw YAML/JSON strings, use
|
|
15
|
+
* `AsyncAPIRenderer` instead, which parses first.
|
|
16
|
+
*/
|
|
11
17
|
declare const AsyncAPI: (props: IAsyncAPIProps) => import("react").JSX.Element;
|
|
12
18
|
export default AsyncAPI;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ConfigInterface } from '../../config';
|
|
3
|
+
import { AsyncAPIDocumentData } from '../../types/schema';
|
|
4
|
+
export interface AsyncAPIDocumentProviderProps {
|
|
5
|
+
document: AsyncAPIDocumentData;
|
|
6
|
+
config?: ConfigInterface;
|
|
7
|
+
/** Extra classes merged onto the root surface (e.g. Layout's sidebar `pt-14`). */
|
|
8
|
+
className?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function AsyncAPIDocumentProvider({ document: asyncapi, config, className, children, }: AsyncAPIDocumentProviderProps): import("react").JSX.Element;
|
|
12
|
+
export default AsyncAPIDocumentProvider;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import { ConfigInterface } from '../../config/config';
|
|
2
2
|
interface AsyncAPIRendererProps {
|
|
3
|
+
/** Raw AsyncAPI document as a YAML or JSON string, parsed and validated internally via `@asyncapi/parser`. */
|
|
3
4
|
raw: string;
|
|
5
|
+
/** UI configuration: theme, which sections to show, sidebar options, and more. */
|
|
4
6
|
config?: ConfigInterface;
|
|
7
|
+
/** Called with the parser's diagnostics (errors/warnings) after each parse attempt. */
|
|
5
8
|
onDiagnostics?: (diagnostics: unknown[]) => void;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Parses a raw AsyncAPI YAML/JSON string (via `@asyncapi/parser`) and renders
|
|
12
|
+
* the same full documentation page as `AsyncAPI`. Use this when you have a
|
|
13
|
+
* document as text rather than a pre-parsed object, e.g. user-entered or
|
|
14
|
+
* loaded from a file at runtime.
|
|
15
|
+
*/
|
|
7
16
|
export declare function AsyncAPIRenderer({ raw, config, onDiagnostics }: AsyncAPIRendererProps): import("react").JSX.Element | null;
|
|
8
17
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,6 +4,8 @@ interface MessageDetailsProps {
|
|
|
4
4
|
expanded: boolean;
|
|
5
5
|
onToggleExpanded: () => void;
|
|
6
6
|
paddingX?: string;
|
|
7
|
+
/** "payload" | "headers" when search navigated here for that schema specifically. */
|
|
8
|
+
focusSection?: string | null;
|
|
7
9
|
}
|
|
8
|
-
export declare function MessageDetails({ message, expanded, onToggleExpanded, paddingX, }: MessageDetailsProps): import("react").JSX.Element;
|
|
10
|
+
export declare function MessageDetails({ message, expanded, onToggleExpanded, paddingX, focusSection, }: MessageDetailsProps): import("react").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -2,6 +2,8 @@ import { MessageObject } from '../../types/asyncapi/MessageObject';
|
|
|
2
2
|
interface MessagesProps {
|
|
3
3
|
messages: Record<string, MessageObject>;
|
|
4
4
|
selectedKey?: string | null;
|
|
5
|
+
/** Which collapsed section ("payload" | "headers") search navigated to. */
|
|
6
|
+
focusSection?: string | null;
|
|
5
7
|
}
|
|
6
|
-
export default function Messages({ messages, selectedKey }: MessagesProps): import("react").JSX.Element;
|
|
8
|
+
export default function Messages({ messages, selectedKey, focusSection }: MessagesProps): import("react").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -2,6 +2,8 @@ import { Operation as OperationInterface } from '../../types/asyncapi/Operation'
|
|
|
2
2
|
interface OperationProps {
|
|
3
3
|
op: OperationInterface;
|
|
4
4
|
id: string | null;
|
|
5
|
+
/** Which collapsed section search navigated to, e.g. `binding:kafka`. */
|
|
6
|
+
focusSection?: string | null;
|
|
5
7
|
}
|
|
6
|
-
export default function Operation({ op, id }: OperationProps): import("react").JSX.Element;
|
|
8
|
+
export default function Operation({ op, id, focusSection }: OperationProps): import("react").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -3,6 +3,8 @@ interface OperationsProps {
|
|
|
3
3
|
operations: Record<string, OperationType>;
|
|
4
4
|
selectedKey?: string | null;
|
|
5
5
|
onSelectKey?: (key: string | null) => void;
|
|
6
|
+
/** Which collapsed section of the selected operation search navigated to. */
|
|
7
|
+
focusSection?: string | null;
|
|
6
8
|
}
|
|
7
|
-
export default function Operations({ operations, selectedKey, onSelectKey }: OperationsProps): import("react").JSX.Element | null;
|
|
9
|
+
export default function Operations({ operations, selectedKey, onSelectKey, focusSection }: OperationsProps): import("react").JSX.Element | null;
|
|
8
10
|
export {};
|
|
@@ -2,6 +2,11 @@ import { SchemaNodeData } from '../../types/schema';
|
|
|
2
2
|
interface SchemasProps {
|
|
3
3
|
schemas: Record<string, SchemaNodeData>;
|
|
4
4
|
selectedKey?: string | null;
|
|
5
|
+
/** The precisely-matched nested node search navigated to, if any — see Layout.tsx. */
|
|
6
|
+
focusTarget?: {
|
|
7
|
+
tokens: string[];
|
|
8
|
+
id: string;
|
|
9
|
+
} | null;
|
|
5
10
|
}
|
|
6
|
-
export default function Schemas({ schemas, selectedKey }: SchemasProps): import("react").JSX.Element;
|
|
11
|
+
export default function Schemas({ schemas, selectedKey, focusTarget }: SchemasProps): import("react").JSX.Element;
|
|
7
12
|
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { Server as ServerInterface } from '../../types/asyncapi/Server';
|
|
2
|
-
|
|
2
|
+
interface ServerProps extends ServerInterface {
|
|
3
|
+
/** The server's own key/name, needed to build ids for its sub-sections. */
|
|
4
|
+
serverKey?: string;
|
|
5
|
+
/** Which collapsed section (if any) search navigated to, e.g. `binding:kafka`. */
|
|
6
|
+
focusSection?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export default function Server({ host, protocol, description, tags, variables, security, bindings, serverKey, focusSection, }: ServerProps): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Server as ServerInterface } from '../../types/asyncapi/Server';
|
|
2
|
-
interface
|
|
3
|
-
|
|
2
|
+
interface ServersProps {
|
|
3
|
+
servers: Record<string, ServerInterface>;
|
|
4
|
+
selectedServer?: string | null;
|
|
5
|
+
onSelectServer?: (serverName: string) => void;
|
|
6
|
+
/** Which collapsed section of the selected server search navigated to. */
|
|
7
|
+
focusSection?: string | null;
|
|
4
8
|
}
|
|
5
|
-
export default function Servers({ servers }:
|
|
9
|
+
export default function Servers({ servers, selectedServer, onSelectServer, focusSection }: ServersProps): import("react").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -10,6 +10,8 @@ interface AsyncAPIContextValue {
|
|
|
10
10
|
defaultSchemaExpanded?: boolean;
|
|
11
11
|
/** Resolved schema tree depth-line colors (config-provided or default), cycled by nesting depth. */
|
|
12
12
|
depthColors: string[];
|
|
13
|
+
/** Whether to render known x-* spec extensions (see the `x-tensions` catalog). Defaults to true. */
|
|
14
|
+
showExtensions: boolean;
|
|
13
15
|
}
|
|
14
16
|
export declare const AsyncAPIDocumentContext: import('react').Context<AsyncAPIContextValue | null>;
|
|
15
17
|
export declare const useAsyncAPIDocument: () => AsyncAPIContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { protoToJsonSchema as ProtoToJsonSchemaFn } from './protoToJsonSchema';
|
|
2
|
+
/** Returns the converter if already loaded; otherwise kicks off the
|
|
3
|
+
* (idempotent) background import and returns null. Pair with
|
|
4
|
+
* useProtobufConverterReady() so callers re-resolve once it's ready. */
|
|
5
|
+
export declare function getProtoToJsonSchema(): typeof ProtoToJsonSchemaFn | null;
|
|
6
|
+
/** Resolves once the converter has finished loading (kicking off the load
|
|
7
|
+
* if needed) — for tests and other non-React callers that need to wait
|
|
8
|
+
* rather than subscribe via useProtobufConverterReady(). */
|
|
9
|
+
export declare function waitForProtobufConverter(): Promise<void>;
|
|
10
|
+
/** True once the Protobuf converter has finished loading. Include in a
|
|
11
|
+
* useMemo's dependencies wherever resolveSchemaInput might return a pending
|
|
12
|
+
* Protobuf conversion, so it re-resolves (synchronously, from then on) the
|
|
13
|
+
* moment loading completes. */
|
|
14
|
+
export declare function useProtobufConverterReady(): boolean;
|
|
@@ -17,6 +17,9 @@ export interface ResolvedSchemaInput {
|
|
|
17
17
|
* back to one carried on the multi-format wrapper (not spec-defined there,
|
|
18
18
|
* but tolerated — the parser passes it through untouched). */
|
|
19
19
|
description?: string;
|
|
20
|
+
/** True while a Protobuf schema's converter is still being lazy-loaded —
|
|
21
|
+
* `schema` is a placeholder until then. See lazyProtoToJsonSchema.ts. */
|
|
22
|
+
pendingConversion?: boolean;
|
|
20
23
|
}
|
|
21
24
|
export declare function isAvroSchemaFormat(format: unknown): boolean;
|
|
22
25
|
export declare function isProtobufSchemaFormat(format: unknown): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AsyncAPIDocumentData } from '../types/schema';
|
|
2
|
+
export type SearchTab = "operations" | "messages" | "schemas" | "info" | "servers";
|
|
3
|
+
export type SearchType = "operation" | "message" | "schema" | "info" | "server";
|
|
4
|
+
export interface SearchEntry {
|
|
5
|
+
id: string;
|
|
6
|
+
targetId: string;
|
|
7
|
+
type: SearchType;
|
|
8
|
+
tab: SearchTab;
|
|
9
|
+
key: string;
|
|
10
|
+
name: string;
|
|
11
|
+
path: string;
|
|
12
|
+
location: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
text: string;
|
|
15
|
+
focusSection?: string;
|
|
16
|
+
schemaFocusTokens?: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare function buildSearchIndex(asyncapi: AsyncAPIDocumentData): SearchEntry[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AsyncAPIDocumentData } from '../types/schema';
|
|
2
|
+
export interface UseSpecSearchOptions {
|
|
3
|
+
threshold?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
/** Delay before a query change triggers a search, in ms. Defaults to 150. */
|
|
6
|
+
debounceMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function useSpecSearch(asyncapi: AsyncAPIDocumentData, options?: UseSpecSearchOptions): {
|
|
9
|
+
query: string;
|
|
10
|
+
setQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
11
|
+
results: import('../helpers/searchIndex').SearchEntry[];
|
|
12
|
+
searchIndex: import('../helpers/searchIndex').SearchEntry[];
|
|
13
|
+
};
|
package/dist/icons/Server.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
interface IconServerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
}
|
|
4
|
+
export default function IconServer({ className }: IconServerProps): import("react").JSX.Element;
|
|
4
5
|
export {};
|