zudoku 0.3.0-dev.30 → 0.3.0-dev.31
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.
- package/dist/app/demo.js +15 -11
- package/dist/app/demo.js.map +1 -1
- package/dist/app/main.js +4 -2
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +14 -10
- package/dist/app/standalone.js.map +1 -1
- package/dist/app/tailwind.d.ts +1 -1
- package/dist/app/tailwind.js +0 -9
- package/dist/app/tailwind.js.map +1 -1
- package/dist/lib/components/DevPortal.d.ts +4 -1
- package/dist/lib/components/DevPortal.js +6 -1
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/Router.js +2 -2
- package/dist/lib/components/Router.js.map +1 -1
- package/dist/lib/components/index.d.ts +4 -1
- package/dist/lib/errors/ErrorAlert.d.ts +3 -0
- package/dist/lib/errors/ErrorAlert.js +8 -0
- package/dist/lib/errors/ErrorAlert.js.map +1 -0
- package/dist/lib/errors/RouterError.d.ts +1 -0
- package/dist/lib/errors/RouterError.js +9 -0
- package/dist/lib/errors/RouterError.js.map +1 -0
- package/dist/lib/errors/TopLevelError.d.ts +2 -0
- package/dist/lib/errors/TopLevelError.js +7 -0
- package/dist/lib/errors/TopLevelError.js.map +1 -0
- package/dist/vite/config.d.ts +0 -1
- package/dist/vite/config.js +5 -3
- package/dist/vite/config.js.map +1 -1
- package/lib/{AnchorLink-BtVKbEwm.js → AnchorLink-ptdQk87q.js} +4 -4
- package/lib/{AnchorLink-BtVKbEwm.js.map → AnchorLink-ptdQk87q.js.map} +1 -1
- package/lib/{DevPortalProvider--xZTs0RJ.js → DevPortalProvider-BMk-RCE0.js} +3 -3
- package/lib/{DevPortalProvider--xZTs0RJ.js.map → DevPortalProvider-BMk-RCE0.js.map} +1 -1
- package/lib/{Markdown-oJFqm0uk.js → Markdown-DDmW47R9.js} +4 -4
- package/lib/{Markdown-oJFqm0uk.js.map → Markdown-DDmW47R9.js.map} +1 -1
- package/lib/{MdxComponents-CsU8yR42.js → MdxComponents-C0R6zobS.js} +4 -4
- package/lib/{MdxComponents-CsU8yR42.js.map → MdxComponents-C0R6zobS.js.map} +1 -1
- package/lib/{MdxPage-BV_9ncEk.js → MdxPage-DyJAHF9y.js} +9 -9
- package/lib/{MdxPage-BV_9ncEk.js.map → MdxPage-DyJAHF9y.js.map} +1 -1
- package/lib/{OperationList-DfG_E0Xa.js → OperationList-Dz9rHM9r.js} +10 -10
- package/lib/{OperationList-DfG_E0Xa.js.map → OperationList-Dz9rHM9r.js.map} +1 -1
- package/lib/{Route-CHqr53jb.js → Route-CN_7-e5r.js} +3 -3
- package/lib/{Route-CHqr53jb.js.map → Route-CN_7-e5r.js.map} +1 -1
- package/lib/{Select-CNmXi4JU.js → Select-D-Jtx53Q.js} +5 -5
- package/lib/{Select-CNmXi4JU.js.map → Select-D-Jtx53Q.js.map} +1 -1
- package/lib/{Spinner-By5opWs5.js → Spinner-BG1JnYy0.js} +4 -4
- package/lib/{Spinner-By5opWs5.js.map → Spinner-BG1JnYy0.js.map} +1 -1
- package/lib/{hook-kVJ4gpk5.js → hook-BzBeIPL4.js} +2 -2
- package/lib/{hook-kVJ4gpk5.js.map → hook-BzBeIPL4.js.map} +1 -1
- package/lib/{index-Cr3hgaqt.js → index-BaOOUFsA.js} +3 -3
- package/lib/{index-Cr3hgaqt.js.map → index-BaOOUFsA.js.map} +1 -1
- package/lib/{index-CUIxJAeE.js → index-CPvRaBBB.js} +12 -12
- package/lib/{index-CUIxJAeE.js.map → index-CPvRaBBB.js.map} +1 -1
- package/lib/{index-B2qLeglF.js → index-Cpdpun6t.js} +4 -4
- package/lib/{index-B2qLeglF.js.map → index-Cpdpun6t.js.map} +1 -1
- package/lib/{index-fXFJf9Ua.js → index-DLS6fPwU.js} +6 -6
- package/lib/{index-fXFJf9Ua.js.map → index-DLS6fPwU.js.map} +1 -1
- package/lib/{jsx-runtime-D7DwziLW.js → jsx-runtime-SV6hXQua.js} +4 -4
- package/lib/{jsx-runtime-D7DwziLW.js.map → jsx-runtime-SV6hXQua.js.map} +1 -1
- package/lib/{util-DnDPBx_j.js → util-CCWvaWo7.js} +2 -2
- package/lib/{util-DnDPBx_j.js.map → util-CCWvaWo7.js.map} +1 -1
- package/lib/zudoku.auth-openid.js +2 -2
- package/lib/zudoku.components.js +344 -246
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +6 -6
- package/lib/zudoku.plugin-markdown.js +5 -5
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/lib/zudoku.plugin-redirect.js +2 -2
- package/package.json +2 -1
- package/src/app/demo.tsx +18 -13
- package/src/app/main.tsx +4 -2
- package/src/app/standalone.tsx +15 -11
- package/src/app/tailwind.ts +1 -11
- package/src/lib/components/DevPortal.tsx +10 -1
- package/src/lib/components/Router.tsx +3 -2
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +12 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/dist/lib/components/Error.d.ts +0 -1
- package/dist/lib/components/Error.js +0 -10
- package/dist/lib/components/Error.js.map +0 -1
- package/src/lib/components/Error.tsx +0 -15
package/src/app/standalone.tsx
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
// Styles
|
|
1
5
|
import "./main.css";
|
|
2
6
|
|
|
7
|
+
// Logger
|
|
3
8
|
import "../lib/util/logInit.js";
|
|
4
9
|
|
|
5
10
|
// Base React Component
|
|
6
11
|
import { DevPortal } from "../lib/components/DevPortal.js";
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
import { createRoot } from "react-dom/client";
|
|
10
|
-
import type { NavigationItem } from "../lib/core/DevPortalContext.js";
|
|
13
|
+
// Plugins
|
|
11
14
|
import { openApiPlugin } from "../lib/plugins/openapi/index.js";
|
|
12
15
|
|
|
13
16
|
const root = document.querySelector("[data-api-url]");
|
|
@@ -19,13 +22,8 @@ const apiUrl = root.getAttribute("data-api-url");
|
|
|
19
22
|
const pageTitle = document.getElementsByTagName("title")[0].innerText;
|
|
20
23
|
const logoUrl = root.getAttribute("data-logo-url");
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
label: "API Reference",
|
|
25
|
-
path: "/",
|
|
26
|
-
categories: [],
|
|
27
|
-
},
|
|
28
|
-
];
|
|
25
|
+
// IMPORTANT: This component must not contain tailwind classes
|
|
26
|
+
// This directory is not processed by the tailwind plugin
|
|
29
27
|
|
|
30
28
|
createRoot(root).render(
|
|
31
29
|
<StrictMode>
|
|
@@ -35,7 +33,13 @@ createRoot(root).render(
|
|
|
35
33
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
36
34
|
pageTitle: pageTitle ?? "Developer Portal",
|
|
37
35
|
}}
|
|
38
|
-
navigation={
|
|
36
|
+
navigation={[
|
|
37
|
+
{
|
|
38
|
+
label: "API Reference",
|
|
39
|
+
path: "/",
|
|
40
|
+
categories: [],
|
|
41
|
+
},
|
|
42
|
+
]}
|
|
39
43
|
plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/" })]}
|
|
40
44
|
/>
|
|
41
45
|
</StrictMode>,
|
package/src/app/tailwind.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import typographyPlugin from "@tailwindcss/typography";
|
|
2
2
|
import type { Config } from "tailwindcss";
|
|
3
3
|
import defaultTheme from "tailwindcss/defaultTheme.js";
|
|
4
|
-
const content = [
|
|
5
|
-
"./src/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
6
|
-
"./node_modules/zudoku/dist/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
7
|
-
];
|
|
8
4
|
|
|
9
|
-
|
|
10
|
-
// if (process.env.NODE_ENV === "development") {
|
|
11
|
-
// content.push("../../plugins/*/src/**/*.{js,ts,jsx,tsx}");
|
|
12
|
-
// }
|
|
13
|
-
|
|
14
|
-
const config: Config = {
|
|
5
|
+
const config: Omit<Config, "content"> = {
|
|
15
6
|
darkMode: "selector",
|
|
16
|
-
content,
|
|
17
7
|
theme: {
|
|
18
8
|
extend: {
|
|
19
9
|
fontFamily: {
|
|
@@ -1,6 +1,7 @@
|
|
|
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 { ErrorBoundary } from "react-error-boundary";
|
|
4
5
|
import { Helmet, HelmetProvider } from "react-helmet-async";
|
|
5
6
|
import {
|
|
6
7
|
DevPortalContext,
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
ZudokuContextOptions,
|
|
9
10
|
} from "../core/DevPortalContext.js";
|
|
10
11
|
import { hasHead } from "../core/plugins.js";
|
|
12
|
+
import { TopLevelError } from "../errors/TopLevelError.js";
|
|
11
13
|
import { MdxComponents } from "../util/MdxComponents.js";
|
|
12
14
|
import {
|
|
13
15
|
ComponentsProvider,
|
|
@@ -81,7 +83,14 @@ const DevPortalInner = (props: ZudokuContextOptions) => {
|
|
|
81
83
|
);
|
|
82
84
|
};
|
|
83
85
|
|
|
84
|
-
const DevPortal =
|
|
86
|
+
const DevPortal = (props: ZudokuContextOptions) => {
|
|
87
|
+
const Inner = memo(DevPortalInner);
|
|
88
|
+
return (
|
|
89
|
+
<ErrorBoundary FallbackComponent={TopLevelError}>
|
|
90
|
+
<Inner {...props} />
|
|
91
|
+
</ErrorBoundary>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
85
94
|
DevPortal.displayName = "DevPortal";
|
|
86
95
|
|
|
87
96
|
export { DevPortal };
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
-
|
|
4
|
+
|
|
5
|
+
import { RouterError } from "../errors/RouterError.js";
|
|
5
6
|
import { Layout } from "./Layout.js";
|
|
6
7
|
|
|
7
8
|
export function Router({ plugins }: { plugins?: DevPortalPlugin[] }) {
|
|
@@ -14,7 +15,7 @@ export function Router({ plugins }: { plugins?: DevPortalPlugin[] }) {
|
|
|
14
15
|
{
|
|
15
16
|
path: "/",
|
|
16
17
|
element: <Layout />,
|
|
17
|
-
errorElement: <
|
|
18
|
+
errorElement: <RouterError />,
|
|
18
19
|
children: routes,
|
|
19
20
|
},
|
|
20
21
|
]);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
+
export function ErrorAlert({ error }: { error: any }) {
|
|
3
|
+
const message = error?.message ?? "Something went wrong";
|
|
4
|
+
const stack = error?.stack;
|
|
5
|
+
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
|
|
8
|
+
<div className="mx-auto max-w-[85%] sm:max-w-[50%]">
|
|
9
|
+
<h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
|
|
10
|
+
Something went wrong
|
|
11
|
+
</h1>
|
|
12
|
+
<p className="mt-5 text-h1-text">{message}</p>
|
|
13
|
+
{stack ? (
|
|
14
|
+
<pre className="mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700">
|
|
15
|
+
{stack}
|
|
16
|
+
</pre>
|
|
17
|
+
) : null}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useRouteError } from "react-router-dom";
|
|
2
|
+
import { Layout } from "../components/Layout.js";
|
|
3
|
+
import { ErrorAlert } from "./ErrorAlert.js";
|
|
4
|
+
|
|
5
|
+
export function RouterError() {
|
|
6
|
+
const error = useRouteError();
|
|
7
|
+
return (
|
|
8
|
+
<Layout>
|
|
9
|
+
<ErrorAlert error={error} />
|
|
10
|
+
</Layout>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FallbackProps } from "react-error-boundary";
|
|
2
|
+
import { ErrorAlert } from "./ErrorAlert.js";
|
|
3
|
+
|
|
4
|
+
export function TopLevelError({ error, resetErrorBoundary }: FallbackProps) {
|
|
5
|
+
// Call resetErrorBoundary() to reset the error boundary and retry the render.
|
|
6
|
+
|
|
7
|
+
return <ErrorAlert error={error} />;
|
|
8
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function ErrorBoundary(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRouteError } from "react-router-dom";
|
|
3
|
-
import { Layout } from "./Layout.js";
|
|
4
|
-
export function ErrorBoundary() {
|
|
5
|
-
const error = useRouteError();
|
|
6
|
-
// eslint-disable-next-line no-console
|
|
7
|
-
console.error(error);
|
|
8
|
-
return (_jsx(Layout, { children: _jsx("div", { className: "h-[75vh] flex items-center justify-center", children: "Error, look at the console" }) }));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=Error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../src/lib/components/Error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,aAAa,EAAE,CAAC;IAC9B,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CACL,KAAC,MAAM,cACL,cAAK,SAAS,EAAC,2CAA2C,2CAEpD,GACC,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|