@publish.os/nextjs 0.0.1-alpha.1
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 +7 -0
- package/dist/cache/tags.cjs +76 -0
- package/dist/cache/tags.d.cts +12 -0
- package/dist/cache/tags.d.ts +12 -0
- package/dist/cache/tags.js +51 -0
- package/dist/components/color-palette.cjs +408 -0
- package/dist/components/color-palette.d.cts +5 -0
- package/dist/components/color-palette.d.ts +5 -0
- package/dist/components/color-palette.js +388 -0
- package/dist/components/nav-breadcrumb.cjs +141 -0
- package/dist/components/nav-breadcrumb.d.cts +9 -0
- package/dist/components/nav-breadcrumb.d.ts +9 -0
- package/dist/components/nav-breadcrumb.js +107 -0
- package/dist/components/page-list.cjs +68 -0
- package/dist/components/page-list.d.cts +11 -0
- package/dist/components/page-list.d.ts +11 -0
- package/dist/components/page-list.js +33 -0
- package/dist/components/providers.cjs +44 -0
- package/dist/components/providers.d.cts +8 -0
- package/dist/components/providers.d.ts +8 -0
- package/dist/components/providers.js +20 -0
- package/dist/components/site-header.cjs +302 -0
- package/dist/components/site-header.d.cts +12 -0
- package/dist/components/site-header.d.ts +12 -0
- package/dist/components/site-header.js +268 -0
- package/dist/components/theme-toggle.cjs +147 -0
- package/dist/components/theme-toggle.d.cts +5 -0
- package/dist/components/theme-toggle.d.ts +5 -0
- package/dist/components/theme-toggle.js +123 -0
- package/dist/config/createNextConfig.cjs +52 -0
- package/dist/config/createNextConfig.d.cts +8 -0
- package/dist/config/createNextConfig.d.ts +8 -0
- package/dist/config/createNextConfig.js +27 -0
- package/dist/index.cjs +347 -0
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +299 -0
- package/dist/layouts/group.cjs +157 -0
- package/dist/layouts/group.d.cts +15 -0
- package/dist/layouts/group.d.ts +15 -0
- package/dist/layouts/group.js +132 -0
- package/dist/mdx/error-boundary.cjs +94 -0
- package/dist/mdx/error-boundary.d.cts +13 -0
- package/dist/mdx/error-boundary.d.ts +13 -0
- package/dist/mdx/error-boundary.js +70 -0
- package/dist/mdx/error-fallback.cjs +58 -0
- package/dist/mdx/error-fallback.d.cts +9 -0
- package/dist/mdx/error-fallback.d.ts +9 -0
- package/dist/mdx/error-fallback.js +33 -0
- package/dist/mdx/mdx.cjs +182 -0
- package/dist/mdx/mdx.d.cts +10 -0
- package/dist/mdx/mdx.d.ts +10 -0
- package/dist/mdx/mdx.js +147 -0
- package/dist/pages/group.cjs +162 -0
- package/dist/pages/group.d.cts +15 -0
- package/dist/pages/group.d.ts +15 -0
- package/dist/pages/group.js +136 -0
- package/dist/pages/leaf.cjs +203 -0
- package/dist/pages/leaf.d.cts +23 -0
- package/dist/pages/leaf.d.ts +23 -0
- package/dist/pages/leaf.js +176 -0
- package/dist/pages/root.cjs +127 -0
- package/dist/pages/root.d.cts +14 -0
- package/dist/pages/root.d.ts +14 -0
- package/dist/pages/root.js +101 -0
- package/dist/resolvers/manifest-resolver.cjs +107 -0
- package/dist/resolvers/manifest-resolver.d.cts +13 -0
- package/dist/resolvers/manifest-resolver.d.ts +13 -0
- package/dist/resolvers/manifest-resolver.js +79 -0
- package/dist/routes/llms.cjs +101 -0
- package/dist/routes/llms.d.cts +7 -0
- package/dist/routes/llms.d.ts +7 -0
- package/dist/routes/llms.js +76 -0
- package/dist/routes/robots.cjs +94 -0
- package/dist/routes/robots.d.cts +5 -0
- package/dist/routes/robots.d.ts +5 -0
- package/dist/routes/robots.js +69 -0
- package/dist/routes/sitemap.cjs +108 -0
- package/dist/routes/sitemap.d.cts +5 -0
- package/dist/routes/sitemap.d.ts +5 -0
- package/dist/routes/sitemap.js +83 -0
- package/dist/types.cjs +18 -0
- package/dist/types.d.cts +144 -0
- package/dist/types.d.ts +144 -0
- package/dist/types.js +0 -0
- package/dist/utils/cn.cjs +49 -0
- package/dist/utils/cn.d.cts +15 -0
- package/dist/utils/cn.d.ts +15 -0
- package/dist/utils/cn.js +24 -0
- package/dist/utils/pretty-date.cjs +55 -0
- package/dist/utils/pretty-date.d.cts +6 -0
- package/dist/utils/pretty-date.d.ts +6 -0
- package/dist/utils/pretty-date.js +30 -0
- package/package.json +100 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/page-list.tsx
|
|
31
|
+
var page_list_exports = {};
|
|
32
|
+
__export(page_list_exports, {
|
|
33
|
+
PageList: () => PageList
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(page_list_exports);
|
|
36
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
function pageNodes(nodes) {
|
|
39
|
+
return nodes.flatMap((node) => {
|
|
40
|
+
if (node.type === "page") return [node];
|
|
41
|
+
if (node.type === "section" || node.type === "folder") {
|
|
42
|
+
return pageNodes(node.children);
|
|
43
|
+
}
|
|
44
|
+
return [];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function PageList({ tree, currentPath, className }) {
|
|
48
|
+
const pages = pageNodes(tree);
|
|
49
|
+
if (pages.length === 0) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": "Pages in this group", className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "space-y-2 text-sm", children: pages.map((page) => {
|
|
53
|
+
const active = page.path === currentPath;
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_link.default,
|
|
56
|
+
{
|
|
57
|
+
"aria-current": active ? "page" : void 0,
|
|
58
|
+
className: active ? "font-medium text-accent-1 underline underline-offset-4" : "text-foreground-2 underline-offset-4 hover:text-accent-1 hover:underline",
|
|
59
|
+
href: page.path,
|
|
60
|
+
children: page.title
|
|
61
|
+
}
|
|
62
|
+
) }, `${page.group}:${page.id}`);
|
|
63
|
+
}) }) });
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
PageList
|
|
68
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TreeNode } from '../types.cjs';
|
|
3
|
+
|
|
4
|
+
type PageListProps = {
|
|
5
|
+
tree: TreeNode[];
|
|
6
|
+
currentPath?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
declare function PageList({ tree, currentPath, className }: PageListProps): react_jsx_runtime.JSX.Element | null;
|
|
10
|
+
|
|
11
|
+
export { PageList };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TreeNode } from '../types.js';
|
|
3
|
+
|
|
4
|
+
type PageListProps = {
|
|
5
|
+
tree: TreeNode[];
|
|
6
|
+
currentPath?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
declare function PageList({ tree, currentPath, className }: PageListProps): react_jsx_runtime.JSX.Element | null;
|
|
10
|
+
|
|
11
|
+
export { PageList };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/components/page-list.tsx
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
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
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function PageList({ tree, currentPath, className }) {
|
|
14
|
+
const pages = pageNodes(tree);
|
|
15
|
+
if (pages.length === 0) {
|
|
16
|
+
return null;
|
|
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;
|
|
20
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
21
|
+
Link,
|
|
22
|
+
{
|
|
23
|
+
"aria-current": active ? "page" : void 0,
|
|
24
|
+
className: active ? "font-medium text-accent-1 underline underline-offset-4" : "text-foreground-2 underline-offset-4 hover:text-accent-1 hover:underline",
|
|
25
|
+
href: page.path,
|
|
26
|
+
children: page.title
|
|
27
|
+
}
|
|
28
|
+
) }, `${page.group}:${page.id}`);
|
|
29
|
+
}) }) });
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
PageList
|
|
33
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/components/providers.tsx
|
|
22
|
+
var providers_exports = {};
|
|
23
|
+
__export(providers_exports, {
|
|
24
|
+
Providers: () => Providers
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(providers_exports);
|
|
27
|
+
var import_next_themes = require("next-themes");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
function Providers({ children }) {
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
31
|
+
import_next_themes.ThemeProvider,
|
|
32
|
+
{
|
|
33
|
+
attribute: "class",
|
|
34
|
+
defaultTheme: "system",
|
|
35
|
+
disableTransitionOnChange: true,
|
|
36
|
+
enableSystem: true,
|
|
37
|
+
children
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
Providers
|
|
44
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/providers.tsx
|
|
4
|
+
import { ThemeProvider } from "next-themes";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function Providers({ children }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
ThemeProvider,
|
|
9
|
+
{
|
|
10
|
+
attribute: "class",
|
|
11
|
+
defaultTheme: "system",
|
|
12
|
+
disableTransitionOnChange: true,
|
|
13
|
+
enableSystem: true,
|
|
14
|
+
children
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
Providers
|
|
20
|
+
};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/components/site-header.tsx
|
|
32
|
+
var site_header_exports = {};
|
|
33
|
+
__export(site_header_exports, {
|
|
34
|
+
SiteHeader: () => SiteHeader
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(site_header_exports);
|
|
37
|
+
var import_link2 = __toESM(require("next/link"), 1);
|
|
38
|
+
var import_navigation2 = require("next/navigation");
|
|
39
|
+
|
|
40
|
+
// src/components/nav-breadcrumb.tsx
|
|
41
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
42
|
+
var import_navigation = require("next/navigation");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
function titleFor(node) {
|
|
45
|
+
return node.title;
|
|
46
|
+
}
|
|
47
|
+
function pathFor(node) {
|
|
48
|
+
if (node.type === "page") return node.path;
|
|
49
|
+
if (node.type === "link") return node.href;
|
|
50
|
+
if (node.type === "section") return node.path;
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
function rankFor(node) {
|
|
54
|
+
if (node.type === "page" || node.type === "section") return 2;
|
|
55
|
+
if (node.type === "folder") return 1;
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
function findCrumbs(nodes, pathname, parents = []) {
|
|
59
|
+
const matches = [];
|
|
60
|
+
for (const node of nodes) {
|
|
61
|
+
const path = pathFor(node);
|
|
62
|
+
const nextParents = path ? [...parents, { title: titleFor(node), path }] : parents;
|
|
63
|
+
if (path === pathname) {
|
|
64
|
+
matches.push({
|
|
65
|
+
crumbs: nextParents.map((crumb, index) => ({
|
|
66
|
+
...crumb,
|
|
67
|
+
current: index === nextParents.length - 1
|
|
68
|
+
})),
|
|
69
|
+
pathLength: path.length,
|
|
70
|
+
rank: rankFor(node)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (node.type === "section" || node.type === "folder") {
|
|
74
|
+
const childMatch = findCrumbs(node.children, pathname, nextParents);
|
|
75
|
+
if (childMatch) matches.push(childMatch);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return matches.sort(
|
|
79
|
+
(a, b) => b.rank - a.rank || b.pathLength - a.pathLength || b.crumbs.length - a.crumbs.length
|
|
80
|
+
)[0] ?? null;
|
|
81
|
+
}
|
|
82
|
+
function groupFallback(tree, pathname) {
|
|
83
|
+
const groups = tree.map((group) => ({ group, path: pathFor(group) })).filter(
|
|
84
|
+
(entry) => typeof entry.path === "string"
|
|
85
|
+
).sort((a, b) => b.path.length - a.path.length);
|
|
86
|
+
for (const { group, path } of groups) {
|
|
87
|
+
if (pathname.startsWith(`${path}/`)) {
|
|
88
|
+
return [{ title: titleFor(group), path }];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
function buildCrumbs(site, tree, pathname) {
|
|
94
|
+
const root = {
|
|
95
|
+
title: site.title,
|
|
96
|
+
path: "/",
|
|
97
|
+
current: pathname === "/"
|
|
98
|
+
};
|
|
99
|
+
if (pathname === "/") return [root];
|
|
100
|
+
const treeMatch = findCrumbs(tree, pathname);
|
|
101
|
+
if (treeMatch) return [root, ...treeMatch.crumbs];
|
|
102
|
+
return [
|
|
103
|
+
root,
|
|
104
|
+
...groupFallback(tree, pathname).map((crumb) => ({
|
|
105
|
+
...crumb,
|
|
106
|
+
current: false
|
|
107
|
+
}))
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
function NavBreadcrumb({
|
|
111
|
+
site,
|
|
112
|
+
tree
|
|
113
|
+
}) {
|
|
114
|
+
const pathname = (0, import_navigation.usePathname)() || "/";
|
|
115
|
+
const crumbs = buildCrumbs(site, tree, pathname);
|
|
116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
"nav",
|
|
118
|
+
{
|
|
119
|
+
"aria-label": "Breadcrumb",
|
|
120
|
+
className: "flex min-w-0 items-center gap-1.5 text-sm",
|
|
121
|
+
children: crumbs.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
122
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", className: "text-stroke-3", children: "/" }),
|
|
123
|
+
crumb.current ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
"span",
|
|
125
|
+
{
|
|
126
|
+
"aria-current": "page",
|
|
127
|
+
className: "truncate font-medium text-foreground-1",
|
|
128
|
+
children: crumb.title
|
|
129
|
+
}
|
|
130
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
|
+
import_link.default,
|
|
132
|
+
{
|
|
133
|
+
className: "truncate text-foreground-3 no-underline hover:text-accent-1",
|
|
134
|
+
href: crumb.path,
|
|
135
|
+
children: crumb.title
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }, crumb.path))
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// src/components/theme-toggle.tsx
|
|
144
|
+
var import_next_themes = require("next-themes");
|
|
145
|
+
var import_react = require("react");
|
|
146
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
147
|
+
var themeOrder = ["system", "light", "dark"];
|
|
148
|
+
function SunIcon() {
|
|
149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
150
|
+
"svg",
|
|
151
|
+
{
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
fill: "none",
|
|
154
|
+
height: "16",
|
|
155
|
+
viewBox: "0 0 16 16",
|
|
156
|
+
width: "16",
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "8", cy: "8", r: "3", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
160
|
+
"path",
|
|
161
|
+
{
|
|
162
|
+
d: "M8 1.5v1.2M8 13.3v1.2M1.5 8h1.2M13.3 8h1.2M3.4 3.4l.9.9M11.7 11.7l.9.9M12.6 3.4l-.9.9M4.3 11.7l-.9.9",
|
|
163
|
+
stroke: "currentColor",
|
|
164
|
+
strokeLinecap: "round",
|
|
165
|
+
strokeWidth: "1.5"
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
function MoonIcon() {
|
|
173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
174
|
+
"svg",
|
|
175
|
+
{
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
fill: "none",
|
|
178
|
+
height: "16",
|
|
179
|
+
viewBox: "0 0 16 16",
|
|
180
|
+
width: "16",
|
|
181
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
182
|
+
"path",
|
|
183
|
+
{
|
|
184
|
+
d: "M13.2 9.6A5.5 5.5 0 0 1 6.4 2.8a5.7 5.7 0 1 0 6.8 6.8Z",
|
|
185
|
+
stroke: "currentColor",
|
|
186
|
+
strokeLinejoin: "round",
|
|
187
|
+
strokeWidth: "1.5"
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
function SystemIcon() {
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
195
|
+
"svg",
|
|
196
|
+
{
|
|
197
|
+
"aria-hidden": "true",
|
|
198
|
+
fill: "none",
|
|
199
|
+
height: "16",
|
|
200
|
+
viewBox: "0 0 16 16",
|
|
201
|
+
width: "16",
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
204
|
+
"rect",
|
|
205
|
+
{
|
|
206
|
+
height: "8.5",
|
|
207
|
+
rx: "1.5",
|
|
208
|
+
stroke: "currentColor",
|
|
209
|
+
strokeWidth: "1.5",
|
|
210
|
+
width: "12",
|
|
211
|
+
x: "2",
|
|
212
|
+
y: "2.5"
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
216
|
+
"path",
|
|
217
|
+
{
|
|
218
|
+
d: "M6.5 13.5h3M8 11v2.5",
|
|
219
|
+
stroke: "currentColor",
|
|
220
|
+
strokeLinecap: "round",
|
|
221
|
+
strokeWidth: "1.5"
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
function Icon({ theme }) {
|
|
229
|
+
if (theme === "light") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SunIcon, {});
|
|
230
|
+
if (theme === "dark") return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MoonIcon, {});
|
|
231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SystemIcon, {});
|
|
232
|
+
}
|
|
233
|
+
function normalizeTheme(theme) {
|
|
234
|
+
if (theme === "light" || theme === "dark") return theme;
|
|
235
|
+
return "system";
|
|
236
|
+
}
|
|
237
|
+
function ThemeToggle() {
|
|
238
|
+
const { theme, setTheme } = (0, import_next_themes.useTheme)();
|
|
239
|
+
const [mounted, setMounted] = (0, import_react.useState)(false);
|
|
240
|
+
const activeTheme = normalizeTheme(theme);
|
|
241
|
+
const nextTheme = (0, import_react.useMemo)(() => {
|
|
242
|
+
const index = themeOrder.indexOf(activeTheme);
|
|
243
|
+
return themeOrder[(index + 1) % themeOrder.length] ?? "system";
|
|
244
|
+
}, [activeTheme]);
|
|
245
|
+
(0, import_react.useEffect)(() => {
|
|
246
|
+
setMounted(true);
|
|
247
|
+
}, []);
|
|
248
|
+
const label = mounted ? `Switch to ${nextTheme} theme` : "Theme preference";
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
"aria-label": label,
|
|
253
|
+
className: "inline-flex size-8 shrink-0 items-center justify-center rounded-button border border-stroke-2 bg-surface-2 text-foreground-2 transition-colors hover:border-stroke-1 hover:bg-surface-hover hover:text-foreground-1",
|
|
254
|
+
onClick: () => setTheme(nextTheme),
|
|
255
|
+
title: label,
|
|
256
|
+
type: "button",
|
|
257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { theme: mounted ? activeTheme : "system" })
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// src/components/site-header.tsx
|
|
263
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
264
|
+
function hasPath(node) {
|
|
265
|
+
return "path" in node && typeof node.path === "string";
|
|
266
|
+
}
|
|
267
|
+
function SiteHeader({
|
|
268
|
+
site,
|
|
269
|
+
siteTitle,
|
|
270
|
+
tree,
|
|
271
|
+
currentPath
|
|
272
|
+
}) {
|
|
273
|
+
const headerSite = site ?? { title: siteTitle ?? "Site" };
|
|
274
|
+
const livePathname = (0, import_navigation2.usePathname)() || "/";
|
|
275
|
+
const pathname = currentPath ?? livePathname;
|
|
276
|
+
const groups = tree.filter(hasPath);
|
|
277
|
+
const activeGroupPath = groups.map((group) => group.path).filter((path) => pathname === path || pathname.startsWith(`${path}/`)).sort((a, b) => b.length - a.length)[0];
|
|
278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("header", { className: "border-b border-stroke-3 bg-surface-2 backdrop-blur", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "mx-auto flex max-w-6xl flex-col gap-3 px-6 py-3 md:flex-row md:items-center md:justify-between lg:px-10", children: [
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(NavBreadcrumb, { site: headerSite, tree }) }),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex shrink-0 items-center gap-4", children: [
|
|
281
|
+
groups.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("nav", { "aria-label": "Groups", className: "flex flex-wrap gap-3 text-sm", children: groups.map((group) => {
|
|
282
|
+
const path = group.path;
|
|
283
|
+
const active = path === activeGroupPath;
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
285
|
+
import_link2.default,
|
|
286
|
+
{
|
|
287
|
+
"aria-current": active ? "page" : void 0,
|
|
288
|
+
className: active ? "font-medium text-accent-1 underline underline-offset-4" : "text-foreground-2 underline-offset-4 hover:text-accent-1 hover:underline",
|
|
289
|
+
href: path,
|
|
290
|
+
children: group.title
|
|
291
|
+
},
|
|
292
|
+
group.id
|
|
293
|
+
);
|
|
294
|
+
}) }),
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ThemeToggle, {})
|
|
296
|
+
] })
|
|
297
|
+
] }) });
|
|
298
|
+
}
|
|
299
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
300
|
+
0 && (module.exports = {
|
|
301
|
+
SiteHeader
|
|
302
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SiteData, TreeNode } from '../types.cjs';
|
|
3
|
+
|
|
4
|
+
type SiteHeaderProps = {
|
|
5
|
+
site?: SiteData;
|
|
6
|
+
siteTitle?: string;
|
|
7
|
+
tree: TreeNode[];
|
|
8
|
+
currentPath?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function SiteHeader({ site, siteTitle, tree, currentPath, }: SiteHeaderProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { SiteHeader };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { SiteData, TreeNode } from '../types.js';
|
|
3
|
+
|
|
4
|
+
type SiteHeaderProps = {
|
|
5
|
+
site?: SiteData;
|
|
6
|
+
siteTitle?: string;
|
|
7
|
+
tree: TreeNode[];
|
|
8
|
+
currentPath?: string;
|
|
9
|
+
};
|
|
10
|
+
declare function SiteHeader({ site, siteTitle, tree, currentPath, }: SiteHeaderProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { SiteHeader };
|