zudoku 0.13.3 → 0.13.4

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 (44) hide show
  1. package/dist/config/validators/validate.d.ts +7 -0
  2. package/dist/config/validators/validate.js +4 -0
  3. package/dist/config/validators/validate.js.map +1 -1
  4. package/dist/lib/authentication/hook.d.ts +1 -1
  5. package/dist/lib/authentication/hook.js +1 -1
  6. package/dist/lib/authentication/hook.js.map +1 -1
  7. package/dist/lib/components/MobileTopNavigation.js +4 -1
  8. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  9. package/dist/lib/components/TopNavigation.d.ts +3 -0
  10. package/dist/lib/components/TopNavigation.js +9 -1
  11. package/dist/lib/components/TopNavigation.js.map +1 -1
  12. package/dist/lib/components/context/ZudokuContext.d.ts +2 -0
  13. package/dist/lib/components/index.d.ts +1 -0
  14. package/dist/lib/components/index.js +2 -0
  15. package/dist/lib/components/index.js.map +1 -1
  16. package/dist/lib/core/DevPortalContext.d.ts +1 -0
  17. package/dist/lib/core/DevPortalContext.js.map +1 -1
  18. package/dist/vite/dev-server.js +1 -1
  19. package/dist/vite/dev-server.js.map +1 -1
  20. package/lib/{Input-a9rLgbP_.js → Input-DrR6P3mq.js} +2 -2
  21. package/lib/{Input-a9rLgbP_.js.map → Input-DrR6P3mq.js.map} +1 -1
  22. package/lib/{OperationList-BhLMwPSh.js → OperationList-C2jKCTwZ.js} +4 -4
  23. package/lib/{OperationList-BhLMwPSh.js.map → OperationList-C2jKCTwZ.js.map} +1 -1
  24. package/lib/{Route-fK1i4Ryz.js → Route-DWXcQzRK.js} +2 -2
  25. package/lib/{Route-fK1i4Ryz.js.map → Route-DWXcQzRK.js.map} +1 -1
  26. package/lib/{SidebarBadge-BdzN0ZBK.js → SidebarBadge-C0iWtji9.js} +2 -2
  27. package/lib/{SidebarBadge-BdzN0ZBK.js.map → SidebarBadge-C0iWtji9.js.map} +1 -1
  28. package/lib/{index-_GxJ8hpM.js → index-Ch8VO_uX.js} +2 -2
  29. package/lib/index-Ch8VO_uX.js.map +1 -0
  30. package/lib/{index-dHVZhVNO.js → index-Dso_b0di.js} +6 -6
  31. package/lib/{index-dHVZhVNO.js.map → index-Dso_b0di.js.map} +1 -1
  32. package/lib/{index-BijFM__9.js → index-bYAqbdYl.js} +3 -3
  33. package/lib/{index-BijFM__9.js.map → index-bYAqbdYl.js.map} +1 -1
  34. package/lib/zudoku.components.js +491 -490
  35. package/lib/zudoku.components.js.map +1 -1
  36. package/lib/zudoku.plugin-api-keys.js +2 -2
  37. package/lib/zudoku.plugin-openapi.js +2 -2
  38. package/package.json +1 -1
  39. package/src/lib/authentication/hook.ts +1 -1
  40. package/src/lib/components/MobileTopNavigation.tsx +5 -1
  41. package/src/lib/components/TopNavigation.tsx +14 -1
  42. package/src/lib/components/index.ts +2 -0
  43. package/src/lib/core/DevPortalContext.ts +6 -1
  44. package/lib/index-_GxJ8hpM.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
2
  import { S as x, R as f } from "./SlotletProvider-DmqWiVFt.js";
3
- import { u as g, a as d, I as j, S as v, b as w, c as b, d as k, e as K, f as m } from "./Input-a9rLgbP_.js";
3
+ import { u as g, a as d, I as j, S as v, b as w, c as b, d as k, e as K, f as m } from "./Input-DrR6P3mq.js";
4
4
  import { a as N, L as u, O as I } from "./index-DFN92YJN.js";
5
5
  import { u as h, a as E, b as S } from "./ZudokuContext-MRoel6bS.js";
6
- import { B as l, n as A } from "./index-_GxJ8hpM.js";
6
+ import { B as l, n as A } from "./index-Ch8VO_uX.js";
7
7
  import { D as C } from "./DeveloperHint-B_QCCafl.js";
8
8
  import { RotateCwIcon as P, TrashIcon as D, EyeOffIcon as R, EyeIcon as q, CheckIcon as O, CopyIcon as z } from "lucide-react";
9
9
  import { useState as p } from "react";
@@ -1,9 +1,9 @@
1
1
  import "./jsx-runtime-B6kdoens.js";
2
- import { o as u } from "./index-dHVZhVNO.js";
2
+ import { o as u } from "./index-Dso_b0di.js";
3
3
  import "./ZudokuContext-MRoel6bS.js";
4
4
  import "lucide-react";
5
5
  import "zudoku/openapi-worker";
