@lukoweb/apitogo 0.1.1 → 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.
Files changed (91) hide show
  1. package/dist/cli/cli.js +17 -6
  2. package/dist/declarations/lib/ui/Command.d.ts +1 -1
  3. package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
  4. package/package.json +1 -1
  5. package/src/app/main.tsx +150 -150
  6. package/src/config/loader.ts +245 -245
  7. package/src/index.ts +33 -33
  8. package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
  9. package/src/lib/authentication/components/SignIn.tsx +46 -46
  10. package/src/lib/authentication/components/SignUp.tsx +48 -48
  11. package/src/lib/authentication/providers/clerk.tsx +224 -224
  12. package/src/lib/authentication/ui/AuthCard.tsx +7 -7
  13. package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
  14. package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
  15. package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
  16. package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
  17. package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
  18. package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
  19. package/src/lib/components/Autocomplete.tsx +123 -123
  20. package/src/lib/components/DeveloperHint.tsx +39 -35
  21. package/src/lib/components/Header.tsx +260 -260
  22. package/src/lib/components/Layout.tsx +53 -53
  23. package/src/lib/components/Main.tsx +51 -51
  24. package/src/lib/components/Mermaid.tsx +74 -70
  25. package/src/lib/components/MobileTopNavigation.tsx +276 -276
  26. package/src/lib/components/MultiSelect.tsx +86 -82
  27. package/src/lib/components/TopNavigation.tsx +103 -103
  28. package/src/lib/components/index.ts +26 -26
  29. package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
  30. package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
  31. package/src/lib/components/navigation/NavigationItem.tsx +181 -177
  32. package/src/lib/core/RouteGuard.tsx +193 -193
  33. package/src/lib/errors/ErrorMessage.tsx +50 -46
  34. package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
  35. package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
  36. package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
  37. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
  38. package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
  39. package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
  40. package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
  41. package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
  42. package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
  43. package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
  44. package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
  45. package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
  46. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
  47. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
  48. package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
  49. package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
  50. package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
  51. package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
  52. package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
  53. package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
  54. package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
  55. package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
  56. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
  57. package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
  58. package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
  59. package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
  60. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
  61. package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
  62. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
  63. package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
  64. package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
  65. package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
  66. package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
  67. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
  68. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
  69. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
  70. package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
  71. package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
  72. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
  73. package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
  74. package/src/lib/ui/ActionButton.tsx +21 -21
  75. package/src/lib/ui/Command.tsx +191 -191
  76. package/src/lib/util/MdxComponents.tsx +150 -150
  77. package/src/vite/config.ts +234 -231
  78. package/src/vite/dev-server.ts +291 -291
  79. package/src/vite/plugin-api-keys.ts +50 -50
  80. package/src/vite/plugin-api.ts +320 -318
  81. package/src/vite/plugin-auth.ts +38 -38
  82. package/src/vite/plugin-component.ts +45 -39
  83. package/src/vite/plugin-config.ts +75 -75
  84. package/src/vite/plugin-custom-pages.ts +36 -36
  85. package/src/vite/plugin-docs.ts +202 -202
  86. package/src/vite/plugin-markdown-export.ts +214 -214
  87. package/src/vite/plugin-mdx.ts +149 -149
  88. package/src/vite/plugin-navigation.ts +106 -106
  89. package/src/vite/plugin-search.ts +47 -47
  90. package/src/vite/plugin.ts +42 -42
  91. package/src/vite/prerender/prerender.ts +233 -233
