@lukoweb/apitogo 0.1.0 → 0.1.2
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/cli/cli.js +37 -147
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +1 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
|
@@ -1,177 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case "
|
|
85
|
-
return (
|
|
86
|
-
<
|
|
87
|
-
);
|
|
88
|
-
case "
|
|
89
|
-
return (
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{item.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{item.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
</span>
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
1
|
+
import { Separator } from "@lukoweb/apitogo/ui/Separator.js";
|
|
2
|
+
import {
|
|
3
|
+
Tooltip,
|
|
4
|
+
TooltipContent,
|
|
5
|
+
TooltipTrigger,
|
|
6
|
+
} from "@lukoweb/apitogo/ui/Tooltip.js";
|
|
7
|
+
import { ExternalLinkIcon } from "lucide-react";
|
|
8
|
+
import { Suspense, lazy, useEffect, useRef, useState } from "react";
|
|
9
|
+
import { NavLink, useLocation } from "react-router";
|
|
10
|
+
import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
|
|
11
|
+
import { useAuth } from "../../authentication/hook.js";
|
|
12
|
+
import { cn } from "../../util/cn.js";
|
|
13
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
14
|
+
import { AnchorLink } from "../AnchorLink.js";
|
|
15
|
+
import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
16
|
+
import { useZudoku } from "../context/ZudokuContext.js";
|
|
17
|
+
import { NavigationBadge } from "./NavigationBadge.js";
|
|
18
|
+
import { NavigationCategory } from "./NavigationCategory.js";
|
|
19
|
+
import { useNavigationFilter } from "./NavigationFilterContext.js";
|
|
20
|
+
import { NavigationFilterInput } from "./NavigationFilterInput.js";
|
|
21
|
+
import { navigationListItem, shouldShowItem } from "./utils.js";
|
|
22
|
+
|
|
23
|
+
const HastRichText = lazy(() => import("../../util/hastToJsx.js"));
|
|
24
|
+
|
|
25
|
+
const TruncatedLabel = ({
|
|
26
|
+
label,
|
|
27
|
+
className,
|
|
28
|
+
}: {
|
|
29
|
+
label: string;
|
|
30
|
+
className?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
const ref = useRef<HTMLSpanElement>(null);
|
|
33
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!ref.current) return;
|
|
37
|
+
|
|
38
|
+
if (ref.current.offsetWidth < ref.current.scrollWidth) {
|
|
39
|
+
setIsTruncated(true);
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<span
|
|
46
|
+
className={cn("truncate flex-1", className)}
|
|
47
|
+
title={label}
|
|
48
|
+
ref={ref}
|
|
49
|
+
>
|
|
50
|
+
{label}
|
|
51
|
+
</span>
|
|
52
|
+
{isTruncated && (
|
|
53
|
+
<Tooltip disableHoverableContent>
|
|
54
|
+
<TooltipTrigger className="absolute inset-0 z-10" />
|
|
55
|
+
<TooltipContent className="max-w-64" side="bottom" align="center">
|
|
56
|
+
{label}
|
|
57
|
+
</TooltipContent>
|
|
58
|
+
</Tooltip>
|
|
59
|
+
)}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const DATA_ANCHOR_ATTR = "data-anchor";
|
|
65
|
+
|
|
66
|
+
export const NavigationItem = ({
|
|
67
|
+
item,
|
|
68
|
+
onRequestClose,
|
|
69
|
+
}: {
|
|
70
|
+
item: NavigationItemType;
|
|
71
|
+
onRequestClose?: () => void;
|
|
72
|
+
}) => {
|
|
73
|
+
const location = useLocation();
|
|
74
|
+
const { activeAnchor } = useViewportAnchor();
|
|
75
|
+
const auth = useAuth();
|
|
76
|
+
const context = useZudoku();
|
|
77
|
+
const { query } = useNavigationFilter();
|
|
78
|
+
|
|
79
|
+
if (!shouldShowItem({ auth, context, filterQuery: query })(item)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
switch (item.type) {
|
|
84
|
+
case "category":
|
|
85
|
+
return (
|
|
86
|
+
<NavigationCategory category={item} onRequestClose={onRequestClose} />
|
|
87
|
+
);
|
|
88
|
+
case "separator":
|
|
89
|
+
return (
|
|
90
|
+
<Separator className="my-1 mx-auto w-[calc(100%-var(--padding-nav-item)*2)]!" />
|
|
91
|
+
);
|
|
92
|
+
case "section":
|
|
93
|
+
return (
|
|
94
|
+
<div className="mt-4 px-(--padding-nav-item) text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
|
95
|
+
{item.label}
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
case "filter":
|
|
99
|
+
return <NavigationFilterInput placeholder={item.placeholder} />;
|
|
100
|
+
case "doc":
|
|
101
|
+
return (
|
|
102
|
+
<NavLink
|
|
103
|
+
viewTransition
|
|
104
|
+
className={({ isActive, isPending }) =>
|
|
105
|
+
navigationListItem({ isActive, isPending })
|
|
106
|
+
}
|
|
107
|
+
to={joinUrl(item.path)}
|
|
108
|
+
onClick={onRequestClose}
|
|
109
|
+
end
|
|
110
|
+
>
|
|
111
|
+
{item.icon && (
|
|
112
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
113
|
+
)}
|
|
114
|
+
{item.rich ? (
|
|
115
|
+
<Suspense fallback={<span>{item.label}</span>}>
|
|
116
|
+
<span>
|
|
117
|
+
<HastRichText>{item.rich}</HastRichText>
|
|
118
|
+
</span>
|
|
119
|
+
</Suspense>
|
|
120
|
+
) : (
|
|
121
|
+
<TruncatedLabel label={item.label} className="flex-1" />
|
|
122
|
+
)}
|
|
123
|
+
{item.badge && <NavigationBadge {...item.badge} />}
|
|
124
|
+
</NavLink>
|
|
125
|
+
);
|
|
126
|
+
case "link":
|
|
127
|
+
case "custom-page": {
|
|
128
|
+
const href = item.type === "link" ? item.to : joinUrl(item.path);
|
|
129
|
+
const hasAnchor = href.includes("#");
|
|
130
|
+
return !href.startsWith("http") ? (
|
|
131
|
+
<AnchorLink
|
|
132
|
+
to={{
|
|
133
|
+
pathname: href.split("#")[0],
|
|
134
|
+
hash: href.split("#")[1],
|
|
135
|
+
search: location.search,
|
|
136
|
+
}}
|
|
137
|
+
{...{ [DATA_ANCHOR_ATTR]: href.split("#")[1] }}
|
|
138
|
+
className={navigationListItem({
|
|
139
|
+
isActive:
|
|
140
|
+
href ===
|
|
141
|
+
(hasAnchor
|
|
142
|
+
? [joinUrl(location.pathname), activeAnchor]
|
|
143
|
+
.filter(Boolean)
|
|
144
|
+
.join("#")
|
|
145
|
+
: joinUrl(location.pathname)),
|
|
146
|
+
})}
|
|
147
|
+
onClick={onRequestClose}
|
|
148
|
+
>
|
|
149
|
+
{item.icon && (
|
|
150
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
151
|
+
)}
|
|
152
|
+
{item.badge ? (
|
|
153
|
+
<>
|
|
154
|
+
{item.label && <TruncatedLabel label={item.label} />}
|
|
155
|
+
<NavigationBadge {...item.badge} />
|
|
156
|
+
</>
|
|
157
|
+
) : (
|
|
158
|
+
<span className="break-all">{item.label}</span>
|
|
159
|
+
)}
|
|
160
|
+
</AnchorLink>
|
|
161
|
+
) : (
|
|
162
|
+
<a
|
|
163
|
+
className={navigationListItem()}
|
|
164
|
+
href={href}
|
|
165
|
+
target={"target" in item ? item.target : "_blank"}
|
|
166
|
+
rel="noopener noreferrer"
|
|
167
|
+
onClick={onRequestClose}
|
|
168
|
+
>
|
|
169
|
+
{item.icon && (
|
|
170
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
171
|
+
)}
|
|
172
|
+
<span className="whitespace-normal">{item.label}</span>
|
|
173
|
+
{/* This prevents that the icon would be positioned in its own line if the text fills a line entirely */}
|
|
174
|
+
<span className="whitespace-nowrap">
|
|
175
|
+
<ExternalLinkIcon className="inline -translate-y-0.5" size={12} />
|
|
176
|
+
</span>
|
|
177
|
+
</a>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|