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
@@ -0,0 +1,555 @@
1
+ import { css } from "lit";
2
+
3
+ export default css`
4
+ /* =========================================================================
5
+ 1. BUTTONS (.btn)
6
+ ========================================================================= */
7
+ /*
8
+ * Control sizes. Every button, input and select uses one of these; don't add one-off padding.
9
+ * All are line-height 1.25 + vertical padding + a 1px border, in em of --font-size-small, so they
10
+ * follow the scale attribute (default-scale heights in brackets):
11
+ * - Default .btn, input, select 2.15em + 2px (~28px) panel-level actions and form fields
12
+ * - Small .btn-sm, select.select-sm 1.85em + 2px (~24px) controls inside a panel: Copy, ADD,
13
+ * response codes, media-type/example pickers
14
+ * - Param inputs in a parameter row 2.75em + 2px (~35px) matches the two-line parameter label
15
+ * (param-list-styles.js)
16
+ * A fixed line-height keeps mono inputs and sans buttons the same height on every OS font.
17
+ * Buttons are flat: variants differ by fill and border only, never by shadow.
18
+ */
19
+ .btn {
20
+ border-radius: var(--radius);
21
+ font-weight: 600;
22
+ display: inline-flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ padding: 0.45em 1em;
26
+ font-size: var(--font-size-small);
27
+ outline: 0;
28
+ line-height: 1.25;
29
+ vertical-align: middle;
30
+ text-align: center;
31
+ white-space: nowrap;
32
+ border: 1px solid var(--primary);
33
+ background: color-mix(in srgb, var(--primary) 12%, transparent);
34
+ color: var(--primary);
35
+ user-select: none;
36
+ cursor: pointer;
37
+ transition:
38
+ background 0.2s ease,
39
+ color 0.2s ease,
40
+ border-color 0.2s ease,
41
+ transform 0.1s ease;
42
+
43
+ &:hover {
44
+ background: color-mix(in srgb, var(--primary) 28%, transparent);
45
+ color: var(--foreground);
46
+ }
47
+
48
+ &:disabled {
49
+ background: var(--muted);
50
+ color: var(--muted-foreground);
51
+ border-color: var(--border);
52
+ cursor: not-allowed;
53
+ opacity: 0.4;
54
+ box-shadow: none;
55
+ }
56
+
57
+ &:active {
58
+ filter: brightness(85%);
59
+ transform: scale(0.97);
60
+ transition: scale 0s;
61
+ }
62
+
63
+ &:focus-visible {
64
+ outline: none;
65
+ box-shadow: var(--focus-shadow);
66
+ }
67
+ }
68
+
69
+ /* Primary Variant (High-priority action: e.g. Try-it, Save, Load) */
70
+ .btn-primary,
71
+ .btn.primary {
72
+ background: var(--primary);
73
+ border-color: var(--primary);
74
+ color: var(--primary-foreground);
75
+
76
+ &:hover {
77
+ background: var(--primary);
78
+ filter: brightness(110%);
79
+ color: var(--primary-foreground);
80
+ }
81
+ }
82
+
83
+ /* Secondary Variant (Muted surface action) */
84
+ .btn-secondary,
85
+ .btn.secondary {
86
+ background: var(--muted);
87
+ border-color: var(--border);
88
+ color: var(--foreground);
89
+ box-shadow: none;
90
+
91
+ &:hover {
92
+ background: color-mix(in srgb, var(--muted) 80%, var(--foreground));
93
+ color: var(--foreground);
94
+ }
95
+ }
96
+
97
+ /*
98
+ * Outline Variant: the form-field border (--input) and a faint fill, so it reads as the same size as a
99
+ * filled button and matches the input it usually sits next to
100
+ */
101
+ .btn-outline,
102
+ .btn.thin-border {
103
+ border-width: 1px;
104
+ border-color: var(--input);
105
+ background: color-mix(in srgb, var(--foreground) 5%, transparent);
106
+ color: var(--foreground);
107
+ box-shadow: none;
108
+
109
+ &:hover {
110
+ background: var(--muted);
111
+ border-color: var(--muted-foreground);
112
+ color: var(--foreground);
113
+ }
114
+ }
115
+
116
+ /* Ghost Variant (Borderless, transparent until hover) */
117
+ .btn-ghost,
118
+ .btn.ghost {
119
+ border-color: transparent;
120
+ background: transparent;
121
+ color: var(--muted-foreground);
122
+ box-shadow: none;
123
+
124
+ &:hover {
125
+ background: var(--muted);
126
+ color: var(--foreground);
127
+ }
128
+ }
129
+
130
+ /* Destructive Variant (Danger / Clear / Reset actions) */
131
+ .btn-destructive,
132
+ .btn.destructive {
133
+ border-color: var(--method-delete);
134
+ background: color-mix(in srgb, var(--method-delete) 15%, transparent);
135
+ color: var(--method-delete);
136
+
137
+ &:hover {
138
+ background: var(--method-delete);
139
+ color: #ffffff;
140
+ }
141
+ }
142
+
143
+ /* Link Variant */
144
+ .btn-link,
145
+ .btn.link {
146
+ border-color: transparent;
147
+ background: transparent;
148
+ color: var(--blue);
149
+ box-shadow: none;
150
+ text-decoration: underline;
151
+ padding: 0;
152
+ }
153
+
154
+ /* Sizes */
155
+ .btn-lg,
156
+ .btn.large {
157
+ padding: 0.55em 1.1em;
158
+ font-size: var(--font-size-regular);
159
+ }
160
+ /* Small: same size as the file input's Choose File button */
161
+ .btn-sm,
162
+ .btn.small {
163
+ padding: 0.3em 0.75em;
164
+ font-size: var(--font-size-small);
165
+ }
166
+ .btn-xs,
167
+ .btn.tiny {
168
+ padding: 0.2em 0.5em;
169
+ font-size: var(--font-size-xs);
170
+ }
171
+ .btn-icon,
172
+ .btn.circle {
173
+ border-radius: 50%;
174
+ padding: 0.35em;
175
+ width: calc(2.15em + 2px);
176
+ height: calc(2.15em + 2px);
177
+ min-width: calc(2.15em + 2px);
178
+ }
179
+ .btn.nav {
180
+ border: 1px solid var(--primary);
181
+
182
+ &:hover {
183
+ background: var(--primary);
184
+ }
185
+ }
186
+
187
+ /* =========================================================================
188
+ 2. BADGES (.badge)
189
+ ========================================================================= */
190
+ .badge {
191
+ display: inline-flex;
192
+ align-items: center;
193
+ justify-content: center;
194
+ border-radius: var(--radius);
195
+ padding: 2px 6px;
196
+ font-size: var(--font-size-xs);
197
+ font-weight: 600;
198
+ line-height: 1;
199
+ white-space: nowrap;
200
+ border: 1px solid transparent;
201
+ background: var(--primary);
202
+ color: var(--primary-foreground);
203
+ user-select: none;
204
+ }
205
+ .badge-secondary {
206
+ background: var(--muted);
207
+ color: var(--foreground);
208
+ border-color: var(--border);
209
+ }
210
+ .badge-outline {
211
+ background: transparent;
212
+ color: var(--foreground);
213
+ border-color: var(--border);
214
+ }
215
+ .badge-destructive {
216
+ background: color-mix(in srgb, var(--method-delete) 15%, transparent);
217
+ color: var(--method-delete);
218
+ border-color: var(--method-delete);
219
+ }
220
+ .badge-sm {
221
+ padding: 1px 4px;
222
+ font-size: var(--font-size-xs);
223
+ }
224
+
225
+ /* =========================================================================
226
+ 3. FORM INPUTS (.input)
227
+ ========================================================================= */
228
+ .input,
229
+ input,
230
+ textarea,
231
+ select,
232
+ pre {
233
+ color: var(--foreground);
234
+ outline: none;
235
+ background: var(--input-background);
236
+ border: 1px solid var(--input);
237
+ border-radius: var(--radius);
238
+ }
239
+ textarea,
240
+ pre {
241
+ border-radius: min(var(--radius), 0.5rem);
242
+ }
243
+ pre {
244
+ background: var(--code-bg);
245
+ }
246
+ button {
247
+ font-family: var(--font-sans);
248
+ color: var(--foreground);
249
+ }
250
+
251
+ /* Form Inputs */
252
+ .input,
253
+ pre,
254
+ select,
255
+ textarea,
256
+ input[type='file'],
257
+ input[type='text'],
258
+ input[type='password'] {
259
+ font-family: var(--font-mono);
260
+ font-weight: 400;
261
+ font-size: var(--font-size-small);
262
+ transition:
263
+ border-color 0.2s ease,
264
+ box-shadow 0.2s ease;
265
+ padding: 6px 8px;
266
+ }
267
+
268
+ /* Single-line fields: same height as .btn (see above); middle-aligned so mono and sans baselines don't offset them */
269
+ .input,
270
+ select,
271
+ input[type='text'],
272
+ input[type='password'] {
273
+ line-height: 1.25;
274
+ padding: 0.45em 0.75em;
275
+ vertical-align: middle;
276
+ }
277
+
278
+ .input:focus,
279
+ .input:focus-visible,
280
+ input[type='text']:focus,
281
+ input[type='text']:focus-visible,
282
+ input[type='password']:focus,
283
+ input[type='password']:focus-visible,
284
+ textarea:focus,
285
+ textarea:focus-visible {
286
+ border-color: var(--primary);
287
+ box-shadow: var(--focus-shadow);
288
+ }
289
+
290
+ .input-sm {
291
+ padding: 0.3em 0.5em;
292
+ font-size: var(--font-size-small);
293
+ }
294
+
295
+ select {
296
+ font-family: var(--font-sans);
297
+ padding-right: 2.25em;
298
+ background-image: url('data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%3E%3Cpath%20d%3D%22M10.3%203.3L6%207.6%201.7%203.3A1%201%200%2000.3%204.7l5%205a1%201%200%20001.4%200l5-5a1%201%200%2010-1.4-1.4z%22%20fill%3D%22%23777777%22%2F%3E%3C%2Fsvg%3E');
299
+ background-position: calc(100% - 5px) center;
300
+ background-repeat: no-repeat;
301
+ background-size: 10px;
302
+ -webkit-appearance: none;
303
+ -moz-appearance: none;
304
+ appearance: none;
305
+ cursor: pointer;
306
+ }
307
+
308
+ select:hover {
309
+ border-color: var(--primary);
310
+ }
311
+
312
+ @supports (appearance: base-select) {
313
+ select,
314
+ select::picker(select) {
315
+ appearance: base-select;
316
+ }
317
+
318
+ select {
319
+ background-image: none;
320
+ padding-right: 0.75em;
321
+ display: inline-flex;
322
+ align-items: center;
323
+ justify-content: space-between;
324
+ }
325
+
326
+ select:focus-visible {
327
+ outline: none;
328
+ border-color: var(--primary);
329
+ box-shadow: var(--focus-shadow);
330
+ }
331
+
332
+ select::picker(select) {
333
+ background: var(--input-background);
334
+ color: var(--foreground);
335
+ border: 1px solid var(--input);
336
+ border-radius: var(--radius);
337
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
338
+ padding: 4px;
339
+ font-family: var(--font-sans);
340
+ font-size: var(--font-size-small);
341
+ scrollbar-width: thin;
342
+ scrollbar-color: var(--input) var(--input-background);
343
+ }
344
+
345
+ select option {
346
+ display: flex;
347
+ align-items: center;
348
+ padding: 4px 6px;
349
+ border-radius: var(--radius);
350
+ color: var(--foreground);
351
+ background: transparent;
352
+ cursor: pointer;
353
+ font-family: var(--font-sans);
354
+ font-size: var(--font-size-small);
355
+ transition:
356
+ background 0.15s ease,
357
+ color 0.15s ease;
358
+ }
359
+
360
+ select option:hover,
361
+ select option:focus-visible {
362
+ background: var(--primary);
363
+ color: var(--primary-foreground);
364
+ }
365
+
366
+ select option:checked {
367
+ background: color-mix(in srgb, var(--primary) 8%, transparent);
368
+ color: var(--foreground);
369
+ font-weight: 500;
370
+ }
371
+
372
+ select option:checked:hover,
373
+ select option:checked:focus-visible {
374
+ background: var(--primary);
375
+ color: var(--primary-foreground);
376
+ }
377
+
378
+ select::picker-icon {
379
+ content: '';
380
+ display: inline-flex;
381
+ align-items: center;
382
+ justify-content: center;
383
+ width: 12px;
384
+ height: 12px;
385
+ margin-left: 8px;
386
+ background-color: var(--muted-foreground);
387
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
388
+ no-repeat center / contain;
389
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
390
+ no-repeat center / contain;
391
+ transform-origin: center center;
392
+ transition:
393
+ transform 0.2s ease,
394
+ background-color 0.15s ease;
395
+ }
396
+
397
+ select:hover::picker-icon {
398
+ background-color: var(--primary);
399
+ }
400
+
401
+ select:open::picker-icon {
402
+ transform: rotate(180deg);
403
+ }
404
+
405
+ select option::checkmark {
406
+ content: '➜';
407
+ display: inline-flex;
408
+ align-items: center;
409
+ justify-content: center;
410
+ width: 14px;
411
+ height: 14px;
412
+ margin-right: 8px;
413
+ line-height: 1;
414
+ font-size: var(--font-size-xs);
415
+ color: var(--primary);
416
+ flex-shrink: 0;
417
+ }
418
+
419
+ select option:not(:checked)::checkmark {
420
+ visibility: hidden;
421
+ }
422
+
423
+ select option:hover::checkmark,
424
+ select option:focus-visible::checkmark,
425
+ select option:checked:hover::checkmark,
426
+ select option:checked:focus-visible::checkmark {
427
+ color: var(--primary-foreground);
428
+ }
429
+ }
430
+
431
+ textarea::placeholder,
432
+ input[type='text']::placeholder,
433
+ input[type='password']::placeholder {
434
+ color: var(--muted-foreground);
435
+ opacity: 1;
436
+ }
437
+
438
+ /* Outer box: 2px border + (0.9em - 2px) + inner button (1.85em + 2px) = 2.75em + 2px, the text-input height */
439
+ input[type='file'] {
440
+ font-family: var(--font-sans);
441
+ padding: calc(0.45em - 1px);
442
+ cursor: pointer;
443
+ background: var(--input-background);
444
+ border: 1px solid var(--input);
445
+ border-radius: var(--radius);
446
+ }
447
+
448
+ input[type='file']::file-selector-button,
449
+ input[type='file']::-webkit-file-upload-button {
450
+ font-family: var(--font-sans);
451
+ font-size: var(--font-size-small);
452
+ outline: none;
453
+ cursor: pointer;
454
+ line-height: 1.25;
455
+ padding: 0.3em 0.75em;
456
+ border: 1px solid var(--primary);
457
+ background: var(--primary);
458
+ color: var(--primary-foreground);
459
+ border-radius: var(--radius);
460
+ -webkit-appearance: none;
461
+ }
462
+
463
+ pre,
464
+ textarea {
465
+ scrollbar-width: thin;
466
+ scrollbar-color: var(--input) var(--input-background);
467
+ }
468
+
469
+ pre::-webkit-scrollbar,
470
+ textarea::-webkit-scrollbar {
471
+ width: 8px;
472
+ height: 8px;
473
+ }
474
+
475
+ pre::-webkit-scrollbar-track,
476
+ textarea::-webkit-scrollbar-track {
477
+ background: var(--input-background);
478
+ }
479
+
480
+ pre::-webkit-scrollbar-thumb,
481
+ textarea::-webkit-scrollbar-thumb {
482
+ border-radius: 2px;
483
+ background: var(--input);
484
+ }
485
+
486
+ .link {
487
+ font-size: var(--font-size-small);
488
+ text-decoration: underline;
489
+ color: var(--blue);
490
+ font-family: var(--font-mono);
491
+ margin-bottom: 2px;
492
+ }
493
+
494
+ /*
495
+ * Checkboxes render as a switch: a 3em x 1.5em track with a round thumb that slides 1.5em when checked.
496
+ * Sized in em of --font-size-small, so it follows the scale attribute.
497
+ */
498
+ input[type='checkbox'] {
499
+ appearance: none;
500
+ position: relative;
501
+ flex: none;
502
+ box-sizing: border-box;
503
+ width: 3em;
504
+ height: 1.5em;
505
+ margin: 0;
506
+ font-size: var(--font-size-small);
507
+ vertical-align: middle;
508
+ background: var(--muted);
509
+ border: 1px solid var(--input);
510
+ border-radius: 999px;
511
+ cursor: pointer;
512
+ transition:
513
+ background-color 0.2s ease,
514
+ border-color 0.2s ease;
515
+
516
+ &::after {
517
+ content: '';
518
+ position: absolute;
519
+ top: 1px;
520
+ left: 1px;
521
+ width: calc(1.5em - 4px);
522
+ height: calc(1.5em - 4px);
523
+ border-radius: 50%;
524
+ background: var(--background);
525
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
526
+ transition: transform 0.2s ease;
527
+ }
528
+
529
+ &:checked {
530
+ background: var(--green);
531
+ border-color: var(--green);
532
+ }
533
+
534
+ &:checked::after {
535
+ transform: translateX(1.5em);
536
+ }
537
+
538
+ &:focus-visible {
539
+ outline: none;
540
+ box-shadow: var(--focus-shadow);
541
+ }
542
+
543
+ &:disabled {
544
+ opacity: 0.5;
545
+ cursor: not-allowed;
546
+ }
547
+
548
+ @media (prefers-reduced-motion: reduce) {
549
+ &,
550
+ &::after {
551
+ transition: none;
552
+ }
553
+ }
554
+ }
555
+ `;