@lukoweb/apitogo 0.1.21 → 0.1.23

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 (52) hide show
  1. package/dist/cli/cli.js +21 -18
  2. package/dist/declarations/app/main.d.ts +4 -3
  3. package/dist/declarations/config/config.d.ts +1 -0
  4. package/dist/declarations/config/create-plugin.d.ts +2 -2
  5. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -3
  6. package/dist/declarations/index.d.ts +7 -3
  7. package/dist/declarations/lib/components/PluginHeads.d.ts +2 -2
  8. package/dist/declarations/lib/components/Zudoku.d.ts +7 -1
  9. package/dist/declarations/lib/components/context/ZudokuContext.d.ts +1 -0
  10. package/dist/declarations/lib/components/context/ZudokuProvider.d.ts +3 -0
  11. package/dist/declarations/lib/components/index.d.ts +5 -0
  12. package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -5
  13. package/dist/declarations/lib/core/plugins.d.ts +13 -13
  14. package/dist/declarations/lib/hooks/index.d.ts +1 -0
  15. package/dist/declarations/lib/hooks/useEvent.d.ts +4 -4
  16. package/dist/declarations/lib/plugins/api-catalog/index.d.ts +2 -2
  17. package/dist/declarations/lib/plugins/api-keys/index.d.ts +2 -2
  18. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -2
  19. package/dist/declarations/lib/plugins/openapi/index.d.ts +2 -2
  20. package/dist/declarations/lib/plugins/search-inkeep/index.d.ts +2 -2
  21. package/dist/declarations/lib/plugins/search-pagefind/index.d.ts +2 -2
  22. package/dist/declarations/lib/testing/index.d.ts +3 -2
  23. package/dist/declarations/lib/util/invariant.d.ts +6 -4
  24. package/dist/flat-config.d.ts +0 -1
  25. package/package.json +1 -1
  26. package/src/app/main.tsx +14 -11
  27. package/src/config/config.ts +7 -0
  28. package/src/config/create-plugin.ts +3 -3
  29. package/src/config/validators/BuildSchema.ts +7 -2
  30. package/src/config/validators/ZudokuConfig.ts +2 -3
  31. package/src/index.ts +13 -3
  32. package/src/lib/authentication/providers/clerk.tsx +2 -2
  33. package/src/lib/components/PluginHeads.tsx +2 -2
  34. package/src/lib/components/Zudoku.tsx +13 -8
  35. package/src/lib/components/context/ZudokuContext.ts +15 -5
  36. package/src/lib/components/context/ZudokuProvider.tsx +7 -1
  37. package/src/lib/components/index.ts +9 -1
  38. package/src/lib/core/ZudokuContext.ts +8 -8
  39. package/src/lib/core/plugins.ts +13 -13
  40. package/src/lib/hooks/index.ts +2 -0
  41. package/src/lib/hooks/useEvent.ts +12 -12
  42. package/src/lib/plugins/api-catalog/index.tsx +2 -2
  43. package/src/lib/plugins/api-keys/index.tsx +2 -2
  44. package/src/lib/plugins/markdown/index.tsx +2 -2
  45. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  46. package/src/lib/plugins/openapi/index.tsx +6 -3
  47. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  48. package/src/lib/plugins/search-pagefind/index.tsx +2 -2
  49. package/src/lib/testing/index.tsx +11 -2
  50. package/src/lib/util/invariant.ts +16 -6
  51. package/src/types.d.ts +6 -6
  52. package/src/vite/config.ts +10 -6
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
  import type { UseAuthReturn } from "../../lib/authentication/hook.js";
8
8
  import type { AuthState } from "../../lib/authentication/state.js";
9
9
  import type { SlotType } from "../../lib/components/context/SlotProvider.js";
10
- import type { ZudokuPlugin } from "../../lib/core/plugins.js";
10
+ import type { ApitogoPlugin } from "../../lib/core/plugins.js";
11
11
  import type { ZudokuContext } from "../../lib/core/ZudokuContext.js";
12
12
  import type { FilterCatalogItemsFn } from "../../lib/plugins/api-catalog/index.js";
13
13
  import type { ApiConsumer } from "../../lib/plugins/api-keys/index.js";
@@ -553,7 +553,6 @@ const SiteSchema = z
553
553
  logoUrl: z.string(),
554
554
  dir: z.enum(["ltr", "rtl"]).optional(),
