rapidoc 9.3.8 → 10.0.1

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 (69) hide show
  1. package/README.md +193 -61
  2. package/dist/rapidoc-min.js +279 -3914
  3. package/package.json +23 -46
  4. package/.babelrc.json +0 -42
  5. package/.eslintrc +0 -53
  6. package/.github/FUNDING.yml +0 -13
  7. package/.github/workflow/words.yaml +0 -22
  8. package/CONTRIBUTING.md +0 -35
  9. package/dist/index.html +0 -1010
  10. package/dist/index.html.gz +0 -0
  11. package/dist/rapidoc-min.js.LICENSE.txt +0 -64
  12. package/dist/rapidoc-min.js.LICENSE.txt.gz +0 -0
  13. package/dist/rapidoc-min.js.gz +0 -0
  14. package/dist/rapidoc-min.js.map +0 -1
  15. package/dist/rapidoc-min.js.map.gz +0 -0
  16. package/dist/rapidoc.js +0 -21603
  17. package/dist/report.html +0 -39
  18. package/index-hashroute.html +0 -65
  19. package/index.html +0 -1045
  20. package/index_bak.html +0 -251
  21. package/jsconfig.json +0 -11
  22. package/logo.png +0 -0
  23. package/performance.html +0 -31
  24. package/src/components/api-request.js +0 -1793
  25. package/src/components/api-response.js +0 -335
  26. package/src/components/dialog-box.js +0 -73
  27. package/src/components/json-tree.js +0 -145
  28. package/src/components/schema-table.js +0 -367
  29. package/src/components/schema-tree.js +0 -381
  30. package/src/components/tag-input.js +0 -135
  31. package/src/index.js +0 -7
  32. package/src/json-schema-viewer.js +0 -346
  33. package/src/oauth-receiver.js +0 -56
  34. package/src/rapidoc-mini.js +0 -382
  35. package/src/rapidoc.js +0 -1083
  36. package/src/styles/border-styles.js +0 -24
  37. package/src/styles/custom-styles.js +0 -10
  38. package/src/styles/dialog-box-styles.js +0 -75
  39. package/src/styles/endpoint-styles.js +0 -202
  40. package/src/styles/flex-styles.js +0 -15
  41. package/src/styles/font-styles.js +0 -268
  42. package/src/styles/info-styles.js +0 -21
  43. package/src/styles/input-styles.js +0 -207
  44. package/src/styles/nav-styles.js +0 -198
  45. package/src/styles/prism-styles.js +0 -105
  46. package/src/styles/schema-styles.js +0 -121
  47. package/src/styles/tab-styles.js +0 -47
  48. package/src/styles/table-styles.js +0 -58
  49. package/src/templates/advance-search-template.js +0 -72
  50. package/src/templates/callback-template.js +0 -75
  51. package/src/templates/code-samples-template.js +0 -34
  52. package/src/templates/components-template.js +0 -76
  53. package/src/templates/endpoint-template.js +0 -251
  54. package/src/templates/expanded-endpoint-template.js +0 -199
  55. package/src/templates/focused-endpoint-template.js +0 -110
  56. package/src/templates/header-template.js +0 -66
  57. package/src/templates/json-schema-viewer-template.js +0 -185
  58. package/src/templates/logo-template.js +0 -18
  59. package/src/templates/main-body-template.js +0 -110
  60. package/src/templates/navbar-template.js +0 -272
  61. package/src/templates/overview-template.js +0 -79
  62. package/src/templates/security-scheme-template.js +0 -612
  63. package/src/templates/server-template.js +0 -115
  64. package/src/utils/color-utils.js +0 -59
  65. package/src/utils/common-utils.js +0 -168
  66. package/src/utils/schema-utils.js +0 -1086
  67. package/src/utils/spec-parser.js +0 -462
  68. package/src/utils/theme.js +0 -288
  69. package/webpack.config.js +0 -142
package/README.md CHANGED
@@ -1,77 +1,209 @@
1
- <img alt="MrinDoc logo" src="https://github.com/rapi-doc/RapiDoc/blob/master/logo.png" width="60px" />
2
-
1
+ <p align="center">
2
+ <img alt="RapiDoc logo" src="https://github.com/rapi-doc/RapiDoc/blob/master/logo.png" width="80px" />
3
+ </p>
3
4
 
