apiuikit 1.6.1 → 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-BJdDUuyW.cjs → CodeSamples-COchoCMD.cjs} +1 -1
- package/dist/{CodeSamples-CBNLIPmf.js → CodeSamples-Dm277WGX.js} +1 -1
- package/dist/{LogoExtension-BnGxs1iO.js → LogoExtension-Bhw9grDi.js} +1 -1
- package/dist/{LogoExtension-s_ImLM33.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-mTesjc4t.js → index-ButmLtm3.js} +1 -1
- package/dist/{index-BeUvL__Z.js → index-ByTEMZ1h.js} +1 -1
- package/dist/index-CF-r_0ZS.cjs +180 -0
- package/dist/{index-C8hbyW3W.cjs → index-CWZRM5w7.cjs} +1 -1
- package/dist/{index-CcMtyrpk.js → index-D1584wmO.js} +5507 -5149
- package/dist/{index-Nbf5MZiI.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-BXXNt4lb.js → protoToJsonSchema-Bu1_KtXF.js} +1 -1
- package/dist/{protoToJsonSchema-BcZ8ZAVF.cjs → protoToJsonSchema-DJXdCExT.cjs} +1 -1
- package/dist/{protobufSchemaParser-SgaIKKy_.js → protobufSchemaParser--9dltEfO.js} +2 -2
- package/dist/{protobufSchemaParser-DDcdjpqs.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/index-DZLN6OIH.cjs +0 -180
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,18 @@ export { default, default as AsyncAPI } from './containers/AsyncAPI/AsyncAPI';
|
|
|
2
2
|
export type { IAsyncAPIProps } from './containers/AsyncAPI/AsyncAPI';
|
|
3
3
|
export { default as OpenAPI } from './containers/OpenAPI/OpenAPI';
|
|
4
4
|
export type { IOpenAPIProps } from './containers/OpenAPI/OpenAPI';
|
|
5
|
-
export type { ConfigInterface, MarkdownConfig, MarkdownTarget, MarkdownUrlResolver, SidePanelConfig, SidePanelContainment } from './config';
|
|
5
|
+
export type { ConfigInterface, MarkdownConfig, MarkdownTarget, MarkdownUrlResolver, SidePanelConfig, SidePanelContainment, ThemeColors, ThemeColorScale, ThemeConfig, ThemeModeColors, } from './config';
|
|
6
6
|
export { documentToLlmsTxt, documentToMarkdown, listDocumentTargets, targetSlug } from './helpers/llmsTxt';
|
|
7
7
|
export type { DocumentTarget, LlmsTxtLink, LlmsTxtOptions } from './helpers/llmsTxt';
|
|
8
8
|
export { markdownForLlm } from './helpers/markdownForLlm';
|
|
9
9
|
export { asyncApiOperationToMarkdown, asyncApiToMarkdown, openApiEndpointToMarkdown, openApiToMarkdown, } from './helpers/toMarkdown';
|
|
10
10
|
export { defaultConfig } from './config';
|
|
11
11
|
export type { AsyncAPIDocumentData } from './types/schema';
|
|
12
|
-
export type { OpenAPIDocumentData } from './types/openapi';
|
|
13
|
-
export { useAsyncAPIDocument } from './contexts';
|
|
12
|
+
export type { HttpMethod, OpenAPIDocumentData, OpenAPIOperationData, OpenAPIParameterData, OpenAPIPathItemData, OpenAPIRequestBodyData, OpenAPISecuritySchemeData, OpenAPIServerData, } from './types/openapi';
|
|
13
|
+
export { useAsyncAPIDocument, useAsyncAPIDocumentContext, useDocumentContext, useOpenAPIDocumentContext, } from './contexts';
|
|
14
|
+
export type { DocumentContextValue, AsyncAPIDocumentContextValue, OpenAPIDocumentContextValue } from './contexts';
|
|
15
|
+
export { PluginSlot, usePluginSlot, useOperationTabPlugins } from './plugins/PluginSlot';
|
|
16
|
+
export type { PluginSlotEntry, PluginSlotProps, PluginTabEntry } from './plugins/PluginSlot';
|
|
14
17
|
export { SchemaTree, SchemaTab } from './components/schema';
|
|
15
18
|
export type { SchemaTreeProps } from './components/schema';
|
|
16
19
|
export { ErrorBoundary } from './components/ErrorBoundary';
|
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("apiuikit");function n(t){return t}Object.defineProperty(exports,"PluginSlot",{enumerable:!0,get:()=>e.PluginSlot});Object.defineProperty(exports,"useAsyncAPIDocument",{enumerable:!0,get:()=>e.useAsyncAPIDocument});Object.defineProperty(exports,"useAsyncAPIDocumentContext",{enumerable:!0,get:()=>e.useAsyncAPIDocumentContext});Object.defineProperty(exports,"useDocumentContext",{enumerable:!0,get:()=>e.useDocumentContext});Object.defineProperty(exports,"useOpenAPIDocumentContext",{enumerable:!0,get:()=>e.useOpenAPIDocumentContext});Object.defineProperty(exports,"useOperationTabPlugins",{enumerable:!0,get:()=>e.useOperationTabPlugins});Object.defineProperty(exports,"usePluginSlot",{enumerable:!0,get:()=>e.usePluginSlot});exports.definePlugin=n;
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { definePlugin } from './plugins/types';
|
|
2
|
+
export type { ApiuikitPlugin, AsyncAPIOperationPluginContext, OpenAPIOperationPluginContext, PluginSlotComponent, PluginSlotContextMap, PluginSlotName, PluginTabSlotFill, SupplementarySlotName, TabSlotName, } from './plugins/types';
|
|
3
|
+
export { PluginSlot, useAsyncAPIDocument, useAsyncAPIDocumentContext, useDocumentContext, useOpenAPIDocumentContext, useOperationTabPlugins, usePluginSlot, } from './index.ts';
|
|
4
|
+
export type { PluginSlotEntry, PluginSlotProps, PluginTabEntry, DocumentContextValue, AsyncAPIDocumentContextValue, OpenAPIDocumentContextValue, } from './index.ts';
|
|
5
|
+
export type { ConfigInterface, ThemeColors, ThemeColorScale, ThemeConfig, ThemeModeColors, } from './index.ts';
|
|
6
|
+
export type { HttpMethod, OpenAPIDocumentData, OpenAPIOperationData, OpenAPIParameterData, OpenAPIPathItemData, OpenAPIRequestBodyData, OpenAPISecuritySchemeData, OpenAPIServerData, } from './types/openapi';
|
|
7
|
+
export type { AsyncAPIDocumentData } from './types/schema';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PluginSlot as o, useAsyncAPIDocument as s, useAsyncAPIDocumentContext as c, useDocumentContext as i, useOpenAPIDocumentContext as P, useOperationTabPlugins as l, usePluginSlot as r } from "apiuikit";
|
|
2
|
+
function n(e) {
|
|
3
|
+
return e;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
o as PluginSlot,
|
|
7
|
+
n as definePlugin,
|
|
8
|
+
s as useAsyncAPIDocument,
|
|
9
|
+
c as useAsyncAPIDocumentContext,
|
|
10
|
+
i as useDocumentContext,
|
|
11
|
+
P as useOpenAPIDocumentContext,
|
|
12
|
+
l as useOperationTabPlugins,
|
|
13
|
+
r as usePluginSlot
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PluginSlotContextMap, TabSlotName } from './types';
|
|
3
|
+
interface OperationPluginTabsProps<N extends TabSlotName> {
|
|
4
|
+
name: N;
|
|
5
|
+
context: PluginSlotContextMap[N];
|
|
6
|
+
/** Whether this operation may host tabs. Callback operations, for example, may not. */
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** Shared host for operation-level plugin tabs and the built-in Reference
|
|
11
|
+
* content. Owns selection, fallback, DOM ids, ARIA panels, and isolation. */
|
|
12
|
+
export default function OperationPluginTabs<N extends TabSlotName>({ name, context, enabled, children, }: OperationPluginTabsProps<N>): import("react").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PluginSlotComponent, PluginSlotContextMap, SupplementarySlotName, TabSlotName } from './types';
|
|
2
|
+
/** Isolates one plugin's render in its own error boundary + Suspense
|
|
3
|
+
* boundary, tagged with `label` for the console error, so one broken or
|
|
4
|
+
* slow-loading plugin can't take down the document or a sibling plugin.
|
|
5
|
+
* Shared by `PluginSlot` (one boundary per component in a slot) and the
|
|
6
|
+
* `*.operation.tab` containers (one boundary around whichever tab is active). */
|
|
7
|
+
export declare function PluginBoundary({ label, children }: {
|
|
8
|
+
label: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export interface PluginSlotEntry<N extends SupplementarySlotName> {
|
|
12
|
+
id: string;
|
|
13
|
+
pluginName: string;
|
|
14
|
+
Component: PluginSlotComponent<N>;
|
|
15
|
+
}
|
|
16
|
+
export declare function usePluginSlot<N extends SupplementarySlotName>(name: N): readonly PluginSlotEntry<N>[];
|
|
17
|
+
export interface PluginSlotProps<N extends SupplementarySlotName> {
|
|
18
|
+
name: N;
|
|
19
|
+
context: PluginSlotContextMap[N];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders every plugin registered for `name`, each isolated in its own
|
|
23
|
+
* `ErrorBoundary` + `Suspense` boundary so one broken or slow-loading plugin
|
|
24
|
+
* can't take down the document or its sibling plugins. Renders nothing when
|
|
25
|
+
* no plugin fills this slot.
|
|
26
|
+
*/
|
|
27
|
+
export declare function PluginSlot<N extends SupplementarySlotName>({ name, context }: PluginSlotProps<N>): import("react").JSX.Element | null;
|
|
28
|
+
/** One plugin's fill of a `*.operation.tab` slot, resolved into what the
|
|
29
|
+
* operation panel's tab strip needs. `id` is generated by the registry and
|
|
30
|
+
* does not depend on the plugin's user-facing name. */
|
|
31
|
+
export interface PluginTabEntry<N extends TabSlotName> {
|
|
32
|
+
id: string;
|
|
33
|
+
pluginName: string;
|
|
34
|
+
label: string;
|
|
35
|
+
Component: PluginSlotComponent<N>;
|
|
36
|
+
}
|
|
37
|
+
/** Every plugin filling the `*.operation.tab` slot `name`, in registration
|
|
38
|
+
* order — what `PathOperation`/`Operation` build their tab strip from. Not
|
|
39
|
+
* meant for plugin authors themselves (a plugin doesn't render its own tab
|
|
40
|
+
* strip); exported alongside `PluginSlot`/`usePluginSlot` for the same reason
|
|
41
|
+
* those are: only relevant if you're building something that itself hosts
|
|
42
|
+
* `*.operation.tab` plugins, like a custom operation panel. */
|
|
43
|
+
export declare function useOperationTabPlugins<N extends TabSlotName>(name: N): readonly PluginTabEntry<N>[];
|
|
44
|
+
export default PluginSlot;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiuikitPlugin, PluginSlotName } from './types';
|
|
2
|
+
/** Internal, normalized values consumed by the slot hooks. Supplementary
|
|
3
|
+
* slots contain components; tab slots contain tab descriptors. The public
|
|
4
|
+
* hooks restore the precise per-slot type when reading an entry. */
|
|
5
|
+
export type PluginSlotRegistry = ReadonlyMap<PluginSlotName, readonly unknown[]>;
|
|
6
|
+
/** Indexes every declared fill once, preserving plugin registration order. */
|
|
7
|
+
export declare function createPluginSlotRegistry(plugins: readonly ApiuikitPlugin[]): PluginSlotRegistry;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { HttpMethod, OpenAPIDocumentData } from '../types/openapi';
|
|
3
|
+
import { AsyncAPIDocumentData } from '../types/schema';
|
|
4
|
+
/** Registered names third-party plugins can fill. Add a new member here (and
|
|
5
|
+
* a matching entry in `PluginSlotContextMap`) whenever a new extension point
|
|
6
|
+
* is introduced — every existing plugin keeps compiling unchanged since
|
|
7
|
+
* `ApiuikitPlugin.slots` only requires the entries a plugin actually fills.
|
|
8
|
+
*
|
|
9
|
+
* Two shapes exist:
|
|
10
|
+
* - `*.operation.reference.supplementary` — rendered at the supplementary
|
|
11
|
+
* extension point within the built-in Reference panel. Reserved for small,
|
|
12
|
+
* secondary additions that complement rather than replace its content.
|
|
13
|
+
* - `*.operation.tab` — a full tab in the operation panel's tab strip,
|
|
14
|
+
* alongside the built-in "Reference" tab. Selecting it hands the
|
|
15
|
+
* plugin the *entire* panel body instead of a sliver of it — see
|
|
16
|
+
* `TabSlotName`/`PluginTabSlotFill`. This is what a plugin like "try it
|
|
17
|
+
* out" wants: its own space, not squeezed between documentation sections. */
|
|
18
|
+
/** Slots whose fill is rendered directly at the extension point. Unlike tab
|
|
19
|
+
* slots, these are filled by a bare React component. */
|
|
20
|
+
export type SupplementarySlotName = "openapi.operation.reference.supplementary" | "asyncapi.operation.reference.supplementary";
|
|
21
|
+
/** The `*.operation.tab` slots — see `PluginSlotName`'s doc comment for what
|
|
22
|
+
* distinguishes them from inline slots. */
|
|
23
|
+
export type TabSlotName = "openapi.operation.tab" | "asyncapi.operation.tab";
|
|
24
|
+
export type PluginSlotName = SupplementarySlotName | TabSlotName;
|
|
25
|
+
/**
|
|
26
|
+
* The whole document plus which OpenAPI operation this slot instance is
|
|
27
|
+
* for, identified by `method`/`path` (its key in `document.paths`, not the
|
|
28
|
+
* optional, often-absent `operationId` field). Deliberately unopinionated:
|
|
29
|
+
* apiuikit doesn't pre-extract parameters/requestBody/security for you —
|
|
30
|
+
* look those up from `document.paths[path][method]` yourself and resolve
|
|
31
|
+
* whatever shape your plugin actually needs. This keeps the slot contract
|
|
32
|
+
* stable as the document
|
|
33
|
+
* schema's own details evolve, and doesn't force every plugin through the
|
|
34
|
+
* same request-shape assumptions a fixed set of fields would bake in.
|
|
35
|
+
*/
|
|
36
|
+
export interface OpenAPIOperationPluginContext {
|
|
37
|
+
document: OpenAPIDocumentData;
|
|
38
|
+
method: HttpMethod;
|
|
39
|
+
path: string;
|
|
40
|
+
}
|
|
41
|
+
/** The whole document plus which AsyncAPI operation this slot instance is
|
|
42
|
+
* for — its key in `document.operations`. Look up the operation itself
|
|
43
|
+
* (`document.operations[operationId]`) for its action, messages, bindings,
|
|
44
|
+
* or anything else your plugin needs. */
|
|
45
|
+
export interface AsyncAPIOperationPluginContext {
|
|
46
|
+
document: AsyncAPIDocumentData;
|
|
47
|
+
operationId: string;
|
|
48
|
+
}
|
|
49
|
+
export interface PluginSlotContextMap {
|
|
50
|
+
"openapi.operation.reference.supplementary": OpenAPIOperationPluginContext;
|
|
51
|
+
"asyncapi.operation.reference.supplementary": AsyncAPIOperationPluginContext;
|
|
52
|
+
"openapi.operation.tab": OpenAPIOperationPluginContext;
|
|
53
|
+
"asyncapi.operation.tab": AsyncAPIOperationPluginContext;
|
|
54
|
+
}
|
|
55
|
+
export type PluginSlotComponent<N extends PluginSlotName> = ComponentType<PluginSlotContextMap[N]>;
|
|
56
|
+
/** What a plugin fills a `*.operation.tab` slot with: its component, plus the
|
|
57
|
+
* label its tab shows in the operation panel's tab strip (next to the
|
|
58
|
+
* built-in "Reference" tab). Static text owned by the plugin, not
|
|
59
|
+
* host-configurable — the host doesn't know a plugin's tabs exist ahead of
|
|
60
|
+
* registering it. Two plugins filling the same tab slot each get their own
|
|
61
|
+
* tab, in registration order. */
|
|
62
|
+
export interface PluginTabSlotFill<N extends TabSlotName> {
|
|
63
|
+
label: string;
|
|
64
|
+
component: PluginSlotComponent<N>;
|
|
65
|
+
}
|
|
66
|
+
/** Supplementary slots are filled with a bare component; `*.operation.tab`
|
|
67
|
+
* slots are filled with a `PluginTabSlotFill` (component + tab label), since
|
|
68
|
+
* the host needs the label before any tab's content is rendered. */
|
|
69
|
+
type PluginSlotFill<N extends PluginSlotName> = N extends TabSlotName ? PluginTabSlotFill<N> : PluginSlotComponent<N>;
|
|
70
|
+
/** A plugin fills one or more named slots. Unfilled slots are simply absent
|
|
71
|
+
* from `slots` rather than declared with a null/undefined value. */
|
|
72
|
+
export interface ApiuikitPlugin {
|
|
73
|
+
/** Unique, human-readable identifier, e.g. "try-it-out-http". Used only in
|
|
74
|
+
* error/debug messages today, not as a registry key. */
|
|
75
|
+
name: string;
|
|
76
|
+
slots: {
|
|
77
|
+
[N in PluginSlotName]?: PluginSlotFill<N>;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Identity helper: exists purely so plugin authors get a typed object
|
|
81
|
+
* literal (and future validation, if it's ever needed) without importing
|
|
82
|
+
* `ApiuikitPlugin` by name at every call site. */
|
|
83
|
+
export declare function definePlugin(plugin: ApiuikitPlugin): ApiuikitPlugin;
|
|
84
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Yr = Object.defineProperty;
|
|
2
2
|
var Xr = (a, e, i) => e in a ? Yr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[e] = i;
|
|
3
3
|
var ve = (a, e, i) => Xr(a, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
-
import { c as Ne, a as Kr } from "./index-
|
|
4
|
+
import { c as Ne, a as Kr } from "./index-D1584wmO.js";
|
|
5
5
|
var Er = { exports: {} }, Ar = { exports: {} }, Tr = {}, Ue = {}, Rr = Qr;
|
|
6
6
|
function Qr(a, e) {
|
|
7
7
|
for (var i = new Array(arguments.length - 1), f = 0, s = 2, u = !0; s < arguments.length; )
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Yr=Object.defineProperty;var Xr=(a,e,i)=>e in a?Yr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i;var ve=(a,e,i)=>Xr(a,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("./index-
|
|
1
|
+
"use strict";var Yr=Object.defineProperty;var Xr=(a,e,i)=>e in a?Yr(a,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[e]=i;var ve=(a,e,i)=>Xr(a,typeof e!="symbol"?e+"":e,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("./index-CF-r_0ZS.cjs");var Er={exports:{}},Ar={exports:{}},Tr={},Ue={},Rr=Kr;function Kr(a,e){for(var i=new Array(arguments.length-1),f=0,s=2,u=!0;s<arguments.length;)i[f++]=arguments[s++];return new Promise(function(o,r){i[f]=function(c){if(u)if(u=!1,c)r(c);else{for(var l=new Array(arguments.length-1),d=0;d<l.length;)l[d++]=arguments[d];o.apply(null,l)}};try{a.apply(e||null,i)}catch(n){u&&(u=!1,r(n))}})}var Nr={};(function(a){var e=a;e.length=function(o){var r=o.length;if(!r)return 0;for(var n=0;--r%4>1&&o.charAt(r)==="=";)++n;return Math.ceil(o.length*3)/4-n};for(var i=new Array(64),f=new Array(123),s=0;s<64;)f[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;e.encode=function(o,r,n){for(var c=null,l=[],d=0,p=0,m;r<n;){var g=o[r++];switch(p){case 0:l[d++]=i[g>>2],m=(g&3)<<4,p=1;break;case 1:l[d++]=i[m|g>>4],m=(g&15)<<2,p=2;break;case 2:l[d++]=i[m|g>>6],l[d++]=i[g&63],p=0;break}d>8191&&((c||(c=[])).push(String.fromCharCode.apply(String,l)),d=0)}return p&&(l[d++]=i[m],l[d++]=61,p===1&&(l[d++]=61)),c?(d&&c.push(String.fromCharCode.apply(String,l.slice(0,d))),c.join("")):String.fromCharCode.apply(String,l.slice(0,d))};var u="invalid encoding";e.decode=function(o,r,n){for(var c=n,l=0,d,p=0;p<o.length;){var m=o.charCodeAt(p++);if(m===61&&l>1)break;if((m=f[m])===void 0)throw Error(u);switch(l){case 0:d=m,l=1;break;case 1:r[n++]=d<<2|(m&48)>>4,d=m,l=2;break;case 2:r[n++]=(d&15)<<4|(m&60)>>2,d=m,l=3;break;case 3:r[n++]=(d&3)<<6|m,l=0;break}}if(l===1)throw Error(u);return n-c},e.test=function(o){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o)}})(Nr);var Qr=ze;function ze(){this._listeners=Object.create(null)}ze.prototype.on=function(e,i,f){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:i,ctx:f||this}),this};ze.prototype.off=function(e,i){if(e===void 0)this._listeners=Object.create(null);else if(i===void 0)this._listeners[e]=[];else{var f=this._listeners[e];if(!f)return this;for(var s=0;s<f.length;)f[s].fn===i?f.splice(s,1):++s}return this};ze.prototype.emit=function(e){var i=this._listeners[e];if(i){for(var f=[],s=1;s<arguments.length;)f.push(arguments[s++]);for(s=0;s<i.length;)i[s].fn.apply(i[s++].ctx,f)}return this};var ei=Ct(Ct);function Ct(a){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),i=new Uint8Array(e.buffer),f=i[3]===128;function s(r,n,c){e[0]=r,n[c]=i[0],n[c+1]=i[1],n[c+2]=i[2],n[c+3]=i[3]}function u(r,n,c){e[0]=r,n[c]=i[3],n[c+1]=i[2],n[c+2]=i[1],n[c+3]=i[0]}a.writeFloatLE=f?s:u,a.writeFloatBE=f?u:s;function t(r,n){return i[0]=r[n],i[1]=r[n+1],i[2]=r[n+2],i[3]=r[n+3],e[0]}function o(r,n){return i[3]=r[n],i[2]=r[n+1],i[1]=r[n+2],i[0]=r[n+3],e[0]}a.readFloatLE=f?t:o,a.readFloatBE=f?o:t})():(function(){function e(f,s,u,t){var o=s<0?1:0;if(o&&(s=-s),s===0)f(1/s>0?0:2147483648,u,t);else if(isNaN(s))f(2143289344,u,t);else if(s>34028234663852886e22)f((o<<31|2139095040)>>>0,u,t);else if(s<11754943508222875e-54)f((o<<31|Math.round(s/1401298464324817e-60))>>>0,u,t);else{var r=Math.floor(Math.log(s)/Math.LN2),n=Math.round(s*Math.pow(2,-r)*8388608)&8388607;f((o<<31|r+127<<23|n)>>>0,u,t)}}a.writeFloatLE=e.bind(null,Bt),a.writeFloatBE=e.bind(null,Pt);function i(f,s,u){var t=f(s,u),o=(t>>31)*2+1,r=t>>>23&255,n=t&8388607;return r===255?n?NaN:o*(1/0):r===0?o*1401298464324817e-60*n:o*Math.pow(2,r-150)*(n+8388608)}a.readFloatLE=i.bind(null,qt),a.readFloatBE=i.bind(null,jt)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),i=new Uint8Array(e.buffer),f=i[7]===128;function s(r,n,c){e[0]=r,n[c]=i[0],n[c+1]=i[1],n[c+2]=i[2],n[c+3]=i[3],n[c+4]=i[4],n[c+5]=i[5],n[c+6]=i[6],n[c+7]=i[7]}function u(r,n,c){e[0]=r,n[c]=i[7],n[c+1]=i[6],n[c+2]=i[5],n[c+3]=i[4],n[c+4]=i[3],n[c+5]=i[2],n[c+6]=i[1],n[c+7]=i[0]}a.writeDoubleLE=f?s:u,a.writeDoubleBE=f?u:s;function t(r,n){return i[0]=r[n],i[1]=r[n+1],i[2]=r[n+2],i[3]=r[n+3],i[4]=r[n+4],i[5]=r[n+5],i[6]=r[n+6],i[7]=r[n+7],e[0]}function o(r,n){return i[7]=r[n],i[6]=r[n+1],i[5]=r[n+2],i[4]=r[n+3],i[3]=r[n+4],i[2]=r[n+5],i[1]=r[n+6],i[0]=r[n+7],e[0]}a.readDoubleLE=f?t:o,a.readDoubleBE=f?o:t})():(function(){function e(f,s,u,t,o,r){var n=t<0?1:0;if(n&&(t=-t),t===0)f(0,o,r+s),f(1/t>0?0:2147483648,o,r+u);else if(isNaN(t))f(0,o,r+s),f(2146959360,o,r+u);else if(t>17976931348623157e292)f(0,o,r+s),f((n<<31|2146435072)>>>0,o,r+u);else{var c;if(t<22250738585072014e-324)c=t/5e-324,f(c>>>0,o,r+s),f((n<<31|c/4294967296)>>>0,o,r+u);else{var l=Math.floor(Math.log(t)/Math.LN2);l===1024&&(l=1023),c=t*Math.pow(2,-l),f(c*4503599627370496>>>0,o,r+s),f((n<<31|l+1023<<20|c*1048576&1048575)>>>0,o,r+u)}}}a.writeDoubleLE=e.bind(null,Bt,0,4),a.writeDoubleBE=e.bind(null,Pt,4,0);function i(f,s,u,t,o){var r=f(t,o+s),n=f(t,o+u),c=(n>>31)*2+1,l=n>>>20&2047,d=4294967296*(n&1048575)+r;return l===2047?d?NaN:c*(1/0):l===0?c*5e-324*d:c*Math.pow(2,l-1075)*(d+4503599627370496)}a.readDoubleLE=i.bind(null,qt,0,4),a.readDoubleBE=i.bind(null,jt,4,0)})(),a}function Bt(a,e,i){e[i]=a&255,e[i+1]=a>>>8&255,e[i+2]=a>>>16&255,e[i+3]=a>>>24}function Pt(a,e,i){e[i]=a>>>24,e[i+1]=a>>>16&255,e[i+2]=a>>>8&255,e[i+3]=a&255}function qt(a,e){return(a[e]|a[e+1]<<8|a[e+2]<<16|a[e+3]<<24)>>>0}function jt(a,e){return(a[e]<<24|a[e+1]<<16|a[e+2]<<8|a[e+3])>>>0}var kr={};(function(a){var e=a,i=65533;e.length=function(s){for(var u=0,t=0,o=0;o<s.length;++o)t=s.charCodeAt(o),t<128?u+=1:t<2048?u+=2:(t&64512)===55296&&(s.charCodeAt(o+1)&64512)===56320?(++o,u+=4):u+=3;return u},e.read=function(s,u,t){if(t-u<1)return"";for(var o=null,r=[],n=0,c,l,d,p;u<t;)c=s[u++],c<=127?r[n++]=c:c>=192&&c<224?(d=(c&31)<<6|s[u++]&63,r[n++]=d>=128?d:i):c>=224&&c<240?(p=(c&15)<<12|(s[u++]&63)<<6|s[u++]&63,r[n++]=p>=2048?p:i):c>=240&&(l=(c&7)<<18|(s[u++]&63)<<12|(s[u++]&63)<<6|s[u++]&63,l<65536||l>1114111?r[n++]=i:(l-=65536,r[n++]=55296+(l>>10),r[n++]=56320+(l&1023))),n>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,r.slice(0,n))),n=0);return o?(n&&o.push(String.fromCharCode.apply(String,r.slice(0,n))),o.join("")):String.fromCharCode.apply(String,r.slice(0,n))},e.write=function(s,u,t){for(var o=t,r,n,c=0;c<s.length;++c)r=s.charCodeAt(c),r<128?u[t++]=r:r<2048?(u[t++]=r>>6|192,u[t++]=r&63|128):(r&64512)===55296&&((n=s.charCodeAt(c+1))&64512)===56320?(r=65536+((r&1023)<<10)+(n&1023),++c,u[t++]=r>>18|240,u[t++]=r>>12&63|128,u[t++]=r>>6&63|128,u[t++]=r&63|128):(u[t++]=r>>12|224,u[t++]=r>>6&63|128,u[t++]=r&63|128);return t-o}})(kr);var ti=ri;function ri(a,e,i){var f=i||8192,s=f>>>1,u=null,t=f;return function(r){if(r<1||r>s)return a(r);t+r>f&&(u=a(f),t=0);var n=e.call(u,t,t+=r);return t&7&&(t=(t|7)+1),n}}var Ze,$t;function ii(){if($t)return Ze;$t=1,Ze=e;var a=me();function e(u,t){this.lo=u>>>0,this.hi=t>>>0}var i=e.zero=new e(0,0);i.toNumber=function(){return 0},i.zzEncode=i.zzDecode=function(){return this},i.length=function(){return 1};var f=e.zeroHash="\0\0\0\0\0\0\0\0";e.fromNumber=function(t){if(t===0)return i;var o=t<0;o&&(t=-t);var r=t>>>0,n=(t-r)/4294967296>>>0;return o&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new e(r,n)},e.from=function(t){if(typeof t=="number")return e.fromNumber(t);if(a.isString(t))if(a.Long)t=a.Long.fromString(t);else return e.fromNumber(parseInt(t,10));return t.low||t.high?new e(t.low>>>0,t.high>>>0):i},e.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var o=~this.lo+1>>>0,r=~this.hi>>>0;return o||(r=r+1>>>0),-(o+r*4294967296)}return this.lo+this.hi*4294967296},e.prototype.toLong=function(t){return a.Long?new a.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var s=String.prototype.charCodeAt;return e.fromHash=function(t){return t===f?i:new e((s.call(t,0)|s.call(t,1)<<8|s.call(t,2)<<16|s.call(t,3)<<24)>>>0,(s.call(t,4)|s.call(t,5)<<8|s.call(t,6)<<16|s.call(t,7)<<24)>>>0)},e.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},e.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},e.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},e.prototype.length=function(){var t=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?o===0?t<16384?t<128?1:2:t<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:r<128?9:10},Ze}var De={exports:{}},ni=De.exports,Ut;function si(){return Ut||(Ut=1,(function(a,e){(function(i,f){function s(u){return u.default||u}f(e),a.exports=s(e)})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:ni,function(i){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2009 The Closure Library Authors
|
|
4
4
|
* Copyright 2020 Daniel Wirtz / The long.js Authors.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { protoToJsonSchema as e } from "./protoToJsonSchema-
|
|
2
|
-
import { r as a, X as t, i as s } from "./index-
|
|
1
|
+
import { protoToJsonSchema as e } from "./protoToJsonSchema-Bu1_KtXF.js";
|
|
2
|
+
import { r as a, X as t, i as s } from "./index-D1584wmO.js";
|
|
3
3
|
function n(r) {
|
|
4
4
|
if (typeof r != "string")
|
|
5
5
|
return ["Protobuf schema must be a string of .proto source"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./protoToJsonSchema-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./protoToJsonSchema-DJXdCExT.cjs"),e=require("./index-CF-r_0ZS.cjs");function n(r){if(typeof r!="string")return["Protobuf schema must be a string of .proto source"];try{return t.protoToJsonSchema(r),[]}catch(o){return[o instanceof Error?o.message:"Failed to parse protobuf schema"]}}const s=["application/vnd.google.protobuf","application/vnd.google.protobuf;version=2","application/vnd.google.protobuf;version=3"];function a(){return{validate:u,parse:i,getMimeTypes:()=>s}}function c(r){e.registerSchemaParserWithFallback(r,a(),e.isProtobufSchemaFormat)}function u(r){return n(r.data).map(o=>({message:o,path:r.path}))}function i(r){if(typeof r.data!="string")return{[e.X_LIB_CONVERSION_ERROR]:"Protobuf schema must be a string of .proto source"};try{return t.protoToJsonSchema(r.data)}catch(o){return{[e.X_LIB_CONVERSION_ERROR]:o instanceof Error?o.message:"Failed to convert Protobuf schema"}}}exports.ProtobufSchemaParser=a;exports.registerProtobufSchemaParser=c;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
2
|
import { SpecType } from '../contexts';
|
|
3
3
|
import { ConfigInterface } from '../config';
|
|
4
|
+
import { ApiuikitPlugin } from '../plugins/types';
|
|
4
5
|
export interface GenericSectionProps<T> {
|
|
5
6
|
/** The document. Required standalone; unnecessary (and ignored) when rendered inside the matching provider. */
|
|
6
7
|
document?: T;
|
|
7
8
|
config?: ConfigInterface;
|
|
9
|
+
/** Third-party plugins. Only applied standalone (this section sets up its own provider); composed under an ambient provider, that provider's own `plugins` apply instead. */
|
|
10
|
+
plugins?: ApiuikitPlugin[];
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Builds a `SectionRoot`: renders `children` inside the ambient document
|
|
@@ -24,7 +27,8 @@ export interface GenericSectionProps<T> {
|
|
|
24
27
|
export declare function createSectionRoot<T>(Provider: ComponentType<{
|
|
25
28
|
document: T;
|
|
26
29
|
config?: ConfigInterface;
|
|
30
|
+
plugins?: ApiuikitPlugin[];
|
|
27
31
|
children: ReactNode;
|
|
28
|
-
}>, specLabel: string, specType: SpecType): ({ document, config, children, }: GenericSectionProps<T> & {
|
|
32
|
+
}>, specLabel: string, specType: SpecType): ({ document, config, plugins, children, }: GenericSectionProps<T> & {
|
|
29
33
|
children: ReactNode;
|
|
30
34
|
}) => import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ConfigInterface } from '../config';
|
|
3
|
+
import { ApiuikitPlugin } from '../plugins/types';
|
|
3
4
|
import { OpenAPIDocumentData } from '../types/openapi';
|
|
4
5
|
import { SectionLayout } from '../components/Section';
|
|
5
6
|
/**
|
|
@@ -13,6 +14,9 @@ export interface OpenAPISectionProps {
|
|
|
13
14
|
/** The OpenAPI document. Required standalone; unnecessary (and ignored) when rendered inside <OpenAPIProvider>. */
|
|
14
15
|
document?: OpenAPIDocumentData;
|
|
15
16
|
config?: ConfigInterface;
|
|
17
|
+
/** Only applied when this section sets up its own context (standalone). When
|
|
18
|
+
* composed under <OpenAPIProvider>, that provider's own `plugins` apply. */
|
|
19
|
+
plugins?: ApiuikitPlugin[];
|
|
16
20
|
/**
|
|
17
21
|
* `"columns"` (default) — reserved right gutter at large breakpoints.
|
|
18
22
|
* `"stacked"` — full-width single column; no prose max-width and no empty
|
|
@@ -20,9 +24,11 @@ export interface OpenAPISectionProps {
|
|
|
20
24
|
*/
|
|
21
25
|
layout?: SectionLayout;
|
|
22
26
|
}
|
|
23
|
-
export declare function OpenAPIProvider({ document, config, children, }: {
|
|
27
|
+
export declare function OpenAPIProvider({ document, config, plugins, children, }: {
|
|
24
28
|
document: OpenAPIDocumentData;
|
|
25
29
|
config?: ConfigInterface;
|
|
30
|
+
/** Third-party plugins shared with sections inside. */
|
|
31
|
+
plugins?: ApiuikitPlugin[];
|
|
26
32
|
children: ReactNode;
|
|
27
33
|
}): import("react").JSX.Element;
|
|
28
34
|
export declare function OpenAPIServers({ layout, ...providerProps }: OpenAPISectionProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ConfigInterface } from '../config';
|
|
3
|
+
import { ApiuikitPlugin } from '../plugins/types';
|
|
3
4
|
import { AsyncAPIDocumentData } from '../types/schema';
|
|
4
5
|
import { SectionLayout } from '../components/Section';
|
|
5
6
|
/**
|
|
@@ -26,6 +27,9 @@ export interface SectionProps {
|
|
|
26
27
|
/** Only applied when this section sets up its own context (standalone). When
|
|
27
28
|
* composed under a provider, config comes from that provider. */
|
|
28
29
|
config?: ConfigInterface;
|
|
30
|
+
/** Only applied when this section sets up its own context (standalone). When
|
|
31
|
+
* composed under <AsyncAPIProvider>, that provider's own `plugins` apply. */
|
|
32
|
+
plugins?: ApiuikitPlugin[];
|
|
29
33
|
/**
|
|
30
34
|
* `"columns"` (default) — reserved right gutter at large breakpoints.
|
|
31
35
|
* `"stacked"` — full-width single column; no prose max-width and no empty
|
|
@@ -37,11 +41,13 @@ export interface SectionProps {
|
|
|
37
41
|
* Provider that resolves a document once and shares it with any section
|
|
38
42
|
* components rendered inside: the composition entry point.
|
|
39
43
|
*/
|
|
40
|
-
export declare function AsyncAPIProvider({ document, config, children, }: {
|
|
44
|
+
export declare function AsyncAPIProvider({ document, config, plugins, children, }: {
|
|
41
45
|
/** The AsyncAPI document to resolve and share with sections inside. */
|
|
42
46
|
document: AsyncAPIDocumentData;
|
|
43
47
|
/** UI configuration (theme, schema expansion defaults) shared with sections inside. */
|
|
44
48
|
config?: ConfigInterface;
|
|
49
|
+
/** Third-party plugins shared with sections inside. */
|
|
50
|
+
plugins?: ApiuikitPlugin[];
|
|
45
51
|
/** Section components (or your own), rendered with access to the shared document context. */
|
|
46
52
|
children: ReactNode;
|
|
47
53
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Which side of its anchor a floating layer ended up on. */
|
|
2
|
+
export type LayerPlacement = "top" | "bottom";
|
|
3
|
+
/**
|
|
4
|
+
* How the layer lines up horizontally with its anchor. `center` layers are
|
|
5
|
+
* rendered with a `-translate-x-1/2`, so `left` is the anchor's midpoint;
|
|
6
|
+
* `end` ones are positioned by their own left edge and need `width`.
|
|
7
|
+
*/
|
|
8
|
+
export type LayerAlign = "center" | "end";
|
|
9
|
+
export interface AnchorPosition {
|
|
10
|
+
top: number;
|
|
11
|
+
left: number;
|
|
12
|
+
placement: LayerPlacement;
|
|
13
|
+
}
|
|
14
|
+
interface AnchorOptions {
|
|
15
|
+
align?: LayerAlign;
|
|
16
|
+
/** Gap between the anchor's edge and the layer. */
|
|
17
|
+
gap?: number;
|
|
18
|
+
/** Room the layer needs above the anchor before it flips below instead. */
|
|
19
|
+
clearance?: number;
|
|
20
|
+
/** The layer's own width. Required by `end` alignment to keep it on-screen. */
|
|
21
|
+
width?: number;
|
|
22
|
+
/** Keep-out margin from the viewport's left/right edges. */
|
|
23
|
+
margin?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Viewport coordinates for a `position: fixed` layer (tooltip, popover)
|
|
27
|
+
* anchored to `anchor`, flipping below when there isn't room above and
|
|
28
|
+
* clamping horizontally so an `end`-aligned layer never runs off-screen.
|
|
29
|
+
*
|
|
30
|
+
* Shared by every floating layer in the address bar — the per-parameter
|
|
31
|
+
* tooltips, the full-address peek, and the query parameter popover — so they
|
|
32
|
+
* all flip and clamp by the same rules.
|
|
33
|
+
*/
|
|
34
|
+
export declare function computeAnchorPosition(anchor: HTMLElement, { align, gap, clearance, width, margin }?: AnchorOptions): AnchorPosition;
|
|
35
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apiuikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "A React UI library for rendering your API specifications",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"bugs": {
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
"import": "./dist/markdown.es.js",
|
|
30
30
|
"require": "./dist/markdown.cjs"
|
|
31
31
|
},
|
|
32
|
+
"./plugin": {
|
|
33
|
+
"types": "./dist/plugin.d.ts",
|
|
34
|
+
"import": "./dist/plugin.es.js",
|
|
35
|
+
"require": "./dist/plugin.cjs"
|
|
36
|
+
},
|
|
32
37
|
"./style.css": "./dist/apiuikit.css"
|
|
33
38
|
},
|
|
34
39
|
"files": [
|
|
@@ -37,7 +42,7 @@
|
|
|
37
42
|
],
|
|
38
43
|
"scripts": {
|
|
39
44
|
"dev": "vite",
|
|
40
|
-
"build": "vite build && node scripts/verifyCssIsolation.mjs && vite build --config vite.markdown.config.ts && node scripts/verifyPackageExports.mjs",
|
|
45
|
+
"build": "vite build && node scripts/verifyCssIsolation.mjs && vite build --config vite.markdown.config.ts && vite build --config vite.plugin.config.ts && node scripts/verifyPackageExports.mjs",
|
|
41
46
|
"watch": "vite build --watch",
|
|
42
47
|
"prepublishOnly": "cp ../../README.md ./README.md && npm run build",
|
|
43
48
|
"typecheck": "node scripts/typecheck.mjs",
|