@publish.os/nextjs 0.0.1-alpha.91 → 0.0.1-alpha.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/compiler-assets/nextjs/defaults/group/index.tsx +16 -11
  2. package/compiler-assets/nextjs/defaults/group/layout.tsx +6 -2
  3. package/compiler-assets/nextjs/defaults/group/page.tsx +7 -6
  4. package/compiler-assets/nextjs/defaults/project/next.config.mjs +2 -1
  5. package/compiler-assets/nextjs/defaults/root/index.tsx +16 -11
  6. package/compiler-assets/nextjs/defaults/root/layout.tsx +7 -3
  7. package/compiler-assets/nextjs/shims/agent-user-agents.ts +65 -0
  8. package/compiler-assets/nextjs/shims/document.tsx +9 -1
  9. package/compiler-assets/nextjs/shims/generated-leaf-page.tsx +3 -0
  10. package/compiler-assets/nextjs/shims/proxy.ts +156 -54
  11. package/dist/{build-operation-5QMLXF7N.js → build-operation-CJDUL4OW.js} +5 -5
  12. package/dist/{chunk-GBPLER5H.js → chunk-3T4HVDSC.js} +2 -2
  13. package/dist/{chunk-UYGCOWRF.js → chunk-DX7PXFCM.js} +860 -50
  14. package/dist/{chunk-F3AGNDF4.js → chunk-DZ3VWEV5.js} +860 -575
  15. package/dist/{chunk-OXOFRXEI.js → chunk-NHSLTARU.js} +1284 -1164
  16. package/dist/{chunk-ORIUWJBQ.js → chunk-SBMDONTV.js} +3 -2
  17. package/dist/compiler.js +42 -23
  18. package/dist/components/blocks/agent-actions.d.ts +7 -7
  19. package/dist/components/blocks/agent-actions.js +1 -32
  20. package/dist/components/blocks/toc.d.ts +7 -7
  21. package/dist/components/ui/button.d.ts +1 -2
  22. package/dist/{compose-CVBJRAF6.js → compose-44GJSMXD.js} +2 -2
  23. package/dist/config/createNextConfig.js +2 -0
  24. package/dist/{dev-operation-OSHHWRWK.js → dev-operation-WNECBHZ5.js} +17 -7
  25. package/dist/{ide-support-CU6Z5PVR.js → ide-support-TG74L4FF.js} +3 -3
  26. package/dist/index.d.ts +143 -126
  27. package/dist/index.js +25 -0
  28. package/dist/kernel/components/blocks/AgentActions.d.ts +7 -7
  29. package/dist/kernel/components/blocks/AgentActions.js +1 -32
  30. package/dist/kernel/components/blocks/agent-actions.d.ts +1 -2
  31. package/dist/kernel/components/blocks/agent-actions.js +1 -32
  32. package/dist/kernel/components/blocks/animated-icon-swap.d.ts +2 -2
  33. package/dist/kernel/components/blocks/color-palette.d.ts +2 -2
  34. package/dist/kernel/components/blocks/logo-block.d.ts +2 -2
  35. package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +6 -5
  36. package/dist/kernel/components/blocks/nav-breadcrumb.js +19 -13
  37. package/dist/kernel/components/blocks/navbar.d.ts +5 -4
  38. package/dist/kernel/components/blocks/navbar.js +62 -42
  39. package/dist/kernel/components/blocks/navigation-progress.d.ts +2 -2
  40. package/dist/kernel/components/blocks/next-prev.d.ts +4 -4
  41. package/dist/kernel/components/blocks/next-prev.js +29 -6
  42. package/dist/kernel/components/blocks/page-list.d.ts +4 -4
  43. package/dist/kernel/components/blocks/page-list.js +30 -7
  44. package/dist/kernel/components/blocks/search.d.ts +9 -15
  45. package/dist/kernel/components/blocks/sidebar-node.d.ts +3 -5
  46. package/dist/kernel/components/blocks/sidebar-node.js +12 -2
  47. package/dist/kernel/components/blocks/sidebar.d.ts +6 -7
  48. package/dist/kernel/components/blocks/sidebar.js +132 -26
  49. package/dist/kernel/components/blocks/theme-toggle.d.ts +3 -4
  50. package/dist/kernel/components/blocks/toc-client.d.ts +7 -7
  51. package/dist/kernel/components/blocks/toc.d.ts +3 -3
  52. package/dist/kernel/components/mdx/components/blockquote.d.ts +2 -2
  53. package/dist/kernel/components/mdx/components/callout.d.ts +3 -3
  54. package/dist/kernel/components/mdx/components/code-block.d.ts +2 -2
  55. package/dist/kernel/components/mdx/components/copy-code-button.d.ts +2 -2
  56. package/dist/kernel/components/mdx/components/figure-caption.d.ts +2 -2
  57. package/dist/kernel/components/mdx/components/figure.d.ts +3 -3
  58. package/dist/kernel/components/mdx/components/footnotes.d.ts +2 -2
  59. package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +2 -2
  60. package/dist/kernel/components/mdx/components/heading.d.ts +2 -2
  61. package/dist/kernel/components/mdx/components/hr.d.ts +4 -4
  62. package/dist/kernel/components/mdx/components/image-zoom.d.ts +3 -3
  63. package/dist/kernel/components/mdx/components/image-zoom.js +3 -2
  64. package/dist/kernel/components/mdx/components/image.d.ts +2 -2
  65. package/dist/kernel/components/mdx/components/image.js +1 -1
  66. package/dist/kernel/components/mdx/components/inline-code.d.ts +2 -2
  67. package/dist/kernel/components/mdx/components/kbd.d.ts +3 -3
  68. package/dist/kernel/components/mdx/components/link.d.ts +3 -3
  69. package/dist/kernel/components/mdx/components/paragraph.d.ts +2 -2
  70. package/dist/kernel/components/mdx/components/strikethrough.d.ts +2 -2
  71. package/dist/kernel/components/mdx/components/table.d.ts +7 -7
  72. package/dist/kernel/components/mdx/components/task-list.d.ts +3 -3
  73. package/dist/kernel/components/mdx/components/video-player.d.ts +2 -2
  74. package/dist/kernel/components/mdx/components/video.d.ts +2 -3
  75. package/dist/kernel/components/mdx/error-boundary.d.ts +2 -3
  76. package/dist/kernel/components/mdx/error-fallback.d.ts +2 -2
  77. package/dist/kernel/components/mdx/mdx.d.ts +42 -11
  78. package/dist/kernel/components/mdx/mdx.js +1 -1
  79. package/dist/kernel/components/next-image.d.ts +3 -3
  80. package/dist/kernel/components/ui/accordion.d.ts +7 -7
  81. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +2 -3
  82. package/dist/kernel/components/ui/breadcrumb.d.ts +13 -13
  83. package/dist/kernel/components/ui/button-group.d.ts +5 -5
  84. package/dist/kernel/components/ui/button.d.ts +3 -3
  85. package/dist/kernel/components/ui/card.d.ts +7 -7
  86. package/dist/kernel/components/ui/dialog.d.ts +10 -10
  87. package/dist/kernel/components/ui/drawer.d.ts +12 -12
  88. package/dist/kernel/components/ui/kbd.d.ts +3 -3
  89. package/dist/kernel/components/ui/link.d.ts +3 -3
  90. package/dist/kernel/components/ui/menu.d.ts +22 -22
  91. package/dist/kernel/components/ui/mod-key.d.ts +2 -3
  92. package/dist/kernel/components/ui/navigation-menu.d.ts +15 -15
  93. package/dist/kernel/components/ui/popover.d.ts +11 -11
  94. package/dist/kernel/components/ui/progress.d.ts +7 -7
  95. package/dist/kernel/components/ui/scroll-area.d.ts +1 -2
  96. package/dist/kernel/components/ui/select.d.ts +16 -16
  97. package/dist/kernel/components/ui/separator.d.ts +3 -3
  98. package/dist/kernel/components/ui/table.d.ts +7 -7
  99. package/dist/kernel/components/ui/tabs.d.ts +12 -12
  100. package/dist/kernel/components/ui/tag.d.ts +3 -3
  101. package/dist/kernel/components/ui/text.d.ts +4 -4
  102. package/dist/kernel/components/ui/toast.d.ts +11 -11
  103. package/dist/kernel/components/ui/tooltip.d.ts +9 -9
  104. package/dist/kernel/defaults.registry.d.ts +2 -2
  105. package/dist/kernel/defaults.registry.js +2 -2
  106. package/dist/kernel/routes/agent/markdown.d.ts +4 -0
  107. package/dist/kernel/routes/agent/markdown.js +11 -7
  108. package/dist/kernel/routes/layouts/group.d.ts +1 -1
  109. package/dist/kernel/routes/metadata/feed.d.ts +1 -2
  110. package/dist/kernel/routes/metadata/feed.js +34 -29
  111. package/dist/kernel/routes/metadata/llms.d.ts +3 -31
  112. package/dist/kernel/routes/metadata/llms.js +2 -200
  113. package/dist/kernel/routes/metadata/robots.d.ts +5 -3
  114. package/dist/kernel/routes/metadata/robots.js +4 -25
  115. package/dist/kernel/routes/metadata/sitemap.d.ts +15 -1
  116. package/dist/kernel/routes/metadata/sitemap.js +200 -112
  117. package/dist/kernel/routes/not-found.js +1 -1
  118. package/dist/kernel/routes/pages/group.d.ts +3 -3
  119. package/dist/kernel/routes/pages/group.js +10 -4
  120. package/dist/kernel/routes/pages/leaf.d.ts +9 -4
  121. package/dist/kernel/routes/pages/leaf.js +16 -8
  122. package/dist/kernel/routes/pages/root.d.ts +3 -3
  123. package/dist/kernel/routes/pages/root.js +20 -5
  124. package/dist/keyboard-shortcuts.d.ts +2 -2
  125. package/dist/manifest-types-CcVPH_jh.d.ts +83 -0
  126. package/dist/resolvers/manifest-resolver.d.ts +2 -2
  127. package/dist/resolvers/manifest-resolver.js +65 -35
  128. package/dist/search.d.ts +2 -9
  129. package/dist/search.js +2 -7
  130. package/dist/sidebar-types-CMrMM0Nj.d.ts +105 -0
  131. package/dist/theme-scope.d.ts +2 -2
  132. package/dist/types-BbqmOzLC.d.ts +168 -0
  133. package/dist/types-TjH1ek0X.d.ts +22 -0
  134. package/dist/types.d.ts +116 -91
  135. package/dist/{validate-local-source-SV44DBQT.js → validate-local-source-EN2GW4FR.js} +3 -3
  136. package/dist/{validate-publish-os-source-NZJF3TB2.js → validate-publish-os-source-OEWQDB7B.js} +2 -2
  137. package/init/seed/minimal/publish.os/blog/index.tsx +25 -22
  138. package/init/seed/minimal/publish.os/blog/page.tsx +31 -16
  139. package/init/seed/minimal/publish.os/components/blog/copy-link.tsx +1 -1
  140. package/init/seed/minimal/publish.os/components/blog/frontmatter.ts +41 -0
  141. package/init/seed/minimal/publish.os/publish.os.config.json +13 -2
  142. package/init/seed/minimal/seed.json +1 -0
  143. package/init/seed/scratch/publish.os/publish.os.config.json +1 -1
  144. package/package.json +4 -4
  145. package/release/app/phosphor/package.json +1 -1
  146. package/release/app/phosphor/pnpm-lock.yaml.template +53 -127
  147. package/release/compiler/pnpm-lock.yaml.template +49 -123
  148. package/release/release.json +4 -4
  149. package/dist/sidebar-types-DKpR27II.d.ts +0 -25
  150. package/dist/types-CJWRG05y.d.ts +0 -76
  151. package/dist/types-CUtrppxt.d.ts +0 -69
  152. package/dist/types-J2w_puPF.d.ts +0 -128
  153. package/dist/{button-BdCScEKi.d.ts → button-D6Xp2HBm.d.ts} +1 -1