555
555
  logo: LogoSchema,
556
- showPoweredBy: z.boolean().optional(),
557
556
  banner: z.object({
558
557
  message: z.custom<NonNullable<ReactNode>>(),
559
558
  color: z
@@ -627,7 +626,7 @@ const BaseConfigSchema = z.object({
627
626
  prose: z.boolean().optional(),
628
627
  }),
629
628
  ),
630
- plugins: z.array(z.custom<ZudokuPlugin>()),
629
+ plugins: z.array(z.custom<ApitogoPlugin>()),
631
630
  build: z.custom<{
632
631
  remarkPlugins?: Options["remarkPlugins"];
633
632
  rehypePlugins?: Options["rehypePlugins"];
package/src/index.ts CHANGED
@@ -1,4 +1,8 @@
1
- export type { ApitogoConfig, ZudokuBuildConfig } from "./config/config.js";
1
+ export type {
2
+ ApitogoBuildConfig,
3
+ ApitogoConfig,
4
+ ZudokuBuildConfig,
5
+ } from "./config/config.js";
2
6
  export { createPlugin } from "./config/create-plugin.js";
3
7
  export type { InputNavigation as Navigation } from "./config/validators/InputNavigationSchema.js";
4
8
  export type { SlotType } from "./lib/components/context/SlotProvider.js";
@@ -17,9 +21,15 @@ export type {
17
21
  RouteObject,
18
22
  SearchProviderPlugin,
19
23
  TransformConfigContext,
20
- ZudokuPlugin,
24
+ ApitogoPlugin,
21
25
  } from "./lib/core/plugins.js";
22
- export { type ApiIdentity, ZudokuContext } from "./lib/core/ZudokuContext.js";
26
+ export type { ApiIdentity, ApitogoEvents } from "./lib/core/ZudokuContext.js";
27
+ /** @deprecated Use {@link ApitogoContextOptions} instead. */
28
+ export type { ZudokuContextOptions } from "./lib/core/ZudokuContext.js";
29
+ export type { ZudokuContextOptions as ApitogoContextOptions } from "./lib/core/ZudokuContext.js";
30
+ /** @deprecated Use {@link ApitogoContext} instead. */
31
+ export { ZudokuContext } from "./lib/core/ZudokuContext.js";
32
+ export { ZudokuContext as ApitogoContext } from "./lib/core/ZudokuContext.js";
23
33
  /** @deprecated Import from `apitogo/hooks` instead */
24
34
  export { useEvent } from "./lib/hooks/index.js";
25
35
  export type { MDXImport } from "./lib/plugins/markdown/index.js";
@@ -1,5 +1,5 @@
1
1
  import type { Clerk } from "@clerk/clerk-js";
2
- import type { ZudokuPlugin } from "@lukoweb/apitogo/plugins";
2
+ import type { ApitogoPlugin } from "@lukoweb/apitogo/plugins";
3
3
  import type { ClerkAuthenticationConfig } from "../../../config/config.js";
4
4
  import type {
5
5
  AuthActionContext,
@@ -62,7 +62,7 @@ const clerkAuth: AuthenticationProviderInitializer<
62
62
  redirectToAfterSignOut = "/",
63
63
  redirectToAfterSignUp,
64
64
  redirectToAfterSignIn,
65
- }): AuthenticationPlugin & ZudokuPlugin => {
65
+ }): AuthenticationPlugin & ApitogoPlugin => {
66
66
  const getClerk = (): Promise<Clerk> => {
67
67
  if (typeof window === "undefined") {
68
68
  return Promise.reject(new Error("Clerk is not available during SSR"));
@@ -1,12 +1,12 @@
1
1
  import { Helmet } from "@zudoku/react-helmet-async";
2
2
  import type { Location } from "react-router";
3
- import { hasHead, type ZudokuPlugin } from "../core/plugins.js";
3
+ import { hasHead, type ApitogoPlugin } from "../core/plugins.js";
4
4
 
5
5
  export const PluginHeads = ({
6
6
  plugins,
7
7
  location,
8
8
  }: {
9
- plugins: ZudokuPlugin[];
9
+ plugins: ApitogoPlugin[];
10
10
  location: Location;
11
11
  }) =>
12
12
  plugins
@@ -20,10 +20,10 @@ import { MdxComponents } from "../util/MdxComponents.js";
20
20
  import { RouterEventsEmitter } from "./context/RouterEventsEmitter.js";
21
21
  import { SlotProvider } from "./context/SlotProvider.js";
22
22
  import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
23
- import { ZudokuProvider } from "./context/ZudokuProvider.js";
23
+ import { ApitogoProvider } from "./context/ZudokuProvider.js";
24
24
  import { PluginHeads } from "./PluginHeads.js";
25
25
 
26
- let zudokuContext: ZudokuContext | undefined;
26
+ let apitogoContext: ZudokuContext | undefined;
27
27
 
28
28
  const ZudokuInner = memo(
29
29
  ({
@@ -61,12 +61,12 @@ const ZudokuInner = memo(
61
61
  setDidNavigate(true);
62
62
  }, [didNavigate, navigation.location]);
63
63
 
64
- zudokuContext ??= new ZudokuContext(props, queryClient, env);
64
+ apitogoContext ??= new ZudokuContext(props, queryClient, env);
65
65
 
66
66
  return (
67
67
  <>
68
68
  <PluginHeads plugins={props.plugins ?? []} location={location} />
69
- <ZudokuProvider context={zudokuContext}>
69
+ <ApitogoProvider context={apitogoContext}>
70
70
  <RouterEventsEmitter />
71
71
  <SlotProvider slots={props.slots ?? props.UNSAFE_slotlets}>
72
72
  <MDXProvider components={mdxComponents}>
@@ -77,7 +77,7 @@ const ZudokuInner = memo(
77
77
  </ThemeProvider>
78
78
  </MDXProvider>
79
79
  </SlotProvider>
80
- </ZudokuProvider>
80
+ </ApitogoProvider>
81
81
  </>
82
82
  );
83
83
  },
@@ -85,7 +85,7 @@ const ZudokuInner = memo(
85
85
 
86
86
  ZudokuInner.displayName = "ZudokuInner";
87
87
 
88
- const Zudoku = (
88
+ const Apitogo = (
89
89
  props: PropsWithChildren<
90
90
  ZudokuContextOptions & { env?: Record<string, string> }
91
91
  >,
@@ -96,6 +96,11 @@ const Zudoku = (
96
96
  </ErrorBoundary>
97
97
  );
98
98
  };
99
- Zudoku.displayName = "Zudoku";
99
+ Apitogo.displayName = "Apitogo";
100
100
 
101
- export { Zudoku };
101
+ /**
102
+ * @deprecated Use {@link Apitogo} instead.
103
+ */
104
+ const Zudoku = Apitogo;
105
+
106
+ export { Apitogo, Zudoku };
@@ -9,18 +9,28 @@ import { CACHE_KEYS, useCache } from "../cache.js";
9
9
  import { getItemPath, traverseNavigation } from "../navigation/utils.js";
10
10
  import { ZudokuReactContext } from "./ZudokuReactContext.js";
11
11
 
12
- export const useZudoku = () => {
12
+ const useApitogoContext = () => {
13
13
  const context = useContext(ZudokuReactContext);
14
14
 
15
15
  if (!context) {
16
- throw new Error("useZudoku must be used within a ZudokuProvider.");
16
+ throw new Error(
17
+ "useApitogo must be used within an ApitogoProvider (from @lukoweb/apitogo/components).",
18
+ );
17
19
  }
18
20
 
19
21
  return context;
20
22
  };
21
23
 
24
+ /** Prefer this over {@link useZudoku}. */
25
+ export const useApitogo = useApitogoContext;
26
+
27
+ /**
28
+ * @deprecated Use {@link useApitogo} instead.
29
+ */
30
+ export const useZudoku = useApitogoContext;
31
+
22
32
  export const useApiIdentities = () => {
23
- const { getApiIdentities } = useZudoku();
33
+ const { getApiIdentities } = useApitogo();
24
34
  const { isAuthenticated } = useAuthState();
25
35
  const { invalidateCache } = useCache();
26
36
 
@@ -55,7 +65,7 @@ const extractAllPaths = (items: NavigationItem[]) => {
55
65
  };
56
66
 
57
67
  export const useCurrentNavigation = () => {
58
- const context = useZudoku();
68
+ const context = useApitogo();
59
69
  const { getPluginNavigation, navigation, navigationRules } = context;
60
70
  const location = useLocation();
61
71
  const loggedWarnings = useRef(new Set<string>());
@@ -112,7 +122,7 @@ export const useCurrentNavigation = () => {
112
122
  if (!loggedWarnings.current.has(warning)) {
113
123
  loggedWarnings.current.add(warning);
114
124
  // biome-ignore lint/suspicious/noConsole: Dev-only navigation rule warnings
115
- console.warn(`[Zudoku] Navigation rule: ${warning}`);
125
+ console.warn(`[APIToGo] Navigation rule: ${warning}`);
116
126
  }
117
127
  }
118
128
  }
@@ -2,7 +2,7 @@ import { use, type PropsWithChildren } from "react";
2
2
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
3
3
  import { ZudokuReactContext } from "./ZudokuReactContext.js";
4
4
 
5
- export const ZudokuProvider = ({
5
+ const ZudokuProviderImpl = ({
6
6
  children,
7
7
  context,
8
8
  }: PropsWithChildren<{ context: ZudokuContext }>) => {
@@ -14,3 +14,9 @@ export const ZudokuProvider = ({
14
14
  </ZudokuReactContext.Provider>
15
15
  );
16
16
  };
17
+
18
+ /** @deprecated Use {@link ApitogoProvider} instead. */
19
+ export const ZudokuProvider = ZudokuProviderImpl;
20
+
21
+ /** Prefer this over {@link ZudokuProvider}. */
22
+ export const ApitogoProvider = ZudokuProviderImpl;
@@ -2,6 +2,8 @@ export { Helmet as Head } from "@zudoku/react-helmet-async";
2
2
  export { Link } from "react-router";
3
3
  export { Button } from "../ui/Button.js";
4
4
  export { Callout } from "../ui/Callout.js";
5
+ export { ApitogoError } from "../util/invariant.js";
6
+ /** @deprecated Use {@link ApitogoError} instead. */
5
7
  export { ZudokuError } from "../util/invariant.js";
6
8
  export { ClientOnly } from "./ClientOnly.js";
7
9
  export { Heading } from "./Heading.js";
@@ -10,7 +12,12 @@ export { Search } from "./Search.js";
10
12
  export { type CustomSlotNames, Slot } from "./Slot.js";
11
13
  export { Spinner } from "./Spinner.js";
12
14
  export { Typography } from "./Typography.js";
15
+ export { Apitogo } from "./Zudoku.js";
16
+ /** @deprecated Use {@link Apitogo} instead. */
13
17
  export { Zudoku } from "./Zudoku.js";
18
+ export { ApitogoProvider } from "./context/ZudokuProvider.js";
19
+ /** @deprecated Use {@link ApitogoProvider} instead. */
20
+ export { ZudokuProvider } from "./context/ZudokuProvider.js";
14
21
 
15
22
  //
16
23
 
@@ -22,5 +29,6 @@ export { useTheme } from "next-themes";
22
29
  export { useAuth } from "../authentication/hook.js";
23
30
  /** @deprecated Import from `apitogo/hooks` instead */
24
31
  export { CACHE_KEYS, useCache } from "./cache.js";
25
- /** @deprecated Import from `apitogo/hooks` instead */
32
+ export { useApitogo } from "./context/ZudokuContext.js";
33
+ /** @deprecated Import {@link useApitogo} from `apitogo/hooks` instead */
26
34
  export { useZudoku } from "./context/ZudokuContext.js";
@@ -32,10 +32,10 @@ import {
32
32
  isProfileMenuPlugin,
33
33
  needsInitialization,
34
34
  type ProfileNavigationItem,
35
- type ZudokuPlugin,
35
+ type ApitogoPlugin,
36
36
  } from "./plugins.js";
37
37
 
38
- export interface ZudokuEvents {
38
+ export interface ApitogoEvents {
39
39
  location: (event: { from?: Location; to: Location }) => void;
40
40
  auth: (auth: { prev: AuthState; next: AuthState }) => void;
41
41
  }
@@ -108,7 +108,7 @@ export type ZudokuContextOptions = {
108
108
  authentication?: AuthenticationPlugin;
109
109
  navigation?: Navigation;
110
110
  navigationRules?: ResolvedNavigationRule[];
111
- plugins?: ZudokuPlugin[];
111
+ plugins?: ApitogoPlugin[];
112
112
  slots?: Record<string, SlotType>;
113
113
  /**
114
114
  * @deprecated Use `slots` instead
@@ -151,7 +151,7 @@ export class ZudokuContext {
151
151
  public readonly env: Record<string, string | undefined>;
152
152
  public readonly protectedRoutes: ReturnType<typeof normalizeProtectedRoutes>;
153
153
  private readonly plugins: NonNullable<ZudokuContextOptions["plugins"]>;
154
- private readonly emitter = createNanoEvents<ZudokuEvents>();
154
+ private readonly emitter = createNanoEvents<ApitogoEvents>();
155
155
  readonly initialize: Promise<void> | undefined;
156
156
 
157
157
  constructor(
@@ -218,16 +218,16 @@ export class ZudokuContext {
218
218
  return keys.flat();
219
219
  };
220
220
 
221
- addEventListener<E extends keyof ZudokuEvents>(
221
+ addEventListener<E extends keyof ApitogoEvents>(
222
222
  event: E,
223
- callback: ZudokuEvents[E],
223
+ callback: ApitogoEvents[E],
224
224
  ) {
225
225
  return this.emitter.on(event, callback);
226
226
  }
227
227
 
228
- emitEvent = <E extends keyof ZudokuEvents>(
228
+ emitEvent = <E extends keyof ApitogoEvents>(
229
229
  event: E,
230
- ...data: Parameters<ZudokuEvents[E]>
230
+ ...data: Parameters<ApitogoEvents[E]>
231
231
  ) => {
232
232
  return this.emitter.emit(event, ...data);
233
233
  };
@@ -8,12 +8,12 @@ import type { AuthenticationPlugin } from "../authentication/authentication.js";
8
8
  import type { MdxComponentsType } from "../util/MdxComponents.js";
9
9
  import type {
10
10
  ApiIdentity,
11
+ ApitogoEvents,
11
12
  ZudokuContext,
12
- ZudokuEvents,
13
13
  } from "./ZudokuContext.js";
14
14
  export { runPluginTransformConfig } from "./transform-config.js";
15
15
 
16
- export type ZudokuPlugin =
16
+ export type ApitogoPlugin =
17
17
  | CommonPlugin
18
18
  | ProfileMenuPlugin
19
19
  | NavigationPlugin
@@ -89,50 +89,50 @@ export interface CommonPlugin {
89
89
  getMdxComponents?: () => MdxComponentsType;
90
90
  }
91
91
 
92
- export type EventConsumerPlugin<Event extends ZudokuEvents = ZudokuEvents> = {
92
+ export type EventConsumerPlugin<Event extends ApitogoEvents = ApitogoEvents> = {
93
93
  events: { [K in keyof Event]?: Event[K] };
94
94
  };
95
95
 
96
96
  export const isEventConsumerPlugin = (
97
- obj: ZudokuPlugin,
97
+ obj: ApitogoPlugin,
98
98
  ): obj is EventConsumerPlugin =>
99
99
  "events" in obj && typeof obj.events === "object";
100
100
 
101
101
  export const isProfileMenuPlugin = (
102
- obj: ZudokuPlugin,
102
+ obj: ApitogoPlugin,
103
103
  ): obj is ProfileMenuPlugin =>
104
104
  "getProfileMenuItems" in obj && typeof obj.getProfileMenuItems === "function";
105
105
 
106
106
  export const isNavigationPlugin = (
107
- obj: ZudokuPlugin,
107
+ obj: ApitogoPlugin,
108
108
  ): obj is NavigationPlugin =>
109
109
  "getRoutes" in obj && typeof obj.getRoutes === "function";
110
110
 
111
111
  export const isAuthenticationPlugin = (
112
- obj: ZudokuPlugin,
112
+ obj: ApitogoPlugin,
113
113
  ): obj is AuthenticationPlugin =>
114
114
  "signUp" in obj && typeof obj.signUp === "function";
115
115
 
116
116
  export const isSearchPlugin = (
117
- obj: ZudokuPlugin,
117
+ obj: ApitogoPlugin,
118
118
  ): obj is SearchProviderPlugin =>
119
119
  "renderSearch" in obj && typeof obj.renderSearch === "function";
120
120
 
121
- export const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>
121
+ export const needsInitialization = (obj: ApitogoPlugin): obj is CommonPlugin =>
122
122
  "initialize" in obj && typeof obj.initialize === "function";
123
123
 
124
- export const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>
124
+ export const hasHead = (obj: ApitogoPlugin): obj is CommonPlugin =>
125
125
  "getHead" in obj && typeof obj.getHead === "function";
126
126
 
127
- export const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>
127
+ export const isMdxProviderPlugin = (obj: ApitogoPlugin): obj is CommonPlugin =>
128
128
  "getMdxComponents" in obj && typeof obj.getMdxComponents === "function";
129
129
 
130
130
  export const isApiIdentityPlugin = (
131
- obj: ZudokuPlugin,
131
+ obj: ApitogoPlugin,
132
132
  ): obj is ApiIdentityPlugin =>
133
133
  "getIdentities" in obj && typeof obj.getIdentities === "function";
134
134
 
135
135
  export const isTransformConfigPlugin = (
136
- obj: ZudokuPlugin,
136
+ obj: ApitogoPlugin,
137
137
  ): obj is TransformConfigPlugin =>
138
138
  "transformConfig" in obj && typeof obj.transformConfig === "function";
@@ -6,6 +6,8 @@ export {
6
6
  useVerifiedEmail,
7
7
  } from "../authentication/hook.js";
8
8
  export { CACHE_KEYS, useCache } from "../components/cache.js";
9
+ export { useApitogo } from "../components/context/ZudokuContext.js";
10
+ /** @deprecated Use {@link useApitogo} instead. */
9
11
  export { useZudoku } from "../components/context/ZudokuContext.js";
10
12
  export { useExposedProps } from "../util/useExposedProps.js";
11
13
  export { useEvent } from "./useEvent.js";
@@ -1,41 +1,41 @@
1
1
  import { useEffect, useState } from "react";
2
- import { useZudoku } from "../components/context/ZudokuContext.js";
3
- import type { ZudokuEvents } from "../core/ZudokuContext.js";
2
+ import { useApitogo } from "../components/context/ZudokuContext.js";
3
+ import type { ApitogoEvents } from "../core/ZudokuContext.js";
4
4
 
5
- type EventParameters<Event extends keyof ZudokuEvents> = Parameters<
6
- ZudokuEvents[Event]
5
+ type EventParameters<Event extends keyof ApitogoEvents> = Parameters<
6
+ ApitogoEvents[Event]
7
7
  >;
8
8
 
9
9
  /**
10
- * Hook to subscribe to Zudoku events with automatic cleanup
10
+ * Hook to subscribe to APIToGo application events with automatic cleanup
11
11
  * @param event The event to subscribe to
12
12
  * @param callback Optional callback to be called when the event is emitted
13
13
  * @returns The latest event data if no callback is provided, or the callback's return value if it returns something
14
14
  */
15
- export function useEvent<E extends keyof ZudokuEvents>(
15
+ export function useEvent<E extends keyof ApitogoEvents>(
16
16
  event: E,
17
17
  ): EventParameters<E>;
18
- export function useEvent<E extends keyof ZudokuEvents, R>(
18
+ export function useEvent<E extends keyof ApitogoEvents, R>(
19
19
  event: E,
20
20
  callback: (...args: EventParameters<E>) => R,
21
21
  ): R;
22
- export function useEvent<E extends keyof ZudokuEvents, R>(
22
+ export function useEvent<E extends keyof ApitogoEvents, R>(
23
23
  event: E,
24
24
  callback?: (...args: EventParameters<E>) => R,
25
25
  ) {
26
- const zudoku = useZudoku();
26
+ const apitogo = useApitogo();
27
27
  const [latestData, setLatestData] = useState<R | EventParameters<E>>();
28
28
 
29
29
  useEffect(() => {
30
- return zudoku.addEventListener(event, ((...args: EventParameters<E>) => {
30
+ return apitogo.addEventListener(event, ((...args: EventParameters<E>) => {
31
31
  if (callback) {
32
32
  const result = callback(...args);
33
33
  setLatestData(result);
34
34
  } else {
35
35
  setLatestData(args);
36
36
  }
37
- }) as ZudokuEvents[E]);
38
- }, [zudoku, event, callback]);
37
+ }) as ApitogoEvents[E]);
38
+ }, [apitogo, event, callback]);
39
39
 
40
40
  return latestData;
41
41
  }
@@ -1,7 +1,7 @@
1
1
  import { matchPath } from "react-router";
2
2
  import type { NavigationItem } from "../../../config/validators/NavigationSchema.js";
3
3
  import type { AuthState } from "../../authentication/state.js";
4
- import type { ZudokuPlugin } from "../../core/plugins.js";
4
+ import type { ApitogoPlugin } from "../../core/plugins.js";
5
5
  import { joinUrl } from "../../util/joinUrl.js";
6
6
  import { slugify } from "../../util/slugify.js";
7
7
 
@@ -49,7 +49,7 @@ export const apiCatalogPlugin = ({
49
49
  categories?: CatalogCategory[];
50
50
  items: ApiCatalogItem[];
51
51
  filterCatalogItems?: FilterCatalogItemsFn;
52
- }): ZudokuPlugin => {
52
+ }): ApitogoPlugin => {
53
53
  const paths = Object.fromEntries(
54
54
  categories.flatMap((category) =>
55
55
  [undefined, ...category.tags].map((tag) => [
@@ -5,7 +5,7 @@ import type { UseAuthReturn } from "../../authentication/hook.js";
5
5
  import type {
6
6
  ApiIdentityPlugin,
7
7
  ProfileMenuPlugin,
8
- ZudokuPlugin,
8
+ ApitogoPlugin,
9
9
  } from "../../core/plugins.js";
10
10
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
11
11
  import invariant from "../../util/invariant.js";
@@ -203,7 +203,7 @@ export const apiKeyPlugin = ({
203
203
  isZuplo,
204
204
  ...options
205
205
  }: Omit<ApiKeysOptions, "enabled"> &
206
- InternalApiKeyPluginOptions): ZudokuPlugin &
206
+ InternalApiKeyPluginOptions): ApitogoPlugin &
207
207
  ApiIdentityPlugin &
208
208
  ProfileMenuPlugin => {
209
209
  if (isZuplo && !deploymentName) {
@@ -2,7 +2,7 @@ import type { MDXProps } from "mdx/types.js";
2
2
  import type { JSX } from "react";
3
3
  import type { ZudokuDocsConfig } from "../../../config/validators/ZudokuConfig.js";
4
4
  import type { Toc } from "../../../vite/mdx/rehype-extract-toc-with-jsx.js";
5
- import type { ZudokuPlugin } from "../../core/plugins.js";
5
+ import type { ApitogoPlugin } from "../../core/plugins.js";
6
6
 
7
7
  export interface MarkdownPluginOptions extends ZudokuDocsConfig {
8
8
  basePath: string;
@@ -37,7 +37,7 @@ export type MDXImport = {
37
37
 
38
38
  export const markdownPlugin = (
39
39
  options: MarkdownPluginOptions,
40
- ): ZudokuPlugin => ({
40
+ ): ApitogoPlugin => ({
41
41
  getRoutes: () => {
42
42
  return Object.entries(options.fileImports).map(
43
43
  ([routePath, importPromise]) => ({
@@ -1,4 +1,4 @@
1
- import { useZudoku } from "@lukoweb/apitogo/hooks";
1
+ import { useApitogo } from "@lukoweb/apitogo/hooks";
2
2
  import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
3
3
  import {
4
4
  NativeSelect,
@@ -63,7 +63,7 @@ export const Sidecar = ({
63
63
  }) => {
64
64
  const { options } = useOasConfig();
65
65
  const auth = useAuthState();
66
- const context = useZudoku();
66
+ const context = useApitogo();
67
67
 
68
68
  const methodTextColor = methodForColor(operation.method);
69
69
 
@@ -175,8 +175,10 @@ export const Sidecar = ({
175
175
  const showPlayground =
176
176
  isOnScreen &&
177
177
  (operation.extensions["x-explorer-enabled"] === true ||
178
+ operation.extensions["x-apitogo-playground-enabled"] === true ||
178
179
  operation.extensions["x-zudoku-playground-enabled"] === true ||
179
180
  (operation.extensions["x-explorer-enabled"] === undefined &&
181
+ operation.extensions["x-apitogo-playground-enabled"] === undefined &&
180
182
  operation.extensions["x-zudoku-playground-enabled"] === undefined &&
181
183
  !options?.disablePlayground));
182
184
 
@@ -1,7 +1,7 @@
1
1
  import { CirclePlayIcon } from "lucide-react";
2
2
  import { type PropsWithChildren, Suspense, lazy } from "react";
3
3
  import { matchPath } from "react-router";
4
- import type { ZudokuPlugin } from "../../core/plugins.js";
4
+ import type { ApitogoPlugin } from "../../core/plugins.js";
5
5
  import { Button } from "../../ui/Button.js";
6
6
  import { joinUrl } from "../../util/joinUrl.js";
7
7
  import { GraphQLClient } from "./client/GraphQLClient.js";
@@ -52,7 +52,7 @@ export type OpenApiPluginOptions = OasPluginConfig;
52
52
 
53
53
  export const UNTAGGED_PATH = "~endpoints";
54
54
 
55
- export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
55
+ export const openApiPlugin = (config: OasPluginConfig): ApitogoPlugin => {
56
56
  const basePath = joinUrl(config.path);
57
57
  const client = new GraphQLClient(config);
58
58
 
@@ -148,10 +148,13 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
148
148
  const categoryPath = joinUrl(basePath, versionParam, tag.slug);
149
149
 
150
150
  const isCollapsed =
151
+ tag.extensions?.["x-apitogo-collapsed"] ??
151
152
  tag.extensions?.["x-zudoku-collapsed"] ??
152
153
  !config.options?.expandAllTags;
153
154
  const isCollapsible =
154
- tag.extensions?.["x-zudoku-collapsible"] ?? true;
155
+ tag.extensions?.["x-apitogo-collapsible"] ??
156
+ tag.extensions?.["x-zudoku-collapsible"] ??
157
+ true;
155
158
 
156
159
  return [
157
160
  tag.name,
@@ -6,7 +6,7 @@ import type {
6
6
  } from "@inkeep/cxkit-types";
7
7
  import { useEffect, useMemo, useState } from "react";
8
8
  import { ClientOnly } from "../../components/ClientOnly.js";
9
- import type { ZudokuPlugin } from "../../core/plugins.js";
9
+ import type { ApitogoPlugin } from "../../core/plugins.js";
10
10
  import {
11
11
  aiChatSettings,
12
12
  baseSettings,
@@ -86,7 +86,7 @@ const InkeepSearch = ({
86
86
 
87
87
  export const inkeepSearchPlugin = (
88
88
  settings: InkeepBaseSettings,
89
- ): ZudokuPlugin => {
89
+ ): ApitogoPlugin => {
90
90
  return {
91
91
  getHead: () => {
92
92
  return (
@@ -1,6 +1,6 @@
1
1
  import type { ZudokuConfig } from "../../../config/validators/ZudokuConfig.js";
2
2
  import { ClientOnly } from "../../components/ClientOnly.js";
3
- import type { ZudokuPlugin } from "../../core/plugins.js";
3
+ import type { ApitogoPlugin } from "../../core/plugins.js";
4
4
  import { PagefindSearch } from "./PagefindSearch.js";
5
5
 
6
6
  export type PagefindOptions = Extract<
@@ -10,7 +10,7 @@ export type PagefindOptions = Extract<
10
10
 
11
11
  export const pagefindSearchPlugin = (
12
12
  options: PagefindOptions,
13
- ): ZudokuPlugin => {
13
+ ): ApitogoPlugin => {
14
14
  return {
15
15
  renderSearch: ({ isOpen, onClose }) => (
16
16
  <ClientOnly>
@@ -23,7 +23,10 @@ type QueryData = {
23
23
  data: unknown;
24
24
  };
25
25
 
26
- type StaticZudokuProps = ZudokuContextOptions & {
26
+ /**
27
+ * @deprecated Use {@link StaticApitogoProps} instead.
28
+ */
29
+ export type StaticZudokuProps = ZudokuContextOptions & {
27
30
  path: string;
28
31
  queryData?: QueryData[];
29
32
  env?: Record<string, string>;
@@ -31,6 +34,9 @@ type StaticZudokuProps = ZudokuContextOptions & {
31
34
  redirects?: ZudokuRedirect[];
32
35
  };
33
36
 
37
+ /** Prefer this over {@link StaticZudokuProps}. */
38
+ export type StaticApitogoProps = StaticZudokuProps;
39
+
34
40
  const getRoutesByOptions = (options: ZudokuContextOptions) => {
35
41
  return [
36
42
  ...(options.plugins ?? []),
@@ -134,4 +140,7 @@ const StaticZudoku = ({
134
140
  );
135
141
  };
136
142
 
137
- export { StaticZudoku, type StaticZudokuProps, type QueryData };
143
+ /**
144
+ * @deprecated Use {@link StaticApitogo} and {@link StaticApitogoProps} instead.
145
+ */
146
+ export { StaticZudoku, StaticZudoku as StaticApitogo, type QueryData };