rapidoc 11.0.0 → 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 +48 -34
  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
package/README.md CHANGED
@@ -62,7 +62,7 @@ Include the script in your HTML page and use the `<rapi-doc>` custom element:
62
62
  This repository is structured as a **Monorepo** using workspaces, compatible with **Node/npm**, **pnpm**, and **Bun**:
63
63
 
64
64
  ```text
65
- astro-rapidoc/
65
+ rapidoc/
66
66
  ├── packages/
67
67
  │ ├── rapidoc/ # Core Web Component library (published as "rapidoc")
68
68
  │ │ ├── src/ # Web component source code (Lit + modern ESM)
@@ -70,7 +70,7 @@ astro-rapidoc/
70
70
  │ │ ├── package.json # Library package config
71
71
  │ │ └── vite.config.mjs # Dedicated library build config
72
72
  │ │
73
- │ ├── rapidoc-cli/ # Command-line utility (lint, preview, bundle)
73
+ │ ├── rapidoc-cli/ # The `rapidoc` command (init, dev, build, validate, migrate)
74
74
  │ │ ├── src/ # CLI source code
75
75
  │ │ └── package.json
76
76
  │ │
@@ -100,11 +100,14 @@ astro-rapidoc/
100
100
  ## Development & Build Instructions
101
101
 
102
102
  ### Prerequisites
103
+
103
104
  - **Node.js**: `>= 22.12.0` (or [Bun](https://bun.sh/))
104
105
  - **npm** (or `bun`)
105
106
 
106
107
  ### 1. Installation
108
+
107
109
  Clone the repository and install dependencies across all workspaces:
110
+
108
111
  ```bash
109
112
  git clone https://github.com/rapi-doc/RapiDoc.git
110
113
  cd RapiDoc
@@ -112,7 +115,9 @@ npm install
112
115
  ```
113
116
 
114
117
  ### 2. Development Server & Live Debugging
118
+
115
119
  Start the local documentation and interactive examples showcase:
120
+
116
121
  ```bash
117
122
  # Start dev server (http://localhost:4321)
118
123
  npm run dev
@@ -120,6 +125,7 @@ npm run dev
120
125
  # Stop background dev server
121
126
  npm run stop
122
127
  ```
128
+
123
129
  - Open `http://localhost:4321` in your browser.
124
130
  - **Live Unminified ES Modules:** In development mode (`npm run dev`), the Astro dev server bypasses pre-compiled production bundles and serves live ES modules directly from `packages/rapidoc/src/index.js`.
125
131
  - **Full DevTools & Console Visibility:** All `console.log`, `console.warn`, `console.error`, and `debugger` breakpoints remain completely intact with original file names and exact line numbers (e.g., `rapidoc.js:516`).
@@ -132,6 +138,7 @@ npm run stop
132
138
  This monorepo contains multiple packages: the core Web Component library (**`packages/rapidoc`**) and the documentation showcase site (**`docs`**). The build system coordinates them as follows:
133
139
 
134
140
  #### Core Library Production Build (`npm run build:rapidoc`)
141
+
135
142
  - **Workspace:** `packages/rapidoc`
136
143
  - **Output:** `packages/rapidoc/dist/rapidoc-min.js`
