feat: add persistent book navigation and public-only pages
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
// Existing Astro book collection filenames, not a second authored guide dataset.
|
||||
export const documentPaths = [
|
||||
'/1-concept.md',
|
||||
'/1.1-interaction-abstraction.md',
|
||||
'/1.2-existing-abstractions.md',
|
||||
'/1.3-design-principles.md',
|
||||
'/1.4-concepts-and-scope.md',
|
||||
'/2-core-model.md',
|
||||
'/2.1-object-tree-schema.md',
|
||||
'/2.2-operation-and-interface.md',
|
||||
@@ -10,13 +14,26 @@ export const documentPaths = [
|
||||
'/4.2-text-view.md',
|
||||
'/5-transports.md',
|
||||
'/5.1-wip-over-http.md',
|
||||
];
|
||||
// Formerly published draft URLs remain regression inputs, never public documents.
|
||||
export const draftPaths = [
|
||||
'/draft/dynamic-worldspace-projection.md',
|
||||
'/draft/filesystem-discovery.md',
|
||||
'/draft/rust-api-model.md',
|
||||
'/draft/typescript-api-model.md',
|
||||
'/draft/unresolved-issues.md',
|
||||
];
|
||||
export const treePaths = ['/', ...documentPaths.filter((path) => !path.startsWith('/draft/')), '/draft', ...documentPaths.filter((path) => path.startsWith('/draft/'))];
|
||||
export const treePaths = ['/', '/book', ...documentPaths];
|
||||
export const treeNodeCount = treePaths.length;
|
||||
export const rootChildCount = treePaths.filter((path) => path !== '/' && path.lastIndexOf('/') === 0).length;
|
||||
export const chapterSections: Record<string, string[]> = {
|
||||
'/1-concept.md': ['/1.1-interaction-abstraction.md', '/1.2-existing-abstractions.md', '/1.3-design-principles.md', '/1.4-concepts-and-scope.md'],
|
||||
'/2-core-model.md': ['/2.1-object-tree-schema.md', '/2.2-operation-and-interface.md'],
|
||||
'/4-client.md': ['/4.1-ai-tools.md', '/4.2-text-view.md'],
|
||||
'/5-transports.md': ['/5.1-wip-over-http.md'],
|
||||
};
|
||||
export const treeParents: Record<string, string> = Object.fromEntries(treePaths.filter((path) => path !== '/').map((path) => [path, path === '/book' ? '/' : '/book']));
|
||||
for (const [chapter, sections] of Object.entries(chapterSections)) {
|
||||
for (const section of sections) treeParents[section] = chapter;
|
||||
}
|
||||
export const rootChildCount = treePaths.filter((path) => treeParents[path] === '/').length;
|
||||
export const bookURL = (path: string, base: string) => new URL(`book/${path.slice(1, -3).split('/').map(encodeURIComponent).join('/')}/`, base).href;
|
||||
|
||||
Reference in New Issue
Block a user