rapidoc 11.0.1 → 12.0.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.
Files changed (80) hide show
  1. package/README.md +46 -31
  2. package/dist/rapidoc-min.js +1424 -213
  3. package/dist/rapidoc-static-min.js +13542 -0
  4. package/package.json +47 -35
  5. package/src/components/api-request.ts +869 -0
  6. package/src/components/api-response.ts +509 -0
  7. package/src/components/json-tree.ts +171 -0
  8. package/src/components/schema-base-element.ts +315 -0
  9. package/src/components/schema-table.ts +430 -0
  10. package/src/components/schema-tree.ts +386 -0
  11. package/src/components/tag-input.ts +184 -0
  12. package/src/index.js +6 -0
  13. package/src/oauth-receiver.ts +29 -0
  14. package/src/rapidoc-mini.ts +582 -0
  15. package/src/rapidoc.ts +1808 -0
  16. package/src/static/index.d.ts +149 -0
  17. package/src/static/index.js +62 -0
  18. package/src/static/navigation.js +497 -0
  19. package/src/static/render.js +490 -0
  20. package/src/static/serializer.js +216 -0
  21. package/src/styles/auth-styles.js +318 -0
  22. package/src/styles/border-styles.js +24 -0
  23. package/src/styles/css-bundle.js +129 -0
  24. package/src/styles/custom-styles.js +8 -0
  25. package/src/styles/dialog-box-styles.js +102 -0
  26. package/src/styles/endpoint-styles.js +559 -0
  27. package/src/styles/flex-styles.js +16 -0
  28. package/src/styles/font-styles.js +432 -0
  29. package/src/styles/info-styles.js +36 -0
  30. package/src/styles/input-styles.js +555 -0
  31. package/src/styles/layout-styles.js +396 -0
  32. package/src/styles/microlighter-styles.js +99 -0
  33. package/src/styles/nav-styles.js +609 -0
  34. package/src/styles/param-list-styles.js +261 -0
  35. package/src/styles/schema-styles.js +288 -0
  36. package/src/styles/tab-styles.js +106 -0
  37. package/src/styles/theme-tokens.js +582 -0
  38. package/src/templates/advanced-search-dialog-template.js +94 -0
  39. package/src/templates/api-response-template.js +219 -0
  40. package/src/templates/callback-template.js +86 -0
  41. package/src/templates/code-samples-template.js +52 -0
  42. package/src/templates/components-template.js +86 -0
  43. package/src/templates/downloads-template.js +85 -0
  44. package/src/templates/endpoint-template.js +386 -0
  45. package/src/templates/expanded-endpoint-template.js +266 -0
  46. package/src/templates/focused-endpoint-template.js +145 -0
  47. package/src/templates/header-template.js +92 -0
  48. package/src/templates/logo-template.js +21 -0
  49. package/src/templates/main-body-template.js +102 -0
  50. package/src/templates/navbar-template.js +489 -0
  51. package/src/templates/overview-template.js +104 -0
  52. package/src/templates/request-body-template.js +651 -0
  53. package/src/templates/request-params-template.js +474 -0
  54. package/src/templates/security-scheme-template.js +1263 -0
  55. package/src/templates/server-template.js +152 -0
  56. package/src/utils/auto-color-scheme.js +99 -0
  57. package/src/utils/bind-navbar.js +175 -0
  58. package/src/utils/color-utils.js +59 -0
  59. package/src/utils/common-utils.js +191 -0
  60. package/src/utils/curl-utils.js +123 -0
  61. package/src/utils/highlighter.js +416 -0
  62. package/src/utils/markdown-utils.js +110 -0
  63. package/src/utils/mcp/common.js +467 -0
  64. package/src/utils/mcp/generators/csharp.js +242 -0
  65. package/src/utils/mcp/generators/go.js +298 -0
  66. package/src/utils/mcp/generators/java.js +330 -0
  67. package/src/utils/mcp/generators/python.js +248 -0
  68. package/src/utils/mcp/generators/rust.js +281 -0
  69. package/src/utils/mcp/generators/typescript.js +290 -0
  70. package/src/utils/mcp-generator.js +143 -0
  71. package/src/utils/mock-interceptor.js +508 -0
  72. package/src/utils/oauth-utils.js +87 -0
  73. package/src/utils/request-utils.js +203 -0
  74. package/src/utils/response-utils.js +203 -0
  75. package/src/utils/sanitize.js +57 -0
  76. package/src/utils/schema-utils.js +1927 -0
  77. package/src/utils/slugger.js +189 -0
  78. package/src/utils/spec-parser.js +915 -0
  79. package/src/utils/url-utils.js +211 -0
  80. package/src/utils/xml-utils.js +61 -0
