zudoku 0.3.0-dev.23 → 0.3.0-dev.26

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 (149) hide show
  1. package/dist/app/demo.d.ts +2 -0
  2. package/dist/app/demo.js +23 -0
  3. package/dist/app/demo.js.map +1 -0
  4. package/dist/app/main.d.ts +2 -1
  5. package/dist/app/main.js +29 -10
  6. package/dist/app/main.js.map +1 -1
  7. package/dist/app/standalone.d.ts +2 -0
  8. package/dist/app/standalone.js +28 -0
  9. package/dist/app/standalone.js.map +1 -0
  10. package/dist/config/config.d.ts +1 -0
  11. package/dist/lib/authentication/Callback.js +1 -1
  12. package/dist/lib/authentication/Callback.js.map +1 -1
  13. package/dist/lib/authentication/providers/openid.d.ts +1 -1
  14. package/dist/lib/components/DevPortal.d.ts +1 -1
  15. package/dist/lib/components/DevPortal.js +2 -2
  16. package/dist/lib/components/DevPortal.js.map +1 -1
  17. package/dist/lib/components/Error.d.ts +1 -0
  18. package/dist/lib/components/Error.js +10 -0
  19. package/dist/lib/components/Error.js.map +1 -0
  20. package/dist/lib/components/Layout.js +2 -2
  21. package/dist/lib/components/Layout.js.map +1 -1
  22. package/dist/lib/components/Router.js +2 -1
  23. package/dist/lib/components/Router.js.map +1 -1
  24. package/dist/lib/components/TopNavigation.d.ts +1 -1
  25. package/dist/lib/components/TopNavigation.js +4 -0
  26. package/dist/lib/components/TopNavigation.js.map +1 -1
  27. package/dist/lib/components/index.d.ts +10 -5
  28. package/dist/lib/components/index.js +8 -5
  29. package/dist/lib/components/index.js.map +1 -1
  30. package/dist/lib/plugins/markdown/MdxPage.js +2 -2
  31. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  32. package/dist/lib/plugins/markdown/Toc.js +1 -1
  33. package/dist/lib/plugins/markdown/Toc.js.map +1 -1
  34. package/dist/lib/plugins/markdown/generateRoutes.d.ts +1 -1
  35. package/dist/lib/plugins/markdown/generateRoutes.js +1 -1
  36. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  37. package/dist/lib/plugins/openapi/Route.js +1 -1
  38. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  39. package/dist/lib/plugins/openapi/SimpleSelect.js +1 -1
  40. package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -1
  41. package/dist/lib/plugins/openapi/index.js +1 -1
  42. package/dist/lib/plugins/openapi/index.js.map +1 -1
  43. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +1 -1
  44. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
  45. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
  46. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js +3 -0
  47. package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -1
  48. package/dist/lib/ui/Callout.js +1 -1
  49. package/dist/lib/ui/Callout.js.map +1 -1
  50. package/dist/lib/util/MdxComponents.js.map +1 -1
  51. package/dist/lib/util/logInit.d.ts +1 -0
  52. package/dist/lib/util/logInit.js +9 -0
  53. package/dist/lib/util/logInit.js.map +1 -0
  54. package/dist/vite/config.d.ts +5 -1
  55. package/dist/vite/config.js +16 -9
  56. package/dist/vite/config.js.map +1 -1
  57. package/dist/vite/plugin-api-keys.js +2 -2
  58. package/dist/vite/plugin-api-keys.js.map +1 -1
  59. package/dist/vite/plugin-api.js +1 -1
  60. package/dist/vite/plugin-api.js.map +1 -1
  61. package/dist/vite/plugin-auth.js +2 -2
  62. package/dist/vite/plugin-auth.js.map +1 -1
  63. package/dist/vite/plugin-component.js +1 -1
  64. package/dist/vite/plugin-component.js.map +1 -1
  65. package/dist/vite/plugin-docs.js +7 -6
  66. package/dist/vite/plugin-docs.js.map +1 -1
  67. package/dist/vite/plugin-html.js +1 -9
  68. package/dist/vite/plugin-html.js.map +1 -1
  69. package/dist/vite/plugin-mdx.d.ts +3 -1
  70. package/dist/vite/plugin-mdx.js +4 -4
  71. package/dist/vite/plugin-mdx.js.map +1 -1
  72. package/dist/vite/plugin-openapi-worker.js +1 -1
  73. package/dist/vite/plugin-openapi-worker.js.map +1 -1
  74. package/dist/vite/plugin-redirect.js +4 -1
  75. package/dist/vite/plugin-redirect.js.map +1 -1
  76. package/dist/vite/plugin.js +1 -1
  77. package/dist/vite/plugin.js.map +1 -1
  78. package/lib/{AnchorLink-DIUlXlf0.js → AnchorLink-BtVKbEwm.js} +183 -183
  79. package/lib/{DevPortalProvider-gzyAGqHT.js → DevPortalProvider--xZTs0RJ.js} +2 -2
  80. package/lib/{Markdown-BjA7peYW.js → Markdown-oJFqm0uk.js} +3 -3
  81. package/lib/{MdxComponents-W-fE1ISO.js → MdxComponents-CsU8yR42.js} +2 -2
  82. package/lib/{MdxPage-DQ7lZBzE.js → MdxPage-BV_9ncEk.js} +21 -21
  83. package/lib/{OperationList-DuIBqFNA.js → OperationList-C9t7wPj8.js} +9 -9
  84. package/lib/{Route-B98Y2MdH.js → Route-CHqr53jb.js} +2 -2
  85. package/lib/{Select-DczD5e29.js → Select-CNmXi4JU.js} +4 -4
  86. package/lib/{Spinner-CSoij67T.js → Spinner-By5opWs5.js} +3 -3
  87. package/lib/{hook-CBXxHulF.js → hook-kVJ4gpk5.js} +1 -1
  88. package/lib/{index-CKvOcM7w.js → index-CUIxJAeE.js} +169 -169
  89. package/lib/{index-C7O9D7f6.js → index-Cr3hgaqt.js} +2 -2
  90. package/lib/{index-Cg6lXS1z.js → index-CySUl0uj.js} +3 -3
  91. package/lib/{index-ClDDiRmC.js → index-fXFJf9Ua.js} +13 -13
  92. package/lib/{router-DibNxKUP.js → jsx-runtime-D7DwziLW.js} +2843 -2843
  93. package/lib/{util-CaVongBq.js → util-DnDPBx_j.js} +1 -1
  94. package/lib/zudoku.auth-openid.js +2 -2
  95. package/lib/zudoku.components.js +142 -141
  96. package/lib/zudoku.openapi-worker.js +3 -1
  97. package/lib/zudoku.plugin-api-keys.js +6 -6
  98. package/lib/zudoku.plugin-markdown.js +5 -5
  99. package/lib/zudoku.plugin-openapi.js +2 -2
  100. package/lib/zudoku.plugin-redirect.js +2 -2
  101. package/package.json +3 -1
  102. package/src/app/demo-cdn.html +14 -0
  103. package/src/app/demo.html +14 -0
  104. package/src/app/demo.tsx +35 -0
  105. package/src/app/main.css +74 -0
  106. package/src/app/main.tsx +40 -9
  107. package/src/app/standalone.html +16 -0
  108. package/src/app/standalone.tsx +42 -0
  109. package/src/lib/authentication/Callback.tsx +1 -1
  110. package/src/lib/authentication/providers/openid.tsx +1 -1
  111. package/src/lib/components/DevPortal.tsx +2 -2
  112. package/src/lib/components/Error.tsx +15 -0
  113. package/src/lib/components/Layout.tsx +1 -2
  114. package/src/lib/components/Router.tsx +2 -7
  115. package/src/lib/components/TopNavigation.tsx +5 -0
  116. package/src/lib/components/index.ts +8 -5
  117. package/src/lib/plugins/markdown/MdxPage.tsx +2 -2
  118. package/src/lib/plugins/markdown/Toc.tsx +1 -1
  119. package/src/lib/plugins/markdown/generateRoutes.tsx +1 -1
  120. package/src/lib/plugins/openapi/Route.tsx +1 -1
  121. package/src/lib/plugins/openapi/SimpleSelect.tsx +1 -1
  122. package/src/lib/plugins/openapi/index.tsx +1 -1
  123. package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
  124. package/src/lib/plugins/openapi/playground/QueryParams.tsx +1 -1
  125. package/src/lib/plugins/openapi/playground/createUrl.ts +1 -1
  126. package/src/lib/plugins/openapi/worker/createSharedWorkerClient.ts +4 -0
  127. package/src/lib/ui/Callout.tsx +2 -2
  128. package/src/lib/util/MdxComponents.tsx +0 -1
  129. package/src/lib/util/logInit.ts +9 -0
  130. package/dist/app/App.d.ts +0 -2
  131. package/dist/app/App.js +0 -32
  132. package/dist/app/App.js.map +0 -1
  133. package/dist/lib/components/Link.d.ts +0 -1
  134. package/dist/lib/components/Link.js +0 -2
  135. package/dist/lib/components/Link.js.map +0 -1
  136. package/dist/lib/core/helmet.d.ts +0 -4
  137. package/dist/lib/core/helmet.js +0 -5
  138. package/dist/lib/core/helmet.js.map +0 -1
  139. package/dist/lib/core/icons.d.ts +0 -1
  140. package/dist/lib/core/icons.js +0 -2
  141. package/dist/lib/core/icons.js.map +0 -1
  142. package/dist/lib/core/router.d.ts +0 -1
  143. package/dist/lib/core/router.js +0 -2
  144. package/dist/lib/core/router.js.map +0 -1
  145. package/src/app/App.tsx +0 -44
  146. package/src/lib/components/Link.tsx +0 -1
  147. package/src/lib/core/helmet.ts +0 -5
  148. package/src/lib/core/icons.tsx +0 -1
  149. package/src/lib/core/router.tsx +0 -1
