@rapidoc/prerender 0.0.0-stage → 0.1.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.txt +22 -0
- package/README.md +27 -2
- package/dist/index.js +15146 -0
- package/package.json +57 -4
- package/src/index.d.ts +200 -0
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rapidoc/prerender",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Renders RapiDoc API documentation to HTML at build time: pre-rendered <rapi-doc> (Declarative Shadow DOM or light DOM), sidebar navigation, Arazzo diagrams",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"api-documentation",
|
|
7
|
+
"declarative-shadow-dom",
|
|
8
|
+
"openapi",
|
|
9
|
+
"rapidoc",
|
|
10
|
+
"ssg",
|
|
11
|
+
"ssr",
|
|
12
|
+
"static-site"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://rapidocui.com",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/rapi-doc/RapiDoc/issues"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "Mrinmoy Majumdar <mrin9@yahoo.com>",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/rapi-doc/RapiDoc.git",
|
|
23
|
+
"directory": "packages/rapidoc-prerender"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"src/index.d.ts"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"types": "./src/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./src/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "vite build && node ../../scripts/capture-build-info.js",
|
|
43
|
+
"prepublishOnly": "npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@scalar/openapi-parser": "^0.29.20",
|
|
47
|
+
"github-slugger": "^2.0.0",
|
|
48
|
+
"lit": "^3.3.3",
|
|
49
|
+
"marked": "^18.1.3",
|
|
50
|
+
"microlighter": "^2.2.0",
|
|
51
|
+
"yaml": "^2.9.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"vite": "^8.3.6"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.12.0"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Type Definitions for '@rapidoc/prerender'
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface RenderRapiDocOptions {
|
|
6
|
+
spec: string | object;
|
|
7
|
+
renderStyle?: "read" | "view" | "focused";
|
|
8
|
+
theme?: string;
|
|
9
|
+
colorScheme?: "dark" | "light" | "system";
|
|
10
|
+
layout?: "row" | "column";
|
|
11
|
+
showHeader?: boolean | string;
|
|
12
|
+
showSideNav?: boolean | string;
|
|
13
|
+
showInfo?: boolean | string;
|
|
14
|
+
allowSearch?: boolean | string;
|
|
15
|
+
allowAdvancedSearch?: boolean | string;
|
|
16
|
+
allowServerSelection?: boolean | string;
|
|
17
|
+
allowAuthentication?: boolean | string;
|
|
18
|
+
allowTry?: boolean | string;
|
|
19
|
+
schemaStyle?: "table" | "tree";
|
|
20
|
+
schemaExpandLevel?: number;
|
|
21
|
+
defaultSchemaTab?: "example" | "schema";
|
|
22
|
+
outputMode?: "dsd" | "html" | "light";
|
|
23
|
+
includeStyles?: boolean;
|
|
24
|
+
matchPaths?: string;
|
|
25
|
+
pageDirection?: "ltr" | "rtl";
|
|
26
|
+
/** Keep tags that no operation uses when they have a description, as `show-unused-tags` of `<rapi-doc>`. */
|
|
27
|
+
showUnusedTags?: boolean | "true" | "false";
|
|
28
|
+
/** Inline an object `spec` as a `<script type="application/json" slot="rapidoc-spec">` (default `true`). */
|
|
29
|
+
inlineSpec?: boolean;
|
|
30
|
+
/** The operation shown first in focused mode (default `"overview"`, or the first operation when `showInfo` is off). */
|
|
31
|
+
focusedElementId?: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type RapiDocOptions = RenderRapiDocOptions;
|
|
36
|
+
|
|
37
|
+
export interface RenderEndpointOptions {
|
|
38
|
+
spec: string | object;
|
|
39
|
+
path: string;
|
|
40
|
+
method: string;
|
|
41
|
+
renderStyle?: "read" | "view";
|
|
42
|
+
layout?: "row" | "column";
|
|
43
|
+
theme?: string;
|
|
44
|
+
colorScheme?: "dark" | "light" | "system";
|
|
45
|
+
includeStyles?: boolean;
|
|
46
|
+
allowTry?: boolean | string;
|
|
47
|
+
schemaStyle?: "table" | "tree";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface RenderSchemaOptions {
|
|
51
|
+
schema: object | string;
|
|
52
|
+
spec?: string | object;
|
|
53
|
+
style?: "table" | "tree";
|
|
54
|
+
schemaExpandLevel?: number;
|
|
55
|
+
theme?: string;
|
|
56
|
+
colorScheme?: "dark" | "light" | "system";
|
|
57
|
+
includeStyles?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface NavigationOperation {
|
|
61
|
+
method: string;
|
|
62
|
+
path: string;
|
|
63
|
+
summary: string;
|
|
64
|
+
description: string;
|
|
65
|
+
elementId: string;
|
|
66
|
+
deprecated: boolean;
|
|
67
|
+
operationId: string;
|
|
68
|
+
isWebhook: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface NavigationTag {
|
|
72
|
+
name: string;
|
|
73
|
+
/** `x-displayName` when the spec sets it, else `name`. */
|
|
74
|
+
displayName: string;
|
|
75
|
+
description: string;
|
|
76
|
+
elementId: string;
|
|
77
|
+
expanded: boolean;
|
|
78
|
+
paths: NavigationOperation[];
|
|
79
|
+
/** A tag kept for its description (`show-unused-tags`, or listed in `x-tagGroups`); `paths` is empty. */
|
|
80
|
+
descriptionOnly?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface NavigationTagGroup {
|
|
84
|
+
name: string;
|
|
85
|
+
/** `x-displayName` when the spec sets it, else `name`. */
|
|
86
|
+
displayName: string;
|
|
87
|
+
description: string;
|
|
88
|
+
elementId: string;
|
|
89
|
+
expanded: boolean;
|
|
90
|
+
tags: NavigationTag[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface SpecNavigation {
|
|
94
|
+
title: string;
|
|
95
|
+
version: string;
|
|
96
|
+
description: string;
|
|
97
|
+
tagGroups: NavigationTagGroup[];
|
|
98
|
+
tags: NavigationTag[];
|
|
99
|
+
/** With tag groups, the tags no group lists; otherwise empty. */
|
|
100
|
+
remainingTags: NavigationTag[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface RenderNavBarHtmlOptions {
|
|
104
|
+
basePath?: string;
|
|
105
|
+
activeHref?: string;
|
|
106
|
+
includeSearch?: boolean;
|
|
107
|
+
searchPlaceholder?: string;
|
|
108
|
+
backToDocsHref?: string;
|
|
109
|
+
backToDocsLabel?: string;
|
|
110
|
+
itemClassName?: string;
|
|
111
|
+
includeOverview?: boolean;
|
|
112
|
+
methodBadgeFormat?: "3-char" | "full";
|
|
113
|
+
/** How each operation shows its HTTP method, as `show-method-in-nav-bar` of `<rapi-doc>` (default `as-colored-block`). */
|
|
114
|
+
showMethodInNavBar?: "false" | "as-plain-text" | "as-colored-text" | "as-colored-block";
|
|
115
|
+
"show-method-in-nav-bar"?: "false" | "as-plain-text" | "as-colored-text" | "as-colored-block";
|
|
116
|
+
/** Show each operation's path instead of its summary, as `use-path-in-nav-bar` of `<rapi-doc>`. */
|
|
117
|
+
usePathInNav?: boolean | "true" | "false";
|
|
118
|
+
"use-path-in-nav-bar"?: boolean | "true" | "false";
|
|
119
|
+
routingMode?: "tag-pages" | "single-page";
|
|
120
|
+
"routing-mode"?: "tag-pages" | "single-page";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function renderRapiDoc(options: RenderRapiDocOptions): Promise<string>;
|
|
124
|
+
export function renderEndpoint(options: RenderEndpointOptions): Promise<string>;
|
|
125
|
+
export function renderSchema(options: RenderSchemaOptions): Promise<string>;
|
|
126
|
+
export function resolveSpecInput(specInput: string | object, options?: any): Promise<any>;
|
|
127
|
+
export function renderTemplateToString(result: any, options?: { stripComments?: boolean }): string;
|
|
128
|
+
export function escapeHtml(str: string): string;
|
|
129
|
+
export function getSpecNavigation(
|
|
130
|
+
specInput: string | object,
|
|
131
|
+
options?: any,
|
|
132
|
+
): Promise<SpecNavigation>;
|
|
133
|
+
export function getNavBarHtml(
|
|
134
|
+
specInput: string | object,
|
|
135
|
+
options?: RenderNavBarHtmlOptions,
|
|
136
|
+
): Promise<string>;
|
|
137
|
+
export function renderNavBarHtml(resolvedSpec: any, options?: RenderNavBarHtmlOptions): string;
|
|
138
|
+
export function getNavFilterHtml(options?: {
|
|
139
|
+
searchPlaceholder?: string;
|
|
140
|
+
/** Alias of `searchPlaceholder`. */
|
|
141
|
+
placeholder?: string;
|
|
142
|
+
inputClassName?: string;
|
|
143
|
+
}): string;
|
|
144
|
+
export function bindNavBar(
|
|
145
|
+
sidebar: HTMLElement | string,
|
|
146
|
+
rapiDoc?: HTMLElement | string,
|
|
147
|
+
options?: { activeClass?: string; updateHistory?: boolean },
|
|
148
|
+
): () => void;
|
|
149
|
+
export function getMethodBadge(method: string, format?: "3-char" | "full"): string;
|
|
150
|
+
export function getBundledCss(options?: {
|
|
151
|
+
theme?: string;
|
|
152
|
+
colorScheme?: string;
|
|
153
|
+
scope?: string;
|
|
154
|
+
}): string;
|
|
155
|
+
export function getNavCss(scope?: string): string;
|
|
156
|
+
export function getThemeTokensCss(theme?: string, scope?: string): string;
|
|
157
|
+
export function toKebabCase(str: string): string;
|
|
158
|
+
|
|
159
|
+
/** Anchor built from an operation's method and path (e.g. "get-routes-id-estimate"); <rapi-doc> resolves it to the operation. */
|
|
160
|
+
export function methodPathSlug(method: string, path: string): string;
|
|
161
|
+
|
|
162
|
+
/** Which field an operation's anchor is built from: 'operationId' (stable), 'summary' or 'path' (method + path). */
|
|
163
|
+
export function operationAnchorSource(op: {
|
|
164
|
+
operationId?: string;
|
|
165
|
+
summary?: string;
|
|
166
|
+
}): "operationId" | "summary" | "path";
|
|
167
|
+
|
|
168
|
+
/** A problem found by Arazzo validation. */
|
|
169
|
+
export interface ArazzoProblem {
|
|
170
|
+
level: "error" | "warning";
|
|
171
|
+
path: string;
|
|
172
|
+
message: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Draws one Arazzo workflow as an SVG string. `sources` maps source description names to their
|
|
177
|
+
* OpenAPI documents (text or object), so steps show their method and path. Style the result with
|
|
178
|
+
* `getFlowCss()` plus `getThemeTokensCss()`.
|
|
179
|
+
*/
|
|
180
|
+
export function renderArazzoWorkflow(
|
|
181
|
+
arazzo: string | object,
|
|
182
|
+
options?: {
|
|
183
|
+
workflowId?: string;
|
|
184
|
+
sources?: Record<string, string | object>;
|
|
185
|
+
/** "expanded" (default) lists each step's inputs and actions in its box. */
|
|
186
|
+
view?: "expanded" | "compact";
|
|
187
|
+
idPrefix?: string;
|
|
188
|
+
interactive?: boolean;
|
|
189
|
+
},
|
|
190
|
+
): {
|
|
191
|
+
svg: string;
|
|
192
|
+
/** Kinds of lines drawn, for a legend, in this order when present. */
|
|
193
|
+
legend: ("seq" | "data" | "output" | "success" | "failure" | "action")[];
|
|
194
|
+
graph: object | null;
|
|
195
|
+
problems: ArazzoProblem[];
|
|
196
|
+
workflowIds: string[];
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/** CSS for the diagrams drawn by `renderArazzoWorkflow`. */
|
|
200
|
+
export function getFlowCss(): string;
|