@publish.os/nextjs 0.0.1-alpha.8 → 0.0.1-alpha.90
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 +7 -3
- package/compiler-assets/nextjs/defaults/group/page.tsx +35 -43
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +22 -11
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +1 -4
- package/compiler-assets/nextjs/defaults/root/css/animation.css +131 -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/generated-group-page.tsx +19 -2
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +16 -2
- package/compiler-assets/nextjs/shims/global-layout.tsx +11 -43
- package/compiler-assets/nextjs/shims/proxy.ts +21 -9
- 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 +34 -0
- package/compiler-assets/nextjs/shims/site-heading-level.tsx +14 -0
- package/compiler-assets/nextjs/shims/site-mdx-components.tsx +100 -0
- package/compiler-assets/nextjs/shims/site-mdx.tsx +12 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +41 -25
- package/dist/build-operation-2JAYBSKF.js +83 -0
- package/dist/button-CtzUJB8u.d.ts +11 -0
- package/dist/{button-CFdx-ohV.d.ts → button-c3WGnxIj.d.ts} +3 -3
- package/dist/chunk-535TM4A5.js +1455 -0
- package/dist/chunk-726GV2NF.js +2344 -0
- package/dist/chunk-7OGTPSKI.js +156 -0
- package/dist/chunk-AI2UULNX.js +9 -0
- package/dist/chunk-B2V22WRT.js +297 -0
- package/dist/chunk-DLDFHU7Y.js +191 -0
- package/dist/chunk-DWA3ZRGW.js +142 -0
- package/dist/chunk-GGKFQ3MA.js +621 -0
- package/dist/chunk-H6XILMZX.js +6154 -0
- package/dist/chunk-NECL5IBJ.js +318 -0
- package/dist/chunk-SVYGXXYR.js +36 -0
- package/dist/chunk-UF6ATARM.js +1100 -0
- package/dist/chunk-VO2I7MTM.js +56 -0
- package/dist/chunk-WDY4IK6Z.js +128 -0
- package/dist/chunk-WKTEO6RS.js +586 -0
- package/dist/chunk-YLTOLYWM.js +92 -0
- package/dist/compiler.d.ts +41 -7
- package/dist/compiler.js +48 -13143
- package/dist/compose-NN23UJGC.js +13 -0
- package/dist/config/createNextConfig.js +13 -0
- package/dist/dev-operation-TZDVJCN7.js +1055 -0
- package/dist/framework-selection-X4U6Y6QC.js +10 -0
- package/dist/ide-support-ZNW7ODFY.js +15 -0
- package/dist/index.d.ts +15 -3
- package/dist/kernel/components/blocks/AgentActions.js +71 -61
- package/dist/kernel/components/blocks/design-system-preview.d.ts +1 -1
- package/dist/kernel/components/blocks/design-system-preview.js +32 -13
- package/dist/kernel/components/blocks/link-playground.js +2 -2
- package/dist/kernel/components/blocks/logo-block.js +2 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +10 -2
- package/dist/kernel/components/blocks/nav-breadcrumb.js +20 -5
- package/dist/kernel/components/blocks/navbar.d.ts +2 -2
- package/dist/kernel/components/blocks/navbar.js +401 -60
- package/dist/kernel/components/blocks/navigation-progress-playground.js +4 -4
- package/dist/kernel/components/blocks/navigation-progress.js +4 -1
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +11 -23
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +5 -4
- package/dist/kernel/components/blocks/search.d.ts +83 -58
- package/dist/kernel/components/blocks/search.js +553 -426
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +11 -9
- package/dist/kernel/components/blocks/sidebar.d.ts +3 -3
- package/dist/kernel/components/blocks/sidebar.js +18 -11
- package/dist/kernel/components/blocks/theme-toggle.d.ts +2 -2
- package/dist/kernel/components/blocks/theme-toggle.js +48 -2
- package/dist/kernel/components/blocks/toc.js +3 -3
- package/dist/kernel/components/mdx/components/blockquote.js +1 -1
- package/dist/kernel/components/mdx/components/callout.d.ts +5 -7
- package/dist/kernel/components/mdx/components/callout.js +66 -35
- 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 +60 -0
- package/dist/kernel/components/mdx/components/figure-caption.js +1 -1
- package/dist/kernel/components/mdx/components/figure.js +1 -1
- package/dist/kernel/components/mdx/components/heading-copy-link.js +3 -3
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +1 -1
- package/dist/kernel/components/mdx/components/image.js +77 -56
- package/dist/kernel/components/mdx/components/inline-code.js +1 -1
- package/dist/kernel/components/mdx/components/kbd.d.ts +2 -2
- package/dist/kernel/components/mdx/components/kbd.js +3 -2
- package/dist/kernel/components/mdx/components/link.d.ts +35 -4
- package/dist/kernel/components/mdx/components/link.js +1 -1
- package/dist/kernel/components/mdx/components/paragraph.js +1 -4
- package/dist/kernel/components/mdx/components/task-list.js +1 -1
- package/dist/kernel/components/mdx/components/video-player.js +2 -2
- package/dist/kernel/components/mdx/components/video.js +1 -1
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/mdx.d.ts +12 -8
- package/dist/kernel/components/mdx/mdx.js +115 -39
- package/dist/kernel/components/mdx/rehype-heading-ids.js +1 -1
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +6 -23
- package/dist/kernel/components/ui/breadcrumb.d.ts +11 -3
- package/dist/kernel/components/ui/breadcrumb.js +6 -4
- package/dist/kernel/components/ui/button-group.d.ts +1 -1
- package/dist/kernel/components/ui/button-group.js +5 -4
- package/dist/kernel/components/ui/button.d.ts +2 -2
- package/dist/kernel/components/ui/button.js +6 -6
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/drawer.d.ts +3 -1
- package/dist/kernel/components/ui/drawer.js +5 -1
- package/dist/kernel/components/ui/input.d.ts +4 -4
- package/dist/kernel/components/ui/kbd.d.ts +1 -1
- package/dist/kernel/components/ui/kbd.js +9 -16
- package/dist/kernel/components/ui/link.d.ts +5 -3
- package/dist/kernel/components/ui/link.js +10 -9
- package/dist/kernel/components/ui/menu.js +5 -5
- 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 +2 -2
- package/dist/kernel/components/ui/progress.js +1 -1
- package/dist/kernel/components/ui/scroll-area.d.ts +8 -8
- package/dist/kernel/components/ui/scroll-area.js +4 -4
- package/dist/kernel/components/ui/select.js +7 -10
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/theme-toggle.d.ts +3 -3
- package/dist/kernel/components/ui/theme-toggle.js +4 -9
- package/dist/kernel/defaults.registry.d.ts +9 -9
- package/dist/kernel/defaults.registry.js +9 -9
- package/dist/kernel/routes/agent/markdown.d.ts +0 -1
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.d.ts +1 -1
- package/dist/kernel/routes/metadata/feed.js +13 -9
- package/dist/kernel/routes/metadata/llms.d.ts +2 -1
- package/dist/kernel/routes/metadata/llms.js +4 -4
- 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 +6 -3
- package/dist/kernel/routes/metadata/sitemap.js +48 -20
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +20 -12
- package/dist/kernel/routes/pages/leaf.d.ts +2 -2
- package/dist/kernel/routes/pages/leaf.js +20 -12
- package/dist/kernel/routes/pages/root.d.ts +2 -2
- package/dist/kernel/routes/pages/root.js +18 -12
- package/dist/resolvers/manifest-resolver.js +29 -6
- package/dist/search.d.ts +6 -7
- package/dist/search.js +47 -22
- package/dist/{sidebar-types-Bgchdfd6.d.ts → sidebar-types-DKpR27II.d.ts} +1 -1
- package/dist/{types-CIwwieNw.d.ts → types-BzkZty3r.d.ts} +23 -3
- 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.d.ts +14 -6
- package/dist/validate-local-source-XRL2Y7XE.js +14 -0
- package/dist/validate-publish-os-source-DAPZ4QGE.js +12 -0
- package/init/seed/minimal/.gitignore +1 -0
- 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
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +6 -10
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +1 -1
- package/init/seed/minimal/publish.os/docs/content/{theme.mdx → themes.mdx} +14 -12
- package/init/seed/minimal/publish.os/publish.os.config.json +3 -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 +4 -1
- 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 +12 -26
- package/release/app/phosphor/package.json +3 -3
- package/release/app/phosphor/pnpm-lock.yaml.template +523 -360
- package/release/app/phosphor/pnpm-workspace.yaml +3 -0
- package/release/compiler/package.json +1 -1
- package/release/compiler/pnpm-lock.yaml.template +439 -286
- package/release/compiler/pnpm-workspace.yaml +3 -0
- package/release/release.json +7 -36
- 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/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/framework-icons.d.ts +0 -1
- package/dist/kernel/framework-icons.js +0 -39
- package/dist/link-CYaCRDb6.d.ts +0 -35
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +0 -58
- package/dist/types-sM2g9nW0.d.ts +0 -12
- 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,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
6
|
} from "@publish.os/nextjs/kernel/components/blocks/logo-block";
|
|
7
|
-
import { NavBreadcrumb } from "@publish.os/nextjs/kernel/components/blocks/nav-breadcrumb";
|
|
8
7
|
import { Search } from "@publish.os/nextjs/kernel/components/blocks/search";
|
|
8
|
+
import { Sidebar } from "@publish.os/nextjs/kernel/components/blocks/sidebar";
|
|
9
9
|
import { ThemeToggle } from "@publish.os/nextjs/kernel/components/blocks/theme-toggle";
|
|
10
|
+
import { Button as Button2 } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
11
|
+
import {
|
|
12
|
+
Drawer,
|
|
13
|
+
DrawerClose,
|
|
14
|
+
DrawerDescription,
|
|
15
|
+
DrawerPopup,
|
|
16
|
+
DrawerPortal,
|
|
17
|
+
DrawerTitle,
|
|
18
|
+
DrawerTrigger,
|
|
19
|
+
DrawerViewport
|
|
20
|
+
} from "@publish.os/nextjs/kernel/components/ui/drawer";
|
|
21
|
+
import { Link as Link3 } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
22
|
+
import { ScrollArea as ScrollArea2 } from "@publish.os/nextjs/kernel/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";
|
|
31
|
+
import { usePathname } from "next/navigation";
|
|
32
|
+
import { useEffect, useRef as useRef2, useState as useState2 } from "react";
|
|
33
|
+
|
|
34
|
+
// src/components/block/navbar/group-navigation.tsx
|
|
35
|
+
import { Button } from "@publish.os/nextjs/kernel/components/ui/button";
|
|
10
36
|
import { Link } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
11
|
-
import {
|
|
12
|
-
|
|
37
|
+
import {
|
|
38
|
+
Menu,
|
|
39
|
+
MenuLinkItem,
|
|
40
|
+
MenuPopup,
|
|
41
|
+
MenuPortal,
|
|
42
|
+
MenuPositioner,
|
|
43
|
+
MenuTrigger
|
|
44
|
+
} from "@publish.os/nextjs/kernel/components/ui/menu";
|
|
45
|
+
import { CaretDownIcon } from "@phosphor-icons/react/ssr";
|
|
13
46
|
import NextLink from "next/link";
|
|
14
|
-
import {
|
|
47
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
15
48
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
function
|
|
17
|
-
|
|
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: "data-[state=path-active]:text-foreground-1 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 "@publish.os/nextjs/kernel/components/ui/link";
|
|
138
|
+
import { ScrollArea } from "@publish.os/nextjs/kernel/components/ui/scroll-area";
|
|
139
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/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 "react/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
|
};
|
|
@@ -234,7 +234,7 @@ function OriginControl({
|
|
|
234
234
|
"button",
|
|
235
235
|
{
|
|
236
236
|
className: cn(
|
|
237
|
-
"h-7 rounded-[max(calc(var(--radius-button)
|
|
237
|
+
"h-7 rounded-[max(calc(var(--radius-button)-0.25rem),0px)] text-xs font-medium text-foreground-3 transition-colors",
|
|
238
238
|
origin === value && "bg-surface-1 text-foreground-1 shadow-sm"
|
|
239
239
|
),
|
|
240
240
|
onClick: () => onChange(origin),
|
|
@@ -346,7 +346,7 @@ function NavigationProgressPlayground() {
|
|
|
346
346
|
return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-surface-page text-foreground-1", children: /* @__PURE__ */ jsxs("div", { className: "grid min-h-screen lg:grid-cols-[1fr_23rem]", children: [
|
|
347
347
|
/* @__PURE__ */ jsxs("main", { className: "relative min-h-screen overflow-hidden", children: [
|
|
348
348
|
/* @__PURE__ */ jsx("div", { className: "absolute left-5 top-5 text-sm font-medium text-foreground-4", children: "Inline" }),
|
|
349
|
-
/* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center px-8 py-20", children: /* @__PURE__ */ jsxs("section", { className: "border-shadow-3 relative flex h-
|
|
349
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center px-8 py-20", children: /* @__PURE__ */ jsxs("section", { className: "border-shadow-3 relative flex h-60 w-full max-w-4xl flex-col items-center justify-center overflow-hidden bg-surface-1", children: [
|
|
350
350
|
/* @__PURE__ */ jsx(
|
|
351
351
|
ProgressPreview,
|
|
352
352
|
{
|
|
@@ -378,7 +378,7 @@ function NavigationProgressPlayground() {
|
|
|
378
378
|
"button",
|
|
379
379
|
{
|
|
380
380
|
className: cn(
|
|
381
|
-
"h-8 rounded-[max(calc(var(--radius-button)
|
|
381
|
+
"h-8 rounded-[max(calc(var(--radius-button)-0.25rem),0px)] text-xs font-medium text-foreground-3 transition-colors",
|
|
382
382
|
activePreset === preset && "bg-surface-1 text-foreground-1 shadow-sm"
|
|
383
383
|
),
|
|
384
384
|
onClick: () => applyPreset(preset),
|
|
@@ -612,7 +612,7 @@ function NavigationProgressPlayground() {
|
|
|
612
612
|
/* @__PURE__ */ jsx(
|
|
613
613
|
"textarea",
|
|
614
614
|
{
|
|
615
|
-
className: "min-h-
|
|
615
|
+
className: "min-h-104 resize-none rounded-panel border border-stroke-2 bg-surface-2 p-3 font-mono text-xs leading-5 text-foreground-1 outline-none focus:border-accent-1",
|
|
616
616
|
readOnly: !0,
|
|
617
617
|
value: output
|
|
618
618
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
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,
|
|
@@ -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)`
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
// src/components/block/navigation/next-prev.tsx
|
|
2
|
-
import {
|
|
3
|
-
FrameworkChevronLeftIcon as ChevronLeft,
|
|
4
|
-
FrameworkChevronRightIcon as ChevronRight
|
|
5
|
-
} from "@publish.os/nextjs/kernel/framework-icons";
|
|
1
|
+
// src/components/block/page-navigation/next-prev.tsx
|
|
2
|
+
import { CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react/ssr";
|
|
6
3
|
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
7
4
|
import NextLink from "next/link";
|
|
8
5
|
|
|
9
|
-
// src/components/block/navigation/page-nodes.ts
|
|
6
|
+
// src/components/block/page-navigation/page-nodes.ts
|
|
10
7
|
function pageNodes(nodes) {
|
|
11
8
|
return nodes.flatMap((node) => node.type === "page" ? [node] : node.type === "section" || node.type === "folder" ? pageNodes(node.children) : []);
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
// src/components/block/navigation/next-prev.tsx
|
|
11
|
+
// src/components/block/page-navigation/next-prev.tsx
|
|
15
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
13
|
function DirectionIcon({ direction }) {
|
|
17
|
-
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(
|
|
14
|
+
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 }) });
|
|
18
15
|
}
|
|
19
16
|
function NavigationCard({
|
|
20
17
|
direction,
|
|
@@ -25,10 +22,10 @@ function NavigationCard({
|
|
|
25
22
|
NextLink,
|
|
26
23
|
{
|
|
27
24
|
className: cn(
|
|
28
|
-
"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
|
|
25
|
+
"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!",
|
|
29
26
|
isNext && "md:text-right"
|
|
30
27
|
),
|
|
31
|
-
href: page.path,
|
|
28
|
+
href: page.href ?? page.path,
|
|
32
29
|
children: /* @__PURE__ */ jsxs(
|
|
33
30
|
"span",
|
|
34
31
|
{
|
|
@@ -60,19 +57,10 @@ function NavigationCard({
|
|
|
60
57
|
}
|
|
61
58
|
function NextPrev({ className, currentPath, tree }) {
|
|
62
59
|
let pages = pageNodes(tree), index = pages.findIndex((page) => page.path === currentPath), previous = index > 0 ? pages[index - 1] : null, next = index >= 0 ? pages[index + 1] : null, hasBoth = !!(previous && next);
|
|
63
|
-
return !previous && !next ? null : /* @__PURE__ */ jsx("nav", { "aria-label": "Previous and next pages", className, children: /* @__PURE__ */ jsxs(
|
|
64
|
-
"
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
"grid gap-4 border-t border-stroke-3 pt-6",
|
|
68
|
-
hasBoth && "md:grid-cols-2"
|
|
69
|
-
),
|
|
70
|
-
children: [
|
|
71
|
-
previous ? /* @__PURE__ */ jsx(NavigationCard, { direction: "previous", page: previous }) : null,
|
|
72
|
-
next ? /* @__PURE__ */ jsx(NavigationCard, { direction: "next", page: next }) : null
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
) });
|
|
60
|
+
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
|
+
previous ? /* @__PURE__ */ jsx(NavigationCard, { direction: "previous", page: previous }) : null,
|
|
62
|
+
next ? /* @__PURE__ */ jsx(NavigationCard, { direction: "next", page: next }) : null
|
|
63
|
+
] }) });
|
|
76
64
|
}
|
|
77
65
|
export {
|
|
78
66
|
NextPrev
|