@@ -0,0 +1,149 @@
1
+ /**
2
+ * TypeScript Type Definitions for 'rapidoc/static'
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
+ [key: string]: any;
27
+ }
28
+
29
+ export type RapiDocOptions = RenderRapiDocOptions;
30
+
31
+ export interface RenderEndpointOptions {
32
+ spec: string | object;
33
+ path: string;
34
+ method: string;
35
+ renderStyle?: "read" | "view";
36
+ layout?: "row" | "column";
37
+ theme?: string;
38
+ colorScheme?: "dark" | "light" | "system";
39
+ includeStyles?: boolean;
40
+ allowTry?: boolean | string;
41
+ schemaStyle?: "table" | "tree";
42
+ }
43
+
44
+ export interface RenderSchemaOptions {
45
+ schema: object | string;
46
+ spec?: string | object;
47
+ style?: "table" | "tree";
48
+ schemaExpandLevel?: number;
49
+ theme?: string;
50
+ colorScheme?: "dark" | "light" | "system";
51
+ includeStyles?: boolean;
52
+ }
53
+
54
+ export interface NavigationOperation {
55
+ method: string;
56
+ path: string;
57
+ summary: string;
58
+ description: string;
59
+ elementId: string;
60
+ deprecated: boolean;
61
+ operationId: string;
62
+ isWebhook: boolean;
63
+ }
64
+
65
+ export interface NavigationTag {
66
+ name: string;
67
+ description: string;
68
+ elementId: string;
69
+ expanded: boolean;
70
+ paths: NavigationOperation[];
71
+ }
72
+
73
+ export interface NavigationTagGroup {
74
+ name: string;
75
+ description: string;
76
+ elementId: string;
77
+ expanded: boolean;
78
+ tags: NavigationTag[];
79
+ }
80
+
81
+ export interface SpecNavigation {
82
+ title: string;
83
+ version: string;
84
+ description: string;
85
+ tagGroups: NavigationTagGroup[];
86
+ tags: NavigationTag[];
87
+ }
88
+
89
+ export interface RenderNavBarHtmlOptions {
90
+ basePath?: string;
91
+ activeHref?: string;
92
+ includeSearch?: boolean;
93
+ searchPlaceholder?: string;
94
+ backToDocsHref?: string;
95
+ backToDocsLabel?: string;
96
+ itemClassName?: string;
97
+ includeOverview?: boolean;
98
+ methodBadgeFormat?: "3-char" | "full";
99
+ /** How each operation shows its HTTP method, as `show-method-in-nav-bar` of `<rapi-doc>` (default `as-colored-block`). */
100
+ showMethodInNavBar?: "false" | "as-plain-text" | "as-colored-text" | "as-colored-block";
101
+ "show-method-in-nav-bar"?: "false" | "as-plain-text" | "as-colored-text" | "as-colored-block";
102
+ /** Show each operation's path instead of its summary, as `use-path-in-nav-bar` of `<rapi-doc>`. */
103
+ usePathInNav?: boolean | "true" | "false";
104
+ "use-path-in-nav-bar"?: boolean | "true" | "false";
105
+ routingMode?: "tag-pages" | "single-page";
106
+ }
107
+
108
+ export function renderRapiDoc(options: RenderRapiDocOptions): Promise<string>;
109
+ export function renderEndpoint(options: RenderEndpointOptions): Promise<string>;
110
+ export function renderSchema(options: RenderSchemaOptions): Promise<string>;
111
+ export function resolveSpecInput(specInput: string | object, options?: any): Promise<any>;
112
+ export function renderTemplateToString(result: any, options?: { stripComments?: boolean }): string;
113
+ export function escapeHtml(str: string): string;
114
+ export function getSpecNavigation(
115
+ specInput: string | object,
116
+ options?: any,
117
+ ): Promise<SpecNavigation>;
118
+ export function getNavBarHtml(
119
+ specInput: string | object,
120
+ options?: RenderNavBarHtmlOptions,
121
+ ): Promise<string>;
122
+ export function renderNavBarHtml(resolvedSpec: any, options?: RenderNavBarHtmlOptions): string;
123
+ export function getNavFilterHtml(options?: {
124
+ searchPlaceholder?: string;
125
+ inputClassName?: string;
126
+ }): string;
127
+ export function bindNavBar(
128
+ sidebar: HTMLElement | string,
129
+ rapiDoc?: HTMLElement | string,
130
+ options?: { activeClass?: string; updateHistory?: boolean },
131
+ ): () => void;
132
+ export function getMethodBadge(method: string, format?: "3-char" | "full"): string;
133
+ export function getBundledCss(options?: {
134
+ theme?: string;
135
+ colorScheme?: string;
136
+ scope?: string;
137
+ }): string;
138
+ export function getNavCss(scope?: string): string;
139
+ export function getThemeTokensCss(theme?: string, scope?: string): string;
140
+ export function toKebabCase(str: string): string;
141
+
142
+ /** Anchor built from an operation's method and path (e.g. "get-routes-id-estimate"); <rapi-doc> resolves it to the operation. */
143
+ export function methodPathSlug(method: string, path: string): string;
144
+
145
+ /** Which field an operation's anchor is built from: 'operationId' (stable), 'summary' or 'path' (method + path). */
146
+ export function operationAnchorSource(op: {
147
+ operationId?: string;
148
+ summary?: string;
149
+ }): "operationId" | "summary" | "path";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Framework-Agnostic Static Pre-Rendering & Portal Utilities for RapiDoc.
3
+ *
4
+ * Exported subpath: 'rapidoc/static'
5
+ *
6
+ * Usable across Node.js >= 22, Bun, Astro, Nuxt, Next.js, 11ty, VitePress, or custom scripts.
7
+ */
8
+
9
+ import { renderRapiDoc, renderEndpoint, renderSchema, resolveSpecInput } from "./render.js";
10
+ import { renderTemplateToString, escapeHtml } from "./serializer.js";
11
+ import {
12
+ getSpecNavigation,
13
+ getNavBarHtml,
14
+ renderNavBarHtml,
15
+ getNavFilterHtml,
16
+ getMethodBadge,
17
+ bindNavBar,
18
+ } from "./navigation.js";
19
+ import { getBundledCss, getNavCss, getThemeTokensCss } from "../styles/css-bundle.js";
20
+ import { toKebabCase, methodPathSlug, operationAnchorSource } from "../utils/slugger.js";
21
+
22
+ export {
23
+ renderRapiDoc,
24
+ renderEndpoint,
25
+ renderSchema,
26
+ resolveSpecInput,
27
+ renderTemplateToString,
28
+ escapeHtml,
29
+ getSpecNavigation,
30
+ getNavBarHtml,
31
+ renderNavBarHtml,
32
+ getNavFilterHtml,
33
+ getMethodBadge,
34
+ bindNavBar,
35
+ getBundledCss,
36
+ getNavCss,
37
+ getThemeTokensCss,
38
+ toKebabCase,
39
+ methodPathSlug,
40
+ operationAnchorSource,
41
+ };
42
+
43
+ export default {
44
+ renderRapiDoc,
45
+ renderEndpoint,
46
+ renderSchema,
47
+ resolveSpecInput,
48
+ renderTemplateToString,
49
+ escapeHtml,
50
+ getSpecNavigation,
51
+ getNavBarHtml,
52
+ renderNavBarHtml,
53
+ getNavFilterHtml,
54
+ getMethodBadge,
55
+ bindNavBar,
56
+ getBundledCss,
57
+ getNavCss,
58
+ getThemeTokensCss,
59
+ toKebabCase,
60
+ methodPathSlug,
61
+ operationAnchorSource,
62
+ };