rapidoc 11.0.1 → 12.1.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 (96) hide show
  1. package/README.md +171 -54
  2. package/dist/rapidoc-flow-min.js +580 -0
  3. package/dist/rapidoc-flow-min.js.LICENSE.txt +171 -0
  4. package/dist/rapidoc-min.js +645 -202
  5. package/dist/rapidoc-min.js.LICENSE.txt +381 -0
  6. package/package.json +57 -42
  7. package/src/README.md +150 -0
  8. package/src/components/README.md +91 -0
  9. package/src/components/api-request.ts +912 -0
  10. package/src/components/api-response.ts +514 -0
  11. package/src/components/json-tree.ts +171 -0
  12. package/src/components/schema-base-element.ts +329 -0
  13. package/src/components/schema-table.ts +475 -0
  14. package/src/components/schema-tree.ts +393 -0
  15. package/src/components/tag-input.ts +180 -0
  16. package/src/flow.js +3 -0
  17. package/src/index.js +6 -0
  18. package/src/oauth-receiver.ts +29 -0
  19. package/src/rapi-flow.ts +1178 -0
  20. package/src/rapidoc-mini.ts +603 -0
  21. package/src/rapidoc.ts +1854 -0
  22. package/src/styles/README.md +96 -0
  23. package/src/styles/auth-styles.js +318 -0
  24. package/src/styles/border-styles.js +24 -0
  25. package/src/styles/css-bundle.js +129 -0
  26. package/src/styles/custom-styles.js +8 -0
  27. package/src/styles/dialog-box-styles.js +102 -0
  28. package/src/styles/endpoint-styles.js +564 -0
  29. package/src/styles/flex-styles.js +16 -0
  30. package/src/styles/flow-styles.js +248 -0
  31. package/src/styles/font-styles.js +432 -0
  32. package/src/styles/info-styles.js +36 -0
  33. package/src/styles/input-styles.js +555 -0
  34. package/src/styles/layout-styles.js +396 -0
  35. package/src/styles/microlighter-styles.js +99 -0
  36. package/src/styles/nav-styles.js +633 -0
  37. package/src/styles/param-list-styles.js +261 -0
  38. package/src/styles/schema-styles.js +296 -0
  39. package/src/styles/tab-styles.js +106 -0
  40. package/src/styles/theme-tokens.js +582 -0
  41. package/src/templates/README.md +89 -0
  42. package/src/templates/advanced-search-dialog-template.js +94 -0
  43. package/src/templates/api-response-template.js +223 -0
  44. package/src/templates/callback-template.js +86 -0
  45. package/src/templates/code-samples-template.js +52 -0
  46. package/src/templates/components-template.js +86 -0
  47. package/src/templates/downloads-template.js +70 -0
  48. package/src/templates/endpoint-template.js +377 -0
  49. package/src/templates/expanded-endpoint-template.js +270 -0
  50. package/src/templates/focused-endpoint-template.js +146 -0
  51. package/src/templates/header-template.js +92 -0
  52. package/src/templates/logo-template.js +21 -0
  53. package/src/templates/main-body-template.js +102 -0
  54. package/src/templates/navbar-template.js +498 -0
  55. package/src/templates/overview-template.js +104 -0
  56. package/src/templates/request-body-template.js +673 -0
  57. package/src/templates/request-params-template.js +485 -0
  58. package/src/templates/security-scheme-template.js +1272 -0
  59. package/src/templates/server-template.js +153 -0
  60. package/src/utils/README.md +146 -0
  61. package/src/utils/arazzo/README.md +119 -0
  62. package/src/utils/arazzo/components.js +15 -0
  63. package/src/utils/arazzo/graph.js +269 -0
  64. package/src/utils/arazzo/index.js +52 -0
  65. package/src/utils/arazzo/operations.js +106 -0
  66. package/src/utils/arazzo/parse.js +196 -0
  67. package/src/utils/arazzo/refs.js +40 -0
  68. package/src/utils/arazzo/svg.js +707 -0
  69. package/src/utils/auto-color-scheme.js +99 -0
  70. package/src/utils/bind-navbar.js +175 -0
  71. package/src/utils/color-utils.js +59 -0
  72. package/src/utils/common-utils.js +191 -0
  73. package/src/utils/curl-utils.js +126 -0
  74. package/src/utils/highlighter.js +419 -0
  75. package/src/utils/markdown-utils.js +110 -0
  76. package/src/utils/mcp/README.md +155 -0
  77. package/src/utils/mcp/common.js +166 -0
  78. package/src/utils/mcp/manifest.js +382 -0
  79. package/src/utils/mcp/project/server.ts +53 -0
  80. package/src/utils/mcp/project.js +88 -0
  81. package/src/utils/mcp/runtime.js +289 -0
  82. package/src/utils/mcp/schema.js +98 -0
  83. package/src/utils/mcp/workflow-runtime.js +374 -0
  84. package/src/utils/mcp/workflows.js +240 -0
  85. package/src/utils/mcp/zip.js +102 -0
  86. package/src/utils/mcp-generator.js +47 -0
  87. package/src/utils/mock-interceptor.js +557 -0
  88. package/src/utils/oauth-utils.js +87 -0
  89. package/src/utils/request-utils.js +264 -0
  90. package/src/utils/response-utils.js +203 -0
  91. package/src/utils/sanitize.js +57 -0
  92. package/src/utils/schema-utils.js +1954 -0
  93. package/src/utils/slugger.js +187 -0
  94. package/src/utils/spec-parser.js +941 -0
  95. package/src/utils/url-utils.js +246 -0
  96. package/src/utils/xml-utils.js +61 -0
