asyncapi-viewer 2.0.0 → 2.1.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 (39) hide show
  1. package/README.md +13 -3
  2. package/dist/asyncapi-viewer.iife.js +127 -128
  3. package/dist/asyncapi-viewer.js +887 -842
  4. package/dist/types/element.d.ts +33 -0
  5. package/dist/types/events.d.ts +99 -0
  6. package/dist/types/index.d.ts +12 -0
  7. package/dist/types/load/loader.d.ts +46 -0
  8. package/dist/types/load/refs.d.ts +62 -0
  9. package/dist/types/model/avro.d.ts +14 -0
  10. package/dist/types/model/context.d.ts +75 -0
  11. package/dist/types/model/invariants.d.ts +7 -0
  12. package/dist/types/model/normalize.d.ts +16 -0
  13. package/dist/types/model/schema.d.ts +16 -0
  14. package/dist/types/model/types.d.ts +324 -0
  15. package/dist/types/model/v2.d.ts +8 -0
  16. package/dist/types/model/v3.d.ts +8 -0
  17. package/dist/types/options.d.ts +56 -0
  18. package/dist/types/render/details.d.ts +23 -0
  19. package/dist/types/render/example.d.ts +36 -0
  20. package/dist/types/render/format.d.ts +2 -0
  21. package/dist/types/render/header.d.ts +19 -0
  22. package/dist/types/render/info.d.ts +4 -0
  23. package/dist/types/render/markdown.d.ts +4 -0
  24. package/dist/types/render/nav.d.ts +69 -0
  25. package/dist/types/render/operation.d.ts +18 -0
  26. package/dist/types/render/sections.d.ts +17 -0
  27. package/dist/types/render/sidebar.d.ts +30 -0
  28. package/dist/types/render/tag.d.ts +7 -0
  29. package/dist/types/render/tree.d.ts +36 -0
  30. package/dist/types/styles/base.d.ts +2 -0
  31. package/dist/types/styles/tokens.d.ts +7 -0
  32. package/dist/types/theme/theme.d.ts +26 -0
  33. package/dist/types/util/color.d.ts +22 -0
  34. package/dist/types/util/example.d.ts +8 -0
  35. package/package.json +13 -3
  36. package/types/react.d.ts +28 -0
  37. package/types/react.js +2 -0
  38. package/dist/asyncapi-viewer.iife.js.map +0 -1
  39. package/dist/asyncapi-viewer.js.map +0 -1
package/README.md CHANGED
@@ -14,14 +14,18 @@ https://weesho-lapara.github.io/asyncapi-viewer/
14
14
  ## Use
15
15
 
16
16
  ```html
17
- <script type="module" src="https://cdn.jsdelivr.net/npm/asyncapi-viewer@2.0.0/dist/asyncapi-viewer.js"></script>
18
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/asyncapi-viewer@2.0.0/theme/asyncapi-theme.css">
17
+ <script type="module" src="https://cdn.jsdelivr.net/npm/asyncapi-viewer@2.1.1/dist/asyncapi-viewer.js"></script>
18
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/asyncapi-viewer@2.1.1/theme/asyncapi-theme.css">
19
19
 
20
20
  <asyncapi-viewer src="asyncapi.yaml" sidebar></asyncapi-viewer>
21
21
  ```
22
22
 
23
23
  Or `npm install asyncapi-viewer` and import `asyncapi-viewer` (an ES module that defines the
24
- element) or load `asyncapi-viewer/iife` with a plain script tag. The theme file is optional: copy
24
+ element) or load `asyncapi-viewer/iife` with a plain script tag. Each load fires
25
+ `asyncapi-load` (`detail.model`, `detail.problems`) or `asyncapi-error` (`detail.error`). Types
26
+ ship with the package; `import type {} from 'asyncapi-viewer/react'` adds the element to React's
27
+ JSX, with `onasyncapi-load` and `onasyncapi-error`. React and SSR notes:
28
+ https://weesho-lapara.github.io/asyncapi-viewer/other-tools/ The theme file is optional: copy
25
29
  it to change the two accent colours, or set any `--asyncapi-*` custom property on the element.
26
30
  Fonts are never loaded by the component; the page opts in (see the theme file).
27
31
 
@@ -63,6 +67,12 @@ Serve the repository root (`node scripts/serve.mjs`, or any static server) and o
63
67
  - `test/e2e/instant.spec.ts`: a Material for MkDocs fixture site with `navigation.instant`
64
68
  (`test/e2e/mkdocs/`, built by `build.py`, ignored): viewers render on every page reached
65
69
  through instant navigation and through history, with no full load. Skipped until built.
70
+ - `test/e2e/react.spec.ts`: a React 19 app (`test/e2e/react/`, built by `build.mjs` from the
71
+ packed npm tarball and type-checked against the shipped types, so `files`, `exports` and the
72
+ types are tested too; `dist/` ignored): JSX props arrive as attributes (booleans bare or
73
+ removed, `className` as `class`), `onasyncapi-load`/`onasyncapi-error` receive the events,
74
+ `src`, theme, sidebar and label changes from state re-render, repeated unmount and remount,
75
+ and a document built as a JavaScript object handed over as a Blob URL. Skipped until built.
66
76
  - `test/e2e/sidebar.spec.ts`: the resizable sidebar (drag, keyboard, clamping, double-click reset,
67
77
  no handle in the drawer layout).
68
78
  - `test/e2e/screenshots.spec.ts`: captures every example document at 1280, 820 and 380px in