@@ -21,7 +21,8 @@ var isDev = process.env.NODE_ENV !== "production", isDebugEnabled = process.env.
21
21
  // src/lib/runtime/metadata/canonical-url.ts
22
22
  function canonicalUrl(manifest, path, group) {
23
23
  let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
24
- if (!origin) return path;
24
+ if (!origin)
25
+ return /^[a-z][a-z\d+.-]*:/i.test(path) ? path : new URL(path, "https://publish.invalid").pathname;
25
26
  try {
26
27
  return new URL(path, `${origin}/`).toString();
27
28
  } catch {
@@ -44,7 +45,12 @@ function agentReadableAlternates({
44
45
  return {
45
46
  ...canonical.startsWith("http") ? { canonical } : {},
46
47
  types: {
47
- ...markdownPath ? { "text/markdown": normalizePath(markdownPath) } : {},
48
+ ...markdownPath ? {
49
+ "text/markdown": new URL(
50
+ normalizePath(markdownPath),
51
+ "https://publish.invalid"
52
+ ).pathname
53
+ } : {},
48
54
  "text/plain": "/llms.txt"
49
55
  }
50
56
  };
@@ -98,12 +104,21 @@ function createSocialMetadata({
98
104
  };
99
105
  }
100
106
 
107
+ // src/lib/shared/root-content-group.ts
108
+ var ROOT_CONTENT_GROUP_KEY = "__root";
109
+
101
110
  // src/route-page-root.tsx
102
111
  import { jsx } from "@publish.os/nextjs/jsx-runtime";
103
112
  var rootManifest, rootPage;
104
113
  async function CachedRootPage() {
105
114
  "use cache";
106
- return cacheLife("page"), cacheTag(tags.site()), !rootManifest || !rootPage ? null : (cacheTag(tags.manifest(rootManifest.contentHash)), log.debug("[cache]", "root"), /* @__PURE__ */ jsx(rootPage, { site: rootManifest.site, tree: rootManifest.tree }));
115
+ if (cacheLife("page"), cacheTag(tags.site()), !rootManifest || !rootPage) return null;
116
+ cacheTag(tags.manifest(rootManifest.contentHash)), log.debug("[cache]", "root");
117
+ let RootPage = rootPage, navigation = rootManifest.groups[ROOT_CONTENT_GROUP_KEY]?.navigation ?? {
118
+ rootGroup: ROOT_CONTENT_GROUP_KEY,
119
+ items: []
120
+ };
121
+ return /* @__PURE__ */ jsx(RootPage, { site: rootManifest.site, navigation });
107
122
  }
108
123
  function createRootPage({ manifest, RootPage }) {
109
124
  return rootManifest = manifest, rootPage = RootPage, async function() {
@@ -125,10 +140,10 @@ function createRootMetadata({
125
140
  }),
126
141
  ...createSocialMetadata({
127
142
  canonicalPath: "/",
128
- description,
143
+ description: manifest.site.metadata?.openGraph?.description ?? description,
129
144
  manifest,
130
145
  ogManifest,
131
- title: manifest.site.name
146
+ title: manifest.site.metadata?.openGraph?.title ?? manifest.site.name
132
147
  })
133
148
  };
134
149
  }
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  type Modifier = "mod" | "meta" | "ctrl" | "alt" | "shift";
@@ -26,7 +26,7 @@ type ShortcutRegistryApi = {
26
26
  };
27
27
  declare function KeyboardShortcutsProvider({ children, }: {
28
28
  children: ReactNode;
29
- }): react_jsx_runtime.JSX.Element;
29
+ }): react.JSX.Element;
30
30
  declare function useShortcut(combo: string | readonly string[], handler: ShortcutHandler, options?: ShortcutOptions): void;
31
31
  declare function useShortcutRegistry(): ShortcutRegistryApi;
32
32
  declare function formatShortcut(source: string): string[];
@@ -0,0 +1,83 @@
1
+ type OgImageMetadata = string | {
2
+ src: string;
3
+ alt?: string;
4
+ };
5
+ type OgMetadata = {
6
+ title?: string;
7
+ description?: string;
8
+ image?: OgImageMetadata;
9
+ };
10
+ type PageStatus = "published" | "draft";
11
+ type PageMetadata = {
12
+ openGraph?: OgMetadata;
13
+ robots?: {
14
+ index?: boolean;
15
+ follow?: boolean;
16
+ };
17
+ };
18
+ type PageFrontmatter<TCustom extends Record<string, unknown> = Record<string, unknown>> = TCustom & {
19
+ title: string;
20
+ description: string;
21
+ slug: string;
22
+ status: PageStatus;
23
+ metadata: PageMetadata;
24
+ };
25
+ type PageData<TCustom extends Record<string, unknown> = Record<string, unknown>> = {
26
+ fileID: string;
27
+ group: string;
28
+ path: string;
29
+ frontmatter: PageFrontmatter<TCustom>;
30
+ body: string;
31
+ };
32
+ type NavigationPageNode = {
33
+ id: string;
34
+ type: "page";
35
+ label: string;
36
+ href: string;
37
+ page: Omit<PageData, "body">;
38
+ children?: NavigationNode[];
39
+ };
40
+ type NavigationGroupNode = {
41
+ id: string;
42
+ type: "group";
43
+ label: string;
44
+ groupKey: string;
45
+ route: string;
46
+ presentation: "page" | "folder";
47
+ href?: string;
48
+ children: NavigationNode[];
49
+ };
50
+ type NavigationContainerNode = {
51
+ id: string;
52
+ type: "section" | "folder";
53
+ label: string;
54
+ children: NavigationNode[];
55
+ };
56
+ type NavigationLinkNode = {
57
+ id: string;
58
+ type: "link";
59
+ label: string;
60
+ href: string;
61
+ };
62
+ type NavigationViewNode = {
63
+ id: string;
64
+ type: "view";
65
+ label?: string;
66
+ viewId?: string;
67
+ items: NavigationNode[];
68
+ };
69
+ type NavigationSwitchViewNode = {
70
+ id: string;
71
+ type: "switch-view";
72
+ label: string;
73
+ target: string | {
74
+ view: string;
75
+ };
76
+ };
77
+ type NavigationNode = NavigationPageNode | NavigationGroupNode | NavigationContainerNode | NavigationLinkNode | NavigationViewNode | NavigationSwitchViewNode;
78
+ type ResolvedNavigation = {
79
+ rootGroup: string;
80
+ items: NavigationNode[];
81
+ };
82
+
83
+ export type { ResolvedNavigation as R };
@@ -1,11 +1,11 @@
1
- import React from 'react';
1
+ import react__default from 'react';
2
2
  import { IndexPageProps, PageProps, ManifestLike, LayoutProps } from '../types.js';
3
3
 
4
4
  type ResolvedLeaf = PageProps;
5
5
  type ResolvedGroup = Omit<IndexPageProps, "children">;
6
6
  declare function resolveLeaf(manifest: ManifestLike, group: string, slug: string | string[]): ResolvedLeaf | null;
7
7
  declare function resolveGroup(manifest: ManifestLike, group: string): ResolvedGroup | null;
8
- declare function resolveGroupLayout(manifest: ManifestLike, group: string, children: React.ReactNode): LayoutProps | null;
8
+ declare function resolveGroupLayout(manifest: ManifestLike, group: string, children: react__default.ReactNode): LayoutProps | null;
9
9
  declare function listStaticParams(manifest: ManifestLike, group: string): Array<{
10
10
  slug: string[];
11
11
  }>;
@@ -1,7 +1,8 @@
1
1
  // src/lib/runtime/metadata/canonical-url.ts
2
2
  function canonicalUrl(manifest, path, group) {
3
3
  let origin = (group && manifest.groups[group]?.origin) ?? manifest.site.origin;
4
- if (!origin) return path;
4
+ if (!origin)
5
+ return /^[a-z][a-z\d+.-]*:/i.test(path) ? path : new URL(path, "https://publish.invalid").pathname;
5
6
  try {
6
7
  return new URL(path, `${origin}/`).toString();
7
8
  } catch {
@@ -10,18 +11,33 @@ function canonicalUrl(manifest, path, group) {
10
11
  }
11
12
  function navigationUrl(manifest, path, group) {
12
13
  let origin = manifest.groups[group]?.origin ?? manifest.site.origin;
13
- return !origin || origin === manifest.site.origin ? path : canonicalUrl(manifest, path, group);
14
+ return !origin || origin === manifest.site.origin ? new URL(path, "https://publish.invalid").pathname : canonicalUrl(manifest, path, group);
14
15
  }
15
16
 
16
17
  // src/manifest-resolver.ts
17
- function findNodeInTree(nodes, id) {
18
+ function findPageNode(nodes, id) {
18
19
  for (let node of nodes) {
19
- if (node.type === "page") {
20
- if (node.fileID === id) return node;
21
- } else if (node.id === id)
22
- return node;
23
- if (node.type === "section" || node.type === "folder") {
24
- let found = findNodeInTree(node.children, id);
20
+ if (node.type === "page" && node.page.fileID === id) return node;
21
+ if ("children" in node && node.children) {
22
+ let found = findPageNode(node.children, id);
23
+ if (found) return found;
24
+ }
25
+ if (node.type === "view") {
26
+ let found = findPageNode(node.items, id);
27
+ if (found) return found;
28
+ }
29
+ }
30
+ return null;
31
+ }
32
+ function findGroupNode(nodes, groupKey) {
33
+ for (let node of nodes) {
34
+ if (node.type === "group" && node.groupKey === groupKey) return node;
35
+ if ("children" in node && node.children) {
36
+ let found = findGroupNode(node.children, groupKey);
37
+ if (found) return found;
38
+ }
39
+ if (node.type === "view") {
40
+ let found = findGroupNode(node.items, groupKey);
25
41
  if (found) return found;
26
42
  }
27
43
  }
@@ -29,43 +45,53 @@ function findNodeInTree(nodes, id) {
29
45
  }
30
46
  function pageNode(manifest, page) {
31
47
  return {
48
+ id: `page:${page.group}:${page.fileID}`,
32
49
  type: "page",
33
- fileID: page.fileID,
34
- title: page.title,
35
- path: page.path,
50
+ label: page.frontmatter.title,
36
51
  href: navigationUrl(manifest, page.path, page.group),
37
- group: page.group,
38
- description: page.description,
39
- status: page.status,
40
- publishedAt: page.publishedAt,
41
- updatedAt: page.updatedAt,
42
- authors: page.authors,
43
- tags: page.tags,
44
- meta: page.meta
52
+ page: {
53
+ fileID: page.fileID,
54
+ group: page.group,
55
+ path: page.path,
56
+ frontmatter: page.frontmatter
57
+ }
45
58
  };
46
59
  }
47
60
  function groupNode(manifest, group) {
48
- return {
49
- type: "section",
50
- id: group.key,
51
- title: group.title,
52
- path: group.path,
61
+ let inNavigation = findGroupNode(group.navigation.items, group.key);
62
+ return inNavigation || {
63
+ type: "group",
64
+ id: `group:${group.key}`,
65
+ label: group.title,
66
+ groupKey: group.key,
67
+ route: group.path,
68
+ presentation: "page",
53
69
  href: navigationUrl(manifest, group.path, group.key),
54
- group: group.key,
55
- children: group.tree
70
+ children: group.navigation.items
56
71
  };
57
72
  }
58
73
  function resolveLeaf(manifest, group, slug) {
59
- let slugPath = Array.isArray(slug) ? slug.join("/") : slug, page = manifest.pages.find((p) => p.group === group && p.slug === slugPath) ?? null;
60
- if (!page) return null;
61
- let groupData = manifest.groups[group];
62
- return groupData ? {
74
+ let segments;
75
+ try {
76
+ segments = (Array.isArray(slug) ? slug : slug.split("/")).map(
77
+ (segment) => decodeURIComponent(segment).normalize("NFC")
78
+ );
79
+ } catch {
80
+ return null;
81
+ }
82
+ if (segments.some((segment) => /[/\\\0]/u.test(segment))) return null;
83
+ let slugPath = segments.join("/"), groupData = manifest.groups[group];
84
+ if (!groupData) return null;
85
+ let pagePath = `${groupData.path === "/" ? "" : groupData.path.replace(/\/$/, "")}/${slugPath}`, page = manifest.pages.find(
86
+ (p) => p.group === group && p.path.normalize("NFC") === pagePath
87
+ ) ?? null;
88
+ return page ? {
63
89
  site: {
64
90
  ...manifest.site,
65
91
  origin: groupData.origin ?? manifest.site.origin
66
92
  },
67
- tree: groupData.tree,
68
- node: findNodeInTree(groupData.tree, page.fileID) ?? pageNode(manifest, page),
93
+ navigation: groupData.navigation,
94
+ node: findPageNode(groupData.navigation.items, page.fileID) ?? pageNode(manifest, page),
69
95
  page,
70
96
  currentPath: page.path,
71
97
  group
@@ -78,7 +104,7 @@ function resolveGroup(manifest, group) {
78
104
  ...manifest.site,
79
105
  origin: groupData.origin ?? manifest.site.origin
80
106
  },
81
- tree: groupData.tree,
107
+ navigation: groupData.navigation,
82
108
  node: groupNode(manifest, groupData),
83
109
  currentPath: groupData.path,
84
110
  group
@@ -90,7 +116,11 @@ function resolveGroupLayout(manifest, group, children) {
90
116
  }
91
117
  function listStaticParams(manifest, group) {
92
118
  let groupData = manifest.groups[group];
93
- return groupData ? groupData.pages.map((page) => ({ slug: page.slug.split("/") })) : [];
119
+ if (!groupData) return [];
120
+ let basePath = groupData.path === "/" ? "" : groupData.path.replace(/\/$/, "");
121
+ return groupData.pages.map((page) => ({
122
+ slug: page.path.slice(basePath.length).replace(/^\//, "").split("/")
123
+ }));
94
124
  }
95
125
  export {
96
126
  listStaticParams,
package/dist/search.d.ts CHANGED
@@ -1,11 +1,9 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { RefObject, ReactNode } from 'react';
3
3
 
4
4
  type SearchInput = {
5
5
  filters?: {
6
- author?: string;
7
6
  group?: string;
8
- tag?: string;
9
7
  };
10
8
  limit?: number;
11
9
  offset?: number;
@@ -22,17 +20,12 @@ type SearchResult = {
22
20
  excerpt: string;
23
21
  id: string;
24
22
  meta: {
25
- author?: string;
26
23
  description?: string;
27
24
  group?: string;
28
- image?: string;
29
25
  nodeId?: string;
30
26
  path?: string;
31
- publishedAt?: string;
32
27
  section?: string;
33
- tags?: string;
34
28
  title?: string;
35
- updatedAt?: string;
36
29
  };
37
30
  plainExcerpt: string;
38
31
  score?: number;
@@ -91,6 +84,6 @@ type SearchProviderProps = {
91
84
  open?: boolean;
92
85
  shortcut?: string | false;
93
86
  };
94
- declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, }: SearchProviderProps): react_jsx_runtime.JSX.Element;
87
+ declare function SearchProvider({ children, defaultOpen, limit, onOpenChange, open: controlledOpen, shortcut, }: SearchProviderProps): react.JSX.Element;
95
88
 
96
89
  export { type SearchBlockActions, type SearchBlockContextValue, type SearchBlockMeta, type SearchBlockState, type SearchInput, type SearchOutput, SearchProvider, type SearchProviderProps, type SearchResult, type SearchStatus, type SearchSubResult, search, useSearch, useSearchBlock };
package/dist/search.js CHANGED
@@ -95,13 +95,8 @@ async function withPagefindIndex(revision, run) {
95
95
  }
96
96
  }
97
97
  function pagefindFilters(filters) {
98
- if (!filters) return;
99
- let entries = Object.entries({
100
- author: filters.author,
101
- group: filters.group,
102
- tag: filters.tag
103
- }).filter((entry) => !!entry[1]);
104
- return entries.length > 0 ? Object.fromEntries(entries) : void 0;
98
+ if (filters)
99
+ return filters.group ? { group: filters.group } : void 0;
105
100
  }
106
101
  function titleForResult(data) {
107
102
  return data.meta?.title ?? data.sub_results?.find((subResult) => subResult.title)?.title ?? data.url;
@@ -0,0 +1,105 @@
1
+ import { Ref, ReactNode, MouseEvent } from 'react';
2
+
3
+ type OgImageMetadata = string | {
4
+ src: string;
5
+ alt?: string;
6
+ };
7
+ type OgMetadata = {
8
+ title?: string;
9
+ description?: string;
10
+ image?: OgImageMetadata;
11
+ };
12
+ type PageStatus = "published" | "draft";
13
+ type PageMetadata = {
14
+ openGraph?: OgMetadata;
15
+ robots?: {
16
+ index?: boolean;
17
+ follow?: boolean;
18
+ };
19
+ };
20
+ type PageFrontmatter<TCustom extends Record<string, unknown> = Record<string, unknown>> = TCustom & {
21
+ title: string;
22
+ description: string;
23
+ slug: string;
24
+ status: PageStatus;
25
+ metadata: PageMetadata;
26
+ };
27
+ type PageData<TCustom extends Record<string, unknown> = Record<string, unknown>> = {
28
+ fileID: string;
29
+ group: string;
30
+ path: string;
31
+ frontmatter: PageFrontmatter<TCustom>;
32
+ body: string;
33
+ };
34
+ type NavigationPageNode = {
35
+ id: string;
36
+ type: "page";
37
+ label: string;
38
+ href: string;
39
+ page: Omit<PageData, "body">;
40
+ children?: NavigationNode[];
41
+ };
42
+ type NavigationGroupNode = {
43
+ id: string;
44
+ type: "group";
45
+ label: string;
46
+ groupKey: string;
47
+ route: string;
48
+ presentation: "page" | "folder";
49
+ href?: string;
50
+ children: NavigationNode[];
51
+ };
52
+ type NavigationContainerNode = {
53
+ id: string;
54
+ type: "section" | "folder";
55
+ label: string;
56
+ children: NavigationNode[];
57
+ };
58
+ type NavigationLinkNode = {
59
+ id: string;
60
+ type: "link";
61
+ label: string;
62
+ href: string;
63
+ };
64
+ type NavigationViewNode = {
65
+ id: string;
66
+ type: "view";
67
+ label?: string;
68
+ viewId?: string;
69
+ items: NavigationNode[];
70
+ };
71
+ type NavigationSwitchViewNode = {
72
+ id: string;
73
+ type: "switch-view";
74
+ label: string;
75
+ target: string | {
76
+ view: string;
77
+ };
78
+ };
79
+ type NavigationNode = NavigationPageNode | NavigationGroupNode | NavigationContainerNode | NavigationLinkNode | NavigationViewNode | NavigationSwitchViewNode;
80
+ type ResolvedNavigation = {
81
+ rootGroup: string;
82
+ items: NavigationNode[];
83
+ };
84
+
85
+ type SidebarNavigationNode = NavigationNode;
86
+ type SidebarActiveState = "path-active" | "child-path-active";
87
+ type SidebarDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
88
+ type SidebarNodePrimitiveProps = {
89
+ activeState?: SidebarActiveState;
90
+ activeItemRef?: Ref<HTMLDivElement>;
91
+ children?: ReactNode;
92
+ contentId?: string;
93
+ depth: SidebarDepth;
94
+ expanded?: boolean;
95
+ href?: string;
96
+ isExpandable?: boolean;
97
+ node: SidebarNavigationNode;
98
+ onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
99
+ onSwitchView?: () => void;
100
+ onToggle?: () => void;
101
+ parentExpanded: boolean;
102
+ title: string;
103
+ };
104
+
105
+ export type { ResolvedNavigation as R, SidebarNodePrimitiveProps as S, SidebarActiveState as a, SidebarDepth as b, SidebarNavigationNode as c };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  type ThemeScopeProps = Readonly<{
@@ -9,7 +9,7 @@ type ThemeScopeProviderProps = Readonly<{
9
9
  children: ReactNode;
10
10
  group?: string;
11
11
  }>;
12
- declare function ThemeScopeProvider({ children, group, }: ThemeScopeProviderProps): react_jsx_runtime.JSX.Element;
12
+ declare function ThemeScopeProvider({ children, group, }: ThemeScopeProviderProps): react.JSX.Element;
13
13
  declare function useThemeScope(): ThemeScopeProps;
14
14
 
15
15
  export { type ThemeScopeProps, ThemeScopeProvider, type ThemeScopeProviderProps, useThemeScope };
@@ -0,0 +1,168 @@
1
+ type OgImageMetadata$1 = string | {
2
+ src: string;
3
+ alt?: string;
4
+ };
5
+ type OgMetadata$1 = {
6
+ title?: string;
7
+ description?: string;
8
+ image?: OgImageMetadata$1;
9
+ };
10
+ type PageStatus$1 = "published" | "draft";
11
+ type PageMetadata$1 = {
12
+ openGraph?: OgMetadata$1;
13
+ robots?: {
14
+ index?: boolean;
15
+ follow?: boolean;
16
+ };
17
+ };
18
+ type PageFrontmatter$1<TCustom extends Record<string, unknown> = Record<string, unknown>> = TCustom & {
19
+ title: string;
20
+ description: string;
21
+ slug: string;
22
+ status: PageStatus$1;
23
+ metadata: PageMetadata$1;
24
+ };
25
+ type PageData$1<TCustom extends Record<string, unknown> = Record<string, unknown>> = {
26
+ fileID: string;
27
+ group: string;
28
+ path: string;
29
+ frontmatter: PageFrontmatter$1<TCustom>;
30
+ body: string;
31
+ };
32
+ type NavigationPageNode = {
33
+ id: string;
34
+ type: "page";
35
+ label: string;
36
+ href: string;
37
+ page: Omit<PageData$1, "body">;
38
+ children?: NavigationNode[];
39
+ };
40
+ type NavigationGroupNode = {
41
+ id: string;
42
+ type: "group";
43
+ label: string;
44
+ groupKey: string;
45
+ route: string;
46
+ presentation: "page" | "folder";
47
+ href?: string;
48
+ children: NavigationNode[];
49
+ };
50
+ type NavigationContainerNode = {
51
+ id: string;
52
+ type: "section" | "folder";
53
+ label: string;
54
+ children: NavigationNode[];
55
+ };
56
+ type NavigationLinkNode = {
57
+ id: string;
58
+ type: "link";
59
+ label: string;
60
+ href: string;
61
+ };
62
+ type NavigationViewNode = {
63
+ id: string;
64
+ type: "view";
65
+ label?: string;
66
+ viewId?: string;
67
+ items: NavigationNode[];
68
+ };
69
+ type NavigationSwitchViewNode = {
70
+ id: string;
71
+ type: "switch-view";
72
+ label: string;
73
+ target: string | {
74
+ view: string;
75
+ };
76
+ };
77
+ type NavigationNode = NavigationPageNode | NavigationGroupNode | NavigationContainerNode | NavigationLinkNode | NavigationViewNode | NavigationSwitchViewNode;
78
+ type ResolvedNavigation = {
79
+ rootGroup: string;
80
+ items: NavigationNode[];
81
+ };
82
+
83
+ type SiteData = {
84
+ name: string;
85
+ description?: string;
86
+ origin?: string;
87
+ metadata?: IndexMetadata;
88
+ };
89
+ type OgImageMetadata = string | {
90
+ src: string;
91
+ alt?: string;
92
+ };
93
+ type OgMetadata = {
94
+ title?: string;
95
+ description?: string;
96
+ image?: OgImageMetadata;
97
+ };
98
+ type IndexMetadata = {
99
+ openGraph?: OgMetadata & {
100
+ scope?: "page" | "subtree";
101
+ };
102
+ };
103
+ type PageStatus = "published" | "draft";
104
+ type PageMetadata = {
105
+ openGraph?: OgMetadata;
106
+ robots?: {
107
+ index?: boolean;
108
+ follow?: boolean;
109
+ };
110
+ };
111
+ type PageFrontmatter<TCustom extends Record<string, unknown> = Record<string, unknown>> = TCustom & {
112
+ title: string;
113
+ description: string;
114
+ slug: string;
115
+ status: PageStatus;
116
+ metadata: PageMetadata;
117
+ };
118
+ type PageData<TCustom extends Record<string, unknown> = Record<string, unknown>> = {
119
+ fileID: string;
120
+ group: string;
121
+ path: string;
122
+ frontmatter: PageFrontmatter<TCustom>;
123
+ body: string;
124
+ };
125
+ type RouteRecord = {
126
+ fileID: string;
127
+ slug: string;
128
+ path: string;
129
+ group: string;
130
+ };
131
+ type ResolvedAttribution = {
132
+ enabled: false;
133
+ } | {
134
+ enabled: true;
135
+ variant: "publish-dev";
136
+ label?: string;
137
+ hrefLabel?: string;
138
+ href: string;
139
+ };
140
+ type GroupManifest = {
141
+ key: string;
142
+ title: string;
143
+ path: string;
144
+ origin?: string;
145
+ ancestry?: string[];
146
+ metadata?: IndexMetadata;
147
+ meta?: Record<string, unknown>;
148
+ navigation: ResolvedNavigation;
149
+ pages: PageData[];
150
+ };
151
+ type ManifestLike = {
152
+ site: SiteData;
153
+ groups: Record<string, GroupManifest>;
154
+ routes: RouteRecord[];
155
+ pages: PageData[];
156
+ attribution?: Record<string, ResolvedAttribution>;
157
+ contentHash: string;
158
+ };
159
+ type LayoutProps = {
160
+ children: React.ReactNode;
161
+ site: SiteData;
162
+ navigation: ResolvedNavigation;
163
+ node: NavigationNode;
164
+ currentPath: string;
165
+ group: string;
166
+ };
167
+
168
+ export type { LayoutProps as L, ManifestLike as M };
@@ -0,0 +1,22 @@
1
+ type SiteData = {
2
+ name: string;
3
+ description?: string;
4
+ origin?: string;
5
+ metadata?: IndexMetadata;
6
+ };
7
+ type OgImageMetadata = string | {
8
+ src: string;
9
+ alt?: string;
10
+ };
11
+ type OgMetadata = {
12
+ title?: string;
13
+ description?: string;
14
+ image?: OgImageMetadata;
15
+ };
16
+ type IndexMetadata = {
17
+ openGraph?: OgMetadata & {
18
+ scope?: "page" | "subtree";
19
+ };
20
+ };
21
+
22
+ export type { SiteData as S };