6
- import "./index-_GxJ8hpM.js";
6
+ import "./index-Ch8VO_uX.js";
7
7
  import "./ErrorPage-DqqAV1dr.js";
8
8
  import "./Markdown-Y__eLG0x.js";
9
9
  import "./joinPath-B7kNnUX4.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "type": "module",
5
5
  "homepage": "https://zudoku.dev",
6
6
  "repository": {
@@ -10,7 +10,7 @@ export const useAuth = () => {
10
10
  isAuthEnabled,
11
11
  isPending: authState.isPending,
12
12
  profile: authState.profile,
13
- isAuthenticated: authState.profile,
13
+ isAuthenticated: Boolean(authState.profile),
14
14
 
15
15
  login: async () => {
16
16
  if (!isAuthEnabled) {
@@ -2,6 +2,7 @@ import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
2
2
  import { cx } from "class-variance-authority";
3
3
  import { MenuIcon } from "lucide-react";
4
4
  import { NavLink } from "react-router-dom";
5
+ import { useAuth } from "../authentication/hook.js";
5
6
  import {
6
7
  Drawer,
7
8
  DrawerClose,
@@ -11,9 +12,12 @@ import {
11
12
  } from "../ui/Drawer.js";
12
13
  import { useZudoku } from "./context/ZudokuContext.js";
13
14
  import { Search } from "./Search.js";
15
+ import { isHiddenItem } from "./TopNavigation.js";
14
16
 
15
17
  export const MobileTopNavigation = () => {
16
18
  const { topNavigation } = useZudoku();
19
+ const { isAuthenticated } = useAuth();
20
+
17
21
  return (
18
22
  <Drawer direction="right">
19
23
  <div className="flex lg:hidden justify-self-end">
@@ -32,7 +36,7 @@ export const MobileTopNavigation = () => {
32
36
  <Search />
33
37
  </div>
34
38
  <ul className="flex flex-col items-center gap-4 p-4">
35
- {topNavigation.map((item) => (
39
+ {topNavigation.filter(isHiddenItem(isAuthenticated)).map((item) => (
36
40
  <li key={item.label}>
37
41
  <NavLink
38
42
  className={({ isActive }) =>
@@ -1,10 +1,23 @@
1
1
  import { cx } from "class-variance-authority";
2
2
  import { NavLink } from "react-router-dom";
3
3
 
4
+ import { useAuth } from "../authentication/hook.js";
4
5
  import { useZudoku } from "./context/ZudokuContext.js";
5
6
 
7
+ export const isHiddenItem =
8
+ (isAuthenticated?: boolean) =>
9
+ (item: { display?: "auth" | "anon" | "always" }) => {
10
+ return (
11
+ (item.display === "auth" && isAuthenticated) ||
12
+ (item.display === "anon" && !isAuthenticated) ||
13
+ !item.display ||
14
+ item.display === "always"
15
+ );
16
+ };
17
+
6
18
  export const TopNavigation = () => {
7
19
  const { topNavigation } = useZudoku();
20
+ const { isAuthenticated } = useAuth();
8
21
 
9
22
  // Hide top nav if there is only one item
10
23
  if (topNavigation.length <= 1) {
@@ -14,7 +27,7 @@ export const TopNavigation = () => {
14
27
  return (
15
28
  <nav className="hidden lg:block border-b text-sm px-12 h-[--top-nav-height]">
16
29
  <ul className="flex flex-row items-center gap-8">
17
- {topNavigation.map((item) => (
30
+ {topNavigation.filter(isHiddenItem(isAuthenticated)).map((item) => (
18
31
  <li key={item.label}>
19
32
  <NavLink
20
33
  className={({ isActive }) =>
@@ -11,6 +11,7 @@ import {
11
11
  } from "./Bootstrap.js";
12
12
  import { DevPortal as DevPortalImport } from "./DevPortal.js";
13
13
  import { Layout as LayoutImport } from "./Layout.js";
14
+ import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
14
15
 
15
16
  export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
16
17
  export const Callout = /*@__PURE__*/ CalloutImport;
@@ -23,3 +24,4 @@ export const Bootstrap = /*@__PURE__*/ BootstrapImport;
23
24
  export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
24
25
  export const Button = /*@__PURE__*/ ButtonImport;
25
26
  export const Head = /*@__PURE__*/ Helmet;
27
+ export const useZudoku = /*@__PURE__*/ useZudokuImport;
@@ -60,7 +60,12 @@ export type ZudokuContextOptions = {
60
60
  metadata?: Metadata;
61
61
  page?: Page;
62
62
  authentication?: AuthenticationProvider;
63
- topNavigation?: Array<{ id: string; label: string; default?: string }>;
63
+ topNavigation?: Array<{
64
+ id: string;
65
+ label: string;
66
+ default?: string;
67
+ display?: "auth" | "anon" | "always";
68
+ }>;
64
69
  sidebars?: SidebarConfig;
65
70
  plugins?: DevPortalPlugin[];
66
71
  slotlets?: Slotlets;