137
144
  - Compiles the RapiDoc custom element in library mode using [Vite 6](https://vitejs.dev/).
@@ -141,6 +148,7 @@ This monorepo contains multiple packages: the core Web Component library (**`pac
141
148
  - Injects the license and version header banner.
142
149
 
143
150
  #### Core Library Development Build (`npm run build:rapidoc:dev`)
151
+
144
152
  - **Workspace:** `packages/rapidoc`
145
153
  - **Output:** `packages/rapidoc/dist/rapidoc-min.js` + `packages/rapidoc/dist/rapidoc-min.js.map`
146
154
  - Compiles the standalone library bundle with `mode: 'development'`.
@@ -148,6 +156,7 @@ This monorepo contains multiple packages: the core Web Component library (**`pac
148
156
  - Useful when you need to test the bundled `<rapi-doc>` script tag artifact in external standalone HTML pages or apps with full DevTools logging.
149
157
 
150
158
  #### Full Monorepo Build (`npm run build`)
159
+
151
160
  - **Scope:** Root monorepo
152
161
  - Sequentially executes `npm run build:rapidoc` followed by `npm run build:docs`.
153
162
 
@@ -175,39 +184,43 @@ Astro documentation and example pages include the component via `<script type="m
175
184
  All primary commands can be run from the root of the repository:
176
185
 
177
186
  #### Development & Live Preview
178
- | Command | Workspace | Description |
179
- |---|---|---|
180
- | `npm run dev` | `docs` | Launches Astro documentation & showcase dev server (`http://localhost:4321`) with live unminified RapiDoc ESM directly from source. |
181
- | `npm run stop` | `docs` | Terminates background Astro dev server processes. |
182
- | `npm run preview` | `docs` | Previews the production build of the documentation site (`docs/dist`) locally. |
187
+
188
+ | Command | Workspace | Description |
189
+ | ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------- |
190
+ | `npm run dev` | `docs` | Launches Astro documentation & showcase dev server (`http://localhost:4321`) with live unminified RapiDoc ESM directly from source. |
191
+ | `npm run stop` | `docs` | Terminates background Astro dev server processes. |
192
+ | `npm run preview` | `docs` | Previews the production build of the documentation site (`docs/dist`) locally. |
183
193
 
184
194
  #### Building
185
- | Command | Workspace | Description |
186
- |---|---|---|
187
- | `npm run build` | Monorepo | Sequentially builds production RapiDoc library bundle and the Astro documentation site. |
188
- | `npm run build:rapidoc` | `rapidoc` | Compiles production, minified Web Component bundle to `packages/rapidoc/dist/rapidoc-min.js`. |
189
- | `npm run build:rapidoc:dev` | `rapidoc` | Compiles unminified Web Component bundle with source maps & console logs to `packages/rapidoc/dist/`. |
190
- | `npm run build:docs` | `docs` | Builds the production Astro documentation site into `docs/dist/` (and syncs bundle to `generated-docs/`). |
191
- | `npm run build:size` | `rapidoc` | Builds RapiDoc with `ANALYZE=true` and opens an interactive bundle visualizer (`dist/stats.html`). |
195
+
196
+ | Command | Workspace | Description |
197
+ | --------------------------- | --------- | --------------------------------------------------------------------------------------------------------- |
198
+ | `npm run build` | Monorepo | Sequentially builds production RapiDoc library bundle and the Astro documentation site. |
199
+ | `npm run build:rapidoc` | `rapidoc` | Compiles production, minified Web Component bundle to `packages/rapidoc/dist/rapidoc-min.js`. |
200
+ | `npm run build:rapidoc:dev` | `rapidoc` | Compiles unminified Web Component bundle with source maps & console logs to `packages/rapidoc/dist/`. |
201
+ | `npm run build:docs` | `docs` | Builds the production Astro documentation site into `docs/dist/` (and syncs bundle to `generated-docs/`). |
202
+ | `npm run build:size` | `rapidoc` | Builds RapiDoc with `ANALYZE=true` and opens an interactive bundle visualizer (`dist/stats.html`). |
192
203
 
193
204
  #### Testing & Benchmarks
194
- | Command | Workspace | Description |
195
- |---|---|---|
196
- | `npm run test:unit` | Monorepo | Runs Node.js native unit tests (`tests/unit/*.test.js`) for schema parsers and AST converters. |
197
- | `npm run test:perf` | Monorepo | Runs spec parsing, circular ref, and dereferencing benchmarks (`tests/perf/benchmark.js`). |
198
- | `npm run test:render` | Monorepo | Measures headless browser rendering performance across render styles using Puppeteer (`tests/perf/render-benchmark.js`). |
205
+
206
+ | Command | Workspace | Description |
207
+ | --------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ |
208
+ | `npm run test:unit` | Monorepo | Runs Node.js native unit tests (`tests/unit/*.test.js`) for schema parsers and AST converters. |
209
+ | `npm run test:perf` | Monorepo | Runs spec parsing, circular ref, and dereferencing benchmarks (`tests/perf/benchmark.js`). |
210
+ | `npm run test:render` | Monorepo | Measures headless browser rendering performance across render styles using Puppeteer (`tests/perf/render-benchmark.js`). |
199
211
 
200
212
  #### Code Quality & Formatting
201
- | Command | Workspace | Description |
202
- |---|---|---|
203
- | `npm run lint` | `rapidoc` | Runs ESLint on `packages/rapidoc/src/**/*.js` with Lit rules. |
204
- | `npm run analyze` | `rapidoc` | Runs Lit Analyzer to validate custom element templates and bindings. |
205
- | `npm run format` | Monorepo | Checks code formatting against `.prettierrc` across packages and docs. |
206
- | `npm run format-fix` | Monorepo | Automatically formats code using Prettier across packages and docs. |
213
+
214
+ | Command | Workspace | Description |
215
+ | -------------------- | --------- | -------------------------------------------------------------------------------------- |
216
+ | `npm run lint` | Monorepo | Runs oxlint (default rules, no config) across packages, docs, tests and scripts. |
217
+ | `npm run format` | Monorepo | Checks formatting with oxfmt (default style) across packages, docs, tests and scripts. |
218
+ | `npm run format-fix` | Monorepo | Formats the same files with oxfmt. |
207
219
 
208
220
  #### Publishing
209
- | Command | Workspace | Description |
210
- |---|---|---|
221
+
222
+ | Command | Workspace | Description |
223
+ | ------------------------- | --------- | ---------------------------------------------------- |
211
224
  | `npm run publish:rapidoc` | `rapidoc` | Publishes the `rapidoc` package to the npm registry. |
212
225
 
213
226
  ---
@@ -217,7 +230,9 @@ All primary commands can be run from the root of the repository:
217
230
  The documentation site is built with modern **Astro** using clean, extensionless URLs (`/api`, `/examples`, `/list`, `/quickstart`).
218
231
 
219
232
  ### Deployment via GitHub Actions
220
- When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/mrin/work/astro-rapidoc/.github/workflows/deploy-docs.yml) GitHub Action automatically:
233
+
234
+ When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/mrin/work/rapidoc/.github/workflows/deploy-docs.yml) GitHub Action automatically:
235
+
221
236
  1. Compiles the `rapidoc` library bundle (`packages/rapidoc/dist/rapidoc-min.js`).