@@ -1,157 +1,157 @@
1
- import * as Collapsible from "@radix-ui/react-collapsible";
2
- import { deepEqual } from "fast-equals";
3
- import { ChevronRightIcon } from "lucide-react";
4
- import { memo, useEffect, useState } from "react";
5
- import { NavLink, useLocation, useMatch } from "react-router";
6
- import { Button } from "@lukoweb/apitogo/ui/Button.js";
7
- import type { NavigationCategory as NavigationCategoryType } from "../../../config/validators/NavigationSchema.js";
8
- import { cn } from "../../util/cn.js";
9
- import { joinUrl } from "../../util/joinUrl.js";
10
- import { useNavigationFilter } from "./NavigationFilterContext.js";
11
- import { NavigationItem } from "./NavigationItem.js";
12
- import { navigationListItem, useIsCategoryOpen } from "./utils.js";
13
-
14
- const NavigationCategoryInner = ({
15
- category,
16
- onRequestClose,
17
- }: {
18
- category: NavigationCategoryType;
19
- onRequestClose?: () => void;
20
- }) => {
21
- const isCategoryOpen = useIsCategoryOpen(category);
22
- const [hasInteracted, setHasInteracted] = useState(false);
23
- const location = useLocation();
24
- const { query: filterQuery } = useNavigationFilter();
25
-
26
- const isCollapsible = category.collapsible ?? true;
27
- const isCollapsed = category.collapsed ?? true;
28
- const isDefaultOpen = Boolean(
29
- !isCollapsible || !isCollapsed || isCategoryOpen,
30
- );
31
- const [open, setOpen] = useState(isDefaultOpen);
32
- const match = useMatch(category.link?.path ?? "");
33
- const isActive = category.link ? match : false;
34
-
35
- useEffect(() => {
36
- // this is triggered when an item from the navigation is clicked
37
- // and the navigation, enclosing this item, is not opened
38
- if (isCategoryOpen) {
39
- setOpen(true);
40
- }
41
- }, [isCategoryOpen]);
42
-
43
- // Auto-expand when there's an active filter query
44
- useEffect(() => {
45
- if (filterQuery.trim()) {
46
- setOpen(true);
47
- }
48
- }, [filterQuery]);
49
-
50
- const ToggleButton = isCollapsible && (
51
- <Button
52
- onClick={(e) => {
53
- e.preventDefault();
54
- setOpen((prev) => !prev);
55
- setHasInteracted(true);
56
- }}
57
- variant="ghost"
58
- size="icon"
59
- className="size-6 hover:bg-[hsl(from_var(--accent)_h_s_calc(l+6*var(--dark)))]"
60
- >
61
- <ChevronRightIcon
62
- size={16}
63
- className={cn(
64
- hasInteracted && "transition",
65
- "shrink-0 group-data-[state=open]:rotate-90 rtl:rotate-180",
66
- )}
67
- />
68
- </Button>
69
- );
70
-
71
- const icon = category.icon && (
72
- <category.icon
73
- size={16}
74
- className={cn("align-[-0.125em] ", isActive && "text-primary")}
75
- />
76
- );
77
-
78
- const styles = navigationListItem({
79
- className: [
80
- "group text-start font-medium",
81
- isCollapsible || typeof category.link !== "undefined"
82
- ? "cursor-pointer"
83
- : "cursor-default hover:bg-transparent",
84
- ],
85
- });
86
-
87
- return (
88
- <Collapsible.Root
89
- className="flex flex-col"
90
- defaultOpen={isDefaultOpen}
91
- open={open}
92
- onOpenChange={() => setOpen(true)}
93
- >
94
- <Collapsible.Trigger className="group" asChild disabled={!isCollapsible}>
95
- {category.link?.type === "doc" ? (
96
- <NavLink
97
- to={{
98
- pathname: joinUrl(category.link.path),
99
- search: location.search,
100
- }}
101
- className={styles}
102
- onClick={() => {
103
- // if it is the current path and closed then open it because there's no path change to trigger the open
104
- if (isActive && !open) {
105
- setHasInteracted(true);
106
- setOpen(true);
107
- }
108
- }}
109
- >
110
- {icon}
111
- <div className="flex items-center gap-2 justify-between w-full text-foreground/80 group-aria-[current='page']:text-primary">
112
- <div className="truncate">{category.label}</div>
113
- {ToggleButton}
114
- </div>
115
- </NavLink>
116
- ) : (
117
- <div className={styles}>
118
- {icon}
119
- <div className="flex items-center justify-between w-full">
120
- <div className="flex gap-2 truncate w-full">{category.label}</div>
121
- {ToggleButton}
122
- </div>
123
- </div>
124
- )}
125
- </Collapsible.Trigger>
126
- <Collapsible.Content
127
- className={cn(
128
- // CollapsibleContent class is used to animate and it should only be applied when the user has triggered the toggle
129
- hasInteracted && "CollapsibleContent",
130
- category.items.length === 0 && "hidden",
131
- "ms-6 my-1",
132
- )}
133
- onAnimationEnd={() => setHasInteracted(false)}
134
- >
135
- <ul className="relative after:absolute after:-inset-s-(--padding-nav-item) after:translate-x-[1.5px] after:top-0 after:bottom-0 after:w-px after:bg-border">
136
- {category.items.map((item) => (
137
- <NavigationItem
138
- key={
139
- item.type +
140
- (item.label ?? "") +
141
- ("path" in item ? item.path : "") +
142
- ("file" in item ? item.file : "") +
143
- ("to" in item ? item.to : "")
144
- }
145
- onRequestClose={onRequestClose}
146
- item={item}
147
- />
148
- ))}
149
- </ul>
150
- </Collapsible.Content>
151
- </Collapsible.Root>
152
- );
153
- };
154
-
155
- export const NavigationCategory = memo(NavigationCategoryInner, deepEqual);
156
-
157
- NavigationCategory.displayName = "NavigationCategory";
1
+ import { Button } from "@lukoweb/apitogo/ui/Button.js";
2
+ import * as Collapsible from "@radix-ui/react-collapsible";
3
+ import { deepEqual } from "fast-equals";
4
+ import { ChevronRightIcon } from "lucide-react";
5
+ import { memo, useEffect, useState } from "react";
6
+ import { NavLink, useLocation, useMatch } from "react-router";
7
+ import type { NavigationCategory as NavigationCategoryType } from "../../../config/validators/NavigationSchema.js";
8
+ import { cn } from "../../util/cn.js";
9
+ import { joinUrl } from "../../util/joinUrl.js";
10
+ import { useNavigationFilter } from "./NavigationFilterContext.js";
11
+ import { NavigationItem } from "./NavigationItem.js";
12
+ import { navigationListItem, useIsCategoryOpen } from "./utils.js";
13
+
14
+ const NavigationCategoryInner = ({
15
+ category,
16
+ onRequestClose,
17
+ }: {
18
+ category: NavigationCategoryType;
19
+ onRequestClose?: () => void;
20
+ }) => {
21
+ const isCategoryOpen = useIsCategoryOpen(category);
22
+ const [hasInteracted, setHasInteracted] = useState(false);
23
+ const location = useLocation();
24
+ const { query: filterQuery } = useNavigationFilter();
25
+
26
+ const isCollapsible = category.collapsible ?? true;
27
+ const isCollapsed = category.collapsed ?? true;
28
+ const isDefaultOpen = Boolean(
29
+ !isCollapsible || !isCollapsed || isCategoryOpen,
30
+ );
31
+ const [open, setOpen] = useState(isDefaultOpen);
32
+ const match = useMatch(category.link?.path ?? "");
33
+ const isActive = category.link ? match : false;
34
+
35
+ useEffect(() => {
36
+ // this is triggered when an item from the navigation is clicked
37
+ // and the navigation, enclosing this item, is not opened
38
+ if (isCategoryOpen) {
39
+ setOpen(true);
40
+ }
41
+ }, [isCategoryOpen]);
42
+
43
+ // Auto-expand when there's an active filter query
44
+ useEffect(() => {
45
+ if (filterQuery.trim()) {
46
+ setOpen(true);
47
+ }
48
+ }, [filterQuery]);
49
+
50
+ const ToggleButton = isCollapsible && (
51
+ <Button
52
+ onClick={(e) => {
53
+ e.preventDefault();
54
+ setOpen((prev) => !prev);
55
+ setHasInteracted(true);
56
+ }}
57
+ variant="ghost"
58
+ size="icon"
59
+ className="size-6 hover:bg-[hsl(from_var(--accent)_h_s_calc(l+6*var(--dark)))]"
60
+ >
61
+ <ChevronRightIcon
62
+ size={16}
63
+ className={cn(
64
+ hasInteracted && "transition",
65
+ "shrink-0 group-data-[state=open]:rotate-90 rtl:rotate-180",
66
+ )}
67
+ />
68
+ </Button>
69
+ );
70
+
71
+ const icon = category.icon && (
72
+ <category.icon
73
+ size={16}
74
+ className={cn("align-[-0.125em] ", isActive && "text-primary")}
75
+ />
76
+ );
77
+
78
+ const styles = navigationListItem({
79
+ className: [
80
+ "group text-start font-medium",
81
+ isCollapsible || typeof category.link !== "undefined"
82
+ ? "cursor-pointer"
83
+ : "cursor-default hover:bg-transparent",
84
+ ],
85
+ });
86
+
87
+ return (
88
+ <Collapsible.Root
89
+ className="flex flex-col"
90
+ defaultOpen={isDefaultOpen}
91
+ open={open}
92
+ onOpenChange={() => setOpen(true)}
93
+ >
94
+ <Collapsible.Trigger className="group" asChild disabled={!isCollapsible}>
95
+ {category.link?.type === "doc" ? (
96
+ <NavLink
97
+ to={{
98
+ pathname: joinUrl(category.link.path),
99
+ search: location.search,
100
+ }}
101
+ className={styles}
102
+ onClick={() => {
103
+ // if it is the current path and closed then open it because there's no path change to trigger the open
104
+ if (isActive && !open) {
105
+ setHasInteracted(true);
106
+ setOpen(true);
107
+ }
108
+ }}
109
+ >
110
+ {icon}
111
+ <div className="flex items-center gap-2 justify-between w-full text-foreground/80 group-aria-[current='page']:text-primary">
112
+ <div className="truncate">{category.label}</div>
113
+ {ToggleButton}
114
+ </div>
115
+ </NavLink>
116
+ ) : (
117
+ <div className={styles}>
118
+ {icon}
119
+ <div className="flex items-center justify-between w-full">
120
+ <div className="flex gap-2 truncate w-full">{category.label}</div>
121
+ {ToggleButton}
122
+ </div>
123
+ </div>
124
+ )}
125
+ </Collapsible.Trigger>
126
+ <Collapsible.Content
127
+ className={cn(
128
+ // CollapsibleContent class is used to animate and it should only be applied when the user has triggered the toggle
129
+ hasInteracted && "CollapsibleContent",
130
+ category.items.length === 0 && "hidden",
131
+ "ms-6 my-1",
132
+ )}
133
+ onAnimationEnd={() => setHasInteracted(false)}
134
+ >
135
+ <ul className="relative after:absolute after:-inset-s-(--padding-nav-item) after:translate-x-[1.5px] after:top-0 after:bottom-0 after:w-px after:bg-border">
136
+ {category.items.map((item) => (
137
+ <NavigationItem
138
+ key={
139
+ item.type +
140
+ (item.label ?? "") +
141
+ ("path" in item ? item.path : "") +
142
+ ("file" in item ? item.file : "") +
143
+ ("to" in item ? item.to : "")
144
+ }
145
+ onRequestClose={onRequestClose}
146
+ item={item}
147
+ />
148
+ ))}
149
+ </ul>
150
+ </Collapsible.Content>
151
+ </Collapsible.Root>
152
+ );
153
+ };
154
+
155
+ export const NavigationCategory = memo(NavigationCategoryInner, deepEqual);
156
+
157
+ NavigationCategory.displayName = "NavigationCategory";
@@ -1,35 +1,35 @@
1
- import { SearchIcon, XIcon } from "lucide-react";
2
- import {
3
- InputGroup,
4
- InputGroupAddon,
5
- InputGroupButton,
6
- InputGroupInput,
7
- } from "@lukoweb/apitogo/ui/InputGroup.js";
8
- import { useNavigationFilter } from "./NavigationFilterContext.js";
9
-
10
- export const NavigationFilterInput = ({
11
- placeholder,
12
- }: {
13
- placeholder?: string;
14
- }) => {
15
- const { query, setQuery } = useNavigationFilter();
16
-
17
- return (
18
- <InputGroup className="my-2">
19
- <InputGroupAddon>
20
- <SearchIcon className="size-3.5" />
21
- </InputGroupAddon>
22
- <InputGroupInput
23
- type="text"
24
- placeholder={placeholder}
25
- value={query}
26
- onChange={(e) => setQuery(e.target.value)}
27
- />
28
- {query && (
29
- <InputGroupButton onClick={() => setQuery("")}>
30
- <XIcon className="size-3" />
31
- </InputGroupButton>
32
- )}
33
- </InputGroup>
34
- );
35
- };
1
+ import {
2
+ InputGroup,
3
+ InputGroupAddon,
4
+ InputGroupButton,
5
+ InputGroupInput,
6
+ } from "@lukoweb/apitogo/ui/InputGroup.js";
7
+ import { SearchIcon, XIcon } from "lucide-react";
8
+ import { useNavigationFilter } from "./NavigationFilterContext.js";
9
+
10
+ export const NavigationFilterInput = ({
11
+ placeholder,
12
+ }: {
13
+ placeholder?: string;
14
+ }) => {
15
+ const { query, setQuery } = useNavigationFilter();
16
+
17
+ return (
18
+ <InputGroup className="my-2">
19
+ <InputGroupAddon>
20
+ <SearchIcon className="size-3.5" />
21
+ </InputGroupAddon>
22
+ <InputGroupInput
23
+ type="text"
24
+ placeholder={placeholder}
25
+ value={query}
26
+ onChange={(e) => setQuery(e.target.value)}
27
+ />
28
+ {query && (
29
+ <InputGroupButton onClick={() => setQuery("")}>
30
+ <XIcon className="size-3" />
31
+ </InputGroupButton>
32
+ )}
33
+ </InputGroup>
34
+ );
35
+ };