zudoku 0.3.0-dev.66 → 0.3.0-dev.68
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/lib/components/context/ViewportAnchorContext.js +2 -1
- package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +2 -1
- package/dist/lib/plugins/markdown/Toc.js.map +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +2 -2
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/StaggeredRender.js +3 -2
- package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +4 -3
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +5 -9
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
- package/dist/lib/util/requestIdle.d.ts +2 -0
- package/dist/lib/util/requestIdle.js +3 -0
- package/dist/lib/util/requestIdle.js.map +1 -0
- package/dist/lib/util/useScrollToAnchor.js +3 -2
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/lib/{AnchorLink-C_pYhuZi.js → AnchorLink-61IZfWrS.js} +2 -2
- package/lib/{AnchorLink-C_pYhuZi.js.map → AnchorLink-61IZfWrS.js.map} +1 -1
- package/lib/{CategoryHeading-D5Q-X6lE.js → CategoryHeading-aW8CL0KA.js} +2 -2
- package/lib/{CategoryHeading-D5Q-X6lE.js.map → CategoryHeading-aW8CL0KA.js.map} +1 -1
- package/lib/{Combination-Cq0UkOXq.js → Combination-BbWKjDLe.js} +2 -2
- package/lib/{Combination-Cq0UkOXq.js.map → Combination-BbWKjDLe.js.map} +1 -1
- package/lib/{Input-DdAxw3vC.js → Input-BY0B_0qy.js} +3 -3
- package/lib/{Input-DdAxw3vC.js.map → Input-BY0B_0qy.js.map} +1 -1
- package/lib/{Markdown-DsCvZnhw.js → Markdown-BO5EsS-C.js} +748 -746
- package/lib/Markdown-BO5EsS-C.js.map +1 -0
- package/lib/{MdxPage-B_7x36CA.js → MdxPage-DEfyHwSx.js} +28 -28
- package/lib/MdxPage-DEfyHwSx.js.map +1 -0
- package/lib/{OperationList-Cv0GStt7.js → OperationList-VK1_1rzp.js} +167 -162
- package/lib/OperationList-VK1_1rzp.js.map +1 -0
- package/lib/{Spinner-DyDcSKPz.js → Spinner-6NfpF1CA.js} +56 -56
- package/lib/Spinner-6NfpF1CA.js.map +1 -0
- package/lib/{hook-Cz5jddRs.js → hook-gOGk1OUF.js} +4 -4
- package/lib/{hook-Cz5jddRs.js.map → hook-gOGk1OUF.js.map} +1 -1
- package/lib/{index-NGns0N9q.js → index-7W7DUZbY.js} +4 -4
- package/lib/{index-NGns0N9q.js.map → index-7W7DUZbY.js.map} +1 -1
- package/lib/zudoku.components.js +351 -351
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +4 -4
- package/lib/zudoku.plugin-custom-page.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/package.json +1 -1
- package/src/lib/components/context/ViewportAnchorContext.tsx +2 -1
- package/src/lib/plugins/markdown/Toc.tsx +2 -1
- package/src/lib/plugins/openapi/ColorizedParam.tsx +2 -2
- package/src/lib/plugins/openapi/StaggeredRender.tsx +3 -2
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +10 -7
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +1 -3
- package/src/lib/plugins/openapi/playground/createUrl.ts +11 -14
- package/src/lib/util/requestIdle.ts +4 -0
- package/src/lib/util/useScrollToAnchor.ts +3 -2
- package/lib/Markdown-DsCvZnhw.js.map +0 -1
- package/lib/MdxPage-B_7x36CA.js.map +0 -1
- package/lib/OperationList-Cv0GStt7.js.map +0 -1
- package/lib/Spinner-DyDcSKPz.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { b as f, j as e, O as j } from "./jsx-runtime-BIr0WBt_.js";
|
|
2
|
-
import { u as g, R as v } from "./hook-
|
|
3
|
-
import { u as w, a as p, I as b, S as k, b as K, c as N, d as E, e as A, f as h } from "./Input-
|
|
4
|
-
import { c as l, L as x, a as P } from "./Markdown-
|
|
2
|
+
import { u as g, R as v } from "./hook-gOGk1OUF.js";
|
|
3
|
+
import { u as w, a as p, I as b, S as k, b as K, c as N, d as E, e as A, f as h } from "./Input-BY0B_0qy.js";
|
|
4
|
+
import { c as l, L as x, a as P } from "./Markdown-BO5EsS-C.js";
|
|
5
5
|
import { u as m, x as S, y as I } from "./DevPortalProvider-BBhQ8kgI.js";
|
|
6
|
-
import { B as c, p as C } from "./Combination-
|
|
6
|
+
import { B as c, p as C } from "./Combination-BbWKjDLe.js";
|
|
7
7
|
import { useState as D } from "react";
|
|
8
8
|
/**
|
|
9
9
|
* @license lucide-react v0.378.0 - ISC
|
|
@@ -9,7 +9,7 @@ const f = (t, e) => {
|
|
|
9
9
|
return {
|
|
10
10
|
path: i.at(-1) === "index" ? i.slice(0, -1).join("/") : s,
|
|
11
11
|
lazy: async () => {
|
|
12
|
-
const { MdxPage: u } = await import("./MdxPage-
|
|
12
|
+
const { MdxPage: u } = await import("./MdxPage-DEfyHwSx.js"), { default: c, ...l } = await m();
|
|
13
13
|
return {
|
|
14
14
|
element: /* @__PURE__ */ o.jsx(
|
|
15
15
|
u,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./jsx-runtime-BIr0WBt_.js";
|
|
2
|
-
import { o as n } from "./index-
|
|
2
|
+
import { o as n } from "./index-7W7DUZbY.js";
|
|
3
3
|
import "./urql-DMlBWUKL.js";
|
|
4
4
|
import "zudoku/openapi-worker";
|
|
5
|
-
import "./Markdown-
|
|
5
|
+
import "./Markdown-BO5EsS-C.js";
|
|
6
6
|
import "./router-BiRCp01d.js";
|
|
7
7
|
export {
|
|
8
8
|
n as openApiPlugin
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useRef,
|
|
9
9
|
useState,
|
|
10
10
|
} from "react";
|
|
11
|
+
import { requestIdle } from "../../util/requestIdle.js";
|
|
11
12
|
|
|
12
13
|
type AnchorContextType = {
|
|
13
14
|
activeAnchor?: string;
|
|
@@ -95,7 +96,7 @@ export const ViewportAnchorProvider = ({
|
|
|
95
96
|
// reset the active anchor when we reach the top
|
|
96
97
|
setActiveAnchor("");
|
|
97
98
|
} else if (hasReachedBottom) {
|
|
98
|
-
|
|
99
|
+
requestIdle(() => {
|
|
99
100
|
// set the last anchor when we reach the bottom
|
|
100
101
|
const lastItem = Array.from(elements).pop();
|
|
101
102
|
setActiveAnchor(lastItem?.id ?? "");
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { AnchorLink } from "../../components/AnchorLink.js";
|
|
11
11
|
import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
|
|
12
12
|
import { cn } from "../../util/cn.js";
|
|
13
|
+
import { requestIdle } from "../../util/requestIdle.js";
|
|
13
14
|
|
|
14
15
|
const DATA_ANCHOR_ATTR = "data-active";
|
|
15
16
|
|
|
@@ -83,7 +84,7 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
83
84
|
if (paintedOnce.current) return;
|
|
84
85
|
|
|
85
86
|
// after all is painted, the indicator should animate
|
|
86
|
-
|
|
87
|
+
requestIdle(() => {
|
|
87
88
|
paintedOnce.current = true;
|
|
88
89
|
});
|
|
89
90
|
}, [activeAnchor]);
|
|
@@ -31,8 +31,8 @@ export const ColorizedParam = ({
|
|
|
31
31
|
onClick?: () => void;
|
|
32
32
|
}) => {
|
|
33
33
|
const ref = useRef<HTMLSpanElement>(null);
|
|
34
|
-
const normalized = name.replace(
|
|
35
|
-
const normalizedSlug = slug?.replace(
|
|
34
|
+
const normalized = name.replace(/[{}]/g, "");
|
|
35
|
+
const normalizedSlug = slug?.replace(/[{}]/g, "");
|
|
36
36
|
const color = usePastellizedColor(normalized);
|
|
37
37
|
|
|
38
38
|
const borderColor = `hsl(${color} / ${borderOpacity})`;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useEffect,
|
|
7
7
|
useState,
|
|
8
8
|
} from "react";
|
|
9
|
+
import { cancelIdle, requestIdle } from "../../util/requestIdle.js";
|
|
9
10
|
|
|
10
11
|
export const StaggeredRenderContext = createContext({ stagger: false });
|
|
11
12
|
|
|
@@ -18,11 +19,11 @@ const StaggeredRender = ({ children }: { children: ReactNode[] }) => {
|
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
const
|
|
22
|
+
const idle = requestIdle(() => {
|
|
22
23
|
setRenderAll(true);
|
|
23
24
|
});
|
|
24
25
|
|
|
25
|
-
return () =>
|
|
26
|
+
return () => cancelIdle(idle);
|
|
26
27
|
}, [renderAll]);
|
|
27
28
|
|
|
28
29
|
return !renderAll ? Children.toArray(children).slice(0, 3) : children;
|
|
@@ -154,16 +154,18 @@ export const Playground = ({
|
|
|
154
154
|
|
|
155
155
|
const path = url.split("/").map((part, i, arr) => {
|
|
156
156
|
const isPathParam = part.startsWith("{") && part.endsWith("}");
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
)?.value;
|
|
157
|
+
const replaced = part.replace(/[{}]/g, "");
|
|
158
|
+
const value = formState.pathParams.find((p) => p.name === replaced)?.value;
|
|
160
159
|
|
|
161
160
|
const pathParamValue = value ? (
|
|
162
|
-
<ColorizedParam backgroundOpacity="
|
|
161
|
+
<ColorizedParam backgroundOpacity="25%" name={part} slug={part}>
|
|
163
162
|
{value}
|
|
164
163
|
</ColorizedParam>
|
|
165
164
|
) : (
|
|
166
|
-
<span
|
|
165
|
+
<span
|
|
166
|
+
className="underline decoration-wavy decoration-red-500"
|
|
167
|
+
title={`Missing value for path parameter \`${replaced}\``}
|
|
168
|
+
>
|
|
167
169
|
{part}
|
|
168
170
|
</span>
|
|
169
171
|
);
|
|
@@ -186,9 +188,10 @@ export const Playground = ({
|
|
|
186
188
|
|
|
187
189
|
const urlQueryParams = formState.queryParams
|
|
188
190
|
.filter((p) => p.active)
|
|
189
|
-
.map((p) => (
|
|
191
|
+
.map((p, i, arr) => (
|
|
190
192
|
<Fragment key={p.name}>
|
|
191
|
-
{p.name}={p.value}
|
|
193
|
+
{p.name}={encodeURIComponent(p.value).replaceAll("%20", "+")}
|
|
194
|
+
{i < arr.length - 1 && "&"}
|
|
192
195
|
<wbr />
|
|
193
196
|
</Fragment>
|
|
194
197
|
));
|
|
@@ -57,9 +57,7 @@ export const QueryParams = ({
|
|
|
57
57
|
title={requiredFields[i] ? "Required field" : undefined}
|
|
58
58
|
>
|
|
59
59
|
{field.value}
|
|
60
|
-
{requiredFields[i] &&
|
|
61
|
-
<sup className="text-destructive">*</sup>
|
|
62
|
-
)}
|
|
60
|
+
{requiredFields[i] && <sup> *</sup>}
|
|
63
61
|
</label>
|
|
64
62
|
</InlineInput>
|
|
65
63
|
)}
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import type { PlaygroundForm } from "./Playground.js";
|
|
2
2
|
|
|
3
3
|
export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.map((v) =>
|
|
9
|
-
v.startsWith("{") && v.endsWith("}")
|
|
10
|
-
? data.pathParams.find((part) => part.name === v.slice(1, -1))
|
|
11
|
-
?.value ?? v
|
|
12
|
-
: v,
|
|
13
|
-
)
|
|
14
|
-
.join("/"),
|
|
4
|
+
const filledPath = path.replace(
|
|
5
|
+
/\{(\w+)}/g,
|
|
6
|
+
(_, key) =>
|
|
7
|
+
data.pathParams.find((part) => part.name === key)?.value || `{${key}}`,
|
|
15
8
|
);
|
|
16
9
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const url = new URL(filledPath, host);
|
|
11
|
+
|
|
12
|
+
data.queryParams
|
|
13
|
+
.filter((param) => param.active)
|
|
14
|
+
.forEach((param) => {
|
|
15
|
+
url.searchParams.set(param.name, param.value);
|
|
16
|
+
});
|
|
20
17
|
|
|
21
18
|
return url;
|
|
22
19
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useLocation } from "react-router-dom";
|
|
3
3
|
import { useViewportAnchor } from "../components/context/ViewportAnchorContext.js";
|
|
4
|
+
import { requestIdle } from "./requestIdle.js";
|
|
4
5
|
|
|
5
6
|
export const useScrollToAnchor = () => {
|
|
6
7
|
const location = useLocation();
|
|
@@ -16,7 +17,7 @@ export const useScrollToAnchor = () => {
|
|
|
16
17
|
// on page navigation element might be in DOM but not yet scrollable, so wait for a frame
|
|
17
18
|
requestAnimationFrame(() => {
|
|
18
19
|
element.scrollIntoView();
|
|
19
|
-
|
|
20
|
+
requestIdle(() => setActiveAnchor(hash));
|
|
20
21
|
});
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
@@ -27,7 +28,7 @@ export const useScrollToAnchor = () => {
|
|
|
27
28
|
if (!element) return;
|
|
28
29
|
|
|
29
30
|
element.scrollIntoView();
|
|
30
|
-
|
|
31
|
+
requestIdle(() => setActiveAnchor(hash));
|
|
31
32
|
obs.disconnect();
|
|
32
33
|
});
|
|
33
34
|
|