@publish.os/nextjs 0.0.1-alpha.81 → 0.0.1-alpha.91
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/app/globals.css +1 -0
- package/compiler-assets/nextjs/defaults/group/index.tsx +50 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +8 -8
- package/compiler-assets/nextjs/defaults/group/page.tsx +44 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +33 -13
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +10 -3
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -0
- package/compiler-assets/nextjs/defaults/root/css/components/code-block.css +18 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +4 -1
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +1 -1
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +6 -25
- package/compiler-assets/nextjs/defaults/root/css/typography.css +51 -68
- package/compiler-assets/nextjs/defaults/root/globals.css +25 -0
- package/compiler-assets/nextjs/defaults/root/{page.tsx → index.tsx} +6 -2
- package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -1
- package/compiler-assets/nextjs/defaults/root/theme.css +22 -22
- package/compiler-assets/nextjs/shims/document.tsx +38 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +18 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +19 -85
- 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 +143 -65
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +76 -15
- package/compiler-assets/nextjs/shims/root-page.tsx +7 -1
- package/compiler-assets/nextjs/shims/site-fenced-code-block.tsx +30 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +112 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +17 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-5QMLXF7N.js +89 -0
- package/dist/{button-CFdx-ohV.d.ts → button-BdCScEKi.d.ts} +6 -6
- package/dist/capture-local-source-WGGDIUU2.js +258 -0
- package/dist/chunk-22RSSUNV.js +13 -0
- package/dist/chunk-4BC2L2KA.js +620 -0
- package/dist/chunk-5J3YUNRY.js +121 -0
- package/dist/chunk-5KAD7W53.js +248 -0
- package/dist/chunk-6C65KV7O.js +142 -0
- package/dist/chunk-6D2E6UMD.js +695 -0
- package/dist/chunk-7NY22B5U.js +161 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-EFO6AWXN.js +19 -0
- package/dist/chunk-F3AGNDF4.js +2377 -0
- package/dist/chunk-GBPLER5H.js +426 -0
- package/dist/chunk-IL4RJOKI.js +186 -0
- package/dist/chunk-NNBJZPFM.js +193 -0
- package/dist/chunk-ORIUWJBQ.js +58 -0
- package/dist/chunk-OXOFRXEI.js +7129 -0
- package/dist/chunk-UYGCOWRF.js +1709 -0
- package/dist/chunk-WL75GQ5M.js +80 -0
- package/dist/compiler.d.ts +54 -7
- package/dist/compiler.js +121 -13147
- package/dist/components/blocks/agent-actions.d.ts +81 -0
- package/dist/components/blocks/agent-actions.js +594 -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 +5 -0
- package/dist/components/ui/button.js +94 -0
- package/dist/compose-CVBJRAF6.js +16 -0
- package/dist/config/createNextConfig.js +27 -0
- package/dist/dev-operation-OSHHWRWK.js +1095 -0
- package/dist/framework-selection-ZVO323PK.js +11 -0
- package/dist/ide-support-CU6Z5PVR.js +16 -0
- package/dist/index.d.ts +55 -4
- 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 +35 -6
- package/dist/kernel/components/blocks/AgentActions.js +401 -150
- package/dist/kernel/components/blocks/agent-actions.d.ts +5 -0
- package/dist/kernel/components/blocks/agent-actions.js +594 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +1 -1
- package/dist/kernel/components/blocks/color-palette.js +4 -4
- package/dist/kernel/components/blocks/logo-block.js +3 -3
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +22 -7
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +406 -65
- package/dist/kernel/components/blocks/navigation-progress.js +6 -3
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +12 -24
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +7 -6
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +554 -428
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +12 -10
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +24 -14
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +47 -1
- 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 +19 -1
- package/dist/kernel/components/blocks/toc.js +122 -180
- package/dist/kernel/components/mdx/components/blockquote.js +2 -2
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +67 -36
- package/dist/kernel/components/mdx/components/code-block.d.ts +5 -2
- package/dist/kernel/components/mdx/components/code-block.js +106 -5
- package/dist/kernel/components/mdx/components/copy-code-button.d.ts +8 -0
- package/dist/kernel/components/mdx/components/copy-code-button.js +61 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +1 -1
- package/dist/kernel/components/mdx/components/figure-caption.js +4 -3
- package/dist/kernel/components/mdx/components/figure.d.ts +6 -2
- package/dist/kernel/components/mdx/components/figure.js +24 -14
- package/dist/kernel/components/mdx/components/footnotes.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +4 -4
- package/dist/kernel/components/mdx/components/heading.js +6 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -2
- package/dist/kernel/components/mdx/components/image.d.ts +1 -1
- package/dist/kernel/components/mdx/components/image.js +94 -68
- package/dist/kernel/components/mdx/components/inline-code.js +2 -2
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +5 -4
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +3 -3
- package/dist/kernel/components/mdx/components/paragraph.js +2 -5
- package/dist/kernel/components/mdx/components/strikethrough.js +1 -1
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +2 -2
- package/dist/kernel/components/mdx/components/video-player.d.ts +6 -2
- package/dist/kernel/components/mdx/components/video-player.js +8 -4
- package/dist/kernel/components/mdx/components/video.d.ts +5 -3
- package/dist/kernel/components/mdx/components/video.js +8 -6
- package/dist/kernel/components/mdx/error-boundary.js +2 -2
- package/dist/kernel/components/mdx/error-fallback.js +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +28 -14
- package/dist/kernel/components/mdx/mdx.js +336 -63
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +1 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +6 -4
- 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.js +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb-trail.js +2 -2
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +10 -8
- package/dist/kernel/components/ui/button-group.js +8 -7
- package/dist/kernel/components/ui/button.d.ts +58 -6
- package/dist/kernel/components/ui/button.js +43 -39
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +1 -1
- package/dist/kernel/components/ui/dialog.js +1 -1
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +6 -2
- 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.js +10 -17
- package/dist/kernel/components/ui/link.d.ts +11 -3
- package/dist/kernel/components/ui/link.js +12 -11
- package/dist/kernel/components/ui/menu.js +6 -6
- package/dist/kernel/components/ui/mod-key.d.ts +10 -0
- package/dist/kernel/components/ui/mod-key.js +36 -0
- package/dist/kernel/components/ui/navigation-menu.js +3 -3
- package/dist/kernel/components/ui/popover.js +1 -1
- package/dist/kernel/components/ui/progress.js +2 -2
- package/dist/kernel/components/ui/scroll-area.js +5 -5
- package/dist/kernel/components/ui/select.js +8 -11
- package/dist/kernel/components/ui/separator.js +1 -1
- package/dist/kernel/components/ui/table.js +1 -1
- package/dist/kernel/components/ui/tabs.js +1 -1
- package/dist/kernel/components/ui/tag.js +1 -1
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +1 -1
- package/dist/kernel/components/ui/toast.js +1 -1
- package/dist/kernel/components/ui/tooltip.js +1 -1
- package/dist/kernel/defaults.registry.d.ts +11 -24
- package/dist/kernel/defaults.registry.js +11 -26
- package/dist/kernel/routes/agent/markdown.d.ts +3 -1
- package/dist/kernel/routes/agent/markdown.js +219 -48
- 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 -1
- package/dist/kernel/routes/metadata/feed.js +111 -81
- package/dist/kernel/routes/metadata/llms.d.ts +12 -3
- package/dist/kernel/routes/metadata/llms.js +156 -59
- package/dist/kernel/routes/metadata/og-image.js +1 -1
- package/dist/kernel/routes/metadata/robots.d.ts +1 -1
- package/dist/kernel/routes/metadata/robots.js +2 -2
- package/dist/kernel/routes/metadata/sitemap.d.ts +26 -4
- package/dist/kernel/routes/metadata/sitemap.js +206 -38
- 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 +2 -2
- package/dist/kernel/routes/pages/group.js +21 -13
- package/dist/kernel/routes/pages/leaf.d.ts +28 -1
- package/dist/kernel/routes/pages/leaf.js +25 -16
- package/dist/kernel/routes/pages/root.js +19 -13
- package/dist/keyboard-shortcuts.js +1 -1
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +52 -29
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/theme-scope.js +1 -1
- package/dist/{types-DHBm7-j6.d.ts → types-CJWRG05y.d.ts} +20 -1
- package/dist/{types-B_b3C0U6.d.ts → types-CUtrppxt.d.ts} +8 -2
- package/dist/{types-CIwwieNw.d.ts → types-J2w_puPF.d.ts} +11 -10
- package/dist/types.d.ts +15 -6
- 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-SV44DBQT.js +16 -0
- package/dist/validate-publish-os-source-NZJF3TB2.js +14 -0
- package/init/seed/minimal/.gitignore +1 -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 +82 -0
- package/init/seed/minimal/publish.os/blog/layout.tsx +13 -0
- package/init/seed/minimal/publish.os/blog/page.tsx +76 -0
- package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +64 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -11
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +6 -7
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +7 -7
- package/init/seed/minimal/publish.os/theme.css +52 -24
- package/init/seed/minimal/publish.os/tsconfig.json +3 -0
- package/init/seed/minimal/seed.json +12 -2
- package/init/seed/scratch/publish.os/docs/content/get-started.mdx +6 -0
- package/init/seed/scratch/publish.os/publish.os.config.json +4 -0
- package/init/seed/scratch/seed.json +5 -0
- package/package.json +55 -44
- package/release/app/phosphor/package.json +5 -5
- package/release/app/phosphor/pnpm-lock.yaml.template +553 -377
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +5 -3
- package/release/compiler/pnpm-lock.yaml.template +500 -303
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +8 -37
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +0 -48
- package/dist/icons.d.ts +0 -1
- package/dist/icons.js +0 -2
- package/dist/kernel/components/blocks/design-system-preview.d.ts +0 -61
- package/dist/kernel/components/blocks/design-system-preview.js +0 -648
- 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/mdx/components/pre.d.ts +0 -6
- package/dist/kernel/components/mdx/components/pre.js +0 -18
- package/dist/kernel/components/ui/meta-key.d.ts +0 -17
- package/dist/kernel/components/ui/meta-key.js +0 -9
- package/dist/kernel/components/ui/theme-toggle.d.ts +0 -24
- package/dist/kernel/components/ui/theme-toggle.js +0 -58
- package/dist/kernel/framework-icons.d.ts +0 -1
- package/dist/kernel/framework-icons.js +0 -39
- package/dist/link-CYaCRDb6.d.ts +0 -35
- package/release/app/lucide/package.json +0 -30
- package/release/app/lucide/pnpm-lock.yaml.template +0 -2905
- package/release/app/lucide/pnpm-workspace.yaml +0 -11
- package/release/app/tabler/package.json +0 -30
- package/release/app/tabler/pnpm-lock.yaml.template +0 -2911
- package/release/app/tabler/pnpm-workspace.yaml +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// src/components/block/
|
|
2
|
-
import { CollapsibleBreadcrumbTrail } from "@
|
|
3
|
-
import { jsx } from "
|
|
1
|
+
// src/components/block/navbar/nav-breadcrumb.tsx
|
|
2
|
+
import { CollapsibleBreadcrumbTrail } from "@components/ui/breadcrumb-trail";
|
|
3
|
+
import { jsx } from "@publish.os/nextjs/jsx-runtime";
|
|
4
4
|
function titleFor(node) {
|
|
5
5
|
return node.title;
|
|
6
6
|
}
|
|
@@ -15,7 +15,14 @@ function rankFor(node) {
|
|
|
15
15
|
function findCrumbs(nodes, pathname, parents = []) {
|
|
16
16
|
let matches = [];
|
|
17
17
|
for (let node of nodes) {
|
|
18
|
-
let path = pathFor(node), nextParents = path ? [
|
|
18
|
+
let path = pathFor(node), nextParents = path ? [
|
|
19
|
+
...parents,
|
|
20
|
+
{
|
|
21
|
+
title: titleFor(node),
|
|
22
|
+
path,
|
|
23
|
+
href: "href" in node && typeof node.href == "string" ? node.href : path
|
|
24
|
+
}
|
|
25
|
+
] : parents;
|
|
19
26
|
if (path === pathname && matches.push({
|
|
20
27
|
crumbs: nextParents.map((crumb, index) => ({
|
|
21
28
|
...crumb,
|
|
@@ -38,13 +45,20 @@ function groupFallback(tree, pathname) {
|
|
|
38
45
|
).sort((a, b) => b.path.length - a.path.length);
|
|
39
46
|
for (let { group, path } of groups)
|
|
40
47
|
if (pathname.startsWith(`${path}/`))
|
|
41
|
-
return [
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
title: titleFor(group),
|
|
51
|
+
path,
|
|
52
|
+
href: "href" in group && typeof group.href == "string" ? group.href : path
|
|
53
|
+
}
|
|
54
|
+
];
|
|
42
55
|
return [];
|
|
43
56
|
}
|
|
44
57
|
function buildCrumbs(site, tree, pathname) {
|
|
45
58
|
let root = {
|
|
46
59
|
title: site.name,
|
|
47
60
|
path: "/",
|
|
61
|
+
href: "/",
|
|
48
62
|
current: pathname === "/"
|
|
49
63
|
};
|
|
50
64
|
if (pathname === "/") return [root];
|
|
@@ -60,15 +74,16 @@ function buildCrumbs(site, tree, pathname) {
|
|
|
60
74
|
function NavBreadcrumb({
|
|
61
75
|
currentPath = "/",
|
|
62
76
|
showRoot = !0,
|
|
77
|
+
size = "sm",
|
|
63
78
|
site,
|
|
64
79
|
tree
|
|
65
80
|
}) {
|
|
66
81
|
let crumbs = buildCrumbs(site, tree, currentPath), items = (showRoot ? crumbs : crumbs.slice(1)).map((crumb) => ({
|
|
67
82
|
current: crumb.current,
|
|
68
|
-
href: crumb.
|
|
83
|
+
href: crumb.href,
|
|
69
84
|
title: crumb.title
|
|
70
85
|
}));
|
|
71
|
-
return items.length === 0 ? null : /* @__PURE__ */ jsx(CollapsibleBreadcrumbTrail, { items, size
|
|
86
|
+
return items.length === 0 ? null : /* @__PURE__ */ jsx(CollapsibleBreadcrumbTrail, { items, size });
|
|
72
87
|
}
|
|
73
88
|
export {
|
|
74
89
|
NavBreadcrumb
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { LogoBlockLogo, LogoBlockAsset } from './logo-block.js';
|
|
3
|
-
import { S as SiteData, T as TreeNode } from '../../../types-
|
|
3
|
+
import { S as SiteData, T as TreeNode } from '../../../types-CUtrppxt.js';
|
|
4
4
|
|
|
5
5
|
type NavbarProps = {
|
|
6
6
|
logo?: NavbarLogo;
|
|
@@ -11,6 +11,6 @@ type NavbarProps = {
|
|
|
11
11
|
};
|
|
12
12
|
type NavbarLogoAsset = LogoBlockAsset;
|
|
13
13
|
type NavbarLogo = LogoBlockLogo;
|
|
14
|
-
declare function Navbar({ logo, site, siteTitle,
|
|
14
|
+
declare function Navbar({ logo, showThemeToggle, site, siteTitle, tree, }: NavbarProps): react_jsx_runtime.JSX.Element;
|
|
15
15
|
|
|
16
16
|
export { Navbar, type NavbarLogo, type NavbarLogoAsset };
|
|
@@ -1,95 +1,436 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/block/
|
|
3
|
+
// src/components/block/navbar/navbar.tsx
|
|
4
4
|
import {
|
|
5
5
|
LogoBlock
|
|
6
|
-
} from "@
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { ThemeToggle } from "@
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
import {
|
|
12
|
+
Drawer,
|
|
13
|
+
DrawerClose,
|
|
14
|
+
DrawerDescription,
|
|
15
|
+
DrawerPopup,
|
|
16
|
+
DrawerPortal,
|
|
17
|
+
DrawerTitle,
|
|
18
|
+
DrawerTrigger,
|
|
19
|
+
DrawerViewport
|
|
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
|
+
import {
|
|
24
|
+
ArrowRightIcon,
|
|
25
|
+
CaretLeftIcon,
|
|
26
|
+
CaretRightIcon,
|
|
27
|
+
ListIcon,
|
|
28
|
+
XIcon
|
|
29
|
+
} from "@phosphor-icons/react/ssr";
|
|
30
|
+
import NextLink2 from "next/link";
|
|
14
31
|
import { usePathname } from "next/navigation";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
32
|
+
import { useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
33
|
+
|
|
34
|
+
// src/components/block/navbar/group-navigation.tsx
|
|
35
|
+
import { Button } from "@components/ui/button";
|
|
36
|
+
import { Link } from "@components/ui/link";
|
|
37
|
+
import {
|
|
38
|
+
Menu,
|
|
39
|
+
MenuLinkItem,
|
|
40
|
+
MenuPopup,
|
|
41
|
+
MenuPortal,
|
|
42
|
+
MenuPositioner,
|
|
43
|
+
MenuTrigger
|
|
44
|
+
} from "@components/ui/menu";
|
|
45
|
+
import { CaretDownIcon } from "@phosphor-icons/react/ssr";
|
|
46
|
+
import NextLink from "next/link";
|
|
47
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
48
|
+
import { jsx, jsxs } from "@publish.os/nextjs/jsx-runtime";
|
|
49
|
+
function GroupNavigation({
|
|
50
|
+
currentPath,
|
|
51
|
+
tree
|
|
52
|
+
}) {
|
|
53
|
+
let groups = tree.filter(
|
|
54
|
+
(node) => node.type === "section" && typeof node.path == "string" && typeof node.group == "string"
|
|
55
|
+
), activeGroup = groups.filter(
|
|
56
|
+
({ path }) => currentPath === path || currentPath.startsWith(path === "/" ? "/" : `${path}/`)
|
|
57
|
+
).reduce(
|
|
58
|
+
(active, group) => !active || group.path.length > active.path.length ? group : active,
|
|
59
|
+
void 0
|
|
60
|
+
), navRef = useRef(null), linksRef = useRef(null), [overflow, setOverflow] = useState(!1), hasGroups = groups.length > 1;
|
|
61
|
+
if (useLayoutEffect(() => {
|
|
62
|
+
if (!hasGroups) return;
|
|
63
|
+
let nav = navRef.current, links = linksRef.current, win = nav?.ownerDocument.defaultView;
|
|
64
|
+
if (!nav || !links || !win?.ResizeObserver) return;
|
|
65
|
+
let measure = () => {
|
|
66
|
+
nav.clientWidth > 0 && setOverflow(links.getBoundingClientRect().width > nav.clientWidth - 4);
|
|
67
|
+
}, observer = new win.ResizeObserver(measure);
|
|
68
|
+
return observer.observe(nav), observer.observe(links), measure(), () => observer.disconnect();
|
|
69
|
+
}, [hasGroups]), !hasGroups) return null;
|
|
70
|
+
let isActive = (path) => activeGroup?.path === path;
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { className: "hidden min-w-0 flex-1 items-center gap-4 md:flex", children: [
|
|
72
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "h-4 w-px shrink-0 bg-stroke-3" }),
|
|
73
|
+
/* @__PURE__ */ jsxs(
|
|
74
|
+
"nav",
|
|
75
|
+
{
|
|
76
|
+
"aria-label": "Site groups",
|
|
77
|
+
className: "relative -m-0.5 min-w-0 flex-1 overflow-hidden p-0.5",
|
|
78
|
+
ref: navRef,
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"ul",
|
|
82
|
+
{
|
|
83
|
+
"aria-hidden": overflow || void 0,
|
|
84
|
+
className: `flex w-max items-center gap-1 ${overflow ? "pointer-events-none invisible absolute top-0" : ""}`,
|
|
85
|
+
inert: overflow || void 0,
|
|
86
|
+
ref: linksRef,
|
|
87
|
+
children: groups.map((group) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
88
|
+
Link,
|
|
89
|
+
{
|
|
90
|
+
active: isActive(group.path),
|
|
91
|
+
"aria-current": isActive(group.path) ? "location" : void 0,
|
|
92
|
+
className: "pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
93
|
+
href: group.href ?? group.path,
|
|
94
|
+
size: "xs",
|
|
95
|
+
target: "_self",
|
|
96
|
+
variant: "button.ghost",
|
|
97
|
+
children: group.title
|
|
98
|
+
}
|
|
99
|
+
) }, group.id))
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
overflow ? /* @__PURE__ */ jsxs(Menu, { children: [
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
MenuTrigger,
|
|
105
|
+
{
|
|
106
|
+
"aria-label": "Browse site groups",
|
|
107
|
+
render: /* @__PURE__ */ jsx(
|
|
108
|
+
Button,
|
|
109
|
+
{
|
|
110
|
+
className: "pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
111
|
+
rightIcon: /* @__PURE__ */ jsx(CaretDownIcon, { "aria-hidden": "true" }),
|
|
112
|
+
size: "xs",
|
|
113
|
+
variant: "ghost"
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
children: "Browse"
|
|
117
|
+
}
|
|
118
|
+
),
|
|
119
|
+
/* @__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
|
+
MenuLinkItem,
|
|
121
|
+
{
|
|
122
|
+
"aria-current": isActive(group.path) ? "location" : void 0,
|
|
123
|
+
className: "whitespace-normal break-words pointer-coarse:min-h-11",
|
|
124
|
+
render: /* @__PURE__ */ jsx(NextLink, { href: group.href ?? group.path }),
|
|
125
|
+
children: group.title
|
|
126
|
+
},
|
|
127
|
+
group.id
|
|
128
|
+
)) }) }) })
|
|
129
|
+
] }) : null
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
] });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// src/components/block/navbar/mobile-navigation-tree.tsx
|
|
137
|
+
import { Link as Link2 } from "@components/ui/link";
|
|
138
|
+
import { ScrollArea } from "@components/ui/scroll-area";
|
|
139
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "@publish.os/nextjs/jsx-runtime";
|
|
140
|
+
function MobileNavigationTree({
|
|
141
|
+
currentPath,
|
|
142
|
+
indexCurrentPath,
|
|
143
|
+
indexPath,
|
|
144
|
+
title,
|
|
145
|
+
tree
|
|
146
|
+
}) {
|
|
147
|
+
return /* @__PURE__ */ jsx2(
|
|
148
|
+
ScrollArea,
|
|
149
|
+
{
|
|
150
|
+
className: "min-h-0 flex-1 rounded-none",
|
|
151
|
+
viewportClassName: "overscroll-contain",
|
|
152
|
+
children: /* @__PURE__ */ jsxs2("nav", { "aria-label": `${title} pages`, className: "px-4 py-5", children: [
|
|
153
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-3 wrap-break-word px-3 text-base leading-6 text-foreground-3", children: title }),
|
|
154
|
+
tree.length > 0 ? /* @__PURE__ */ jsx2(PageList, { currentPath, tree }) : /* @__PURE__ */ jsx2(
|
|
155
|
+
PageLink,
|
|
156
|
+
{
|
|
157
|
+
currentPath,
|
|
158
|
+
href: indexPath,
|
|
159
|
+
activePath: indexCurrentPath,
|
|
160
|
+
sameTab: !0,
|
|
161
|
+
title: "Overview"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] })
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function PageList({
|
|
169
|
+
currentPath,
|
|
170
|
+
tree
|
|
171
|
+
}) {
|
|
172
|
+
return /* @__PURE__ */ jsx2("ul", { className: "space-y-1", children: tree.map((node) => /* @__PURE__ */ jsx2(
|
|
173
|
+
"li",
|
|
174
|
+
{
|
|
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(
|
|
177
|
+
PageLink,
|
|
178
|
+
{
|
|
179
|
+
currentPath,
|
|
180
|
+
href: node.type === "page" ? node.href ?? node.path : node.href,
|
|
181
|
+
activePath: node.type === "page" ? node.path : void 0,
|
|
182
|
+
sameTab: node.type === "page",
|
|
183
|
+
title: node.title
|
|
184
|
+
}
|
|
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.title }),
|
|
187
|
+
/* @__PURE__ */ jsx2(PageList, { currentPath, tree: node.children })
|
|
188
|
+
] })
|
|
189
|
+
},
|
|
190
|
+
node.type === "page" ? node.fileID : node.id
|
|
191
|
+
)) });
|
|
18
192
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
193
|
+
function PageLink({
|
|
194
|
+
currentPath,
|
|
195
|
+
href,
|
|
196
|
+
activePath,
|
|
197
|
+
sameTab = !1,
|
|
198
|
+
title
|
|
199
|
+
}) {
|
|
200
|
+
return /* @__PURE__ */ jsx2(
|
|
201
|
+
Link2,
|
|
202
|
+
{
|
|
203
|
+
active: currentPath === (activePath ?? href),
|
|
204
|
+
className: "h-auto min-h-14 w-full min-w-0 justify-start whitespace-normal px-3 py-3 text-start text-lg font-medium leading-normal text-foreground-1",
|
|
205
|
+
href,
|
|
206
|
+
target: sameTab ? "_self" : void 0,
|
|
207
|
+
size: "lg",
|
|
208
|
+
variant: "button.ghost",
|
|
209
|
+
children: /* @__PURE__ */ jsx2("span", { className: "min-w-0 wrap-break-word", children: title })
|
|
210
|
+
}
|
|
211
|
+
);
|
|
21
212
|
}
|
|
213
|
+
|
|
214
|
+
// src/components/block/navbar/navbar.tsx
|
|
215
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "@publish.os/nextjs/jsx-runtime";
|
|
22
216
|
function Navbar({
|
|
23
217
|
logo,
|
|
218
|
+
showThemeToggle = !0,
|
|
24
219
|
site,
|
|
25
220
|
siteTitle,
|
|
26
|
-
showThemeToggle = !0,
|
|
27
221
|
tree
|
|
28
222
|
}) {
|
|
29
|
-
let pathname = usePathname() || "/", headerSite = site ?? { name: siteTitle ?? "Site" }
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
"aria-label": `${headerSite.name} home`,
|
|
36
|
-
className: "inline-flex h-8 shrink-0 items-center text-sm font-semibold text-foreground-1 transition-colors hover:text-accent-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-1",
|
|
37
|
-
href: "/",
|
|
38
|
-
children: /* @__PURE__ */ jsx(LogoBlock, { logo, siteName: headerSite.name })
|
|
39
|
-
}
|
|
40
|
-
),
|
|
41
|
-
/* @__PURE__ */ jsx("div", { className: "hidden h-4 w-px shrink-0 bg-stroke-3 md:block" }),
|
|
42
|
-
/* @__PURE__ */ jsx("div", { className: "min-w-0", children: /* @__PURE__ */ jsx(
|
|
43
|
-
NavBreadcrumb,
|
|
44
|
-
{
|
|
45
|
-
currentPath: pathname,
|
|
46
|
-
showRoot: !1,
|
|
47
|
-
site: headerSite,
|
|
48
|
-
tree
|
|
49
|
-
}
|
|
50
|
-
) })
|
|
223
|
+
let pathname = usePathname() || "/", headerSite = site ?? { name: siteTitle ?? "Site" };
|
|
224
|
+
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
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-1 items-center gap-4", children: [
|
|
226
|
+
/* @__PURE__ */ jsx3(HomeLink, { logo, siteName: headerSite.name }),
|
|
227
|
+
/* @__PURE__ */ jsx3(GroupNavigation, { currentPath: pathname, tree })
|
|
51
228
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
"
|
|
229
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1 md:gap-2", children: [
|
|
230
|
+
/* @__PURE__ */ jsxs3(Search.Root, { children: [
|
|
231
|
+
/* @__PURE__ */ jsx3(Search.Trigger, { className: "max-md:size-11 max-md:border-transparent max-md:p-0 max-md:[&_svg]:size-5 pointer-coarse:md:min-h-11" }),
|
|
232
|
+
/* @__PURE__ */ jsx3(Search.Dialog, {})
|
|
233
|
+
] }),
|
|
234
|
+
showThemeToggle ? /* @__PURE__ */ jsx3(
|
|
235
|
+
ThemeToggle,
|
|
55
236
|
{
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let path = group.path, active = path === activeGroupPath;
|
|
60
|
-
return /* @__PURE__ */ jsx(
|
|
61
|
-
Link,
|
|
62
|
-
{
|
|
63
|
-
active,
|
|
64
|
-
className: cn(
|
|
65
|
-
"px-1 text-foreground-2",
|
|
66
|
-
active && "text-foreground-1"
|
|
67
|
-
),
|
|
68
|
-
href: path,
|
|
69
|
-
size: "sm",
|
|
70
|
-
variant: "link.standalone",
|
|
71
|
-
children: group.title
|
|
72
|
-
},
|
|
73
|
-
group.type === "page" ? group.fileID : group.id
|
|
74
|
-
);
|
|
75
|
-
})
|
|
237
|
+
className: "hidden md:inline-flex pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
238
|
+
size: "sm",
|
|
239
|
+
variant: "ghost"
|
|
76
240
|
}
|
|
77
241
|
) : null,
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
80
|
-
|
|
242
|
+
/* @__PURE__ */ jsx3(
|
|
243
|
+
"span",
|
|
244
|
+
{
|
|
245
|
+
"aria-hidden": "true",
|
|
246
|
+
className: "mx-2 hidden h-4 w-px bg-stroke-3 md:block"
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ jsx3(
|
|
250
|
+
Link3,
|
|
81
251
|
{
|
|
252
|
+
className: "hidden md:inline-flex pointer-coarse:min-h-11",
|
|
82
253
|
href: "/",
|
|
83
|
-
|
|
254
|
+
prefetch: !1,
|
|
255
|
+
rightIcon: /* @__PURE__ */ jsx3(ArrowRightIcon, { "aria-hidden": "true", size: 14 }),
|
|
84
256
|
size: "sm",
|
|
85
257
|
variant: "button.solid",
|
|
86
258
|
children: "Start"
|
|
87
259
|
}
|
|
88
260
|
),
|
|
89
|
-
|
|
261
|
+
/* @__PURE__ */ jsx3(
|
|
262
|
+
MobileNavigation,
|
|
263
|
+
{
|
|
264
|
+
currentPath: pathname,
|
|
265
|
+
logo,
|
|
266
|
+
showThemeToggle,
|
|
267
|
+
siteName: headerSite.name,
|
|
268
|
+
tree
|
|
269
|
+
},
|
|
270
|
+
pathname
|
|
271
|
+
)
|
|
90
272
|
] })
|
|
91
273
|
] }) });
|
|
92
274
|
}
|
|
275
|
+
function NavbarFrame({ children }) {
|
|
276
|
+
return /* @__PURE__ */ jsx3("div", { className: "mx-auto flex min-h-(--layout-global-nav-height) w-full max-w-(--layout-site-max-width) items-center gap-3 border-x border-stroke-3 px-4 py-2 md:gap-4 md:px-5 lg:px-6", children });
|
|
277
|
+
}
|
|
278
|
+
function HomeLink({ logo, siteName }) {
|
|
279
|
+
return /* @__PURE__ */ jsx3(
|
|
280
|
+
NextLink2,
|
|
281
|
+
{
|
|
282
|
+
"aria-label": `${siteName} home`,
|
|
283
|
+
className: "inline-flex min-w-0 items-center py-1.5 text-sm font-semibold leading-5 text-foreground-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-stroke md:max-w-32 md:shrink-0 lg:max-w-48 pointer-coarse:min-h-11",
|
|
284
|
+
href: "/",
|
|
285
|
+
prefetch: !1,
|
|
286
|
+
title: siteName,
|
|
287
|
+
children: /* @__PURE__ */ jsx3("span", { className: "block min-w-0 truncate", children: /* @__PURE__ */ jsx3(LogoBlock, { logo, maxHeight: 20, siteName }) })
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
function MobileNavigation({
|
|
292
|
+
currentPath,
|
|
293
|
+
logo,
|
|
294
|
+
showThemeToggle,
|
|
295
|
+
siteName,
|
|
296
|
+
tree
|
|
297
|
+
}) {
|
|
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 = tree.filter(
|
|
299
|
+
(node) => node.type === "section" && typeof node.path == "string" && typeof node.group == "string"
|
|
300
|
+
), selectedGroup = groups.find((group) => group.id === selectedGroupId), changeOpen = (nextOpen) => {
|
|
301
|
+
setOpen(nextOpen), nextOpen || (setSelectedGroupId(null), returnGroupIdRef.current = null);
|
|
302
|
+
};
|
|
303
|
+
return useEffect(() => {
|
|
304
|
+
if (!open) return;
|
|
305
|
+
(selectedGroupId ? backRef.current : groupButtonRefs.current.get(returnGroupIdRef.current ?? ""))?.focus({ preventScroll: !0 });
|
|
306
|
+
}, [open, selectedGroupId]), useEffect(() => {
|
|
307
|
+
let win = triggerRef.current?.ownerDocument.defaultView;
|
|
308
|
+
if (!win) return;
|
|
309
|
+
let desktop = win.matchMedia("(min-width: 768px)"), closeOnDesktop = () => {
|
|
310
|
+
desktop.matches && (setOpen(!1), setSelectedGroupId(null), returnGroupIdRef.current = null);
|
|
311
|
+
};
|
|
312
|
+
return desktop.addEventListener("change", closeOnDesktop), () => desktop.removeEventListener("change", closeOnDesktop);
|
|
313
|
+
}, []), /* @__PURE__ */ jsxs3(Drawer, { open, onOpenChange: changeOpen, children: [
|
|
314
|
+
/* @__PURE__ */ jsx3(
|
|
315
|
+
DrawerTrigger,
|
|
316
|
+
{
|
|
317
|
+
"aria-label": "Open navigation",
|
|
318
|
+
className: "md:hidden",
|
|
319
|
+
ref: triggerRef,
|
|
320
|
+
render: /* @__PURE__ */ jsx3(Button2, { iconOnly: !0, size: "lg", variant: "ghost" }),
|
|
321
|
+
children: /* @__PURE__ */ jsx3(ListIcon, { "aria-hidden": "true", className: "size-5!" })
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsx3(DrawerPortal, { children: /* @__PURE__ */ jsx3(DrawerViewport, { children: /* @__PURE__ */ jsxs3(
|
|
325
|
+
DrawerPopup,
|
|
326
|
+
{
|
|
327
|
+
className: "animate-mobile-navigation inset-0 flex w-full max-w-none flex-col overflow-hidden border-0 bg-surface-2 p-0 pb-[env(safe-area-inset-bottom)] shadow-none",
|
|
328
|
+
initialFocus: closeRef,
|
|
329
|
+
finalFocus: triggerRef,
|
|
330
|
+
onClick: (event) => {
|
|
331
|
+
let link = event.target.closest("a[href]");
|
|
332
|
+
link && link.getAttribute("target") !== "_blank" && event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey && changeOpen(!1);
|
|
333
|
+
},
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ jsxs3(DrawerTitle, { className: "sr-only", children: [
|
|
336
|
+
selectedGroup ? selectedGroup.title : siteName,
|
|
337
|
+
" navigation"
|
|
338
|
+
] }),
|
|
339
|
+
/* @__PURE__ */ jsx3(DrawerDescription, { className: "sr-only", children: "Browse pages and site controls." }),
|
|
340
|
+
/* @__PURE__ */ jsx3("header", { className: "shrink-0 border-b border-stroke-3", children: /* @__PURE__ */ jsxs3(NavbarFrame, { children: [
|
|
341
|
+
/* @__PURE__ */ jsx3("div", { className: "flex min-w-0 flex-1 items-center", children: /* @__PURE__ */ jsx3(HomeLink, { logo, siteName }) }),
|
|
342
|
+
/* @__PURE__ */ jsx3(
|
|
343
|
+
DrawerClose,
|
|
344
|
+
{
|
|
345
|
+
"aria-label": "Close navigation",
|
|
346
|
+
className: "size-11",
|
|
347
|
+
ref: closeRef,
|
|
348
|
+
render: /* @__PURE__ */ jsx3(Button2, { iconOnly: !0, size: "lg", variant: "ghost" }),
|
|
349
|
+
children: /* @__PURE__ */ jsx3(XIcon, { "aria-hidden": "true", className: "size-5!" })
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] }) }),
|
|
353
|
+
/* @__PURE__ */ jsx3("div", { className: "flex min-h-0 flex-1 flex-col", children: selectedGroup ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
354
|
+
/* @__PURE__ */ jsx3("div", { className: "flex shrink-0 items-center justify-between gap-4 border-b border-stroke-3 px-4 py-2", children: /* @__PURE__ */ jsx3(
|
|
355
|
+
Button2,
|
|
356
|
+
{
|
|
357
|
+
className: "h-auto min-h-11 px-2 py-2 text-base text-accent-1 hover:not-data-disabled:text-accent-1",
|
|
358
|
+
leftIcon: /* @__PURE__ */ jsx3(
|
|
359
|
+
CaretLeftIcon,
|
|
360
|
+
{
|
|
361
|
+
"aria-hidden": "true",
|
|
362
|
+
className: "rtl:rotate-180"
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
onClick: () => setSelectedGroupId(null),
|
|
366
|
+
ref: backRef,
|
|
367
|
+
size: "lg",
|
|
368
|
+
variant: "ghost",
|
|
369
|
+
children: "Back"
|
|
370
|
+
}
|
|
371
|
+
) }),
|
|
372
|
+
/* @__PURE__ */ jsx3(
|
|
373
|
+
MobileNavigationTree,
|
|
374
|
+
{
|
|
375
|
+
currentPath,
|
|
376
|
+
indexPath: selectedGroup.href ?? selectedGroup.path,
|
|
377
|
+
indexCurrentPath: selectedGroup.path,
|
|
378
|
+
title: selectedGroup.title,
|
|
379
|
+
tree: selectedGroup.children
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }) : groups.length > 0 ? /* @__PURE__ */ jsx3(
|
|
383
|
+
ScrollArea2,
|
|
384
|
+
{
|
|
385
|
+
className: "min-h-0 flex-1",
|
|
386
|
+
viewportClassName: "overscroll-contain",
|
|
387
|
+
children: /* @__PURE__ */ jsx3("nav", { "aria-label": "Navigation groups", className: "px-4 py-4", children: /* @__PURE__ */ jsx3("ul", { className: "space-y-1", children: groups.map((group) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsx3(
|
|
388
|
+
Button2,
|
|
389
|
+
{
|
|
390
|
+
className: "h-auto min-h-12 w-full justify-between whitespace-normal px-3 py-3 text-start text-lg",
|
|
391
|
+
onClick: () => {
|
|
392
|
+
returnGroupIdRef.current = group.id, setSelectedGroupId(group.id);
|
|
393
|
+
},
|
|
394
|
+
ref: (button) => {
|
|
395
|
+
button ? groupButtonRefs.current.set(group.id, button) : groupButtonRefs.current.delete(group.id);
|
|
396
|
+
},
|
|
397
|
+
rightIcon: /* @__PURE__ */ jsx3(CaretRightIcon, { "aria-hidden": "true" }),
|
|
398
|
+
size: "lg",
|
|
399
|
+
variant: "ghost",
|
|
400
|
+
children: /* @__PURE__ */ jsx3("span", { className: "min-w-0 wrap-break-word", children: group.title })
|
|
401
|
+
}
|
|
402
|
+
) }, group.id)) }) })
|
|
403
|
+
}
|
|
404
|
+
) : /* @__PURE__ */ jsx3(
|
|
405
|
+
Sidebar,
|
|
406
|
+
{
|
|
407
|
+
className: "w-full min-w-0 max-w-none",
|
|
408
|
+
currentPath,
|
|
409
|
+
tree
|
|
410
|
+
}
|
|
411
|
+
) }),
|
|
412
|
+
selectedGroup ? null : /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 flex-col gap-4 border-t border-stroke-3 px-4 py-4", children: [
|
|
413
|
+
showThemeToggle ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between gap-3 text-sm text-foreground-2", children: [
|
|
414
|
+
/* @__PURE__ */ jsx3("span", { children: "Theme" }),
|
|
415
|
+
/* @__PURE__ */ jsx3(ThemeToggle, { size: "lg", variant: "ghost" })
|
|
416
|
+
] }) : null,
|
|
417
|
+
/* @__PURE__ */ jsx3(
|
|
418
|
+
Link3,
|
|
419
|
+
{
|
|
420
|
+
href: "/",
|
|
421
|
+
prefetch: !1,
|
|
422
|
+
rightIcon: /* @__PURE__ */ jsx3(ArrowRightIcon, { "aria-hidden": "true", size: 16 }),
|
|
423
|
+
size: "lg",
|
|
424
|
+
variant: "button.solid",
|
|
425
|
+
children: "Start"
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] })
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
) }) })
|
|
432
|
+
] });
|
|
433
|
+
}
|
|
93
434
|
export {
|
|
94
435
|
Navbar
|
|
95
436
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/components/block/navigation
|
|
3
|
+
// src/components/block/navigation-progress.tsx
|
|
4
4
|
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,
|
|
@@ -111,6 +111,7 @@ function NavigationProgressContent() {
|
|
|
111
111
|
Progress,
|
|
112
112
|
{
|
|
113
113
|
"aria-label": "Page navigation",
|
|
114
|
+
"aria-hidden": !isVisible,
|
|
114
115
|
className: cn(
|
|
115
116
|
"pointer-events-none fixed left-0 right-0 top-0 z-progress overflow-hidden transition-opacity duration-300",
|
|
116
117
|
isVisible ? "opacity-100" : "opacity-0"
|
|
@@ -127,6 +128,8 @@ function NavigationProgressContent() {
|
|
|
127
128
|
progress === 0 && "scale-x-0"
|
|
128
129
|
),
|
|
129
130
|
style: {
|
|
131
|
+
// Keep Base UI's percentage width from multiplying the animated scale.
|
|
132
|
+
width: "100%",
|
|
130
133
|
transform: isExiting ? "scaleX(0)" : `scaleX(${Math.max(0, Math.min(100, progress)) / 100})`,
|
|
131
134
|
transformOrigin: isExiting ? "right" : "left",
|
|
132
135
|
transition: isExiting ? `transform ${navigationProgressConfig.exitDuration}ms var(--animation-ease-progress-exit)` : `transform ${navigationProgressConfig.completeDuration}ms var(--animation-ease-progress)`
|