apiuikit 1.6.0 → 1.7.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 +18 -4
- package/dist/CodeSamples-COchoCMD.cjs +50 -0
- package/dist/{CodeSamples-C5u3VGKi.js → CodeSamples-Dm277WGX.js} +913 -895
- package/dist/{LogoExtension-BbOZyyI7.js → LogoExtension-Bhw9grDi.js} +1 -1
- package/dist/{LogoExtension-Bri3O9Zb.cjs → LogoExtension-uCSh3C3x.cjs} +1 -1
- package/dist/apiuikit.cjs.js +1 -1
- package/dist/apiuikit.css +1 -1
- package/dist/apiuikit.es.js +32 -26
- package/dist/components/ChannelAddress.d.ts +9 -1
- package/dist/components/QueryParameters.d.ts +21 -0
- package/dist/components/Tabs.d.ts +21 -2
- package/dist/containers/AsyncAPI/AsyncAPI.d.ts +3 -0
- package/dist/containers/AsyncAPI/AsyncAPIDocumentProvider.d.ts +4 -1
- package/dist/containers/AsyncAPI/AsyncAPIRenderer.d.ts +4 -1
- package/dist/containers/AsyncAPI/Layout.d.ts +3 -1
- package/dist/containers/OpenAPI/Layout.d.ts +3 -1
- package/dist/containers/OpenAPI/OpenAPI.d.ts +3 -0
- package/dist/containers/OpenAPI/OpenAPIDocumentProvider.d.ts +4 -1
- package/dist/containers/OpenAPI/OpenAPIRenderer.d.ts +4 -1
- package/dist/contexts/useSpec.d.ts +15 -1
- package/dist/hooks/useDocumentProviderValue.d.ts +5 -1
- package/dist/{index-DKGx9erP.js → index-ButmLtm3.js} +1 -1
- package/dist/{index-C65x4n-2.js → index-ByTEMZ1h.js} +1 -1
- package/dist/index-CF-r_0ZS.cjs +180 -0
- package/dist/{index-our7aldY.cjs → index-CWZRM5w7.cjs} +1 -1
- package/dist/{index-Cm3BxV47.js → index-D1584wmO.js} +5507 -5149
- package/dist/{index-Qg1sJSxE.cjs → index-D5GCtn8R.cjs} +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/plugin.cjs +1 -0
- package/dist/plugin.d.ts +7 -0
- package/dist/plugin.es.js +14 -0
- package/dist/plugins/OperationPluginTabs.d.ts +13 -0
- package/dist/plugins/PluginSlot.d.ts +44 -0
- package/dist/plugins/registry.d.ts +7 -0
- package/dist/plugins/types.d.ts +84 -0
- package/dist/{protoToJsonSchema-CUW6qxgm.js → protoToJsonSchema-Bu1_KtXF.js} +1 -1
- package/dist/{protoToJsonSchema-ihLMaBYf.cjs → protoToJsonSchema-DJXdCExT.cjs} +1 -1
- package/dist/{protobufSchemaParser-5O-3561f.js → protobufSchemaParser--9dltEfO.js} +2 -2
- package/dist/{protobufSchemaParser-Br30FYfe.cjs → protobufSchemaParser-C2DRuW2U.cjs} +1 -1
- package/dist/public/createSectionRoot.d.ts +5 -1
- package/dist/public/openapiSections.d.ts +7 -1
- package/dist/public/sections.d.ts +7 -1
- package/dist/utils/anchorLayer.d.ts +35 -0
- package/package.json +7 -2
- package/dist/CodeSamples-CRObUKHj.cjs +0 -50
- package/dist/index-DQqbljF-.cjs +0 -180
|
@@ -2,11 +2,14 @@ import { ConfigInterface } from '../../config';
|
|
|
2
2
|
import { OpenAPIDocumentData } from '../../types/openapi';
|
|
3
3
|
import { ErrorBoundaryFallbackRenderer } from '../../components/ErrorBoundary';
|
|
4
4
|
import { ErrorInfo, ReactNode } from 'react';
|
|
5
|
+
import { ApiuikitPlugin } from '../../plugins/types';
|
|
5
6
|
export interface IOpenAPIProps {
|
|
6
7
|
/** A pre-resolved OpenAPI 3.0/3.1 document object, or one that still contains `$ref`s. */
|
|
7
8
|
openapi: OpenAPIDocumentData;
|
|
8
9
|
/** UI configuration: theme, which sections to show, sidebar options, and more. */
|
|
9
10
|
config?: ConfigInterface;
|
|
11
|
+
/** Third-party plugins (e.g. a "try it out" panel) to render into this document's extension slots. */
|
|
12
|
+
plugins?: ApiuikitPlugin[];
|
|
10
13
|
/** Promise that `openapi` is already fully dereferenced upstream. Verified rather than trusted: `$ref`s left in place are still resolved either way, with a console warning that the promise was false. */
|
|
11
14
|
kind?: "resolved";
|
|
12
15
|
/** Custom UI shown if rendering this document throws. Defaults to a built-in fallback. */
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ConfigInterface } from '../../config';
|
|
3
3
|
import { OpenAPIDocumentData } from '../../types/openapi';
|
|
4
|
+
import { ApiuikitPlugin } from '../../plugins/types';
|
|
4
5
|
export interface OpenAPIDocumentProviderProps {
|
|
5
6
|
document: OpenAPIDocumentData;
|
|
6
7
|
config?: ConfigInterface;
|
|
8
|
+
/** Third-party plugins to register on this document's context. */
|
|
9
|
+
plugins?: ApiuikitPlugin[];
|
|
7
10
|
/** Extra classes merged onto the root surface. */
|
|
8
11
|
className?: string;
|
|
9
12
|
children: ReactNode;
|
|
10
13
|
}
|
|
11
14
|
/** Mirrors AsyncAPIDocumentProvider, sharing the same DocumentContext shape. */
|
|
12
|
-
export declare function OpenAPIDocumentProvider({ document: openapi, config, className, children, }: OpenAPIDocumentProviderProps): import("react").JSX.Element;
|
|
15
|
+
export declare function OpenAPIDocumentProvider({ document: openapi, config, plugins, className, children, }: OpenAPIDocumentProviderProps): import("react").JSX.Element;
|
|
13
16
|
export default OpenAPIDocumentProvider;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ConfigInterface } from '../../config/config';
|
|
2
2
|
import { ErrorBoundaryFallbackRenderer } from '../../components/ErrorBoundary';
|
|
3
3
|
import { ErrorInfo, ReactNode } from 'react';
|
|
4
|
+
import { ApiuikitPlugin } from '../../plugins/types';
|
|
4
5
|
interface OpenAPIRendererProps {
|
|
5
6
|
/** Raw OpenAPI document as a YAML or JSON string, parsed and validated internally via `@readme/openapi-parser`. */
|
|
6
7
|
raw: string;
|
|
7
8
|
/** UI configuration: theme, which sections to show, sidebar options, and more. */
|
|
8
9
|
config?: ConfigInterface;
|
|
10
|
+
/** Third-party plugins (e.g. a "try it out" panel) to render into this document's extension slots. */
|
|
11
|
+
plugins?: ApiuikitPlugin[];
|
|
9
12
|
/** Called with the parser's diagnostics (errors/warnings) after each parse attempt. */
|
|
10
13
|
onDiagnostics?: (diagnostics: unknown[]) => void;
|
|
11
14
|
/** Custom UI shown if rendering the parsed document throws. Defaults to a built-in fallback. */
|
|
@@ -19,5 +22,5 @@ interface OpenAPIRendererProps {
|
|
|
19
22
|
* have a document as text rather than a pre-parsed object, e.g. user-entered
|
|
20
23
|
* or loaded from a file at runtime.
|
|
21
24
|
*/
|
|
22
|
-
export declare function OpenAPIRenderer({ raw, config, onDiagnostics, errorFallback, onError }: OpenAPIRendererProps): import("react").JSX.Element | null;
|
|
25
|
+
export declare function OpenAPIRenderer({ raw, config, plugins, onDiagnostics, errorFallback, onError }: OpenAPIRendererProps): import("react").JSX.Element | null;
|
|
23
26
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AsyncAPIDocumentData } from '../types/schema';
|
|
2
2
|
import { OpenAPIDocumentData } from '../types/openapi';
|
|
3
|
-
import { MarkdownUrlResolver, SidePanelContainment } from '../config/config';
|
|
3
|
+
import { ConfigInterface, MarkdownUrlResolver, SidePanelContainment } from '../config/config';
|
|
4
|
+
import { ApiuikitPlugin } from '../plugins/types';
|
|
5
|
+
import { PluginSlotRegistry } from '../plugins/registry';
|
|
4
6
|
/** Which spec produced the ambient document. The discriminant of DocumentContextValue. */
|
|
5
7
|
export type SpecType = "asyncapi" | "openapi";
|
|
6
8
|
interface DocumentContextBase {
|
|
@@ -25,6 +27,12 @@ interface DocumentContextBase {
|
|
|
25
27
|
showCodeSamples: boolean;
|
|
26
28
|
/** Resolves the hosted URL serving a target as Markdown, if the consumer serves one (config.markdown.url). */
|
|
27
29
|
markdownUrl?: MarkdownUrlResolver;
|
|
30
|
+
/** Third-party plugins registered on the nearest `<AsyncAPI>`/`<OpenAPI>` (or provider), consumed via `PluginSlot`. Undefined is equivalent to none registered. */
|
|
31
|
+
plugins?: ApiuikitPlugin[];
|
|
32
|
+
/** Pre-indexed plugin fills used internally by slot hosts. */
|
|
33
|
+
pluginSlotRegistry?: PluginSlotRegistry;
|
|
34
|
+
/** The host's as-given `config` prop, unmerged with defaults. For plugins; prefer the derived fields above for apiuikit's own UI. Theme colors: use the CSS custom properties on the document root (see Plugins docs), not `config.theme`. */
|
|
35
|
+
config?: ConfigInterface;
|
|
28
36
|
}
|
|
29
37
|
export interface AsyncAPIDocumentContextValue extends DocumentContextBase {
|
|
30
38
|
specType: "asyncapi";
|
|
@@ -44,6 +52,12 @@ export interface OpenAPIDocumentContextValue extends DocumentContextBase {
|
|
|
44
52
|
export type DocumentContextValue = AsyncAPIDocumentContextValue | OpenAPIDocumentContextValue;
|
|
45
53
|
export declare const DocumentContext: import('react').Context<DocumentContextValue | null>;
|
|
46
54
|
export declare const useDocumentContext: () => DocumentContextValue;
|
|
55
|
+
/** Returns an AsyncAPI context and fails fast when rendered under the wrong
|
|
56
|
+
* document provider. */
|
|
57
|
+
export declare const useAsyncAPIDocumentContext: () => AsyncAPIDocumentContextValue;
|
|
58
|
+
/** Returns an OpenAPI context and fails fast when rendered under the wrong
|
|
59
|
+
* document provider. */
|
|
60
|
+
export declare const useOpenAPIDocumentContext: () => OpenAPIDocumentContextValue;
|
|
47
61
|
export declare const AsyncAPIDocumentContext: import('react').Context<DocumentContextValue | null>;
|
|
48
62
|
export declare const useAsyncAPIDocument: () => DocumentContextValue;
|
|
49
63
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConfigInterface } from '../config';
|
|
2
2
|
import { MarkdownUrlResolver, SidePanelContainment } from '../config/config';
|
|
3
3
|
import { SpecType } from '../contexts';
|
|
4
|
+
import { ApiuikitPlugin } from '../plugins/types';
|
|
4
5
|
/**
|
|
5
6
|
* Builds the shared DocumentContext value (deref resolver, portal/root refs,
|
|
6
7
|
* theme-derived settings) plus the CSS custom properties for the theme,
|
|
@@ -10,7 +11,7 @@ import { SpecType } from '../contexts';
|
|
|
10
11
|
* `specType` and document type, and thus lands as the right member of the
|
|
11
12
|
* DocumentContextValue union.
|
|
12
13
|
*/
|
|
13
|
-
export declare function useDocumentProviderValue<S extends SpecType, D extends object>(specType: S, document: D, config?: ConfigInterface): {
|
|
14
|
+
export declare function useDocumentProviderValue<S extends SpecType, D extends object>(specType: S, document: D, config?: ConfigInterface, plugins?: ApiuikitPlugin[]): {
|
|
14
15
|
contextValue: {
|
|
15
16
|
specType: S;
|
|
16
17
|
document: D;
|
|
@@ -25,6 +26,9 @@ export declare function useDocumentProviderValue<S extends SpecType, D extends o
|
|
|
25
26
|
showExtensions: boolean;
|
|
26
27
|
showCodeSamples: boolean;
|
|
27
28
|
markdownUrl: MarkdownUrlResolver | undefined;
|
|
29
|
+
plugins: ApiuikitPlugin[];
|
|
30
|
+
pluginSlotRegistry: import('../plugins/registry').PluginSlotRegistry;
|
|
31
|
+
config: ConfigInterface;
|
|
28
32
|
};
|
|
29
33
|
themeVars: Record<string, string>;
|
|
30
34
|
setPortalHost: import('react').Dispatch<import('react').SetStateAction<HTMLDivElement | null>>;
|
|
@@ -5,7 +5,7 @@ var Vp = (xi) => {
|
|
|
5
5
|
var bd = (xi, Oi, Ai) => Oi in xi ? gd(xi, Oi, { enumerable: !0, configurable: !0, writable: !0, value: Ai }) : xi[Oi] = Ai;
|
|
6
6
|
var Np = (xi, Oi, Ai) => bd(xi, typeof Oi != "symbol" ? Oi + "" : Oi, Ai), Fp = (xi, Oi, Ai) => Oi.has(xi) || Vp("Cannot " + Ai);
|
|
7
7
|
var ir = (xi, Oi, Ai) => (Fp(xi, Oi, "read from private field"), Ai ? Ai.call(xi) : Oi.get(xi)), so = (xi, Oi, Ai) => Oi.has(xi) ? Vp("Cannot add the same private member more than once") : Oi instanceof WeakSet ? Oi.add(xi) : Oi.set(xi, Ai), ca = (xi, Oi, Ai, sn) => (Fp(xi, Oi, "write to private field"), sn ? sn.call(xi, Ai) : Oi.set(xi, Ai), Ai);
|
|
8
|
-
import { g as vd } from "./index-
|
|
8
|
+
import { g as vd } from "./index-D1584wmO.js";
|
|
9
9
|
function jd(xi, Oi) {
|
|
10
10
|
for (var Ai = 0; Ai < Oi.length; Ai++) {
|
|
11
11
|
const sn = Oi[Ai];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var kl = Object.defineProperty;
|
|
2
2
|
var Il = (t, e, r) => e in t ? kl(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var We = (t, e, r) => Il(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { g as Mn } from "./index-
|
|
4
|
+
import { g as Mn } from "./index-D1584wmO.js";
|
|
5
5
|
function ii(t) {
|
|
6
6
|
return t.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
7
7
|
}
|