222
237
  2. Builds the Astro documentation site into `docs/dist/` (`npm run build`).
223
238
  3. Deploys the static output directory (`docs/dist/`) directly to **GitHub Pages** using `@actions/deploy-pages`.
@@ -231,9 +246,9 @@ When code is pushed to `master` or `main`, the [deploy-docs.yml](file:///Users/m
231
246
 
232
247
  OpenAPI specs are organized inside `docs/public/` based on their visibility and purpose:
233
248
 
234
- * **`docs/public/specs/`**: Public showcase specs referenced in [example-list.yaml](file:///Users/mrin/work/astro-rapidoc/docs/src/data/example-list.yaml) and displayed on `rapidocui.com` (e.g., `petstore.yaml`, `code-highlight.yaml`, `auth.yaml`).
235
- * **`docs/public/specs-test/`**: Internal edge-case and boundary specs used for UI verification and regression tests (e.g., `circular-refs.yaml`, `xxx-of-combinations.yaml`).
236
- * **`docs/public/specs-test/parser/`**: Malformed or invalid specs used to test CLI validation and error reporting (e.g., `invalid-syntax.yaml`, `missing-info.yaml`, `broken-ref.yaml`).
249
+ - **`docs/public/specs/`**: Public showcase specs referenced in [example-list.yaml](file:///Users/mrin/work/rapidoc/docs/src/data/example-list.yaml) and displayed on `rapidocui.com` (e.g., `petstore.yaml`, `code-highlight.yaml`, `auth.yaml`).
250
+ - **`docs/public/specs-test/`**: Internal edge-case and boundary specs used for UI verification and regression tests (e.g., `circular-refs.yaml`, `xxx-of-combinations.yaml`).
251
+ - **`docs/public/specs-test/parser/`**: Malformed or invalid specs used to test CLI validation and error reporting (e.g., `invalid-syntax.yaml`, `missing-info.yaml`, `broken-ref.yaml`).
237
252
 
238
253
  ---
239
254