@@ -0,0 +1,91 @@
1
+ # RapiDoc Sub-Components
2
+
3
+ ## Overview
4
+
5
+ Lit 3 elements that `<rapi-doc>` (and `@rapidoc/prerender`, which constructs the schema renderers
6
+ directly) composes into each operation's request and response panels. Each file is a TypeScript
7
+ class with `@customElement` / `@property` decorators and shadow DOM.
8
+
9
+ This folder owns the request panel (parameters, body, Try, cURL, live response), the response
10
+ panel, the schema tree/table renderers, the JSON example viewer and the tag editor. It does not own
11
+ the surrounding templates (`../templates/`), styles (`../styles/`), or the parsing, URL, cURL and
12
+ fetch helpers (`../utils/`). Callers: `../rapidoc.ts`, `../templates/*` and
13
+ `../static/render.js` (`renderSchema` uses `SchemaTable` / `SchemaTree`).
14
+
15
+ ## Interface
16
+
17
+ - `<api-request>` [api-request.ts:ApiRequest] — request panel; the only component that calls
18
+ `fetch`. Dispatches `before-try`, `after-try` and `request-aborted`.
19
+ - `<api-response>` [api-response.ts:ApiResponse] — status buttons, MIME dropdown, Example/Schema
20
+ tabs, response headers. `resetSelection()` is called by `<rapi-doc>` when focused mode reuses one
21
+ instance. Dispatches no events.
22
+ - `SchemaBaseElement` [schema-base-element.ts:SchemaBaseElement] — unregistered base class for the
23
+ schema renderers: config sync, hide rules, description cells, expand/collapse.
24
+ - `<schema-tree>` [schema-tree.ts:SchemaTree] and `<schema-table>` [schema-table.ts:SchemaTable] —
25
+ render a schema AST (from `../utils/schema-utils.js`) as a bracketed tree or a
26
+ Field/Type/Description table via `renderAST(node, parentType, schemaLevel, indentLevel)`.
27
+ - `<json-tree>` [json-tree.ts:JsonTree] — collapsible JSON viewer with a Copy button.
28
+ - `<tag-input>` [tag-input.ts:TagInput] — tag editor for array-valued parameters; dispatches
29
+ `change` then `input` with `detail: { value }`.
30
+
31
+ The `before-try`, `after-try`, `request-aborted`, `change` and `input` events are all
32
+ `bubbles: true, composed: true`. Property lists, CSS parts and event detail fields are in the code.
33
+
34
+ ## Invariants
35
+
36
+ - Flags passed from `<rapi-doc>` are strings, compared with `=== "true"` / `=== "false"`, not
37
+ booleans (`allowTry`, `showCurlBeforeTry`, `webhook`, `callback`, the `schema*` flags).
38
+ - `<api-request>` omits the Try bar only when `allowTry === "false"`, and sets
39
+ `allowTry = "false"` after every update while `webhook === "true"`
40
+ [api-request.ts:ApiRequest.updated].
41
+ - Config sync runs in `willUpdate` only when `config` is set and changed. `<api-request>` and
42
+ `<api-response>` map a defined `config.schemaHide*` of `"never"` to `"false"` and any other value
43
+ to the direction default (requests hide read-only, responses hide write-only; webhooks invert
44
+ both) [api-request.ts:ApiRequest.willUpdate; api-response.ts:ApiResponse.willUpdate].
45
+ `SchemaBaseElement` maps `"never"` to `"false"`, copies a literal `"true"` / `"false"`, and
46
+ otherwise keeps the value the template set [schema-base-element.ts:hideFlagFromConfig].
47
+ - `SchemaBaseElement.willUpdate` resets a falsy or `< 1` `schemaExpandLevel` to `99999`, and
48
+ resets `schemaDescriptionExpanded` to `"false"` and either hide flag to `"true"` when the value
49
+ is not `"true"` or `"false"`.
50
+ - `isFieldHidden(node)` hides read-only / write-only nodes per the hide flags, and `renderAST`
51
+ skips a hidden node's whole subtree [schema-base-element.ts:SchemaBaseElement.isFieldHidden].
52
+ - A node starts expanded iff `schemaLevel < schemaExpandLevel`; children render at
53
+ `schemaLevel + 1`. Union options stay at the parent's level in `<schema-tree>` but go one level
54
+ deeper in `<schema-table>`.
55
+ - Markdown descriptions are passed through `sanitizeHTML` before `unsafeHTML`; plain-text schema
56
+ descriptions skip markdown and rely on Lit escaping
57
+ [schema-base-element.ts:SchemaBaseElement.renderDescrCell; api-response.ts:ApiResponse].
58
+ - Each Try gets its own `AbortController`; `before-try` listeners may change the request (`url`,
59
+ `method`, `headers`, `credentials`, `body`) before the `Request` is built, and `loading` is reset
60
+ in `finally` [api-request.ts:ApiRequest.onTryClick].
61
+ - `<tag-input value="a,b">` is a comma-separated list: blank parts are dropped, values are not
62
+ trimmed, and removing the attribute sets `value` to `[]` [tag-input.ts:TagInput]. Events fire
63
+ only after user edits (paste, Enter, Backspace/Delete on an empty input, blur), never on
64
+ attribute or property sets.
65
+
66
+ ## Side Effects
67
+
68
+ - Network: `ApiRequest.onTryClick` calls `fetch`; `disconnectedCallback` aborts an in-flight
69
+ request.
70
+ - Object URLs for blob responses are revoked before each Try, in `clearResponseData`, and in
71
+ `disconnectedCallback` (they are created in `../utils/response-utils.js`).
72
+ - `ApiRequest.updated` schedules `syncTryBarState` with `queueMicrotask` and calls
73
+ `scheduleHighlight` on the host's shadow root; example selection uses `window.setTimeout`.
74
+ - `<api-request>` reads outside its shadow root: `buildFetchHeaders` takes `Accept` from the
75
+ sibling `<api-response>`'s `selectedMimeType` via `this.closest(...)`.
76
+ - Direct DOM writes without reactive state: example fill/clear writes input values;
77
+ `<api-response>` toggles `.example` panel `display`; expand/collapse swaps classes.
78
+ - Clipboard: `<json-tree>` copies JSON; `<tag-input>` reads pasted text and prevents the default.
79
+ - `renderMarkdownDescription` keeps a module-level cache shared by all schema renderers, cleared
80
+ when it reaches 5000 entries [schema-base-element.ts:renderMarkdownDescription].
81
+ - `willUpdate` overwrites reactive properties from `config`, so a `config` change replaces values
82
+ set by attribute.
83
+
84
+ ## Verification
85
+
86
+ - Run `npm run test:unit` from the repo root (`tests/unit/*.test.js`, Node test runner).
87
+ - Unit tests that render or load these components: `semantic-markup.test.js` (heading outline,
88
+ `exportparts`), `schema-modernization.test.js`, `schema-nullable.test.js`,
89
+ `multipart-form-curl.test.js` (`<tag-input>` converter), `static-renderer.test.js`;
90
+ `css-variables.test.js` checks every `var(--x)` read here is defined.
91
+ - Template rendering is also covered by `npm run test:component` and `npm run test:e2e`.