@@ -187,7 +187,9 @@ const G = () => {
187
187
  ), {
188
188
  type: "module"
189
189
  });
190
- e.port.start();
190
+ e.onerror = (r) => {
191
+ console.error(r);
192
+ }, e.port.start();
191
193
  const [t, n] = G();
192
194
  return e.port.onmessage = (r) => {
193
195
  n(r.data.id, r.data.body);
@@ -1,13 +1,13 @@
1
- import { j as e } from "./router-DibNxKUP.js";
1
+ import { j as e } from "./jsx-runtime-D7DwziLW.js";
2
2
  import { l as g } from "./loglevel-CA34MiFn.js";
3
- import { u as j } from "./hook-CBXxHulF.js";
4
- import { u as v, a as m, S as b, b as w, c as N, d as k, e as K, f as p, B as o } from "./Select-DczD5e29.js";
5
- import { c as l, L as x } from "./index-CKvOcM7w.js";
6
- import { u as h, q as S, t as E } from "./DevPortalProvider-gzyAGqHT.js";
3
+ import { u as j } from "./hook-kVJ4gpk5.js";
4
+ import { u as v, a as m, S as b, b as w, c as N, d as k, e as K, f as p, B as o } from "./Select-CNmXi4JU.js";
5
+ import { c as l, L as x } from "./index-CUIxJAeE.js";
6
+ import { u as h, q as S, t as E } from "./DevPortalProvider--xZTs0RJ.js";
7
7
  import * as A from "react";
8
8
  import { useState as C } from "react";
9
9
  import { c as P } from "./cn-DpqTslo9.js";
10
- import { a as D, O as I, b as O } from "./index-ClDDiRmC.js";
10
+ import { b as D, O as I, a as O } from "./index-fXFJf9Ua.js";
11
11
  /**
12
12
  * @license lucide-react v0.378.0 - ISC
13
13
  *
@@ -1,7 +1,7 @@
1
- import { j as s } from "./router-DibNxKUP.js";
2
- import { j as x } from "./DevPortalProvider-gzyAGqHT.js";
3
- import { t as f, i as d } from "./util-CaVongBq.js";
4
- import { N as g } from "./index-ClDDiRmC.js";
1
+ import { j as s } from "./jsx-runtime-D7DwziLW.js";
2
+ import { j as x } from "./DevPortalProvider--xZTs0RJ.js";
3
+ import { t as f, i as d } from "./util-DnDPBx_j.js";
4
+ import { N as g } from "./index-fXFJf9Ua.js";
5
5
  const h = (t, e) => {
6
6
  const n = Object.entries(t).flatMap(
7
7
  ([r, p]) => {
@@ -11,7 +11,7 @@ const h = (t, e) => {
11
11
  return {
12
12
  path: i.at(-1) === "index" ? i.slice(0, -1).join("/") : a,
13
13
  lazy: async () => {
14
- const { MdxPage: u } = await import("./MdxPage-DQ7lZBzE.js"), { default: c, ...l } = await p();
14
+ const { MdxPage: u } = await import("./MdxPage-BV_9ncEk.js"), { default: c, ...l } = await p();
15
15
  return {
16
16
  element: /* @__PURE__ */ s.jsx(
17
17
  u,
@@ -1,5 +1,5 @@
1
- import "./router-DibNxKUP.js";
2
- import { o as t } from "./index-Cg6lXS1z.js";
1
+ import "./jsx-runtime-D7DwziLW.js";
2
+ import { o as t } from "./index-CySUl0uj.js";
3
3
  import "./urql-DMlBWUKL.js";
4
4
  import "virtual:zudoku-openapi-worker";
5
5
  export {
@@ -1,5 +1,5 @@
1
- import { j as s } from "./router-DibNxKUP.js";
2
- import { N as i } from "./index-ClDDiRmC.js";
1
+ import { j as s } from "./jsx-runtime-D7DwziLW.js";
2
+ import { N as i } from "./index-fXFJf9Ua.js";
3
3
  const p = (t) => ({
4
4
  getRoutes: () => t.redirects.map(({ from: e, to: r, replace: o }) => ({
5
5
  path: e,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.3.0-dev.23",
3
+ "version": "0.3.0-dev.26",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -160,6 +160,8 @@
160
160
  "scripts": {
161
161
  "build": "tsc --project tsconfig.json",
162
162
  "build:vite": "vite build && pnpm run hack:fix-worker-paths",
163
+ "build:standalone:vite": "vite build --config vite.standalone.config.ts && pnpm run hack:fix-worker-paths",
164
+ "build:standalone:html": "cp ./src/app/standalone.html ./standalone/standalone.html && cp ./src/app/demo.html ./standalone/demo.html && cp ./src/app/demo-cdn.html ./standalone/index.html",
163
165
  "hack:fix-worker-paths": "node ./scripts/hack-worker.mjs",
164
166
  "clean": "tsc --build --clean",
165
167
  "test": "node --test --enable-source-maps"
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Zudoku Demo</title>
8
+ <script type="module" crossorigin src="/latest/demo.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/latest/style.css" />
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Zudoku Demo</title>
8
+ <script type="module" crossorigin src="./demo.js"></script>
9
+ <link rel="stylesheet" crossorigin href="./style.css" />
10
+ </head>
11
+ <body>
12
+ <div id="root"></div>
13
+ </body>
14
+ </html>
@@ -0,0 +1,35 @@
1
+ import "./main.css";
2
+
3
+ import "../lib/util/logInit.js";
4
+
5
+ // Base React Component
6
+ import { DevPortal } from "../lib/components/DevPortal.js";
7
+
8
+ import logger from "loglevel";
9
+ import { StrictMode } from "react";
10
+ import { createRoot } from "react-dom/client";
11
+ import type { NavigationItem } from "../lib/core/DevPortalContext.js";
12
+ import { openApiPlugin } from "../lib/plugins/openapi/index.js";
13
+
14
+ const navigation: NavigationItem[] = [
15
+ {
16
+ label: "API Reference",
17
+ path: "/demo",
18
+ categories: [],
19
+ },
20
+ ];
21
+
22
+ const apiUrl = new URL(window.location.href).searchParams.get("api-url");
23
+ logger.info(`API URL: ${apiUrl}`);
24
+ createRoot(document.getElementById("root")!).render(
25
+ <StrictMode>
26
+ <DevPortal
27
+ page={{
28
+ logo: "https://cdn.zuplo.com/www/favicon.png",
29
+ pageTitle: "Developer Portal",
30
+ }}
31
+ navigation={navigation}
32
+ plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/demo" })]}
33
+ />
34
+ </StrictMode>,
35
+ );
package/src/app/main.css CHANGED
@@ -2,6 +2,80 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
+ @font-face {
6
+ font-family: Geist;
7
+ font-style: normal;
8
+ font-weight: 100;
9
+ font-display: swap;
10
+ src: url("https://cdn.zudoku.dev/geist/Geist-Thin.woff2") format("woff2");
11
+ }
12
+
13
+ @font-face {
14
+ font-family: Geist;
15
+ font-style: normal;
16
+ font-weight: 200;
17
+ font-display: swap;
18
+ src: url("https://cdn.zudoku.dev/geist/Geist-UltraLight.woff2")
19
+ format("woff2");
20
+ }
21
+
22
+ @font-face {
23
+ font-family: Geist;
24
+ font-style: normal;
25
+ font-weight: 300;
26
+ font-display: swap;
27
+ src: url("https://cdn.zudoku.dev/geist/Geist-Light.woff2") format("woff2");
28
+ }
29
+
30
+ @font-face {
31
+ font-family: Geist;
32
+ font-style: normal;
33
+ font-weight: 400;
34
+ font-display: swap;
35
+ src: url("https://cdn.zudoku.dev/geist/Geist-Regular.woff2") format("woff2");
36
+ }
37
+
38
+ @font-face {
39
+ font-family: Geist;
40
+ font-style: normal;
41
+ font-weight: 500;
42
+ font-display: swap;
43
+ src: url("https://cdn.zudoku.dev/geist/Geist-Medium.woff2") format("woff2");
44
+ }
45
+
46
+ @font-face {
47
+ font-family: Geist;
48
+ font-style: normal;
49
+ font-weight: 600;
50
+ font-display: swap;
51
+ src: url("https://cdn.zudoku.dev/geist/Geist-SemiBold.woff2") format("woff2");
52
+ }
53
+
54
+ @font-face {
55
+ font-family: Geist;
56
+ font-style: normal;
57
+ font-weight: 700;
58
+ font-display: swap;
59
+ src: url("https://cdn.zudoku.dev/geist/Geist-Bold.woff2") format("woff2");
60
+ }
61
+
62
+ @font-face {
63
+ font-family: Geist;
64
+ font-style: normal;
65
+ font-weight: 800;
66
+ font-display: swap;
67
+ src: url("https://cdn.zudoku.dev/geist/Geist-Black.woff2") format("woff2");
68
+ }
69
+
70
+ @font-face {
71
+ font-family: Geist;
72
+ font-style: normal;
73
+ font-weight: 900;
74
+ font-display: swap;
75
+ src: url("https://cdn.zudoku.dev/geist/Geist-UltraBlack.woff2")
76
+ format("woff2");
77
+ }
78
+
5
79
  @layer base {
6
80
  :root {
7
81
  --top-header-height: 65px;
package/src/app/main.tsx CHANGED
@@ -1,18 +1,49 @@
1
- import log from "loglevel";
2
1
  import { StrictMode } from "react";
3
2
  import { createRoot } from "react-dom/client";
4
- import App from "./App.js";
5
3
 
6
- log.setDefaultLevel("silent");
4
+ import "./main.css";
7
5
 
8
- if (import.meta.env.DEV) {
9
- log.setLevel("debug");
10
- } else if (localStorage.getItem("ENABLE_DEBUG_LOGS")) {
11
- log.setLevel("debug");
12
- }
6
+ import "../lib/util/logInit.js";
7
+
8
+ // Virtual config
9
+ import config from "virtual:zudoku-config";
10
+
11
+ // Virtual Plugins
12
+ import { configuredApiKeysPlugin } from "virtual:zudoku-api-keys-plugin";
13
+ import { configuredApiPlugins } from "virtual:zudoku-api-plugins";
14
+ import { configuredAuthProvider } from "virtual:zudoku-auth";
15
+ import { configuredDocsPlugins } from "virtual:zudoku-docs-plugins";
16
+ import { configuredRedirectPlugin } from "virtual:zudoku-redirect-plugin";
17
+
18
+ // Base React Component
19
+ import { DevPortal } from "zudoku/components";
20
+
21
+ // IMPORTANT: This component must not contain tailwind classes
22
+ // This directory is not processed by the tailwind plugin
13
23
 
14
24
  createRoot(document.getElementById("root")!).render(
15
25
  <StrictMode>
16
- <App />
26
+ <DevPortal
27
+ page={{
28
+ logo: config.page?.logo ?? "https://cdn.zuplo.com/www/favicon.png",
29
+ pageTitle: "Developer Portal",
30
+ ...config.page,
31
+ }}
32
+ metadata={{
33
+ favicon: "https://cdn.zuplo.com/www/favicon.png",
34
+ title: "%s | Developer Portal",
35
+ ...config.metadata,
36
+ }}
37
+ navigation={config.navigation ?? []}
38
+ authentication={configuredAuthProvider}
39
+ mdxComponents={config.mdx?.components}
40
+ plugins={[
41
+ ...configuredDocsPlugins,
42
+ ...configuredApiPlugins,
43
+ configuredRedirectPlugin,
44
+ ...(configuredApiKeysPlugin ? [configuredApiKeysPlugin] : []),
45
+ ...(configuredAuthProvider ? [configuredAuthProvider] : []),
46
+ ]}
47
+ />
17
48
  </StrictMode>,
18
49
  );
@@ -0,0 +1,16 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Dev Portal</title>
8
+ <script type="module" crossorigin src="./main.js"></script>
9
+ <link rel="stylesheet" crossorigin href="./style.css" />
10
+ </head>
11
+ <body>
12
+ <div
13
+ data-api-url="https://blue-sloth-main-afc3428.d2.zuplo.dev/schemas/rewiring-america"
14
+ ></div>
15
+ </body>
16
+ </html>
@@ -0,0 +1,42 @@
1
+ import "./main.css";
2
+
3
+ import "../lib/util/logInit.js";
4
+
5
+ // Base React Component
6
+ import { DevPortal } from "../lib/components/DevPortal.js";
7
+
8
+ import { StrictMode } from "react";
9
+ import { createRoot } from "react-dom/client";
10
+ import type { NavigationItem } from "../lib/core/DevPortalContext.js";
11
+ import { openApiPlugin } from "../lib/plugins/openapi/index.js";
12
+
13
+ const root = document.querySelector("[data-api-url]");
14
+ if (!root || root.tagName !== "DIV") {
15
+ throw new Error("No div found with attribute data-api-url");
16
+ }
17
+
18
+ const apiUrl = root.getAttribute("data-api-url");
19
+ const pageTitle = document.getElementsByTagName("title")[0].innerText;
20
+ const logoUrl = root.getAttribute("data-logo-url");
21
+
22
+ const navigation: NavigationItem[] = [
23
+ {
24
+ label: "API Reference",
25
+ path: "/",
26
+ categories: [],
27
+ },
28
+ ];
29
+
30
+ createRoot(root).render(
31
+ <StrictMode>
32
+ <DevPortal
33
+ page={{
34
+ logo: logoUrl ?? "https://cdn.zuplo.com/www/favicon.png",
35
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
36
+ pageTitle: pageTitle ?? "Developer Portal",
37
+ }}
38
+ navigation={navigation}
39
+ plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/" })]}
40
+ />
41
+ </StrictMode>,
42
+ );
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef, useState } from "react";
2
- import { useNavigate } from "../core/router.js";
2
+ import { useNavigate } from "react-router-dom";
3
3
  import { OAuthAuthorizationError } from "./errors.js";
4
4
 
5
5
  export function Callback({
@@ -1,7 +1,7 @@
1
1
  import logger from "loglevel";
2
2
  import * as oauth from "oauth4webapi";
3
+ import type { RouteObject } from "react-router-dom";
3
4
  import { OpenIDAuthenticationConfig } from "../../../config/config.js";
4
- import { RouteObject } from "../../core/router.js";
5
5
  import {
6
6
  AuthenticationProvider,
7
7
  AuthenticationProviderInitializer,
@@ -1,12 +1,12 @@
1
1
  import { MDXProvider } from "@mdx-js/react";
2
2
  import { QueryClientProvider } from "@tanstack/react-query";
3
3
  import { Fragment, memo, Suspense, useEffect, useMemo } from "react";
4
+ import { Helmet, HelmetProvider } from "react-helmet-async";
4
5
  import {
5
6
  DevPortalContext,
6
7
  queryClient,
7
8
  ZudokuContextOptions,
8
9
  } from "../core/DevPortalContext.js";
9
- import { Helmet, HelmetProvider } from "../core/helmet.js";
10
10
  import { hasHead } from "../core/plugins.js";
11
11
  import { MdxComponents } from "../util/MdxComponents.js";
12
12
  import {
@@ -18,7 +18,7 @@ import { ThemeProvider } from "./context/ThemeContext.js";
18
18
  import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
19
19
  import { Router } from "./Router.js";
20
20
 
21
- export const DevPortalSystemPaths = {
21
+ const DevPortalSystemPaths = {
22
22
  Settings: "/settings",
23
23
  } as const;
24
24
 
@@ -0,0 +1,15 @@
1
+ import { useRouteError } from "react-router-dom";
2
+ import { Layout } from "./Layout.js";
3
+
4
+ export function ErrorBoundary() {
5
+ const error = useRouteError();
6
+ // eslint-disable-next-line no-console
7
+ console.error(error);
8
+ return (
9
+ <Layout>
10
+ <div className="h-[75vh] flex items-center justify-center">
11
+ Error, look at the console
12
+ </div>
13
+ </Layout>
14
+ );
15
+ }
@@ -1,6 +1,6 @@
1
1
  import { Suspense, useEffect, useRef, type ReactNode } from "react";
2
+ import { Helmet } from "react-helmet-async";
2
3
  import { Outlet, useLocation } from "react-router-dom";
3
- import { Helmet } from "../core/helmet.js";
4
4
  import { useScrollToAnchor } from "../util/useScrollToAnchor.js";
5
5
  import { useScrollToTop } from "../util/useScrollToTop.js";
6
6
  import { useDevPortal } from "./context/DevPortalProvider.js";
@@ -30,7 +30,6 @@ export const Layout = ({ children }: { children?: ReactNode }) => {
30
30
  return (
31
31
  <>
32
32
  <Helmet titleTemplate={meta?.title}>
33
- <title>Home</title>
34
33
  {meta?.description && (
35
34
  <meta name="description" content={meta.description} />
36
35
  )}
@@ -1,6 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
  import { createBrowserRouter, RouterProvider } from "react-router-dom";
3
3
  import { DevPortalPlugin, isNavigationPlugin } from "../core/plugins.js";
4
+ import { ErrorBoundary } from "./Error.js";
4
5
  import { Layout } from "./Layout.js";
5
6
 
6
7
  export function Router({ plugins }: { plugins?: DevPortalPlugin[] }) {
@@ -13,13 +14,7 @@ export function Router({ plugins }: { plugins?: DevPortalPlugin[] }) {
13
14
  {
14
15
  path: "/",
15
16
  element: <Layout />,
16
- errorElement: (
17
- <Layout>
18
- <div className="h-[75vh] flex items-center justify-center">
19
- Error, look at the console
20
- </div>
21
- </Layout>
22
- ),
17
+ errorElement: <ErrorBoundary />,
23
18
  children: routes,
24
19
  },
25
20
  ]);
@@ -6,6 +6,11 @@ import { useDevPortal } from "./context/DevPortalProvider.js";
6
6
  export const TopNavigation = () => {
7
7
  const { navigation } = useDevPortal();
8
8
 
9
+ // Hide tope nav if there is only one item
10
+ if (navigation.length <= 1) {
11
+ return null;
12
+ }
13
+
9
14
  return (
10
15
  <nav className="border-b border-border text-sm px-12 h-[--top-nav-height]">
11
16
  <ul className="flex flex-row items-center gap-8">
@@ -1,6 +1,9 @@
1
- import { Callout } from "../ui/Callout.js";
1
+ import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
2
+ import { Link as LinkImport } from "react-router-dom";
3
+ import { Callout as CalloutImport } from "../ui/Callout.js";
4
+ import { DevPortal as DevPortalImport } from "./DevPortal.js";
2
5
 
3
- export { useMDXComponents } from "@mdx-js/react";
4
- export { DevPortal } from "./DevPortal.js";
5
- export { Link } from "./Link.js";
6
- export { Callout };
6
+ export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
7
+ export const Callout = /*@__PURE__*/ CalloutImport;
8
+ export const DevPortal = /*@__PURE__*/ DevPortalImport;
9
+ export const Link = /*@__PURE__*/ LinkImport;
@@ -1,12 +1,12 @@
1
1
  import { useMDXComponents } from "@mdx-js/react";
2
2
  import { useMemo, type PropsWithChildren, type ReactNode } from "react";
3
+ import { Helmet } from "react-helmet-async";
4
+ import { Link, useLocation } from "react-router-dom";
3
5
  import { CategoryHeading } from "../../components/CategoryHeading.js";
4
6
  import { Heading } from "../../components/Heading.js";
5
7
  import { ProseClasses } from "../../components/Markdown.js";
6
8
  import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
7
9
  import { isPathItem } from "../../components/navigation/util.js";
8
- import { Helmet } from "../../core/helmet.js";
9
- import { Link, useLocation } from "../../core/router.js";
10
10
  import type { MdxComponentsType } from "../../util/MdxComponents.js";
11
11
  import { cn } from "../../util/cn.js";
12
12
  import slugify from "../../util/slugify.js";
@@ -1,4 +1,5 @@
1
1
  import type { TocEntry } from "@stefanprobst/rehype-extract-toc";
2
+ import { ListTreeIcon } from "lucide-react";
2
3
  import {
3
4
  useEffect,
4
5
  useRef,
@@ -8,7 +9,6 @@ import {
8
9
  } from "react";
9
10
  import { AnchorLink } from "../../components/AnchorLink.js";
10
11
  import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
11
- import { ListTreeIcon } from "../../core/icons.js";
12
12
  import { cn } from "../../util/cn.js";
13
13
 
14
14
  const DATA_ANCHOR_ATTR = "data-active";
@@ -1,6 +1,6 @@
1
+ import { Navigate, type RouteObject } from "react-router-dom";
1
2
  import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
2
3
  import { isPathItem } from "../../components/navigation/util.js";
3
- import { Navigate, type RouteObject } from "../../core/router.js";
4
4
  import { traverseNavigation } from "../../util/traverseNavigation.js";
5
5
 
6
6
  import {
@@ -1,4 +1,4 @@
1
- import { Outlet } from "../../core/router.js";
1
+ import { Outlet } from "react-router-dom";
2
2
  import { OasConfigProvider } from "./context.js";
3
3
  import { OasPluginConfig } from "./interfaces.js";
4
4
 
@@ -1,5 +1,5 @@
1
+ import { ChevronsUpDownIcon } from "lucide-react";
1
2
  import type { ChangeEventHandler } from "react";
2
- import { ChevronsUpDownIcon } from "../../core/icons.js";
3
3
  import { cn } from "../../util/cn.js";
4
4
 
5
5
  export const SimpleSelect = ({
@@ -1,8 +1,8 @@
1
+ import { matchPath, type RouteObject } from "react-router-dom";
1
2
  import {
2
3
  type DevPortalPlugin,
3
4
  type PluginNavigationCategory,
4
5
  } from "../../core/plugins.js";
5
- import { matchPath, type RouteObject } from "../../core/router.js";
6
6
  import { MethodBadge } from "./MethodBadge.js";
7
7
  import { graphql } from "./graphql/index.js";
8
8
  import {
@@ -3,7 +3,7 @@ import { Control, useFieldArray, UseFormRegister } from "react-hook-form";
3
3
  import { cn } from "../../../util/cn.js";
4
4
  import { DATA_ATTR, usePastellizedColor } from "../ColorizedParam.js";
5
5
  import { InlineInput } from "./InlineInput.js";
6
- import { PlaygroundForm } from "./Playground.js";
6
+ import type { PlaygroundForm } from "./Playground.js";
7
7
 
8
8
  type ParameterValueProps = {
9
9
  part: string;
@@ -6,7 +6,7 @@ import {
6
6
  useFormContext,
7
7
  } from "react-hook-form";
8
8
  import { InlineInput } from "./InlineInput.js";
9
- import { PlaygroundForm } from "./Playground.js";
9
+ import type { PlaygroundForm } from "./Playground.js";
10
10
 
11
11
  export const QueryParams = ({
12
12
  control,
@@ -1,4 +1,4 @@
1
- import { PlaygroundForm } from "./Playground.js";
1
+ import type { PlaygroundForm } from "./Playground.js";
2
2
 
3
3
  export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
4
4
  const url = new URL(
@@ -16,6 +16,10 @@ export const createSharedWorkerClient = () => {
16
16
  type: "module",
17
17
  });
18
18
 
19
+ worker.onerror = (e) => {
20
+ console.error(e);
21
+ };
22
+
19
23
  worker.port.start();
20
24
 
21
25
  const [waitFor, notify] = createWaitForNotify<string>();
@@ -1,10 +1,10 @@
1
- import type { ReactNode } from "react";
2
1
  import {
3
2
  AlertTriangleIcon,
4
3
  InfoIcon,
5
4
  LightbulbIcon,
6
5
  ShieldAlertIcon,
7
- } from "../core/icons.js";
6
+ } from "lucide-react";
7
+ import type { ReactNode } from "react";
8
8
  import { cn } from "../util/cn.js";
9
9
 
10
10
  const stylesMap = {
@@ -1,6 +1,5 @@
1
1
  import { MDXProvider } from "@mdx-js/react";
2
2
  import type { ComponentProps } from "react";
3
-
4
3
  import { Link } from "react-router-dom";
5
4
  import { Heading } from "../components/Heading.js";
6
5
  import { SyntaxHighlight } from "../components/SyntaxHighlight.js";
@@ -0,0 +1,9 @@
1
+ import log from "loglevel";
2
+
3
+ log.setDefaultLevel("silent");
4
+
5
+ if (import.meta.env.DEV) {
6
+ log.setLevel("debug");
7
+ } else if (localStorage.getItem("ENABLE_DEBUG_LOGS")) {
8
+ log.setLevel("debug");
9
+ }
package/dist/app/App.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import "./main.css";
2
- export default function App(): import("react/jsx-runtime").JSX.Element;