@publish.os/nextjs 0.0.1-alpha.90 → 0.0.1-alpha.92
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/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -6
- package/compiler-assets/nextjs/defaults/group/page.tsx +36 -26
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +21 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
- package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
- package/compiler-assets/nextjs/shims/document.tsx +46 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +5 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +8 -42
- package/compiler-assets/nextjs/shims/global-not-found.tsx +69 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +2 -0
- package/compiler-assets/nextjs/shims/metadata-icons.tsx +39 -0
- package/compiler-assets/nextjs/shims/not-found-content.tsx +53 -0
- package/compiler-assets/nextjs/shims/not-found-navigation.tsx +60 -0
- package/compiler-assets/nextjs/shims/proxy.ts +254 -86
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +2 -6
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +28 -16
- package/compiler-assets/nextjs/shims/site-mdx.tsx +6 -1
- package/dist/{build-operation-2JAYBSKF.js → build-operation-CJDUL4OW.js} +29 -23
- package/dist/{button-c3WGnxIj.d.ts → button-D6Xp2HBm.d.ts} +4 -4
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-3T4HVDSC.js +426 -0
- package/dist/{chunk-WKTEO6RS.js → chunk-4BC2L2KA.js} +46 -12
- package/dist/{chunk-WDY4IK6Z.js → chunk-5J3YUNRY.js} +3 -10
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/{chunk-DWA3ZRGW.js → chunk-6C65KV7O.js} +2 -2
- package/dist/{chunk-GGKFQ3MA.js → chunk-6D2E6UMD.js} +144 -70
- package/dist/{chunk-7OGTPSKI.js → chunk-7NY22B5U.js} +8 -3
- package/dist/chunk-DX7PXFCM.js +2519 -0
- package/dist/{chunk-726GV2NF.js → chunk-DZ3VWEV5.js} +950 -632
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/{chunk-H6XILMZX.js → chunk-NHSLTARU.js} +2588 -1493
- package/dist/{chunk-DLDFHU7Y.js → chunk-NNBJZPFM.js} +4 -2
- package/dist/{chunk-VO2I7MTM.js → chunk-SBMDONTV.js} +10 -7
- package/dist/{chunk-YLTOLYWM.js → chunk-WL75GQ5M.js} +6 -18
- package/dist/compiler.d.ts +15 -2
- package/dist/compiler.js +111 -23
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +563 -0
- package/dist/components/blocks/toc.d.ts +43 -0
- package/dist/components/blocks/toc.js +136 -0
- package/dist/components/ui/button.d.ts +4 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-44GJSMXD.js +16 -0
- package/dist/config/createNextConfig.js +19 -3
- package/dist/{dev-operation-TZDVJCN7.js → dev-operation-WNECBHZ5.js} +134 -84
- package/dist/{framework-selection-X4U6Y6QC.js → framework-selection-ZVO323PK.js} +3 -2
- package/dist/ide-support-TG74L4FF.js +16 -0
- package/dist/index.d.ts +151 -95
- package/dist/index.js +25 -0
- package/dist/jsx-dev-runtime.d.ts +6 -0
- package/dist/jsx-dev-runtime.js +100 -0
- package/dist/jsx-runtime.d.ts +7 -0
- package/dist/jsx-runtime.js +97 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +37 -8
- package/dist/kernel/components/blocks/AgentActions.js +384 -174
- package/dist/kernel/components/blocks/agent-actions.d.ts +4 -0
- package/dist/kernel/components/blocks/agent-actions.js +563 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
- package/dist/kernel/components/blocks/logo-block.js +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
- package/dist/kernel/components/blocks/nav-breadcrumb.js +21 -15
- package/dist/kernel/components/blocks/navbar.d.ts +5 -4
- package/dist/kernel/components/blocks/navbar.js +79 -59
- package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
- package/dist/kernel/components/blocks/navigation-progress.js +2 -2
- package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
- package/dist/kernel/components/blocks/next-prev.js +30 -7
- package/dist/kernel/components/blocks/page-list.d.ts +4 -4
- package/dist/kernel/components/blocks/page-list.js +32 -9
- package/dist/kernel/components/blocks/search.d.ts +9 -15
- package/dist/kernel/components/blocks/search.js +16 -17
- package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
- package/dist/kernel/components/blocks/sidebar-node.js +13 -3
- package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
- package/dist/kernel/components/blocks/sidebar.js +137 -28
- package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
- package/dist/kernel/components/blocks/theme-toggle.js +5 -5
- package/dist/kernel/components/blocks/toc-client.d.ts +40 -0
- package/dist/kernel/components/blocks/toc-client.js +495 -0
- package/dist/kernel/components/blocks/toc.d.ts +20 -2
- package/dist/kernel/components/blocks/toc.js +121 -179
- package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
- package/dist/kernel/components/mdx/components/callout.js +1 -1
- package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
- package/dist/kernel/components/mdx/components/copy-code-button.js +5 -4
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +3 -3
- package/dist/kernel/components/mdx/components/figure-caption.js +3 -2
- package/dist/kernel/components/mdx/components/figure.d.ts +8 -4
- package/dist/kernel/components/mdx/components/figure.js +23 -13
- package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading-copy-link.js +1 -1
- package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.js +4 -3
- package/dist/kernel/components/mdx/components/image.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image.js +22 -17
- package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +6 -6
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +1 -1
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.d.ts +7 -7
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.d.ts +8 -4
- package/dist/kernel/components/mdx/components/video-player.js +6 -2
- package/dist/kernel/components/mdx/components/video.d.ts +5 -4
- package/dist/kernel/components/mdx/components/video.js +7 -5
- package/dist/kernel/components/mdx/error-boundary.d.ts +3 -4
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +57 -16
- package/dist/kernel/components/mdx/mdx.js +232 -35
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +5 -3
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/next-image.d.ts +12 -0
- package/dist/kernel/components/next-image.js +61 -0
- package/dist/kernel/components/ui/accordion.d.ts +7 -7
- package/dist/kernel/components/ui/accordion.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -4
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +14 -14
- package/dist/kernel/components/ui/breadcrumb.js +4 -4
- package/dist/kernel/components/ui/button-group.d.ts +6 -6
- package/dist/kernel/components/ui/button-group.js +3 -3
- package/dist/kernel/components/ui/button.d.ts +59 -7
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +7 -7
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.d.ts +10 -10
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +12 -12
- package/dist/kernel/components/ui/drawer.js +1 -1
- package/dist/kernel/components/ui/input.d.ts +2 -2
- package/dist/kernel/components/ui/input.js +1 -1
- package/dist/kernel/components/ui/kbd.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.js +1 -1
- package/dist/kernel/components/ui/link.d.ts +11 -5
- package/dist/kernel/components/ui/link.js +2 -2
- package/dist/kernel/components/ui/menu.d.ts +22 -22
- package/dist/kernel/components/ui/menu.js +1 -1
- package/dist/kernel/components/ui/mod-key.d.ts +2 -3
- package/dist/kernel/components/ui/mod-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
- package/dist/kernel/components/ui/navigation-menu.js +1 -1
- package/dist/kernel/components/ui/popover.d.ts +11 -11
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.d.ts +7 -7
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +9 -10
- package/dist/kernel/components/ui/scroll-area.js +1 -1
- package/dist/kernel/components/ui/select.d.ts +16 -16
- package/dist/kernel/components/ui/select.js +1 -1
- package/dist/kernel/components/ui/separator.d.ts +3 -3
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.d.ts +7 -7
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.d.ts +12 -12
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.d.ts +3 -3
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +4 -4
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.d.ts +11 -11
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.d.ts +9 -9
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +4 -17
- package/dist/kernel/defaults.registry.js +4 -19
- package/dist/kernel/routes/agent/markdown.d.ts +7 -0
- package/dist/kernel/routes/agent/markdown.js +229 -54
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +5 -7
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +119 -88
- package/dist/kernel/routes/metadata/llms.d.ts +3 -23
- package/dist/kernel/routes/metadata/llms.js +2 -103
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +5 -3
- package/dist/kernel/routes/metadata/robots.js +4 -25
- package/dist/kernel/routes/metadata/sitemap.d.ts +36 -3
- package/dist/kernel/routes/metadata/sitemap.js +277 -49
- package/dist/kernel/routes/not-found.d.ts +34 -0
- package/dist/kernel/routes/not-found.js +213 -0
- package/dist/kernel/routes/pages/group.d.ts +5 -5
- package/dist/kernel/routes/pages/group.js +11 -5
- package/dist/kernel/routes/pages/leaf.d.ts +38 -6
- package/dist/kernel/routes/pages/leaf.js +21 -12
- package/dist/kernel/routes/pages/root.d.ts +5 -5
- package/dist/kernel/routes/pages/root.js +21 -6
- package/dist/keyboard-shortcuts.d.ts +2 -2
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +65 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +2 -9
- package/dist/search.js +9 -16
- package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
- package/dist/theme-scope.d.ts +2 -2
- package/dist/theme-scope.js +1 -1
- package/dist/types-BbqmOzLC.d.ts +168 -0
- package/dist/types-TjH1ek0X.d.ts +22 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +117 -91
- package/dist/utils/heading-ids.js +30 -11
- package/dist/utils/toc-selection.d.ts +7 -0
- package/dist/utils/toc-selection.js +14 -0
- package/dist/validate-local-source-EN2GW4FR.js +16 -0
- package/dist/validate-publish-os-source-OEWQDB7B.js +14 -0
- package/init/seed/minimal/publish.os/assets/blog/hello-world.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.dark.svg +13 -0
- package/init/seed/minimal/publish.os/assets/favicon.svg +13 -0
- package/init/seed/minimal/publish.os/blog/content/hello-world.mdx +48 -0
- package/init/seed/minimal/publish.os/blog/content/series-a.mdx +11 -0
- package/init/seed/minimal/publish.os/blog/index.tsx +85 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +91 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +2 -3
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +5 -6
- package/init/seed/minimal/publish.os/publish.os.config.json +17 -2
- package/init/seed/minimal/publish.os/theme.css +3 -3
- package/init/seed/minimal/seed.json +12 -4
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +1 -1
- package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
- package/package.json +48 -23
- package/release/app/phosphor/package.json +4 -4
- package/release/app/phosphor/pnpm-lock.yaml.template +123 -184
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +153 -183
- package/release/release.json +6 -6
- package/dist/button-CtzUJB8u.d.ts +0 -11
- package/dist/chunk-535TM4A5.js +0 -1455
- package/dist/chunk-B2V22WRT.js +0 -297
- package/dist/chunk-NECL5IBJ.js +0 -318
- package/dist/chunk-SVYGXXYR.js +0 -36
- package/dist/chunk-UF6ATARM.js +0 -1100
- package/dist/compose-NN23UJGC.js +0 -13
- package/dist/ide-support-ZNW7ODFY.js +0 -15
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -667
- package/dist/kernel/components/blocks/link-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/link-playground.js +0 -744
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +0 -5
- package/dist/kernel/components/blocks/navigation-progress-playground.js +0 -629
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -53
- package/dist/sidebar-types-DKpR27II.d.ts +0 -25
- package/dist/types-BzkZty3r.d.ts +0 -147
- package/dist/types-CJWRG05y.d.ts +0 -76
- package/dist/types-CUtrppxt.d.ts +0 -69
- package/dist/validate-local-source-XRL2Y7XE.js +0 -14
- package/dist/validate-publish-os-source-DAPZ4QGE.js +0 -12
- package/init/seed/minimal/publish.os/assets/favicon/favicon.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/favicon/favicon.png +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/components/block/navbar/nav-breadcrumb.tsx
|
|
2
|
-
import { CollapsibleBreadcrumbTrail } from "@
|
|
3
|
-
import { jsx } from "
|
|
2
|
+
import { CollapsibleBreadcrumbTrail } from "@components/ui/breadcrumb-trail";
|
|
3
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
4
4
|
function titleFor(node) {
|
|
5
|
-
return node.
|
|
5
|
+
return node.label ?? "";
|
|
6
6
|
}
|
|
7
7
|
function pathFor(node) {
|
|
8
|
-
if (node.type === "page") return node.path;
|
|
8
|
+
if (node.type === "page") return node.page.path;
|
|
9
|
+
if (node.type === "group" && node.presentation === "page") return node.route;
|
|
9
10
|
if (node.type === "link") return node.href;
|
|
10
|
-
if (node.type === "folder" || node.type === "section") return node.path;
|
|
11
11
|
}
|
|
12
12
|
function rankFor(node) {
|
|
13
|
-
return node.type === "page" || node.type === "
|
|
13
|
+
return node.type === "page" || node.type === "group" && node.presentation === "page" ? 2 : node.type === "folder" || node.type === "group" && node.presentation === "folder" ? 1 : 0;
|
|
14
14
|
}
|
|
15
15
|
function findCrumbs(nodes, pathname, parents = []) {
|
|
16
16
|
let matches = [];
|
|
@@ -30,8 +30,12 @@ function findCrumbs(nodes, pathname, parents = []) {
|
|
|
30
30
|
})),
|
|
31
31
|
pathLength: path.length,
|
|
32
32
|
rank: rankFor(node)
|
|
33
|
-
}), node.type === "section" || node.type === "folder") {
|
|
34
|
-
let childMatch = findCrumbs(
|
|
33
|
+
}), node.type === "section" || node.type === "folder" || node.type === "group" || node.type === "view" || node.type === "page" && node.children) {
|
|
34
|
+
let childMatch = findCrumbs(
|
|
35
|
+
node.type === "view" ? node.items : node.type === "page" ? node.children ?? [] : node.children,
|
|
36
|
+
pathname,
|
|
37
|
+
nextParents
|
|
38
|
+
);
|
|
35
39
|
childMatch && matches.push(childMatch);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
@@ -39,8 +43,10 @@ function findCrumbs(nodes, pathname, parents = []) {
|
|
|
39
43
|
(a, b) => b.rank - a.rank || b.pathLength - a.pathLength || b.crumbs.length - a.crumbs.length
|
|
40
44
|
)[0] ?? null;
|
|
41
45
|
}
|
|
42
|
-
function groupFallback(
|
|
43
|
-
let groups =
|
|
46
|
+
function groupFallback(nodes, pathname) {
|
|
47
|
+
let groups = nodes.filter(
|
|
48
|
+
(node) => node.type === "group"
|
|
49
|
+
).map((group) => ({ group, path: group.route })).filter(
|
|
44
50
|
(entry) => typeof entry.path == "string"
|
|
45
51
|
).sort((a, b) => b.path.length - a.path.length);
|
|
46
52
|
for (let { group, path } of groups)
|
|
@@ -54,7 +60,7 @@ function groupFallback(tree, pathname) {
|
|
|
54
60
|
];
|
|
55
61
|
return [];
|
|
56
62
|
}
|
|
57
|
-
function buildCrumbs(site,
|
|
63
|
+
function buildCrumbs(site, navigation, pathname) {
|
|
58
64
|
let root = {
|
|
59
65
|
title: site.name,
|
|
60
66
|
path: "/",
|
|
@@ -62,10 +68,10 @@ function buildCrumbs(site, tree, pathname) {
|
|
|
62
68
|
current: pathname === "/"
|
|
63
69
|
};
|
|
64
70
|
if (pathname === "/") return [root];
|
|
65
|
-
let treeMatch = findCrumbs(
|
|
71
|
+
let treeMatch = findCrumbs(navigation.items, pathname);
|
|
66
72
|
return treeMatch ? [root, ...treeMatch.crumbs] : [
|
|
67
73
|
root,
|
|
68
|
-
...groupFallback(
|
|
74
|
+
...groupFallback(navigation.items, pathname).map((crumb) => ({
|
|
69
75
|
...crumb,
|
|
70
76
|
current: !1
|
|
71
77
|
}))
|
|
@@ -76,9 +82,9 @@ function NavBreadcrumb({
|
|
|
76
82
|
showRoot = !0,
|
|
77
83
|
size = "sm",
|
|
78
84
|
site,
|
|
79
|
-
|
|
85
|
+
navigation
|
|
80
86
|
}) {
|
|
81
|
-
let crumbs = buildCrumbs(site,
|
|
87
|
+
let crumbs = buildCrumbs(site, navigation, currentPath), items = (showRoot ? crumbs : crumbs.slice(1)).map((crumb) => ({
|
|
82
88
|
current: crumb.current,
|
|
83
89
|
href: crumb.href,
|
|
84
90
|
title: crumb.title
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
import { LogoBlockLogo, LogoBlockAsset } from './logo-block.js';
|
|
3
|
-
import { S as SiteData
|
|
3
|
+
import { S as SiteData } from '../../../types-TjH1ek0X.js';
|
|
4
|
+
import { R as ResolvedNavigation } from '../../../manifest-types-CcVPH_jh.js';
|
|
4
5
|
|
|
5
6
|
type NavbarProps = {
|
|
6
7
|
logo?: NavbarLogo;
|
|
7
8
|
site?: SiteData;
|
|
8
9
|
siteTitle?: string;
|
|
9
|
-
|
|
10
|
+
navigation: ResolvedNavigation;
|
|
10
11
|
showThemeToggle?: boolean;
|
|
11
12
|
};
|
|
12
13
|
type NavbarLogoAsset = LogoBlockAsset;
|
|
13
14
|
type NavbarLogo = LogoBlockLogo;
|
|
14
|
-
declare function Navbar({ logo, showThemeToggle, site, siteTitle,
|
|
15
|
+
declare function Navbar({ logo, showThemeToggle, site, siteTitle, navigation, }: NavbarProps): react.JSX.Element;
|
|
15
16
|
|
|
16
17
|
export { Navbar, type NavbarLogo, type NavbarLogoAsset };
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
// src/components/block/navbar/navbar.tsx
|
|
4
4
|
import {
|
|
5
5
|
LogoBlock
|
|
6
|
-
} from "@
|
|
7
|
-
import { Search } from "@
|
|
8
|
-
import { Sidebar } from "@
|
|
9
|
-
import { ThemeToggle } from "@
|
|
10
|
-
import { Button as Button2 } from "@
|
|
6
|
+
} from "@components/blocks/logo-block";
|
|
7
|
+
import { Search } from "@components/blocks/search";
|
|
8
|
+
import { Sidebar } from "@components/blocks/sidebar";
|
|
9
|
+
import { ThemeToggle } from "@components/blocks/theme-toggle";
|
|
10
|
+
import { Button as Button2 } from "@components/ui/button";
|
|
11
11
|
import {
|
|
12
12
|
Drawer,
|
|
13
13
|
DrawerClose,
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
DrawerTitle,
|
|
18
18
|
DrawerTrigger,
|
|
19
19
|
DrawerViewport
|
|
20
|
-
} from "@
|
|
21
|
-
import { Link as Link3 } from "@
|
|
22
|
-
import { ScrollArea as ScrollArea2 } from "@
|
|
20
|
+
} from "@components/ui/drawer";
|
|
21
|
+
import { Link as Link3 } from "@components/ui/link";
|
|
22
|
+
import { ScrollArea as ScrollArea2 } from "@components/ui/scroll-area";
|
|
23
23
|
import {
|
|
24
24
|
ArrowRightIcon,
|
|
25
25
|
CaretLeftIcon,
|
|
@@ -32,8 +32,8 @@ import { usePathname } from "next/navigation";
|
|
|
32
32
|
import { useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
33
33
|
|
|
34
34
|
// src/components/block/navbar/group-navigation.tsx
|
|
35
|
-
import { Button } from "@
|
|
36
|
-
import { Link } from "@
|
|
35
|
+
import { Button } from "@components/ui/button";
|
|
36
|
+
import { Link } from "@components/ui/link";
|
|
37
37
|
import {
|
|
38
38
|
Menu,
|
|
39
39
|
MenuLinkItem,
|
|
@@ -41,21 +41,28 @@ import {
|
|
|
41
41
|
MenuPortal,
|
|
42
42
|
MenuPositioner,
|
|
43
43
|
MenuTrigger
|
|
44
|
-
} from "@
|
|
44
|
+
} from "@components/ui/menu";
|
|
45
45
|
import { CaretDownIcon } from "@phosphor-icons/react/ssr";
|
|
46
46
|
import NextLink from "next/link";
|
|
47
47
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
// src/components/block/navbar/navigation-groups.ts
|
|
50
|
+
function navigationGroups(nodes) {
|
|
51
|
+
return nodes.flatMap((node) => node.type === "group" ? [node, ...navigationGroups(node.children)] : node.type === "section" || node.type === "folder" ? navigationGroups(node.children) : node.type === "view" ? navigationGroups(node.items) : node.type === "page" && node.children ? navigationGroups(node.children) : []);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/components/block/navbar/group-navigation.tsx
|
|
55
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
49
56
|
function GroupNavigation({
|
|
50
57
|
currentPath,
|
|
51
|
-
|
|
58
|
+
navigation
|
|
52
59
|
}) {
|
|
53
|
-
let groups =
|
|
54
|
-
(
|
|
60
|
+
let groups = navigationGroups(navigation.items).filter(
|
|
61
|
+
(group) => group.groupKey !== navigation.rootGroup && group.presentation === "page"
|
|
55
62
|
), activeGroup = groups.filter(
|
|
56
|
-
({
|
|
63
|
+
({ route }) => currentPath === route || currentPath.startsWith(route === "/" ? "/" : `${route}/`)
|
|
57
64
|
).reduce(
|
|
58
|
-
(active, group) => !active || group.
|
|
65
|
+
(active, group) => !active || group.route.length > active.route.length ? group : active,
|
|
59
66
|
void 0
|
|
60
67
|
), navRef = useRef(null), linksRef = useRef(null), [overflow, setOverflow] = useState(!1), hasGroups = groups.length > 1;
|
|
61
68
|
if (useLayoutEffect(() => {
|
|
@@ -67,7 +74,7 @@ function GroupNavigation({
|
|
|
67
74
|
}, observer = new win.ResizeObserver(measure);
|
|
68
75
|
return observer.observe(nav), observer.observe(links), measure(), () => observer.disconnect();
|
|
69
76
|
}, [hasGroups]), !hasGroups) return null;
|
|
70
|
-
let isActive = (path) => activeGroup?.
|
|
77
|
+
let isActive = (path) => activeGroup?.route === path;
|
|
71
78
|
return /* @__PURE__ */ jsxs("div", { className: "hidden min-w-0 flex-1 items-center gap-4 md:flex", children: [
|
|
72
79
|
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "h-4 w-px shrink-0 bg-stroke-3" }),
|
|
73
80
|
/* @__PURE__ */ jsxs(
|
|
@@ -84,19 +91,19 @@ function GroupNavigation({
|
|
|
84
91
|
className: `flex w-max items-center gap-1 ${overflow ? "pointer-events-none invisible absolute top-0" : ""}`,
|
|
85
92
|
inert: overflow || void 0,
|
|
86
93
|
ref: linksRef,
|
|
87
|
-
children: groups.map((group) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
94
|
+
children: groups.map((group) => /* @__PURE__ */ jsx("li", { children: group.href ? /* @__PURE__ */ jsx(
|
|
88
95
|
Link,
|
|
89
96
|
{
|
|
90
|
-
active: isActive(group.
|
|
91
|
-
"aria-current": isActive(group.
|
|
92
|
-
className: "
|
|
93
|
-
href: group.href
|
|
97
|
+
active: isActive(group.route),
|
|
98
|
+
"aria-current": isActive(group.route) ? "location" : void 0,
|
|
99
|
+
className: "pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
100
|
+
href: group.href,
|
|
94
101
|
size: "xs",
|
|
95
102
|
target: "_self",
|
|
96
103
|
variant: "button.ghost",
|
|
97
|
-
children: group.
|
|
104
|
+
children: group.label
|
|
98
105
|
}
|
|
99
|
-
) }, group.id))
|
|
106
|
+
) : /* @__PURE__ */ jsx("span", { className: "px-2 text-xs text-foreground-3", children: group.label }) }, group.id))
|
|
100
107
|
}
|
|
101
108
|
),
|
|
102
109
|
overflow ? /* @__PURE__ */ jsxs(Menu, { children: [
|
|
@@ -119,10 +126,10 @@ function GroupNavigation({
|
|
|
119
126
|
/* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { align: "start", children: /* @__PURE__ */ jsx(MenuPopup, { className: "max-w-[min(24rem,calc(100vw-2rem))]", children: groups.map((group) => /* @__PURE__ */ jsx(
|
|
120
127
|
MenuLinkItem,
|
|
121
128
|
{
|
|
122
|
-
"aria-current": isActive(group.
|
|
129
|
+
"aria-current": isActive(group.route) ? "location" : void 0,
|
|
123
130
|
className: "whitespace-normal break-words pointer-coarse:min-h-11",
|
|
124
|
-
render: /* @__PURE__ */ jsx(NextLink, { href: group.href ?? group.
|
|
125
|
-
children: group.
|
|
131
|
+
render: /* @__PURE__ */ jsx(NextLink, { href: group.href ?? group.route }),
|
|
132
|
+
children: group.label
|
|
126
133
|
},
|
|
127
134
|
group.id
|
|
128
135
|
)) }) }) })
|
|
@@ -134,15 +141,15 @@ function GroupNavigation({
|
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
// src/components/block/navbar/mobile-navigation-tree.tsx
|
|
137
|
-
import { Link as Link2 } from "@
|
|
138
|
-
import { ScrollArea } from "@
|
|
139
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "
|
|
144
|
+
import { Link as Link2 } from "@components/ui/link";
|
|
145
|
+
import { ScrollArea } from "@components/ui/scroll-area";
|
|
146
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "@publish.os/nextjs/jsx-runtime";
|
|
140
147
|
function MobileNavigationTree({
|
|
141
148
|
currentPath,
|
|
142
149
|
indexCurrentPath,
|
|
143
150
|
indexPath,
|
|
144
151
|
title,
|
|
145
|
-
|
|
152
|
+
navigation
|
|
146
153
|
}) {
|
|
147
154
|
return /* @__PURE__ */ jsx2(
|
|
148
155
|
ScrollArea,
|
|
@@ -151,7 +158,7 @@ function MobileNavigationTree({
|
|
|
151
158
|
viewportClassName: "overscroll-contain",
|
|
152
159
|
children: /* @__PURE__ */ jsxs2("nav", { "aria-label": `${title} pages`, className: "px-4 py-5", children: [
|
|
153
160
|
/* @__PURE__ */ jsx2("p", { className: "mb-3 wrap-break-word px-3 text-base leading-6 text-foreground-3", children: title }),
|
|
154
|
-
|
|
161
|
+
navigation.items.length > 0 ? /* @__PURE__ */ jsx2(PageList, { currentPath, navigation }) : indexPath ? /* @__PURE__ */ jsx2(
|
|
155
162
|
PageLink,
|
|
156
163
|
{
|
|
157
164
|
currentPath,
|
|
@@ -160,34 +167,44 @@ function MobileNavigationTree({
|
|
|
160
167
|
sameTab: !0,
|
|
161
168
|
title: "Overview"
|
|
162
169
|
}
|
|
163
|
-
)
|
|
170
|
+
) : null
|
|
164
171
|
] })
|
|
165
172
|
}
|
|
166
173
|
);
|
|
167
174
|
}
|
|
168
175
|
function PageList({
|
|
169
176
|
currentPath,
|
|
170
|
-
|
|
177
|
+
navigation
|
|
171
178
|
}) {
|
|
179
|
+
let tree = navigation.items;
|
|
172
180
|
return /* @__PURE__ */ jsx2("ul", { className: "space-y-1", children: tree.map((node) => /* @__PURE__ */ jsx2(
|
|
173
181
|
"li",
|
|
174
182
|
{
|
|
175
|
-
className: node.type === "section" || node.type === "folder" ? "pt-5 first:pt-0" : void 0,
|
|
176
|
-
children: node.type === "page" || node.type === "link" ? /* @__PURE__ */ jsx2(
|
|
183
|
+
className: node.type === "section" || node.type === "folder" || node.type === "group" ? "pt-5 first:pt-0" : void 0,
|
|
184
|
+
children: node.type === "page" || node.type === "link" || node.type === "group" && node.presentation === "page" ? /* @__PURE__ */ jsx2(
|
|
177
185
|
PageLink,
|
|
178
186
|
{
|
|
179
187
|
currentPath,
|
|
180
|
-
href: node.type === "
|
|
181
|
-
activePath: node.type === "page" ? node.path : void 0,
|
|
182
|
-
sameTab: node.type
|
|
183
|
-
title: node.
|
|
188
|
+
href: node.type === "group" ? node.href ?? node.route : node.href,
|
|
189
|
+
activePath: node.type === "page" ? node.page.path : node.type === "group" ? node.route : void 0,
|
|
190
|
+
sameTab: node.type !== "link",
|
|
191
|
+
title: node.label
|
|
184
192
|
}
|
|
185
|
-
) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
186
|
-
/* @__PURE__ */ jsx2("p", { className: "mb-2 wrap-break-word px-3 text-base leading-6 text-foreground-3", children: node.
|
|
187
|
-
/* @__PURE__ */ jsx2(
|
|
193
|
+
) : node.type === "switch-view" ? null : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
194
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-2 wrap-break-word px-3 text-base leading-6 text-foreground-3", children: node.label }),
|
|
195
|
+
/* @__PURE__ */ jsx2(
|
|
196
|
+
PageList,
|
|
197
|
+
{
|
|
198
|
+
currentPath,
|
|
199
|
+
navigation: {
|
|
200
|
+
rootGroup: navigation.rootGroup,
|
|
201
|
+
items: "items" in node ? node.items : node.children
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
)
|
|
188
205
|
] })
|
|
189
206
|
},
|
|
190
|
-
node.
|
|
207
|
+
node.id
|
|
191
208
|
)) });
|
|
192
209
|
}
|
|
193
210
|
function PageLink({
|
|
@@ -212,19 +229,19 @@ function PageLink({
|
|
|
212
229
|
}
|
|
213
230
|
|
|
214
231
|
// src/components/block/navbar/navbar.tsx
|
|
215
|
-
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "
|
|
232
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "@publish.os/nextjs/jsx-runtime";
|
|
216
233
|
function Navbar({
|
|
217
234
|
logo,
|
|
218
235
|
showThemeToggle = !0,
|
|
219
236
|
site,
|
|
220
237
|
siteTitle,
|
|
221
|
-
|
|
238
|
+
navigation
|
|
222
239
|
}) {
|
|
223
240
|
let pathname = usePathname() || "/", headerSite = site ?? { name: siteTitle ?? "Site" };
|
|
224
241
|
return /* @__PURE__ */ jsx3("header", { className: "sticky top-0 z-nav border-b border-stroke-3 bg-surface-2 [anchor-name:--global-navbar]", children: /* @__PURE__ */ jsxs3(NavbarFrame, { children: [
|
|
225
242
|
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
226
243
|
/* @__PURE__ */ jsx3(HomeLink, { logo, siteName: headerSite.name }),
|
|
227
|
-
/* @__PURE__ */ jsx3(GroupNavigation, { currentPath: pathname,
|
|
244
|
+
/* @__PURE__ */ jsx3(GroupNavigation, { currentPath: pathname, navigation })
|
|
228
245
|
] }),
|
|
229
246
|
/* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1 md:gap-2", children: [
|
|
230
247
|
/* @__PURE__ */ jsxs3(Search.Root, { children: [
|
|
@@ -265,7 +282,7 @@ function Navbar({
|
|
|
265
282
|
logo,
|
|
266
283
|
showThemeToggle,
|
|
267
284
|
siteName: headerSite.name,
|
|
268
|
-
|
|
285
|
+
navigation
|
|
269
286
|
},
|
|
270
287
|
pathname
|
|
271
288
|
)
|
|
@@ -293,10 +310,10 @@ function MobileNavigation({
|
|
|
293
310
|
logo,
|
|
294
311
|
showThemeToggle,
|
|
295
312
|
siteName,
|
|
296
|
-
|
|
313
|
+
navigation
|
|
297
314
|
}) {
|
|
298
|
-
let [open, setOpen] = useState2(!1), [selectedGroupId, setSelectedGroupId] = useState2(null), triggerRef = useRef2(null), closeRef = useRef2(null), backRef = useRef2(null), returnGroupIdRef = useRef2(null), groupButtonRefs = useRef2(/* @__PURE__ */ new Map()), groups =
|
|
299
|
-
(
|
|
315
|
+
let [open, setOpen] = useState2(!1), [selectedGroupId, setSelectedGroupId] = useState2(null), triggerRef = useRef2(null), closeRef = useRef2(null), backRef = useRef2(null), returnGroupIdRef = useRef2(null), groupButtonRefs = useRef2(/* @__PURE__ */ new Map()), groups = navigationGroups(navigation.items).filter(
|
|
316
|
+
(group) => group.groupKey !== navigation.rootGroup
|
|
300
317
|
), selectedGroup = groups.find((group) => group.id === selectedGroupId), changeOpen = (nextOpen) => {
|
|
301
318
|
setOpen(nextOpen), nextOpen || (setSelectedGroupId(null), returnGroupIdRef.current = null);
|
|
302
319
|
};
|
|
@@ -333,7 +350,7 @@ function MobileNavigation({
|
|
|
333
350
|
},
|
|
334
351
|
children: [
|
|
335
352
|
/* @__PURE__ */ jsxs3(DrawerTitle, { className: "sr-only", children: [
|
|
336
|
-
selectedGroup ? selectedGroup.
|
|
353
|
+
selectedGroup ? selectedGroup.label : siteName,
|
|
337
354
|
" navigation"
|
|
338
355
|
] }),
|
|
339
356
|
/* @__PURE__ */ jsx3(DrawerDescription, { className: "sr-only", children: "Browse pages and site controls." }),
|
|
@@ -373,10 +390,13 @@ function MobileNavigation({
|
|
|
373
390
|
MobileNavigationTree,
|
|
374
391
|
{
|
|
375
392
|
currentPath,
|
|
376
|
-
indexPath: selectedGroup.
|
|
377
|
-
indexCurrentPath: selectedGroup.
|
|
378
|
-
title: selectedGroup.
|
|
379
|
-
|
|
393
|
+
indexPath: selectedGroup.presentation === "page" ? selectedGroup.href : void 0,
|
|
394
|
+
indexCurrentPath: selectedGroup.route,
|
|
395
|
+
title: selectedGroup.label,
|
|
396
|
+
navigation: {
|
|
397
|
+
rootGroup: selectedGroup.groupKey,
|
|
398
|
+
items: selectedGroup.children
|
|
399
|
+
}
|
|
380
400
|
}
|
|
381
401
|
)
|
|
382
402
|
] }) : groups.length > 0 ? /* @__PURE__ */ jsx3(
|
|
@@ -397,7 +417,7 @@ function MobileNavigation({
|
|
|
397
417
|
rightIcon: /* @__PURE__ */ jsx3(CaretRightIcon, { "aria-hidden": "true" }),
|
|
398
418
|
size: "lg",
|
|
399
419
|
variant: "ghost",
|
|
400
|
-
children: /* @__PURE__ */ jsx3("span", { className: "min-w-0 wrap-break-word", children: group.
|
|
420
|
+
children: /* @__PURE__ */ jsx3("span", { className: "min-w-0 wrap-break-word", children: group.label })
|
|
401
421
|
}
|
|
402
422
|
) }, group.id)) }) })
|
|
403
423
|
}
|
|
@@ -406,7 +426,7 @@ function MobileNavigation({
|
|
|
406
426
|
{
|
|
407
427
|
className: "w-full min-w-0 max-w-none",
|
|
408
428
|
currentPath,
|
|
409
|
-
|
|
429
|
+
navigation
|
|
410
430
|
}
|
|
411
431
|
) }),
|
|
412
432
|
selectedGroup ? null : /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 flex-col gap-4 border-t border-stroke-3 px-4 py-4", children: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from 'react';
|
|
2
2
|
|
|
3
3
|
declare const navigationProgressConfig: {
|
|
4
4
|
initialProgress: number;
|
|
@@ -11,6 +11,6 @@ declare const navigationProgressConfig: {
|
|
|
11
11
|
settleDelay: number;
|
|
12
12
|
timeout: number;
|
|
13
13
|
};
|
|
14
|
-
declare function NavigationProgressBar():
|
|
14
|
+
declare function NavigationProgressBar(): react.JSX.Element;
|
|
15
15
|
|
|
16
16
|
export { NavigationProgressBar, navigationProgressConfig };
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
Progress,
|
|
6
6
|
ProgressIndicator,
|
|
7
7
|
ProgressTrack
|
|
8
|
-
} from "@
|
|
8
|
+
} from "@components/ui/progress";
|
|
9
9
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
10
10
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
11
11
|
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
|
|
12
|
-
import { jsx } from "
|
|
12
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
13
13
|
var navigationProgressConfig = {
|
|
14
14
|
initialProgress: 0,
|
|
15
15
|
targetProgress: 98,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { R as ResolvedNavigation } from '../../../manifest-types-CcVPH_jh.js';
|
|
3
3
|
|
|
4
4
|
type NextPrevProps = {
|
|
5
5
|
className?: string;
|
|
6
6
|
currentPath?: string;
|
|
7
|
-
|
|
7
|
+
navigation: ResolvedNavigation;
|
|
8
8
|
};
|
|
9
|
-
declare function NextPrev({ className, currentPath,
|
|
9
|
+
declare function NextPrev({ className, currentPath, navigation, }: NextPrevProps): react.JSX.Element | null;
|
|
10
10
|
|
|
11
11
|
export { NextPrev, type NextPrevProps };
|
|
@@ -4,12 +4,31 @@ import { cn } from "@publish.os/nextjs/utils/cn";
|
|
|
4
4
|
import NextLink from "next/link";
|
|
5
5
|
|
|
6
6
|
// src/components/block/page-navigation/page-nodes.ts
|
|
7
|
-
function
|
|
8
|
-
return nodes.flatMap((node) => node.type === "page" ? [
|
|
7
|
+
function selectNavigationPages(nodes) {
|
|
8
|
+
return nodes.flatMap((node) => node.type === "page" ? [
|
|
9
|
+
{
|
|
10
|
+
id: node.id,
|
|
11
|
+
label: node.label,
|
|
12
|
+
href: node.href,
|
|
13
|
+
path: node.page.path,
|
|
14
|
+
page: node.page
|
|
15
|
+
}
|
|
16
|
+
] : node.type === "group" ? [
|
|
17
|
+
...node.presentation === "page" ? [
|
|
18
|
+
{
|
|
19
|
+
id: node.id,
|
|
20
|
+
label: node.label,
|
|
21
|
+
href: node.href ?? node.route,
|
|
22
|
+
path: node.route,
|
|
23
|
+
group: node
|
|
24
|
+
}
|
|
25
|
+
] : [],
|
|
26
|
+
...selectNavigationPages(node.children)
|
|
27
|
+
] : node.type === "section" || node.type === "folder" ? selectNavigationPages(node.children) : node.type === "view" ? selectNavigationPages(node.items) : []);
|
|
9
28
|
}
|
|
10
29
|
|
|
11
30
|
// src/components/block/page-navigation/next-prev.tsx
|
|
12
|
-
import { jsx, jsxs } from "
|
|
31
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
13
32
|
function DirectionIcon({ direction }) {
|
|
14
33
|
return /* @__PURE__ */ jsx("span", { className: "shrink-0 text-foreground-3 transition-colors duration-200 group-hover/next-prev:text-foreground-2", children: direction === "previous" ? /* @__PURE__ */ jsx(CaretLeftIcon, { "aria-hidden": "true", size: 14 }) : /* @__PURE__ */ jsx(CaretRightIcon, { "aria-hidden": "true", size: 14 }) });
|
|
15
34
|
}
|
|
@@ -25,7 +44,7 @@ function NavigationCard({
|
|
|
25
44
|
"group/next-prev grid min-h-24 w-full min-w-0 overflow-hidden rounded-card border border-stroke-3 bg-surface-1 p-px text-left text-foreground-1 no-underline shadow-xs transition-[border-color,box-shadow] duration-200 hover:text-foreground-1 hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke **:no-underline!",
|
|
26
45
|
isNext && "md:text-right"
|
|
27
46
|
),
|
|
28
|
-
href: page.href
|
|
47
|
+
href: page.href,
|
|
29
48
|
children: /* @__PURE__ */ jsxs(
|
|
30
49
|
"span",
|
|
31
50
|
{
|
|
@@ -48,15 +67,19 @@ function NavigationCard({
|
|
|
48
67
|
]
|
|
49
68
|
}
|
|
50
69
|
),
|
|
51
|
-
/* @__PURE__ */ jsx("span", { className: "line-clamp-2 text-sm font-medium leading-6 text-foreground-1 transition-colors duration-200", children: page.
|
|
70
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-2 text-sm font-medium leading-6 text-foreground-1 transition-colors duration-200", children: page.label })
|
|
52
71
|
]
|
|
53
72
|
}
|
|
54
73
|
)
|
|
55
74
|
}
|
|
56
75
|
);
|
|
57
76
|
}
|
|
58
|
-
function NextPrev({
|
|
59
|
-
|
|
77
|
+
function NextPrev({
|
|
78
|
+
className,
|
|
79
|
+
currentPath,
|
|
80
|
+
navigation
|
|
81
|
+
}) {
|
|
82
|
+
let pages = selectNavigationPages(navigation.items), index = pages.findIndex((page) => page.path === currentPath), previous = index > 0 ? pages[index - 1] : null, next = index >= 0 ? pages[index + 1] : null, hasBoth = !!(previous && next);
|
|
60
83
|
return !previous && !next ? null : /* @__PURE__ */ jsx("nav", { "aria-label": "Previous and next pages", className, children: /* @__PURE__ */ jsxs("div", { className: cn("grid gap-4 pt-6", hasBoth && "md:grid-cols-2"), children: [
|
|
61
84
|
previous ? /* @__PURE__ */ jsx(NavigationCard, { direction: "previous", page: previous }) : null,
|
|
62
85
|
next ? /* @__PURE__ */ jsx(NavigationCard, { direction: "next", page: next }) : null
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { R as ResolvedNavigation } from '../../../manifest-types-CcVPH_jh.js';
|
|
3
3
|
|
|
4
4
|
type PageListProps = {
|
|
5
|
-
|
|
5
|
+
navigation: ResolvedNavigation;
|
|
6
6
|
currentPath?: string;
|
|
7
7
|
className?: string;
|
|
8
8
|
};
|
|
9
|
-
declare function PageList({
|
|
9
|
+
declare function PageList({ navigation, currentPath, className, }: PageListProps): react.JSX.Element | null;
|
|
10
10
|
|
|
11
11
|
export { PageList };
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
// src/components/block/page-navigation/page-list.tsx
|
|
2
|
-
import { Link } from "@
|
|
2
|
+
import { Link } from "@components/ui/link";
|
|
3
3
|
|
|
4
4
|
// src/components/block/page-navigation/page-nodes.ts
|
|
5
|
-
function
|
|
6
|
-
return nodes.flatMap((node) => node.type === "page" ? [
|
|
5
|
+
function selectNavigationPages(nodes) {
|
|
6
|
+
return nodes.flatMap((node) => node.type === "page" ? [
|
|
7
|
+
{
|
|
8
|
+
id: node.id,
|
|
9
|
+
label: node.label,
|
|
10
|
+
href: node.href,
|
|
11
|
+
path: node.page.path,
|
|
12
|
+
page: node.page
|
|
13
|
+
}
|
|
14
|
+
] : node.type === "group" ? [
|
|
15
|
+
...node.presentation === "page" ? [
|
|
16
|
+
{
|
|
17
|
+
id: node.id,
|
|
18
|
+
label: node.label,
|
|
19
|
+
href: node.href ?? node.route,
|
|
20
|
+
path: node.route,
|
|
21
|
+
group: node
|
|
22
|
+
}
|
|
23
|
+
] : [],
|
|
24
|
+
...selectNavigationPages(node.children)
|
|
25
|
+
] : node.type === "section" || node.type === "folder" ? selectNavigationPages(node.children) : node.type === "view" ? selectNavigationPages(node.items) : []);
|
|
7
26
|
}
|
|
8
27
|
|
|
9
28
|
// src/components/block/page-navigation/page-list.tsx
|
|
10
|
-
import { jsx } from "
|
|
11
|
-
function PageList({
|
|
12
|
-
|
|
29
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
30
|
+
function PageList({
|
|
31
|
+
navigation,
|
|
32
|
+
currentPath,
|
|
33
|
+
className
|
|
34
|
+
}) {
|
|
35
|
+
let pages = selectNavigationPages(navigation.items);
|
|
13
36
|
return pages.length === 0 ? null : /* @__PURE__ */ jsx("nav", { "aria-label": "Pages in this group", className, children: /* @__PURE__ */ jsx("ul", { className: "space-y-2 text-sm", children: pages.map((page) => {
|
|
14
37
|
let active = page.path === currentPath;
|
|
15
38
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
@@ -17,12 +40,12 @@ function PageList({ tree, currentPath, className }) {
|
|
|
17
40
|
{
|
|
18
41
|
active,
|
|
19
42
|
color: active ? "accent" : "default",
|
|
20
|
-
href: page.href
|
|
43
|
+
href: page.href,
|
|
21
44
|
size: "sm",
|
|
22
45
|
target: "_self",
|
|
23
|
-
children: page.
|
|
46
|
+
children: page.label
|
|
24
47
|
}
|
|
25
|
-
) },
|
|
48
|
+
) }, page.id);
|
|
26
49
|
}) }) });
|
|
27
50
|
}
|
|
28
51
|
export {
|