@publish.os/nextjs 0.0.1-alpha.6 → 0.0.1-alpha.7
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/README.md +3 -5
- package/compiler-assets/nextjs/defaults/app/globals.css +6 -0
- package/compiler-assets/nextjs/defaults/group/layout.tsx +23 -0
- package/compiler-assets/nextjs/defaults/group/leaf.tsx +48 -0
- package/compiler-assets/nextjs/defaults/group/page.tsx +50 -0
- package/compiler-assets/nextjs/defaults/project/next.config.mjs +45 -0
- package/compiler-assets/nextjs/defaults/project/postcss.config.mjs +5 -0
- package/compiler-assets/nextjs/defaults/project/tsconfig.json.template +41 -0
- package/compiler-assets/nextjs/defaults/root/css/animation.css +90 -0
- package/compiler-assets/nextjs/defaults/root/css/components/dialog.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/drawer.css +21 -0
- package/compiler-assets/nextjs/defaults/root/css/components/menu.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/navigation-menu.css +25 -0
- package/compiler-assets/nextjs/defaults/root/css/components/popover.css +17 -0
- package/compiler-assets/nextjs/defaults/root/css/components/select.css +23 -0
- package/compiler-assets/nextjs/defaults/root/css/components/toast.css +19 -0
- package/compiler-assets/nextjs/defaults/root/css/components/tooltip.css +15 -0
- package/compiler-assets/nextjs/defaults/root/css/layout.css +22 -0
- package/compiler-assets/nextjs/defaults/root/css/media.css +81 -0
- package/compiler-assets/nextjs/defaults/root/css/radius.css +49 -0
- package/compiler-assets/nextjs/defaults/root/css/scrollbar.css +43 -0
- package/compiler-assets/nextjs/defaults/root/css/shadow.css +145 -0
- package/compiler-assets/nextjs/defaults/root/css/typography.css +607 -0
- package/compiler-assets/nextjs/defaults/root/css/zindex.css +39 -0
- package/compiler-assets/nextjs/defaults/root/globals.css +191 -0
- package/compiler-assets/nextjs/defaults/root/layout.tsx +19 -0
- package/compiler-assets/nextjs/defaults/root/page.tsx +61 -0
- package/compiler-assets/nextjs/defaults/root/theme.css +50 -0
- package/compiler-assets/nextjs/defaults/source/_internal/logger.ts +21 -0
- package/compiler-assets/nextjs/shims/generated-group-layout.tsx +19 -0
- package/compiler-assets/nextjs/shims/generated-group-page.tsx +18 -0
- package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +21 -0
- package/compiler-assets/nextjs/shims/global-layout.tsx +134 -0
- package/compiler-assets/nextjs/shims/markdown-route.ts +29 -0
- package/compiler-assets/nextjs/shims/og-image-route.ts +18 -0
- package/compiler-assets/nextjs/shims/powered-by-footer.tsx +40 -0
- package/compiler-assets/nextjs/shims/providers.tsx +13 -0
- package/compiler-assets/nextjs/shims/proxy.ts +317 -0
- package/compiler-assets/nextjs/shims/publish-os-theme-provider.tsx +77 -0
- package/compiler-assets/nextjs/shims/root-page.tsx +13 -0
- package/compiler-assets/nextjs/shims/theme-defaults.css +177 -0
- package/dist/button-CFdx-ohV.d.ts +20 -0
- package/dist/cache/tags.js +6 -14
- package/dist/compiler.d.ts +100 -0
- package/dist/compiler.js +13379 -0
- package/dist/config/createNextConfig.d.ts +2 -1
- package/dist/config/createNextConfig.js +16 -12
- package/dist/icons.d.ts +1 -0
- package/dist/icons.js +2 -0
- package/dist/index.d.ts +303 -15
- package/dist/index.js +30 -1198
- package/dist/kernel/components/blocks/AgentActions.d.ts +9 -3
- package/dist/kernel/components/blocks/AgentActions.js +114 -200
- package/dist/kernel/components/blocks/animated-icon-swap.js +4 -25
- package/dist/kernel/components/blocks/color-palette.js +88 -169
- package/dist/kernel/components/blocks/design-system-preview.d.ts +38 -6
- package/dist/kernel/components/blocks/design-system-preview.js +44 -52
- package/dist/kernel/components/blocks/link-playground.js +23 -71
- package/dist/kernel/components/blocks/logo-block.js +18 -47
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +1 -1
- package/dist/kernel/components/blocks/nav-breadcrumb.js +28 -42
- package/dist/kernel/components/blocks/navbar.d.ts +1 -1
- package/dist/kernel/components/blocks/navbar.js +14 -41
- package/dist/kernel/components/blocks/navigation-progress-playground.js +56 -149
- package/dist/kernel/components/blocks/navigation-progress.js +53 -157
- package/dist/kernel/components/blocks/next-prev.d.ts +1 -1
- package/dist/kernel/components/blocks/next-prev.js +16 -42
- package/dist/kernel/components/blocks/page-list.d.ts +1 -1
- package/dist/kernel/components/blocks/page-list.js +11 -16
- package/dist/kernel/components/blocks/search.d.ts +13 -2
- package/dist/kernel/components/blocks/search.js +116 -247
- package/dist/kernel/components/blocks/sidebar-node.d.ts +2 -2
- package/dist/kernel/components/blocks/sidebar-node.js +56 -95
- package/dist/kernel/components/blocks/sidebar.d.ts +5 -23
- package/dist/kernel/components/blocks/sidebar.js +35 -103
- package/dist/kernel/components/blocks/theme-toggle.d.ts +7 -3
- package/dist/kernel/components/blocks/theme-toggle.js +2 -2
- package/dist/kernel/components/blocks/toc.js +42 -178
- package/dist/kernel/components/mdx/components/blockquote.js +3 -24
- package/dist/kernel/components/mdx/components/callout.d.ts +1 -1
- package/dist/kernel/components/mdx/components/callout.js +15 -47
- package/dist/kernel/components/mdx/components/code-block.js +2 -2
- package/dist/kernel/components/mdx/components/figure-caption.js +6 -24
- package/dist/kernel/components/mdx/components/figure.js +9 -36
- package/dist/kernel/components/mdx/components/footnotes.js +3 -24
- package/dist/kernel/components/mdx/components/heading-copy-link.js +13 -37
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -3
- package/dist/kernel/components/mdx/components/heading.js +32 -116
- package/dist/kernel/components/mdx/components/hr.d.ts +5 -3
- package/dist/kernel/components/mdx/components/hr.js +2 -2
- package/dist/kernel/components/mdx/components/image-zoom.js +2 -3
- package/dist/kernel/components/mdx/components/image.js +22 -62
- package/dist/kernel/components/mdx/components/inline-code.js +3 -24
- package/dist/kernel/components/mdx/components/kbd.d.ts +9 -4
- package/dist/kernel/components/mdx/components/kbd.js +2 -2
- package/dist/kernel/components/mdx/components/link.d.ts +1 -2
- package/dist/kernel/components/mdx/components/link.js +2 -2
- package/dist/kernel/components/mdx/components/paragraph.js +13 -41
- package/dist/kernel/components/mdx/components/pre.js +3 -24
- package/dist/kernel/components/mdx/components/strikethrough.js +6 -24
- package/dist/kernel/components/mdx/components/table.js +2 -2
- package/dist/kernel/components/mdx/components/task-list.js +6 -28
- package/dist/kernel/components/mdx/components/video-player.js +53 -88
- package/dist/kernel/components/mdx/components/video.js +27 -75
- package/dist/kernel/components/mdx/error-boundary.d.ts +1 -1
- package/dist/kernel/components/mdx/error-boundary.js +12 -15
- package/dist/kernel/components/mdx/error-fallback.js +4 -4
- package/dist/kernel/components/mdx/mdx.d.ts +68 -11
- package/dist/kernel/components/mdx/mdx.js +29 -29
- package/dist/kernel/components/mdx/rehype-heading-ids.js +11 -67
- package/dist/kernel/components/mdx/types.d.ts +1 -1
- package/dist/kernel/components/ui/accordion.js +3 -26
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +23 -7
- package/dist/kernel/components/ui/breadcrumb-trail.js +32 -80
- package/dist/kernel/components/ui/breadcrumb.d.ts +1 -1
- package/dist/kernel/components/ui/breadcrumb.js +20 -54
- package/dist/kernel/components/ui/button-group.d.ts +4 -3
- package/dist/kernel/components/ui/button-group.js +7 -30
- package/dist/kernel/components/ui/button.js +13 -36
- package/dist/kernel/components/ui/card.d.ts +2 -2
- package/dist/kernel/components/ui/card.js +2 -23
- package/dist/kernel/components/ui/dialog.d.ts +9 -9
- package/dist/kernel/components/ui/dialog.js +15 -33
- package/dist/kernel/components/ui/drawer.d.ts +10 -10
- package/dist/kernel/components/ui/drawer.js +15 -33
- package/dist/kernel/components/ui/input.js +6 -30
- package/dist/kernel/components/ui/kbd.js +10 -31
- package/dist/kernel/components/ui/link.d.ts +1 -1
- package/dist/kernel/components/ui/link.js +53 -104
- package/dist/kernel/components/ui/menu.d.ts +21 -21
- package/dist/kernel/components/ui/menu.js +10 -32
- package/dist/kernel/components/ui/meta-key.d.ts +9 -4
- package/dist/kernel/components/ui/meta-key.js +2 -2
- package/dist/kernel/components/ui/navigation-menu.d.ts +14 -14
- package/dist/kernel/components/ui/navigation-menu.js +9 -30
- package/dist/kernel/components/ui/popover.d.ts +10 -10
- package/dist/kernel/components/ui/popover.js +19 -34
- package/dist/kernel/components/ui/progress.js +2 -25
- package/dist/kernel/components/ui/scroll-area.js +39 -118
- package/dist/kernel/components/ui/select.d.ts +15 -15
- package/dist/kernel/components/ui/select.js +19 -35
- package/dist/kernel/components/ui/separator.js +2 -25
- package/dist/kernel/components/ui/table.js +2 -23
- package/dist/kernel/components/ui/tabs.js +39 -99
- package/dist/kernel/components/ui/tag.d.ts +2 -2
- package/dist/kernel/components/ui/tag.js +4 -25
- package/dist/kernel/components/ui/text.d.ts +2 -2
- package/dist/kernel/components/ui/text.js +3 -25
- package/dist/kernel/components/ui/theme-toggle.d.ts +18 -4
- package/dist/kernel/components/ui/theme-toggle.js +18 -44
- package/dist/kernel/components/ui/toast.d.ts +10 -10
- package/dist/kernel/components/ui/toast.js +13 -35
- package/dist/kernel/components/ui/tooltip.d.ts +8 -8
- package/dist/kernel/components/ui/tooltip.js +8 -29
- package/dist/kernel/defaults.registry.d.ts +1 -1
- package/dist/kernel/defaults.registry.js +2 -2
- package/dist/kernel/framework-icons.d.ts +1 -0
- package/dist/kernel/framework-icons.js +39 -0
- package/dist/kernel/routes/agent/markdown.js +36 -65
- package/dist/kernel/routes/layouts/group.d.ts +1 -1
- package/dist/kernel/routes/layouts/group.js +20 -109
- package/dist/kernel/routes/metadata/feed.d.ts +1 -2
- package/dist/kernel/routes/metadata/feed.js +46 -127
- package/dist/kernel/routes/metadata/llms.d.ts +1 -2
- package/dist/kernel/routes/metadata/llms.js +40 -120
- package/dist/kernel/routes/metadata/og-image.d.ts +10 -0
- package/dist/kernel/routes/metadata/og-image.js +264 -198
- package/dist/kernel/routes/metadata/robots.d.ts +1 -2
- package/dist/kernel/routes/metadata/robots.js +21 -90
- package/dist/kernel/routes/metadata/sitemap.d.ts +1 -2
- package/dist/kernel/routes/metadata/sitemap.js +36 -102
- package/dist/kernel/routes/pages/group.d.ts +1 -1
- package/dist/kernel/routes/pages/group.js +42 -137
- package/dist/kernel/routes/pages/leaf.d.ts +1 -1
- package/dist/kernel/routes/pages/leaf.js +74 -213
- package/dist/kernel/routes/pages/root.d.ts +1 -1
- package/dist/kernel/routes/pages/root.js +37 -108
- package/dist/keyboard-shortcuts.js +69 -141
- package/dist/link-CYaCRDb6.d.ts +35 -0
- package/dist/resolvers/manifest-resolver.d.ts +3 -3
- package/dist/resolvers/manifest-resolver.js +15 -21
- package/dist/route-metadata-og-image-BeKKFHg7.d.ts +58 -0
- package/dist/search.d.ts +81 -4
- package/dist/search.js +124 -195
- package/dist/sidebar-types-Bgchdfd6.d.ts +25 -0
- package/dist/theme-scope.d.ts +15 -0
- package/dist/theme-scope.js +23 -0
- package/dist/types-B_b3C0U6.d.ts +63 -0
- package/dist/types-CIwwieNw.d.ts +127 -0
- package/dist/types-DHBm7-j6.d.ts +57 -0
- package/dist/types-sM2g9nW0.d.ts +12 -0
- package/dist/types.d.ts +0 -1
- package/dist/types.js +1 -1
- package/dist/utils/cn.d.ts +5 -9
- package/dist/utils/cn.js +13 -7
- package/dist/utils/heading-ids.js +20 -47
- package/dist/utils/pretty-date.js +7 -13
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.dark.png +0 -0
- package/init/seed/minimal/publish.os/assets/logo/publish-dev-logo.png +0 -0
- package/init/seed/minimal/publish.os/docs/content/get-started.mdx +54 -0
- package/init/seed/minimal/publish.os/docs/content/groups.mdx +31 -0
- package/init/seed/minimal/publish.os/docs/content/theme.mdx +64 -0
- package/init/seed/minimal/publish.os/publish.os.config.json +21 -0
- package/init/seed/minimal/publish.os/theme.css +47 -0
- package/init/seed/minimal/seed.json +13 -0
- package/package.json +469 -35
- package/release/{package.json → app/lucide/package.json} +11 -5
- package/release/app/lucide/pnpm-lock.yaml.template +2905 -0
- package/release/app/lucide/pnpm-workspace.yaml +11 -0
- package/release/app/phosphor/package.json +30 -0
- package/release/app/phosphor/pnpm-lock.yaml.template +2908 -0
- package/release/app/phosphor/pnpm-workspace.yaml +11 -0
- package/release/app/tabler/package.json +30 -0
- package/release/app/tabler/pnpm-lock.yaml.template +2911 -0
- package/release/app/tabler/pnpm-workspace.yaml +11 -0
- package/release/compiler/package.json +20 -0
- package/release/compiler/pnpm-lock.yaml.template +2432 -0
- package/release/compiler/pnpm-workspace.yaml +11 -0
- package/release/release.json +29 -5
- package/release/runtime-pnpm-lock.yaml +0 -1316
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/components/block/navigation/navigation-progress.tsx
|
|
4
4
|
import {
|
|
5
5
|
Progress,
|
|
6
6
|
ProgressIndicator,
|
|
7
7
|
ProgressTrack
|
|
8
|
-
} from "
|
|
9
|
-
|
|
10
|
-
// src/utils/cn.ts
|
|
11
|
-
import { clsx } from "clsx";
|
|
12
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
13
|
-
var twMerge = extendTailwindMerge({
|
|
14
|
-
extend: {
|
|
15
|
-
classGroups: {
|
|
16
|
-
z: [
|
|
17
|
-
"z-content",
|
|
18
|
-
"z-nav",
|
|
19
|
-
"z-overlay",
|
|
20
|
-
"z-modal",
|
|
21
|
-
"z-search",
|
|
22
|
-
"z-toast",
|
|
23
|
-
"z-progress"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
function cn(...inputs) {
|
|
29
|
-
return twMerge(clsx(inputs));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// src/kernel/components/blocks/navigation-progress.tsx
|
|
8
|
+
} from "@publish.os/nextjs/kernel/components/ui/progress";
|
|
9
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
33
10
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
34
11
|
import { Suspense, useCallback, useEffect, useRef, useState } from "react";
|
|
35
12
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -45,172 +22,91 @@ var navigationProgressConfig = {
|
|
|
45
22
|
timeout: 8e3
|
|
46
23
|
};
|
|
47
24
|
function normalizePath(path) {
|
|
48
|
-
|
|
49
|
-
return normalized || "/";
|
|
25
|
+
return path.replace(/\/+$/, "") || "/";
|
|
50
26
|
}
|
|
51
27
|
function normalizeHref(href) {
|
|
52
|
-
|
|
53
|
-
const [path = "", search = ""] = pathWithSearch.split("?");
|
|
54
|
-
const normalizedPath = normalizePath(path);
|
|
28
|
+
let [pathWithSearch = ""] = href.split("#"), [path = "", search = ""] = pathWithSearch.split("?"), normalizedPath = normalizePath(path);
|
|
55
29
|
return search ? `${normalizedPath}?${search}` : normalizedPath;
|
|
56
30
|
}
|
|
57
31
|
function shouldShowProgressFor(fromPath, toPath) {
|
|
58
|
-
|
|
59
|
-
if (/^(mailto:|tel:|sms:)/i.test(toPath)) return false;
|
|
60
|
-
if (toPath.startsWith("#")) return false;
|
|
61
|
-
if (toPath.startsWith("/_next/") || toPath.startsWith("/static/")) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return normalizeHref(fromPath) !== normalizeHref(toPath);
|
|
32
|
+
return !fromPath.trim() || !toPath.trim() || /^(mailto:|tel:|sms:)/i.test(toPath) || toPath.startsWith("#") || toPath.startsWith("/_next/") || toPath.startsWith("/static/") ? !1 : normalizeHref(fromPath) !== normalizeHref(toPath);
|
|
65
33
|
}
|
|
66
34
|
function useNavigationProgress() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (animationFrame.current !== null) {
|
|
79
|
-
cancelAnimationFrame(animationFrame.current);
|
|
80
|
-
}
|
|
81
|
-
if (completionTimer.current) clearTimeout(completionTimer.current);
|
|
82
|
-
if (cleanupTimer.current) clearTimeout(cleanupTimer.current);
|
|
83
|
-
if (navigation.current?.timeoutId) {
|
|
84
|
-
clearTimeout(navigation.current.timeoutId);
|
|
85
|
-
}
|
|
86
|
-
animationFrame.current = null;
|
|
87
|
-
completionTimer.current = null;
|
|
88
|
-
cleanupTimer.current = null;
|
|
89
|
-
navigation.current = null;
|
|
90
|
-
}, []);
|
|
91
|
-
const completeNavigation = useCallback(() => {
|
|
92
|
-
if (!navigation.current) return;
|
|
93
|
-
if (animationFrame.current !== null) {
|
|
94
|
-
cancelAnimationFrame(animationFrame.current);
|
|
95
|
-
animationFrame.current = null;
|
|
96
|
-
}
|
|
97
|
-
if (completionTimer.current) {
|
|
98
|
-
clearTimeout(completionTimer.current);
|
|
99
|
-
completionTimer.current = null;
|
|
100
|
-
}
|
|
101
|
-
if (cleanupTimer.current) {
|
|
102
|
-
clearTimeout(cleanupTimer.current);
|
|
103
|
-
cleanupTimer.current = null;
|
|
104
|
-
}
|
|
105
|
-
if (navigation.current.timeoutId) {
|
|
106
|
-
clearTimeout(navigation.current.timeoutId);
|
|
107
|
-
navigation.current.timeoutId = null;
|
|
108
|
-
}
|
|
109
|
-
setProgress(100);
|
|
110
|
-
cleanupTimer.current = setTimeout(() => {
|
|
111
|
-
if (!navigation.current) return;
|
|
112
|
-
setIsExiting(true);
|
|
113
|
-
cleanupTimer.current = setTimeout(() => {
|
|
114
|
-
setProgress(0);
|
|
115
|
-
setIsExiting(false);
|
|
116
|
-
navigation.current = null;
|
|
117
|
-
cleanupTimer.current = null;
|
|
118
|
-
}, navigationProgressConfig.exitDuration);
|
|
119
|
-
}, navigationProgressConfig.completeDuration);
|
|
120
|
-
}, []);
|
|
121
|
-
const reset = useCallback(() => {
|
|
122
|
-
cleanup();
|
|
123
|
-
setProgress(0);
|
|
124
|
-
setIsExiting(false);
|
|
125
|
-
}, [cleanup]);
|
|
126
|
-
const startNavigation = useCallback(
|
|
35
|
+
let [progress, setProgress] = useState(0), [isExiting, setIsExiting] = useState(!1), pathname = usePathname() || "/", searchParams = useSearchParams(), currentUrl = `${pathname}${searchParams.size ? `?${searchParams}` : ""}`, navigation = useRef(null), animationFrame = useRef(null), completionTimer = useRef(null), cleanupTimer = useRef(null), previousUrl = useRef(""), cleanup = useCallback(() => {
|
|
36
|
+
animationFrame.current !== null && cancelAnimationFrame(animationFrame.current), completionTimer.current && clearTimeout(completionTimer.current), cleanupTimer.current && clearTimeout(cleanupTimer.current), navigation.current?.timeoutId && clearTimeout(navigation.current.timeoutId), animationFrame.current = null, completionTimer.current = null, cleanupTimer.current = null, navigation.current = null;
|
|
37
|
+
}, []), completeNavigation = useCallback(() => {
|
|
38
|
+
navigation.current && (animationFrame.current !== null && (cancelAnimationFrame(animationFrame.current), animationFrame.current = null), completionTimer.current && (clearTimeout(completionTimer.current), completionTimer.current = null), cleanupTimer.current && (clearTimeout(cleanupTimer.current), cleanupTimer.current = null), navigation.current.timeoutId && (clearTimeout(navigation.current.timeoutId), navigation.current.timeoutId = null), setProgress(100), cleanupTimer.current = setTimeout(() => {
|
|
39
|
+
navigation.current && (setIsExiting(!0), cleanupTimer.current = setTimeout(() => {
|
|
40
|
+
setProgress(0), setIsExiting(!1), navigation.current = null, cleanupTimer.current = null;
|
|
41
|
+
}, navigationProgressConfig.exitDuration));
|
|
42
|
+
}, navigationProgressConfig.completeDuration));
|
|
43
|
+
}, []), reset = useCallback(() => {
|
|
44
|
+
cleanup(), setProgress(0), setIsExiting(!1);
|
|
45
|
+
}, [cleanup]), startNavigation = useCallback(
|
|
127
46
|
(fromPath, toPath) => {
|
|
128
47
|
if (!shouldShowProgressFor(fromPath, toPath)) return;
|
|
129
|
-
|
|
48
|
+
let normalizedTarget = normalizeHref(toPath);
|
|
130
49
|
if (navigation.current?.targetPath === normalizedTarget) return;
|
|
131
|
-
cleanup();
|
|
132
|
-
|
|
133
|
-
setProgress(navigationProgressConfig.initialProgress);
|
|
134
|
-
const timeoutId = setTimeout(() => {
|
|
50
|
+
cleanup(), setIsExiting(!1), setProgress(navigationProgressConfig.initialProgress);
|
|
51
|
+
let timeoutId = setTimeout(() => {
|
|
135
52
|
completeNavigation();
|
|
136
|
-
}, navigationProgressConfig.timeout);
|
|
137
|
-
const startTime = Date.now();
|
|
53
|
+
}, navigationProgressConfig.timeout), startTime = Date.now();
|
|
138
54
|
navigation.current = {
|
|
139
55
|
startTime,
|
|
140
56
|
targetPath: normalizedTarget,
|
|
141
57
|
timeoutId
|
|
142
58
|
};
|
|
143
|
-
|
|
59
|
+
let animate = () => {
|
|
144
60
|
if (!navigation.current) return;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (elapsed < navigationProgressConfig.minDuration) {
|
|
61
|
+
let elapsed = Date.now() - startTime, progressValue;
|
|
62
|
+
if (elapsed < navigationProgressConfig.minDuration)
|
|
148
63
|
progressValue = navigationProgressConfig.initialProgress + elapsed / navigationProgressConfig.minDuration * (navigationProgressConfig.fastPhaseEnd - navigationProgressConfig.initialProgress);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const normalizedTime = Math.min(
|
|
64
|
+
else {
|
|
65
|
+
let remainingProgress = navigationProgressConfig.targetProgress - navigationProgressConfig.fastPhaseEnd, easedTime = 1 - (1 - Math.min(
|
|
152
66
|
1,
|
|
153
67
|
(elapsed - navigationProgressConfig.minDuration) / (navigationProgressConfig.maxDuration - navigationProgressConfig.minDuration)
|
|
154
|
-
);
|
|
155
|
-
const easedTime = 1 - (1 - normalizedTime) ** 3;
|
|
68
|
+
)) ** 3;
|
|
156
69
|
progressValue = navigationProgressConfig.fastPhaseEnd + easedTime * remainingProgress;
|
|
157
70
|
}
|
|
158
71
|
setProgress(
|
|
159
72
|
Math.min(navigationProgressConfig.targetProgress, progressValue)
|
|
160
|
-
);
|
|
161
|
-
animationFrame.current = requestAnimationFrame(animate);
|
|
73
|
+
), animationFrame.current = requestAnimationFrame(animate);
|
|
162
74
|
};
|
|
163
75
|
animationFrame.current = requestAnimationFrame(animate);
|
|
164
76
|
},
|
|
165
77
|
[cleanup, completeNavigation]
|
|
166
78
|
);
|
|
167
|
-
useEffect(() => {
|
|
79
|
+
return useEffect(() => {
|
|
168
80
|
if (!previousUrl.current) {
|
|
169
81
|
previousUrl.current = currentUrl;
|
|
170
82
|
return;
|
|
171
83
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
previousUrl.current = currentUrl;
|
|
180
|
-
}, [completeNavigation, currentUrl]);
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
const handleClick = (event) => {
|
|
183
|
-
if (event.button !== 0) return;
|
|
184
|
-
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const target = event.target;
|
|
188
|
-
if (!(target instanceof Element)) return;
|
|
189
|
-
if (target.closest("button, input, select, textarea, [role='button']")) {
|
|
84
|
+
navigation.current && currentUrl !== previousUrl.current && (completionTimer.current && clearTimeout(completionTimer.current), completionTimer.current = setTimeout(() => {
|
|
85
|
+
completionTimer.current = null, completeNavigation();
|
|
86
|
+
}, navigationProgressConfig.settleDelay)), previousUrl.current = currentUrl;
|
|
87
|
+
}, [completeNavigation, currentUrl]), useEffect(() => {
|
|
88
|
+
let handleClick = (event) => {
|
|
89
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
190
90
|
return;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (!anchor?.href) return;
|
|
194
|
-
if (anchor.target && anchor.target !== "_self") return;
|
|
195
|
-
if (anchor.hasAttribute("download")) return;
|
|
196
|
-
try {
|
|
197
|
-
const url = new URL(anchor.href, window.location.origin);
|
|
198
|
-
if (url.origin !== window.location.origin) return;
|
|
199
|
-
const targetPath = `${url.pathname}${url.search}`;
|
|
200
|
-
startNavigation(currentUrl, targetPath);
|
|
201
|
-
} catch {
|
|
91
|
+
let target = event.target;
|
|
92
|
+
if (!(target instanceof Element) || target.closest("button, input, select, textarea, [role='button']"))
|
|
202
93
|
return;
|
|
203
|
-
|
|
94
|
+
let anchor = target.closest("a");
|
|
95
|
+
if (anchor?.href && !(anchor.target && anchor.target !== "_self") && !anchor.hasAttribute("download"))
|
|
96
|
+
try {
|
|
97
|
+
let url = new URL(anchor.href, window.location.origin);
|
|
98
|
+
if (url.origin !== window.location.origin) return;
|
|
99
|
+
let targetPath = `${url.pathname}${url.search}`;
|
|
100
|
+
startNavigation(currentUrl, targetPath);
|
|
101
|
+
} catch {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
204
104
|
};
|
|
205
|
-
document.addEventListener("click", handleClick);
|
|
206
|
-
|
|
207
|
-
}, [currentUrl, startNavigation]);
|
|
208
|
-
useEffect(() => reset, [reset]);
|
|
209
|
-
return { isExiting, progress };
|
|
105
|
+
return document.addEventListener("click", handleClick), () => document.removeEventListener("click", handleClick);
|
|
106
|
+
}, [currentUrl, startNavigation]), useEffect(() => reset, [reset]), { isExiting, progress };
|
|
210
107
|
}
|
|
211
108
|
function NavigationProgressContent() {
|
|
212
|
-
|
|
213
|
-
const isVisible = progress > 0;
|
|
109
|
+
let { isExiting, progress } = useNavigationProgress(), isVisible = progress > 0;
|
|
214
110
|
return /* @__PURE__ */ jsx(
|
|
215
111
|
Progress,
|
|
216
112
|
{
|
|
@@ -220,14 +116,14 @@ function NavigationProgressContent() {
|
|
|
220
116
|
isVisible ? "opacity-100" : "opacity-0"
|
|
221
117
|
),
|
|
222
118
|
style: {
|
|
223
|
-
height: "var(--progress-
|
|
119
|
+
height: "var(--progress-height, 2px)"
|
|
224
120
|
},
|
|
225
121
|
value: isVisible ? progress : null,
|
|
226
|
-
children: /* @__PURE__ */ jsx(ProgressTrack, { className: "h-full rounded-none bg-progress-
|
|
122
|
+
children: /* @__PURE__ */ jsx(ProgressTrack, { className: "h-full rounded-none bg-progress-track-surface", children: /* @__PURE__ */ jsx(
|
|
227
123
|
ProgressIndicator,
|
|
228
124
|
{
|
|
229
125
|
className: cn(
|
|
230
|
-
"h-full w-full rounded-none bg-progress-
|
|
126
|
+
"h-full w-full rounded-none bg-progress-indicator-surface",
|
|
231
127
|
progress === 0 && "scale-x-0"
|
|
232
128
|
),
|
|
233
129
|
style: {
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
z: [
|
|
8
|
-
"z-content",
|
|
9
|
-
"z-nav",
|
|
10
|
-
"z-overlay",
|
|
11
|
-
"z-modal",
|
|
12
|
-
"z-search",
|
|
13
|
-
"z-toast",
|
|
14
|
-
"z-progress"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
function cn(...inputs) {
|
|
20
|
-
return twMerge(clsx(inputs));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// src/kernel/components/blocks/next-prev.tsx
|
|
24
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
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";
|
|
6
|
+
import { cn } from "@publish.os/nextjs/utils/cn";
|
|
25
7
|
import NextLink from "next/link";
|
|
26
|
-
|
|
8
|
+
|
|
9
|
+
// src/components/block/navigation/page-nodes.ts
|
|
27
10
|
function pageNodes(nodes) {
|
|
28
|
-
return nodes.flatMap((node) =>
|
|
29
|
-
if (node.type === "page") return [node];
|
|
30
|
-
if (node.type === "section" || node.type === "folder") {
|
|
31
|
-
return pageNodes(node.children);
|
|
32
|
-
}
|
|
33
|
-
return [];
|
|
34
|
-
});
|
|
11
|
+
return nodes.flatMap((node) => node.type === "page" ? [node] : node.type === "section" || node.type === "folder" ? pageNodes(node.children) : []);
|
|
35
12
|
}
|
|
13
|
+
|
|
14
|
+
// src/components/block/navigation/next-prev.tsx
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
16
|
function DirectionIcon({ direction }) {
|
|
37
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(ChevronLeft, { "aria-hidden": "true", size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", size: 14 }) });
|
|
38
18
|
}
|
|
@@ -40,13 +20,12 @@ function NavigationCard({
|
|
|
40
20
|
direction,
|
|
41
21
|
page
|
|
42
22
|
}) {
|
|
43
|
-
|
|
44
|
-
const label = isNext ? "Next" : "Previous";
|
|
23
|
+
let isNext = direction === "next", label = isNext ? "Next" : "Previous";
|
|
45
24
|
return /* @__PURE__ */ jsx(
|
|
46
25
|
NextLink,
|
|
47
26
|
{
|
|
48
27
|
className: cn(
|
|
49
|
-
"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-
|
|
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 [&_*]:!no-underline",
|
|
50
29
|
isNext && "md:text-right"
|
|
51
30
|
),
|
|
52
31
|
href: page.path,
|
|
@@ -80,13 +59,8 @@ function NavigationCard({
|
|
|
80
59
|
);
|
|
81
60
|
}
|
|
82
61
|
function NextPrev({ className, currentPath, tree }) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const previous = index > 0 ? pages[index - 1] : null;
|
|
86
|
-
const next = index >= 0 ? pages[index + 1] : null;
|
|
87
|
-
const hasBoth = Boolean(previous && next);
|
|
88
|
-
if (!previous && !next) return null;
|
|
89
|
-
return /* @__PURE__ */ jsx("nav", { "aria-label": "Previous and next pages", className, children: /* @__PURE__ */ jsxs(
|
|
62
|
+
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(
|
|
90
64
|
"div",
|
|
91
65
|
{
|
|
92
66
|
className: cn(
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import { Link } from "
|
|
3
|
-
|
|
1
|
+
// src/components/block/navigation/page-list.tsx
|
|
2
|
+
import { Link } from "@publish.os/nextjs/kernel/components/ui/link";
|
|
3
|
+
|
|
4
|
+
// src/components/block/navigation/page-nodes.ts
|
|
4
5
|
function pageNodes(nodes) {
|
|
5
|
-
return nodes.flatMap((node) =>
|
|
6
|
-
if (node.type === "page") return [node];
|
|
7
|
-
if (node.type === "section" || node.type === "folder") {
|
|
8
|
-
return pageNodes(node.children);
|
|
9
|
-
}
|
|
10
|
-
return [];
|
|
11
|
-
});
|
|
6
|
+
return nodes.flatMap((node) => node.type === "page" ? [node] : node.type === "section" || node.type === "folder" ? pageNodes(node.children) : []);
|
|
12
7
|
}
|
|
8
|
+
|
|
9
|
+
// src/components/block/navigation/page-list.tsx
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
11
|
function PageList({ tree, currentPath, className }) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return /* @__PURE__ */ jsx("nav", { "aria-label": "Pages in this group", className, children: /* @__PURE__ */ jsx("ul", { className: "space-y-2 text-sm", children: pages.map((page) => {
|
|
19
|
-
const active = page.path === currentPath;
|
|
12
|
+
let pages = pageNodes(tree);
|
|
13
|
+
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
|
+
let active = page.path === currentPath;
|
|
20
15
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
21
16
|
Link,
|
|
22
17
|
{
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ButtonVariantProps } from '
|
|
3
|
-
import { SearchProviderProps } from '@publish.os/nextjs/search';
|
|
2
|
+
import { B as ButtonVariantProps } from '../../../button-CFdx-ohV.js';
|
|
4
3
|
import { ReactNode, ReactElement } from 'react';
|
|
5
4
|
import 'class-variance-authority/types';
|
|
6
5
|
import 'class-variance-authority';
|
|
7
6
|
|
|
7
|
+
type SearchBlockVariant = "desktop" | "mobile";
|
|
8
|
+
|
|
9
|
+
type SearchProviderProps = {
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
limit?: number;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
shortcut?: string;
|
|
16
|
+
variant?: SearchBlockVariant;
|
|
17
|
+
};
|
|
18
|
+
|
|
8
19
|
declare function SearchProgressBar({ className }: {
|
|
9
20
|
className?: string;
|
|
10
21
|
}): react_jsx_runtime.JSX.Element;
|