4
5
  <p align="center">
5
- <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square"/>
6
- <img src="https://img.shields.io/github/size/rapi-doc/rapidoc/dist/rapidoc-min.js.svg?colorB=blue&label=minified&style=flat-square">
7
- <img src="https://img.shields.io/github/size/rapi-doc/rapidoc/dist/rapidoc-min.js.gz.svg?colorB=blue&label=zip&style=flat-square">
8
- <a href="https://www.webcomponents.org/element/rapidoc" alt="published on webcomponents.org">
9
- <img src="https://img.shields.io/badge/webcomponents.org-rapidoc-blue.svg?style=social"/>
10
- </a>
6
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square"/>
7
+
11
8
  </p>
12
9
 
13
10
  # RapiDoc
14
- Custom Element for Open-API spec viewing
15
11
 
16
- > Sponsored by [Zuplo](https://zuplo.link/rapidoc-2) - Get a Stripe-like API experience for your customers in minutes - documentation, rate-limiting and API-key auth in minutes.
12
+ **Custom Element for OpenAPI / Swagger Spec Viewing**
13
+
14
+ RapiDoc is a fast, responsive, and customizable Web Component that renders beautiful, interactive API documentation from OpenAPI (Swagger) specifications.
15
+
16
+ ---
17
17
 
18
18
  ## Features
19
- - Supports Swagger 2.0, OpenAPI 3.x.x
20
- - Works with any framework or with no framework
21
- - Allows making API calls
22
- - Better Usability,
23
- - all Models and Examples are expanded by default, eliminates the need to click and reveal.
24
- - Request fields are pre-populated with sample data
25
- - Takes only one click to make an API call
26
- - Request and response can be placed side-by-side for easy comparison
27
- - Branding and Personalization features makes it easy to follow any style guide
28
- - Comes with 2 Themes (Dark and Light)
29
- - Replace default logo with yours
30
- - Typography, allows changing fonts
31
- - Allows changing text-color, button-color, header-color and color of other UI elements
32
- - Plenty of customization options
33
- - Add external contents at the top and bottom of the document, you may add images, link, text, forms etc
34
- - Allows disabling API calling feature
35
- - Hide the header, so the user can't load any other OpenAPI Spec
36
- - Hide Authentication and provide your own pre-generated api-key
37
- - Embed it inside another HTML document
38
- - Use it inside another framework (react, vue, angular, lit-element)
39
- - Use JavaScript to change its attributes, and it will react to those changes
40
- - Style the element with standard css (change padding, position, border, margin )
41
- - Lightweight and fast
42
- - Load local json spec from the disk
43
- - Supported on Chrome, FireFox and Safari. (Not yet tested on Edge)
44
-
45
-
46
- ## Documentation
47
- [Check out the usage and demos](https://rapi-doc.github.io/RapiDoc/)
48
-
49
- ## Examples
50
- [Examples and Test cases](https://rapi-doc.github.io/RapiDoc/list.html)
51
-
52
-
53
- ## Build Process
19
+
20
+ - **OpenAPI Support:** Full support for OpenAPI 3.0.x, 3.1.x, and Swagger 2.0.
21
+ - **Framework Agnostic:** Works with plain HTML, React, Vue, Angular, Svelte, or Lit.
22
+ - **Built-in API Console:** Call and test APIs directly from the documentation.
23
+ - **Usability First:**
24
+ - Models and examples expanded by default — no endless clicking to reveal schemas.
25
+ - Pre-populated sample data in request fields.
26
+ - Side-by-side request and response view for quick comparison.
27
+ - **Branding & Theming:**
28
+ - Dark and Light themes out of the box.
29
+ - Easily customizable brand colors, typography, logos, and header styling.
30
+ - **Customizable Layouts:**
31
+ - Three distinct rendering styles: `read`, `view`, and `focused`.
32
+ - Inject custom content using web component slots (`fixed-header`, `overview`, `servers`, `auth`).
33
+ - **Fast & Lightweight:** Built using [Lit](https://lit.dev/) with zero unnecessary overhead.
34
+
35
+ ---
36
+
37
+ ## Quick Usage
38
+
39
+ Include the script in your HTML page and use the `<rapi-doc>` custom element:
40
+
41
+ ```html
42
+ <!DOCTYPE html>
43
+ <html>
44
+ <head>
45
+ <meta charset="utf-8">
46
+ <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
47
+ </head>
48
+ <body>
49
+ <rapi-doc
50
+ spec-url="https://petstore.swagger.io/v2/swagger.json"
51
+ theme="dark"
52
+ render-style="read"
53
+ ></rapi-doc>
54
+ </body>
55
+ </html>
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Repository Architecture
61
+
62
+ This repository is structured as a **Monorepo** using workspaces, compatible with **Node/npm**, **pnpm**, and **Bun**:
63
+
64
+ ```text
65
+ astro-rapidoc/
66
+ ├── packages/
67
+ │ ├── rapidoc/ # Core Web Component library (published as "rapidoc")
68
+ │ │ ├── src/ # Web component source code (Lit + modern ESM)
69
+ │ │ ├── dist/ # Production bundle (rapidoc-min.js)
70
+ │ │ ├── package.json # Library package config
71
+ │ │ └── vite.config.mjs # Dedicated library build config
72
+ │ │
73
+ │ ├── rapidoc-cli/ # Command-line utility (lint, preview, bundle)
74
+ │ │ ├── src/ # CLI source code
75
+ │ │ └── package.json
76
+ │ │
77
+ │ └── rapidoc-portal/ # PocketBase developer portal to host & secure specs
78
+ │ └── package.json
79
+ │
80
+ ├── docs/ # Astro documentation & showcase site (GitHub Pages)
81
+ │ ├── src/ # Astro pages, components, and layouts
82
+ │ │ ├── pages/examples/ # Public showcase pages (code-highlight, petstore, etc.)
83
+ │ │ └── pages/tests/ # Internal test & edge-case pages
84
+ │ ├── public/
85
+ │ │ ├── specs/ # PUBLIC showcase specs (used by /examples)
86
+ │ │ └── specs-test/ # INTERNAL test specs (edge cases & parser fixtures)
87
+ │ │ └── parser/ # Malformed & validation test specs
88
+ │ ├── astro.config.mjs # Astro site configuration
89
+ │ └── package.json # Workspace package "docs"
90
+ │
91
+ ├── tests/
92
+ │ └── visual/ # Automated visual regression test suite (Playwright)
93
+ │
94
+ ├── package.json # Monorepo root configuration (workspaces)
95
+ └── README.md
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Development & Build Instructions
101
+
102
+ ### Prerequisites
103
+ - **Node.js**: `>= 22.12.0` (or [Bun](https://bun.sh/))
104
+ - **npm** (or `bun`)
105
+
106
+ ### 1. Installation
107
+ Clone the repository and install dependencies across all workspaces:
54
108
  ```bash
55
- # Clone / Download the project then
109
+ git clone https://github.com/rapi-doc/RapiDoc.git
110
+ cd RapiDoc
56
111
  npm install
112
+ ```
57
113
 
58
- # build will generate rapidoc-min.js, this is the only file you will need.
59
- # use it in the script tag of your html <script type="text/javascript" src="rapidoc-min.js"></script></body>
60
- npm run build
114
+ ### 2. Development Server
115
+ Start the local documentation and examples server:
116
+ ```bash
117
+ # Start dev server
118
+ npm run dev
61
119
 
62
- # for development use yarn serve (this will start an webserver at port 8080, then navigate to localhost:8080)
63
- npm run serve
120
+ # Stop background dev server
121
+ npm run stop
64
122
  ```
123
+ - Open `http://localhost:4321` in your browser.
124
+ - **Instant HMR:** During development, the server maps directly to `packages/rapidoc/src/index.js`. Any edit you make to RapiDoc's component source reloads immediately in your browser without requiring a rebuild!
125
+
126
+ ### 3. Building
127
+
128
+ | Command | Description |
129
+ |---|---|
130
+ | `npm run dev` | Starts the Astro development server. |
131
+ | `npm run stop` | Stops the running Astro development server. |
132
+ | `npm run build` | Builds both the `rapidoc` web component library and the `docs` site. |
133
+ | `npm run build:rapidoc` | Builds only the RapiDoc web component (`packages/rapidoc/dist/rapidoc-min.js`). |
134
+ | `npm run build:docs` | Builds only the Astro documentation site (`docs/generated-docs/`). |
135
+ | `npm run build:size` | Builds RapiDoc with a visual bundle analyzer report (`dist/stats.html`). |
136
+ | `npm run preview` | Previews the built production documentation site locally. |
137
+
138
+ ### 4. Code Quality & Linting
139
+
140
+ ```bash
141
+ # Run ESLint on packages/rapidoc
142
+ npm run lint
143
+
144
+ # Run Lit Analyzer for Web Component template validation
145
+ npm run analyze
146
+
147
+ # Check code formatting with Prettier
148
+ npm run format
149
+
150
+ # Automatically fix code formatting
151
+ npm run format-fix
152
+ ```
153
+
154
+ ### 5. Publishing to npm
155
+
156
+ To publish a new version of the core `rapidoc` package to npm:
157
+
158
+ 1. **Bump Version:** Update `"version"` in `packages/rapidoc/package.json` (e.g. `9.3.9`).
159
+ 2. **Build Library Bundle:**
160
+ ```bash
161
+ npm run build:rapidoc
162
+ ```
163
+ 3. **Publish to npm Registry:**
164
+ ```bash
165
+ npm run publish:rapidoc
166
+ ```
167
+ *(Or navigate into `cd packages/rapidoc && npm publish`)*.
168
+
169
+ ---
170
+
171
+ ## Documentation Site & GitHub Pages Deployment
172
+
173
+ The documentation site is built with modern **Astro** using clean, extensionless URLs (`/api`, `/examples`, `/list`, `/quickstart`).
174
+
175
+ ### Deployment via GitHub Actions
176
+ 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:
177
+ 1. Compiles the `rapidoc` library bundle.
178
+ 2. Builds the documentation site (`npm run build:docs`).
179
+ 3. Deploys the static output (`docs/generated-docs/`) directly to **GitHub Pages**.
180
+
181
+ > **Note on GitHub Pages Configuration:**
182
+ > In repository settings under **Settings → Pages**, set **Source** to **GitHub Actions**. This keeps the repository clean by eliminating the need to commit compiled static HTML files into git branches.
183
+
184
+ ---
185
+
186
+ ## Specs Organization
187
+
188
+ OpenAPI specs are organized inside `docs/public/` based on their visibility and purpose:
189
+
190
+ * **`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`).
191
+ * **`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`).
192
+ * **`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`).
193
+
194
+ ---
65
195
 
66
196
  ## Roadmap
67
- - ✅ Upgrade to use `lit 2`
68
- - Pre Rendering / Server Side Rendering (SSR) of RapiDoc
69
- - Improve PDF generation of OpenAPI spec Using RapiPDF
70
- - Create a Command Line interface (CLI) to make it automation friendly
71
- - Add localization support
72
- - Follow Web Content Accessibility Guidelines (WCAG 2)
73
- - Improve Homepage, Documentation and Examples
74
- - Create groundwork for automated testing
75
- - Create a live playground (Something like swagger editor)
76
- - Create a short animation/video to show how RapiDoc/RapiPDF works
77
197
 
198
+ - [x] Modernize project dependencies (Vite + Astro + Node 22+)
199
+ - [x] Restructure as a multi-package Monorepo
200
+ - [ ] Build `rapidoc-cli` for OpenAPI linting and local zero-config previews
201
+ - [ ] Build `rapidoc-portal` with PocketBase for developer API portals
202
+ - [ ] Automated visual regression testing suite with Playwright
203
+ - [ ] Web Content Accessibility Guidelines (WCAG 2.1) compliance enhancements
204
+
205
+ ---
206
+
207
+ ## License
208
+
209
+ MIT © [Mrinmoy Majumdar](https://github.com/mrin9)