polen 0.9.1-next.1 → 0.10.0-next.10
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 +49 -364
- package/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/config/configurator.d.ts +9 -1
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +18 -6
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/load.js +5 -5
- package/build/api/config/load.js.map +1 -1
- package/build/api/config-resolver/resolve.js +2 -2
- package/build/api/config-resolver/resolve.js.map +1 -1
- package/build/api/content/$$.d.ts +7 -0
- package/build/api/content/$$.d.ts.map +1 -0
- package/build/api/content/$$.js +7 -0
- package/build/api/content/$$.js.map +1 -0
- package/build/api/content/$.d.ts +2 -0
- package/build/api/content/$.d.ts.map +1 -0
- package/build/api/content/$.js +2 -0
- package/build/api/content/$.js.map +1 -0
- package/build/api/content/metadata.d.ts +10 -0
- package/build/api/content/metadata.d.ts.map +1 -0
- package/build/api/content/metadata.js +9 -0
- package/build/api/content/metadata.js.map +1 -0
- package/build/api/content/navbar.d.ts +10 -0
- package/build/api/content/navbar.d.ts.map +1 -0
- package/build/api/content/navbar.js +45 -0
- package/build/api/content/navbar.js.map +1 -0
- package/build/api/content/page.d.ts +11 -0
- package/build/api/content/page.d.ts.map +1 -0
- package/build/api/content/page.js +2 -0
- package/build/api/content/page.js.map +1 -0
- package/build/api/content/scan.d.ts +19 -0
- package/build/api/content/scan.d.ts.map +1 -0
- package/build/api/content/scan.js +90 -0
- package/build/api/content/scan.js.map +1 -0
- package/build/api/content/sidebar.d.ts +104 -0
- package/build/api/content/sidebar.d.ts.map +1 -0
- package/build/api/content/sidebar.js +166 -0
- package/build/api/content/sidebar.js.map +1 -0
- package/build/api/content/utils.d.ts +5 -0
- package/build/api/content/utils.d.ts.map +1 -0
- package/build/api/content/utils.js +8 -0
- package/build/api/content/utils.js.map +1 -0
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +3 -2
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/static/index.d.ts +2 -0
- package/build/api/static/index.d.ts.map +1 -0
- package/build/api/static/index.js +2 -0
- package/build/api/static/index.js.map +1 -0
- package/build/api/static/manifest.d.ts +18 -0
- package/build/api/static/manifest.d.ts.map +1 -0
- package/build/api/static/manifest.js +13 -0
- package/build/api/static/manifest.js.map +1 -0
- package/build/api/static/rebase.d.ts +14 -0
- package/build/api/static/rebase.d.ts.map +1 -0
- package/build/api/static/rebase.js +110 -0
- package/build/api/static/rebase.js.map +1 -0
- package/build/api/static/static.d.ts +3 -0
- package/build/api/static/static.d.ts.map +1 -0
- package/build/api/static/static.js +3 -0
- package/build/api/static/static.js.map +1 -0
- package/build/api/vite/plugins/branding/index.d.ts +4 -0
- package/build/api/vite/plugins/branding/index.d.ts.map +1 -0
- package/build/api/vite/plugins/branding/index.js +80 -0
- package/build/api/vite/plugins/branding/index.js.map +1 -0
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +22 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts +2 -2
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +4 -5
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +2 -1
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts +8 -14
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +110 -183
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.js +5 -5
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/cli/_/self-contained-mode.js +5 -5
- package/build/cli/_/self-contained-mode.js.map +1 -1
- package/build/cli/commands/static/$default.d.ts +3 -0
- package/build/cli/commands/static/$default.d.ts.map +1 -0
- package/build/cli/commands/static/$default.js +38 -0
- package/build/cli/commands/static/$default.js.map +1 -0
- package/build/cli/commands/static/rebase.d.ts +2 -0
- package/build/cli/commands/static/rebase.d.ts.map +1 -0
- package/build/cli/commands/static/rebase.js +26 -0
- package/build/cli/commands/static/rebase.js.map +1 -0
- package/build/cli/commands/static.d.ts +3 -0
- package/build/cli/commands/static.d.ts.map +1 -0
- package/build/cli/commands/static.js +5 -0
- package/build/cli/commands/static.js.map +1 -0
- package/build/exports/components.d.ts +2 -0
- package/build/exports/components.d.ts.map +1 -0
- package/build/exports/components.js +2 -0
- package/build/exports/components.js.map +1 -0
- package/build/lib/demos/builder.d.ts +83 -0
- package/build/lib/demos/builder.d.ts.map +1 -0
- package/build/lib/demos/builder.js +237 -0
- package/build/lib/demos/builder.js.map +1 -0
- package/build/lib/demos/config-schema.d.ts +243 -0
- package/build/lib/demos/config-schema.d.ts.map +1 -0
- package/build/lib/demos/config-schema.js +52 -0
- package/build/lib/demos/config-schema.js.map +1 -0
- package/build/lib/demos/config.d.ts +40 -0
- package/build/lib/demos/config.d.ts.map +1 -0
- package/build/lib/demos/config.js +180 -0
- package/build/lib/demos/config.js.map +1 -0
- package/build/lib/demos/index.d.ts +9 -0
- package/build/lib/demos/index.d.ts.map +1 -0
- package/build/lib/demos/index.js +8 -0
- package/build/lib/demos/index.js.map +1 -0
- package/build/lib/demos/ui/components.d.ts +33 -0
- package/build/lib/demos/ui/components.d.ts.map +1 -0
- package/build/lib/demos/ui/components.js +699 -0
- package/build/lib/demos/ui/components.js.map +1 -0
- package/build/lib/demos/ui/data-collector.d.ts +88 -0
- package/build/lib/demos/ui/data-collector.d.ts.map +1 -0
- package/build/lib/demos/ui/data-collector.js +174 -0
- package/build/lib/demos/ui/data-collector.js.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts +3 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.js +21 -0
- package/build/lib/demos/ui/landing-page-cli.js.map +1 -0
- package/build/lib/demos/ui/landing-page.d.ts +32 -0
- package/build/lib/demos/ui/landing-page.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page.js +83 -0
- package/build/lib/demos/ui/landing-page.js.map +1 -0
- package/build/lib/demos/ui/page-renderer.d.ts +26 -0
- package/build/lib/demos/ui/page-renderer.d.ts.map +1 -0
- package/build/lib/demos/ui/page-renderer.js +104 -0
- package/build/lib/demos/ui/page-renderer.js.map +1 -0
- package/build/lib/demos/utils.d.ts +14 -0
- package/build/lib/demos/utils.d.ts.map +1 -0
- package/build/lib/demos/utils.js +37 -0
- package/build/lib/demos/utils.js.map +1 -0
- package/build/lib/deployment/$$.d.ts +3 -0
- package/build/lib/deployment/$$.d.ts.map +1 -0
- package/build/lib/deployment/$$.js +3 -0
- package/build/lib/deployment/$$.js.map +1 -0
- package/build/lib/deployment/$.d.ts +2 -0
- package/build/lib/deployment/$.d.ts.map +1 -0
- package/build/lib/deployment/$.js +2 -0
- package/build/lib/deployment/$.js.map +1 -0
- package/build/lib/deployment/metadata.d.ts +32 -0
- package/build/lib/deployment/metadata.d.ts.map +1 -0
- package/build/lib/deployment/metadata.js +37 -0
- package/build/lib/deployment/metadata.js.map +1 -0
- package/build/lib/deployment/path-manager.d.ts +41 -0
- package/build/lib/deployment/path-manager.d.ts.map +1 -0
- package/build/lib/deployment/path-manager.js +157 -0
- package/build/lib/deployment/path-manager.js.map +1 -0
- package/build/lib/file-router/file-router.d.ts +0 -2
- package/build/lib/file-router/file-router.d.ts.map +1 -1
- package/build/lib/file-router/file-router.js +0 -2
- package/build/lib/file-router/file-router.js.map +1 -1
- package/build/lib/file-router/route.d.ts +2 -0
- package/build/lib/file-router/route.d.ts.map +1 -1
- package/build/lib/file-router/route.js.map +1 -1
- package/build/lib/file-router/scan.d.ts.map +1 -1
- package/build/lib/file-router/scan.js +22 -13
- package/build/lib/file-router/scan.js.map +1 -1
- package/build/lib/github-actions/git-controller.d.ts +50 -0
- package/build/lib/github-actions/git-controller.d.ts.map +1 -0
- package/build/lib/github-actions/git-controller.js +90 -0
- package/build/lib/github-actions/git-controller.js.map +1 -0
- package/build/lib/github-actions/github-actions.d.ts +7 -0
- package/build/lib/github-actions/github-actions.d.ts.map +1 -0
- package/build/lib/github-actions/github-actions.js +7 -0
- package/build/lib/github-actions/github-actions.js.map +1 -0
- package/build/lib/github-actions/index.d.ts +2 -0
- package/build/lib/github-actions/index.d.ts.map +1 -0
- package/build/lib/github-actions/index.js +2 -0
- package/build/lib/github-actions/index.js.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts +12 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js +51 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js.map +1 -0
- package/build/lib/github-actions/pr-controller.d.ts +39 -0
- package/build/lib/github-actions/pr-controller.d.ts.map +1 -0
- package/build/lib/github-actions/pr-controller.js +122 -0
- package/build/lib/github-actions/pr-controller.js.map +1 -0
- package/build/lib/github-actions/run-step-cli.d.ts +9 -0
- package/build/lib/github-actions/run-step-cli.d.ts.map +1 -0
- package/build/lib/github-actions/run-step-cli.js +71 -0
- package/build/lib/github-actions/run-step-cli.js.map +1 -0
- package/build/lib/github-actions/runner.d.ts +17 -0
- package/build/lib/github-actions/runner.d.ts.map +1 -0
- package/build/lib/github-actions/runner.js +195 -0
- package/build/lib/github-actions/runner.js.map +1 -0
- package/build/lib/github-actions/schemas/context.d.ts +933 -0
- package/build/lib/github-actions/schemas/context.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/context.js +407 -0
- package/build/lib/github-actions/schemas/context.js.map +1 -0
- package/build/lib/github-actions/schemas/index.d.ts +5 -0
- package/build/lib/github-actions/schemas/index.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/index.js +5 -0
- package/build/lib/github-actions/schemas/index.js.map +1 -0
- package/build/lib/github-actions/search-module.d.ts +38 -0
- package/build/lib/github-actions/search-module.d.ts.map +1 -0
- package/build/lib/github-actions/search-module.js +40 -0
- package/build/lib/github-actions/search-module.js.map +1 -0
- package/build/lib/github-actions/step.d.ts +163 -0
- package/build/lib/github-actions/step.d.ts.map +1 -0
- package/build/lib/github-actions/step.js +121 -0
- package/build/lib/github-actions/step.js.map +1 -0
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +5 -3
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/kit-temp.d.ts +54 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +82 -14
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/kit-temp.test-d.d.ts +2 -0
- package/build/lib/kit-temp.test-d.d.ts.map +1 -0
- package/build/lib/kit-temp.test-d.js +75 -0
- package/build/lib/kit-temp.test-d.js.map +1 -0
- package/build/lib/mask/$$.d.ts +3 -0
- package/build/lib/mask/$$.d.ts.map +1 -0
- package/build/lib/mask/$$.js +3 -0
- package/build/lib/mask/$$.js.map +1 -0
- package/build/lib/mask/$.d.ts +2 -0
- package/build/lib/mask/$.d.ts.map +1 -0
- package/build/lib/mask/$.js +2 -0
- package/build/lib/mask/$.js.map +1 -0
- package/build/lib/mask/apply.d.ts +86 -0
- package/build/lib/mask/apply.d.ts.map +1 -0
- package/build/lib/mask/apply.js +86 -0
- package/build/lib/mask/apply.js.map +1 -0
- package/build/lib/mask/mask.d.ts +124 -0
- package/build/lib/mask/mask.d.ts.map +1 -0
- package/build/lib/mask/mask.js +137 -0
- package/build/lib/mask/mask.js.map +1 -0
- package/build/lib/mask/mask.test-d.d.ts +2 -0
- package/build/lib/mask/mask.test-d.d.ts.map +1 -0
- package/build/lib/mask/mask.test-d.js +102 -0
- package/build/lib/mask/mask.test-d.js.map +1 -0
- package/build/lib/mutation-type.d.ts +18 -0
- package/build/lib/mutation-type.d.ts.map +1 -0
- package/build/lib/mutation-type.js +16 -0
- package/build/lib/mutation-type.js.map +1 -0
- package/build/lib/task/$$.d.ts +3 -0
- package/build/lib/task/$$.d.ts.map +1 -0
- package/build/lib/task/$$.js +3 -0
- package/build/lib/task/$$.js.map +1 -0
- package/build/lib/task/$.d.ts +2 -0
- package/build/lib/task/$.d.ts.map +1 -0
- package/build/lib/task/$.js +2 -0
- package/build/lib/task/$.js.map +1 -0
- package/build/lib/task/report.d.ts +28 -0
- package/build/lib/task/report.d.ts.map +1 -0
- package/build/lib/task/report.js +33 -0
- package/build/lib/task/report.js.map +1 -0
- package/build/lib/task/task.d.ts +44 -0
- package/build/lib/task/task.d.ts.map +1 -0
- package/build/lib/task/task.js +63 -0
- package/build/lib/task/task.js.map +1 -0
- package/build/lib/version-history/index.d.ts +3 -0
- package/build/lib/version-history/index.d.ts.map +1 -0
- package/build/lib/version-history/index.js +2 -0
- package/build/lib/version-history/index.js.map +1 -0
- package/build/lib/version-history/types.d.ts +64 -0
- package/build/lib/version-history/types.d.ts.map +1 -0
- package/build/lib/version-history/types.js +5 -0
- package/build/lib/version-history/types.js.map +1 -0
- package/build/lib/version-history/version-history.d.ts +85 -0
- package/build/lib/version-history/version-history.d.ts.map +1 -0
- package/build/lib/version-history/version-history.js +248 -0
- package/build/lib/version-history/version-history.js.map +1 -0
- package/build/lib/vite-virtual/debug.d.ts +1 -1
- package/build/lib/vite-virtual/debug.d.ts.map +1 -1
- package/build/lib/vite-virtual/debug.js +1 -1
- package/build/lib/vite-virtual/debug.js.map +1 -1
- package/build/project-data.d.ts +0 -1
- package/build/project-data.d.ts.map +1 -1
- package/build/sandbox.d.ts +2 -0
- package/build/sandbox.d.ts.map +1 -0
- package/build/sandbox.js +18 -0
- package/build/sandbox.js.map +1 -0
- package/build/singletons/debug.d.ts +2 -2
- package/build/singletons/debug.d.ts.map +1 -1
- package/build/singletons/debug.js +2 -2
- package/build/singletons/debug.js.map +1 -1
- package/build/template/components/HamburgerMenu.d.ts +9 -0
- package/build/template/components/HamburgerMenu.d.ts.map +1 -0
- package/build/template/components/HamburgerMenu.jsx +53 -0
- package/build/template/components/HamburgerMenu.jsx.map +1 -0
- package/build/template/components/Link.jsx +1 -1
- package/build/template/components/Logo.d.ts +9 -0
- package/build/template/components/Logo.d.ts.map +1 -0
- package/build/template/components/Logo.jsx +29 -0
- package/build/template/components/Logo.jsx.map +1 -0
- package/build/template/components/NotFound.d.ts +2 -0
- package/build/template/components/NotFound.d.ts.map +1 -0
- package/build/template/components/NotFound.jsx +26 -0
- package/build/template/components/NotFound.jsx.map +1 -0
- package/build/template/components/ThemeToggle.d.ts +3 -0
- package/build/template/components/ThemeToggle.d.ts.map +1 -0
- package/build/template/components/ThemeToggle.jsx +10 -0
- package/build/template/components/ThemeToggle.jsx.map +1 -0
- package/build/template/components/content/$$.d.ts +2 -0
- package/build/template/components/content/$$.d.ts.map +1 -0
- package/build/template/components/content/$$.js +2 -0
- package/build/template/components/content/$$.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts +2 -2
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.d.ts +3 -3
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx.map +1 -1
- package/build/template/contexts/ThemeContext.d.ts +12 -0
- package/build/template/contexts/ThemeContext.d.ts.map +1 -0
- package/build/template/contexts/ThemeContext.jsx +41 -0
- package/build/template/contexts/ThemeContext.jsx.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.jsx +66 -53
- package/build/template/routes/root.jsx.map +1 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +2 -21
- package/build/template/server/app.js.map +1 -1
- package/package.json +42 -28
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +28 -6
- package/src/api/config/load.ts +5 -5
- package/src/api/config-resolver/resolve.ts +2 -2
- package/src/api/content/$$.ts +6 -0
- package/src/api/content/$.test.ts +72 -0
- package/src/api/content/$.ts +1 -0
- package/src/api/content/metadata.ts +11 -0
- package/src/api/content/navbar.test.ts +55 -0
- package/src/api/content/navbar.ts +61 -0
- package/src/api/content/page.ts +12 -0
- package/src/api/content/scan.ts +117 -0
- package/src/api/content/sidebar.test.ts +297 -0
- package/src/api/content/sidebar.ts +283 -0
- package/src/api/content/utils.ts +7 -0
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +3 -2
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/static/index.ts +1 -0
- package/src/api/static/manifest.test.ts +106 -0
- package/src/api/static/manifest.ts +16 -0
- package/src/api/static/rebase.test.ts +229 -0
- package/src/api/static/rebase.ts +140 -0
- package/src/api/static/static.ts +2 -0
- package/src/api/utils/asset-url/asset-url.test.ts +4 -4
- package/src/api/vite/plugins/branding/index.ts +108 -0
- package/src/api/vite/plugins/build.ts +25 -1
- package/src/api/vite/plugins/core.ts +6 -7
- package/src/api/vite/plugins/main.ts +2 -0
- package/src/api/vite/plugins/pages.ts +131 -207
- package/src/api/vite/plugins/serve.ts +5 -5
- package/src/cli/_/self-contained-mode.ts +5 -5
- package/src/cli/commands/static/$default.ts +43 -0
- package/src/cli/commands/static/rebase.ts +37 -0
- package/src/cli/commands/static.ts +6 -0
- package/src/exports/components.ts +1 -0
- package/src/lib/demos/builder.ts +298 -0
- package/src/lib/demos/config-schema.ts +56 -0
- package/src/lib/demos/config.test.ts +193 -0
- package/src/lib/demos/config.ts +205 -0
- package/src/lib/demos/index.ts +9 -0
- package/src/lib/demos/ui/components.ts +739 -0
- package/src/lib/demos/ui/data-collector.ts +246 -0
- package/src/lib/demos/ui/landing-page-cli.ts +23 -0
- package/src/lib/demos/ui/landing-page.ts +126 -0
- package/src/lib/demos/ui/page-renderer.ts +124 -0
- package/src/lib/demos/utils.ts +43 -0
- package/src/lib/deployment/$$.ts +2 -0
- package/src/lib/deployment/$.test.ts +53 -0
- package/src/lib/deployment/$.ts +1 -0
- package/src/lib/deployment/metadata.ts +40 -0
- package/src/lib/deployment/path-manager.ts +186 -0
- package/src/lib/file-router/file-router.ts +0 -2
- package/src/lib/file-router/linter.test.ts +2 -0
- package/src/lib/file-router/route.ts +2 -0
- package/src/lib/file-router/scan.ts +26 -14
- package/src/lib/github-actions/git-controller.ts +151 -0
- package/src/lib/github-actions/github-actions.ts +6 -0
- package/src/lib/github-actions/index.ts +1 -0
- package/src/lib/github-actions/lib/get-pr-deployments.ts +76 -0
- package/src/lib/github-actions/pr-controller.test.ts +172 -0
- package/src/lib/github-actions/pr-controller.ts +183 -0
- package/src/lib/github-actions/run-step-cli.ts +84 -0
- package/src/lib/github-actions/runner.test.ts +192 -0
- package/src/lib/github-actions/runner.ts +226 -0
- package/src/lib/github-actions/schemas/context.ts +424 -0
- package/src/lib/github-actions/schemas/index.ts +5 -0
- package/src/lib/github-actions/search-module.test.ts +110 -0
- package/src/lib/github-actions/search-module.ts +76 -0
- package/src/lib/github-actions/step.test.ts +149 -0
- package/src/lib/github-actions/step.ts +232 -0
- package/src/lib/helpers.ts +4 -3
- package/src/lib/kit-temp.test-d.ts +115 -0
- package/src/lib/kit-temp.test.ts +127 -0
- package/src/lib/kit-temp.ts +128 -14
- package/src/lib/mask/$$.ts +2 -0
- package/src/lib/mask/$.test.ts +248 -0
- package/src/lib/mask/$.ts +1 -0
- package/src/lib/mask/apply.ts +134 -0
- package/src/lib/mask/mask.test-d.ts +144 -0
- package/src/lib/mask/mask.ts +244 -0
- package/src/lib/mutation-type.ts +20 -0
- package/src/lib/shiki/shiki.test.ts +1 -1
- package/src/lib/task/$$.ts +2 -0
- package/src/lib/task/$.test.ts +209 -0
- package/src/lib/task/$.ts +1 -0
- package/src/lib/task/report.ts +72 -0
- package/src/lib/task/task.ts +112 -0
- package/src/lib/version-history/index.test.ts +196 -0
- package/src/lib/version-history/index.ts +4 -0
- package/src/lib/version-history/types.ts +68 -0
- package/src/lib/version-history/version-history.ts +293 -0
- package/src/lib/vite-virtual/debug.ts +1 -1
- package/src/project-data.ts +0 -1
- package/src/sandbox.ts +20 -0
- package/src/singletons/debug.ts +2 -2
- package/src/template/components/HamburgerMenu.tsx +96 -0
- package/src/template/components/Link.tsx +1 -1
- package/src/template/components/Logo.tsx +46 -0
- package/src/template/components/NotFound.tsx +28 -0
- package/src/template/components/ThemeToggle.tsx +21 -0
- package/src/template/components/content/$$.ts +1 -0
- package/src/template/components/sidebar/Sidebar.tsx +2 -2
- package/src/template/components/sidebar/SidebarItem.tsx +8 -8
- package/src/template/contexts/ThemeContext.tsx +60 -0
- package/src/template/routes/root.tsx +85 -74
- package/src/template/server/app.ts +2 -27
- package/build/lib/debug/debug.d.ts +0 -13
- package/build/lib/debug/debug.d.ts.map +0 -1
- package/build/lib/debug/debug.js +0 -86
- package/build/lib/debug/debug.js.map +0 -1
- package/build/lib/debug/environment-variable.d.ts +0 -6
- package/build/lib/debug/environment-variable.d.ts.map +0 -1
- package/build/lib/debug/environment-variable.js +0 -48
- package/build/lib/debug/environment-variable.js.map +0 -1
- package/build/lib/debug/index.d.ts +0 -2
- package/build/lib/debug/index.d.ts.map +0 -1
- package/build/lib/debug/index.js +0 -2
- package/build/lib/debug/index.js.map +0 -1
- package/build/lib/file-router/scan-tree.d.ts +0 -20
- package/build/lib/file-router/scan-tree.d.ts.map +0 -1
- package/build/lib/file-router/scan-tree.js +0 -158
- package/build/lib/file-router/scan-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/index.d.ts +0 -3
- package/build/lib/file-router/sidebar/index.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/index.js +0 -4
- package/build/lib/file-router/sidebar/index.js.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts +0 -9
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.js +0 -85
- package/build/lib/file-router/sidebar/sidebar-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/types.d.ts +0 -17
- package/build/lib/file-router/sidebar/types.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/types.js +0 -2
- package/build/lib/file-router/sidebar/types.js.map +0 -1
- package/build/lib/tree/index.d.ts +0 -3
- package/build/lib/tree/index.d.ts.map +0 -1
- package/build/lib/tree/index.js +0 -2
- package/build/lib/tree/index.js.map +0 -1
- package/build/lib/tree/tree.d.ts +0 -62
- package/build/lib/tree/tree.d.ts.map +0 -1
- package/build/lib/tree/tree.js +0 -134
- package/build/lib/tree/tree.js.map +0 -1
- package/src/lib/debug/debug.ts +0 -120
- package/src/lib/debug/environment-variable.ts +0 -56
- package/src/lib/debug/index.ts +0 -1
- package/src/lib/file-router/scan-tree.test.ts +0 -189
- package/src/lib/file-router/scan-tree.ts +0 -205
- package/src/lib/file-router/sidebar/index.ts +0 -3
- package/src/lib/file-router/sidebar/sidebar-tree.test.ts +0 -123
- package/src/lib/file-router/sidebar/sidebar-tree.ts +0 -110
- package/src/lib/file-router/sidebar/types.ts +0 -19
- package/src/lib/tree/index.ts +0 -2
- package/src/lib/tree/tree.test.ts +0 -117
- package/src/lib/tree/tree.ts +0 -183
@@ -1,205 +0,0 @@
|
|
1
|
-
import { TinyGlobby } from '#dep/tiny-globby/index'
|
2
|
-
import { Tree, type TreeNode } from '#lib/tree/index'
|
3
|
-
import { Path, Str } from '@wollybeard/kit'
|
4
|
-
import type { Diagnostic } from './linter.ts'
|
5
|
-
import type { Route, RouteFile } from './route.ts'
|
6
|
-
|
7
|
-
//
|
8
|
-
// Types
|
9
|
-
//
|
10
|
-
|
11
|
-
export type RouteTreeNodeType = 'directory' | 'file'
|
12
|
-
|
13
|
-
export interface RouteTreeNodeValue {
|
14
|
-
name: string
|
15
|
-
order?: number
|
16
|
-
type: RouteTreeNodeType
|
17
|
-
route?: Route // Only present for file nodes
|
18
|
-
}
|
19
|
-
|
20
|
-
export type RouteTreeNode = TreeNode<RouteTreeNodeValue>
|
21
|
-
|
22
|
-
export interface ScanTreeResult {
|
23
|
-
routeTree: RouteTreeNode
|
24
|
-
diagnostics: Diagnostic[]
|
25
|
-
}
|
26
|
-
|
27
|
-
//
|
28
|
-
// Constants
|
29
|
-
//
|
30
|
-
|
31
|
-
const conventions = {
|
32
|
-
index: {
|
33
|
-
name: `index`,
|
34
|
-
},
|
35
|
-
numberedPrefix: {
|
36
|
-
pattern: Str.pattern<{ groups: ['order', 'name'] }>(/^(?<order>\d+)[_-](?<name>.+)$/),
|
37
|
-
},
|
38
|
-
}
|
39
|
-
|
40
|
-
//
|
41
|
-
// Helpers
|
42
|
-
//
|
43
|
-
|
44
|
-
const parseSegment = (segment: string): { name: string; order?: number } => {
|
45
|
-
const match = Str.match(segment, conventions.numberedPrefix.pattern)
|
46
|
-
if (match) {
|
47
|
-
return {
|
48
|
-
name: match.groups.name,
|
49
|
-
order: parseInt(match.groups.order, 10),
|
50
|
-
}
|
51
|
-
}
|
52
|
-
return { name: segment }
|
53
|
-
}
|
54
|
-
|
55
|
-
const buildRouteTreeFromPaths = async (paths: string[], rootDir: string): Promise<RouteTreeNode> => {
|
56
|
-
// Root node (represents the pages directory itself)
|
57
|
-
const root = Tree.node<RouteTreeNodeValue>({
|
58
|
-
name: 'root',
|
59
|
-
type: 'directory',
|
60
|
-
})
|
61
|
-
|
62
|
-
// Process each file path
|
63
|
-
for (const filePath of paths) {
|
64
|
-
const relativePath = Path.relative(rootDir, filePath)
|
65
|
-
|
66
|
-
// Split the path into segments
|
67
|
-
const segments = relativePath.split(Path.sep).filter(s => s.length > 0)
|
68
|
-
if (segments.length === 0) continue // Skip root directory
|
69
|
-
|
70
|
-
// Navigate/create path in tree
|
71
|
-
let currentNode = root
|
72
|
-
|
73
|
-
for (let i = 0; i < segments.length; i++) {
|
74
|
-
const segment = segments[i]!
|
75
|
-
const isLast = i === segments.length - 1
|
76
|
-
|
77
|
-
// Parse segment for ordering
|
78
|
-
let segmentName = segment
|
79
|
-
// Strip extension for files
|
80
|
-
if (isLast && (segment.endsWith('.md') || segment.endsWith('.mdx'))) {
|
81
|
-
segmentName = segment.replace(/\.(md|mdx)$/, '')
|
82
|
-
}
|
83
|
-
const parsed = parseSegment(segmentName)
|
84
|
-
|
85
|
-
// Find existing child
|
86
|
-
const existingChildIndex = currentNode.children.findIndex(child => child.value.name === parsed.name)
|
87
|
-
let childNode = existingChildIndex >= 0 ? currentNode.children[existingChildIndex] : undefined
|
88
|
-
|
89
|
-
if (!childNode) {
|
90
|
-
// Create new node
|
91
|
-
if (isLast) {
|
92
|
-
// This is a file
|
93
|
-
const route = filePathToRoute(filePath, rootDir)
|
94
|
-
childNode = Tree.node<RouteTreeNodeValue>({
|
95
|
-
name: parsed.name,
|
96
|
-
order: parsed.order,
|
97
|
-
type: 'file',
|
98
|
-
route,
|
99
|
-
})
|
100
|
-
} else {
|
101
|
-
// This is a directory (implicit from file path)
|
102
|
-
childNode = Tree.node<RouteTreeNodeValue>({
|
103
|
-
name: parsed.name,
|
104
|
-
order: parsed.order,
|
105
|
-
type: 'directory',
|
106
|
-
})
|
107
|
-
}
|
108
|
-
currentNode.children.push(childNode)
|
109
|
-
} else if (isLast && childNode.value.type === 'file') {
|
110
|
-
// Handle collision for files with same name
|
111
|
-
// If new file has higher or equal order, replace the existing one (last wins for ties)
|
112
|
-
if (
|
113
|
-
parsed.order !== undefined
|
114
|
-
&& (childNode.value.order === undefined || parsed.order >= childNode.value.order)
|
115
|
-
) {
|
116
|
-
const route = filePathToRoute(filePath, rootDir)
|
117
|
-
const newNode = Tree.node<RouteTreeNodeValue>({
|
118
|
-
name: parsed.name,
|
119
|
-
order: parsed.order,
|
120
|
-
type: 'file',
|
121
|
-
route,
|
122
|
-
})
|
123
|
-
currentNode.children[existingChildIndex] = newNode
|
124
|
-
childNode = newNode
|
125
|
-
}
|
126
|
-
// Otherwise keep the existing node (when existing has higher order)
|
127
|
-
}
|
128
|
-
|
129
|
-
currentNode = childNode
|
130
|
-
}
|
131
|
-
}
|
132
|
-
|
133
|
-
// Sort the tree
|
134
|
-
return sortRouteTree(root)
|
135
|
-
}
|
136
|
-
|
137
|
-
const sortRouteTree = (tree: RouteTreeNode): RouteTreeNode => {
|
138
|
-
return Tree.sort(tree, (a, b) => {
|
139
|
-
// If both have orders, sort by order
|
140
|
-
if (a.order !== undefined && b.order !== undefined) {
|
141
|
-
return a.order - b.order
|
142
|
-
}
|
143
|
-
// If only one has order, it comes first
|
144
|
-
if (a.order !== undefined) return -1
|
145
|
-
if (b.order !== undefined) return 1
|
146
|
-
// Otherwise sort alphabetically
|
147
|
-
return a.name.localeCompare(b.name)
|
148
|
-
})
|
149
|
-
}
|
150
|
-
|
151
|
-
//
|
152
|
-
// Main scan function
|
153
|
-
//
|
154
|
-
|
155
|
-
export const scanTree = async (parameters: {
|
156
|
-
dir: string
|
157
|
-
glob?: string
|
158
|
-
}): Promise<ScanTreeResult> => {
|
159
|
-
const { dir, glob = `**/*` } = parameters
|
160
|
-
|
161
|
-
// Get all files
|
162
|
-
const filePaths = await TinyGlobby.glob(glob, {
|
163
|
-
absolute: true,
|
164
|
-
cwd: dir,
|
165
|
-
onlyFiles: true,
|
166
|
-
})
|
167
|
-
|
168
|
-
// Build tree structure (directories will be created implicitly)
|
169
|
-
const routeTree = await buildRouteTreeFromPaths(filePaths, dir)
|
170
|
-
|
171
|
-
// TODO: Implement tree-based linting
|
172
|
-
const diagnostics: Diagnostic[] = []
|
173
|
-
|
174
|
-
return {
|
175
|
-
routeTree,
|
176
|
-
diagnostics,
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
// Reuse existing route creation logic
|
181
|
-
const filePathToRoute = (filePathExpression: string, rootDir: string): Route => {
|
182
|
-
const file: RouteFile = {
|
183
|
-
path: {
|
184
|
-
absolute: Path.parse(filePathExpression),
|
185
|
-
relative: Path.parse(Path.relative(rootDir, filePathExpression)),
|
186
|
-
},
|
187
|
-
}
|
188
|
-
|
189
|
-
const dirPath = Str.split(Str.removeSurrounding(file.path.relative.dir, Path.sep), Path.sep)
|
190
|
-
|
191
|
-
// Parse numbered prefix from filename
|
192
|
-
const prefixMatch = file.path.relative.name.match(conventions.numberedPrefix.pattern)
|
193
|
-
const order = prefixMatch?.groups?.[`order`] ? parseInt(prefixMatch.groups[`order`], 10) : undefined
|
194
|
-
const nameWithoutPrefix = prefixMatch?.groups?.[`name`] ?? file.path.relative.name
|
195
|
-
|
196
|
-
const logical = {
|
197
|
-
path: nameWithoutPrefix === conventions.index.name ? dirPath : dirPath.concat(nameWithoutPrefix),
|
198
|
-
order,
|
199
|
-
}
|
200
|
-
|
201
|
-
return {
|
202
|
-
logical,
|
203
|
-
file,
|
204
|
-
}
|
205
|
-
}
|
@@ -1,123 +0,0 @@
|
|
1
|
-
import { Tree } from '#lib/tree/index'
|
2
|
-
import { describe, expect, test } from 'vitest'
|
3
|
-
import type { RouteTreeNode, RouteTreeNodeValue } from '../scan-tree.ts'
|
4
|
-
import { buildFromTree } from './sidebar-tree.ts'
|
5
|
-
|
6
|
-
// Helper to create mock routes
|
7
|
-
const mockRoute = (path: string[]) => ({
|
8
|
-
logical: { path },
|
9
|
-
file: {
|
10
|
-
path: {
|
11
|
-
absolute: { root: '/', dir: '/', base: 'file.md', ext: '.md', name: 'file' },
|
12
|
-
relative: { root: '', dir: '', base: 'file.md', ext: '.md', name: 'file' },
|
13
|
-
},
|
14
|
-
},
|
15
|
-
})
|
16
|
-
|
17
|
-
// Helper to create file node
|
18
|
-
const fileNode = (name: string, route: any): RouteTreeNode =>
|
19
|
-
Tree.node<RouteTreeNodeValue>({ name, type: 'file', route })
|
20
|
-
|
21
|
-
// Helper to create directory node
|
22
|
-
const dirNode = (name: string, children: RouteTreeNode[] = []): RouteTreeNode =>
|
23
|
-
Tree.node<RouteTreeNodeValue>({ name, type: 'directory' }, children)
|
24
|
-
|
25
|
-
describe('sidebar-tree', () => {
|
26
|
-
test('builds sidebar from simple tree', () => {
|
27
|
-
const tree = dirNode('root', [
|
28
|
-
fileNode('getting-started', mockRoute(['getting-started'])),
|
29
|
-
dirNode('guide', [
|
30
|
-
fileNode('introduction', mockRoute(['guide', 'introduction'])),
|
31
|
-
fileNode('basics', mockRoute(['guide', 'basics'])),
|
32
|
-
]),
|
33
|
-
])
|
34
|
-
|
35
|
-
const sidebar = buildFromTree(tree, [])
|
36
|
-
|
37
|
-
expect(sidebar.items).toHaveLength(2)
|
38
|
-
expect(sidebar.items[0]).toMatchObject({
|
39
|
-
type: 'ItemLink',
|
40
|
-
pathExp: 'getting-started',
|
41
|
-
title: 'Getting Started',
|
42
|
-
})
|
43
|
-
const section = sidebar.items[1]
|
44
|
-
expect(section).toBeDefined()
|
45
|
-
expect(section!.type).toBe('ItemSection')
|
46
|
-
if (section!.type === 'ItemSection') {
|
47
|
-
expect(section).toMatchObject({
|
48
|
-
type: 'ItemSection',
|
49
|
-
title: 'Guide',
|
50
|
-
pathExp: 'guide',
|
51
|
-
isLinkToo: false,
|
52
|
-
})
|
53
|
-
expect(section!.links).toHaveLength(2)
|
54
|
-
}
|
55
|
-
})
|
56
|
-
|
57
|
-
test('handles index files correctly', () => {
|
58
|
-
const tree = dirNode('root', [
|
59
|
-
dirNode('guide', [
|
60
|
-
fileNode('index', mockRoute(['guide'])),
|
61
|
-
fileNode('introduction', mockRoute(['guide', 'introduction'])),
|
62
|
-
]),
|
63
|
-
])
|
64
|
-
|
65
|
-
const sidebar = buildFromTree(tree, [])
|
66
|
-
|
67
|
-
expect(sidebar.items).toHaveLength(1)
|
68
|
-
const section = sidebar.items[0]
|
69
|
-
expect(section).toBeDefined()
|
70
|
-
expect(section!.type).toBe('ItemSection')
|
71
|
-
if (section!.type === 'ItemSection') {
|
72
|
-
expect(section).toMatchObject({
|
73
|
-
type: 'ItemSection',
|
74
|
-
title: 'Guide',
|
75
|
-
pathExp: 'guide',
|
76
|
-
isLinkToo: true, // Should be true because of index file
|
77
|
-
})
|
78
|
-
expect(section!.links).toHaveLength(1) // Only introduction, not index
|
79
|
-
}
|
80
|
-
})
|
81
|
-
|
82
|
-
test('respects node ordering from tree', () => {
|
83
|
-
const tree = dirNode('root', [
|
84
|
-
Tree.node<RouteTreeNodeValue>({ name: 'quickstart', order: 5, type: 'file', route: mockRoute(['quickstart']) }),
|
85
|
-
Tree.node<RouteTreeNodeValue>({ name: 'guide', order: 10, type: 'file', route: mockRoute(['guide']) }),
|
86
|
-
fileNode('api', mockRoute(['api'])),
|
87
|
-
fileNode('troubleshooting', mockRoute(['troubleshooting'])),
|
88
|
-
])
|
89
|
-
|
90
|
-
const sidebar = buildFromTree(tree, [])
|
91
|
-
|
92
|
-
// Tree should already be sorted, so sidebar should maintain that order
|
93
|
-
const titles = sidebar.items.map(item => item.title)
|
94
|
-
expect(titles).toEqual(['Quickstart', 'Guide', 'Api', 'Troubleshooting'])
|
95
|
-
})
|
96
|
-
|
97
|
-
test('handles nested directories', () => {
|
98
|
-
const tree = dirNode('root', [
|
99
|
-
dirNode('guide', [
|
100
|
-
fileNode('intro', mockRoute(['guide', 'intro'])),
|
101
|
-
dirNode('advanced', [
|
102
|
-
fileNode('performance', mockRoute(['guide', 'advanced', 'performance'])),
|
103
|
-
fileNode('optimization', mockRoute(['guide', 'advanced', 'optimization'])),
|
104
|
-
]),
|
105
|
-
]),
|
106
|
-
])
|
107
|
-
|
108
|
-
const sidebar = buildFromTree(tree, [])
|
109
|
-
|
110
|
-
expect(sidebar.items).toHaveLength(1)
|
111
|
-
const guideSection = sidebar.items[0]
|
112
|
-
expect(guideSection).toBeDefined()
|
113
|
-
expect(guideSection!.type).toBe('ItemSection')
|
114
|
-
if (guideSection!.type === 'ItemSection') {
|
115
|
-
expect(guideSection!.links).toHaveLength(3) // intro + 2 from advanced subdirectory
|
116
|
-
|
117
|
-
const navTitles = guideSection!.links.map(nav => nav.title)
|
118
|
-
expect(navTitles).toContain('Intro')
|
119
|
-
expect(navTitles).toContain('Performance')
|
120
|
-
expect(navTitles).toContain('Optimization')
|
121
|
-
}
|
122
|
-
})
|
123
|
-
})
|
@@ -1,110 +0,0 @@
|
|
1
|
-
import { Tree } from '#lib/tree/index'
|
2
|
-
import { Str } from '@wollybeard/kit'
|
3
|
-
import * as FileRouter from '../file-router.ts'
|
4
|
-
import type { RouteTreeNode } from '../scan-tree.ts'
|
5
|
-
import type { ItemLink, ItemSection, Sidebar } from './types.ts'
|
6
|
-
|
7
|
-
export * from './types.ts'
|
8
|
-
|
9
|
-
/**
|
10
|
-
* Build sidebar from tree structure
|
11
|
-
*/
|
12
|
-
export const buildFromTree = (routeTree: RouteTreeNode, basePath: FileRouter.Path): Sidebar => {
|
13
|
-
const links: ItemLink[] = []
|
14
|
-
const sections: ItemSection[] = []
|
15
|
-
|
16
|
-
// Process only the children of the root node
|
17
|
-
for (const child of routeTree.children) {
|
18
|
-
processNode(child, basePath, [], links, sections)
|
19
|
-
}
|
20
|
-
|
21
|
-
const items = [...links, ...sections]
|
22
|
-
|
23
|
-
return {
|
24
|
-
items,
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
const processNode = (
|
29
|
-
node: RouteTreeNode,
|
30
|
-
basePath: FileRouter.Path,
|
31
|
-
parentPath: string[],
|
32
|
-
links: ItemLink[],
|
33
|
-
sections: ItemSection[],
|
34
|
-
): void => {
|
35
|
-
const currentPath = [...parentPath, node.value.name]
|
36
|
-
|
37
|
-
if (node.value.type === 'directory') {
|
38
|
-
// This is a directory - create a section
|
39
|
-
const sectionPath = [...basePath, ...currentPath]
|
40
|
-
const sectionPathExp = FileRouter.pathToExpression(sectionPath)
|
41
|
-
const sectionTitle = Str.titlizeSlug(node.value.name)
|
42
|
-
|
43
|
-
const section: ItemSection = {
|
44
|
-
type: `ItemSection`,
|
45
|
-
title: sectionTitle,
|
46
|
-
pathExp: sectionPathExp.startsWith('/') ? sectionPathExp.slice(1) : sectionPathExp,
|
47
|
-
isLinkToo: false,
|
48
|
-
links: [],
|
49
|
-
}
|
50
|
-
|
51
|
-
// Check if this directory has an index file
|
52
|
-
const indexChild = node.children.find(child => child.value.type === 'file' && child.value.name === 'index')
|
53
|
-
if (indexChild) {
|
54
|
-
section.isLinkToo = true
|
55
|
-
}
|
56
|
-
|
57
|
-
// Process all non-index children as links for this section
|
58
|
-
for (const child of node.children) {
|
59
|
-
if (child.value.type === 'file' && child.value.name !== 'index' && child.value.route) {
|
60
|
-
// Pass the parent path of the route, not the section path
|
61
|
-
const routeParentPath = child.value.route.logical.path.slice(0, -1)
|
62
|
-
section.links.push(routeToItemLink(child.value.route, routeParentPath))
|
63
|
-
} else if (child.value.type === 'directory') {
|
64
|
-
// Recursively process subdirectories
|
65
|
-
// Note: This creates nested sections which the original implementation doesn't support
|
66
|
-
// For now, we'll just add the files from subdirectories to the parent section
|
67
|
-
collectFilesFromDirectory(child, child.value.route?.logical.path || [], section.links)
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
sections.push(section)
|
72
|
-
} else if (node.value.type === 'file' && node.value.route) {
|
73
|
-
// This is a top-level file - add as nav
|
74
|
-
if (node.value.name !== 'index') {
|
75
|
-
links.push(routeToItemLink(node.value.route, basePath))
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
const collectFilesFromDirectory = (
|
81
|
-
node: RouteTreeNode,
|
82
|
-
basePath: FileRouter.Path,
|
83
|
-
links: ItemLink[],
|
84
|
-
): void => {
|
85
|
-
Tree.visit(node, (n) => {
|
86
|
-
if (n.value.type === 'file' && n.value.route && n.value.name !== 'index') {
|
87
|
-
// Use the route's parent path for relative title generation
|
88
|
-
const routeParentPath = n.value.route.logical.path.slice(0, -1)
|
89
|
-
links.push(routeToItemLink(n.value.route, routeParentPath))
|
90
|
-
}
|
91
|
-
})
|
92
|
-
}
|
93
|
-
|
94
|
-
const routeToItemLink = (route: FileRouter.Route, basePath: FileRouter.Path): ItemLink => {
|
95
|
-
const pagePathExp = FileRouter.routeToPathExpression(route)
|
96
|
-
const pageRelative = FileRouter.makeRelativeUnsafe(route, basePath)
|
97
|
-
const pageRelativePathExp = FileRouter.routeToPathExpression(pageRelative)
|
98
|
-
|
99
|
-
// Remove leading slash for title generation
|
100
|
-
const titlePath = pageRelativePathExp.startsWith('/') ? pageRelativePathExp.slice(1) : pageRelativePathExp
|
101
|
-
|
102
|
-
// Use only the last segment for the title
|
103
|
-
const titleSegment = pageRelative.logical.path[pageRelative.logical.path.length - 1] || titlePath
|
104
|
-
|
105
|
-
return {
|
106
|
-
type: `ItemLink`,
|
107
|
-
pathExp: pagePathExp.startsWith('/') ? pagePathExp.slice(1) : pagePathExp,
|
108
|
-
title: Str.titlizeSlug(titleSegment),
|
109
|
-
}
|
110
|
-
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
export interface Sidebar {
|
2
|
-
items: Item[]
|
3
|
-
}
|
4
|
-
|
5
|
-
export type Item = ItemLink | ItemSection
|
6
|
-
|
7
|
-
export interface ItemLink {
|
8
|
-
type: `ItemLink`
|
9
|
-
title: string
|
10
|
-
pathExp: string
|
11
|
-
}
|
12
|
-
|
13
|
-
export interface ItemSection {
|
14
|
-
type: `ItemSection`
|
15
|
-
title: string
|
16
|
-
pathExp: string
|
17
|
-
isLinkToo: boolean
|
18
|
-
links: ItemLink[]
|
19
|
-
}
|
package/src/lib/tree/index.ts
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
import { describe, expect, test } from 'vitest'
|
2
|
-
import * as Tree from './tree.ts'
|
3
|
-
|
4
|
-
describe('Tree', () => {
|
5
|
-
const sampleTree = Tree.node('root', [
|
6
|
-
Tree.node('a', [
|
7
|
-
Tree.node('a1'),
|
8
|
-
Tree.node('a2'),
|
9
|
-
]),
|
10
|
-
Tree.node('b', [
|
11
|
-
Tree.node('b1'),
|
12
|
-
]),
|
13
|
-
Tree.node('c'),
|
14
|
-
])
|
15
|
-
|
16
|
-
test('node creates a tree node', () => {
|
17
|
-
const leaf = Tree.node('leaf')
|
18
|
-
expect(leaf).toEqual({ value: 'leaf', children: [] })
|
19
|
-
|
20
|
-
const parent = Tree.node('parent', [leaf])
|
21
|
-
expect(parent).toEqual({ value: 'parent', children: [leaf] })
|
22
|
-
})
|
23
|
-
|
24
|
-
test('map transforms node values', () => {
|
25
|
-
const upperTree = Tree.map(sampleTree, value => value.toUpperCase())
|
26
|
-
|
27
|
-
expect(upperTree.value).toBe('ROOT')
|
28
|
-
expect(upperTree.children[0]!.value).toBe('A')
|
29
|
-
expect(upperTree.children[0]!.children[0]!.value).toBe('A1')
|
30
|
-
})
|
31
|
-
|
32
|
-
test('map provides depth and path', () => {
|
33
|
-
const depths: number[] = []
|
34
|
-
const paths: string[][] = []
|
35
|
-
|
36
|
-
Tree.map(sampleTree, (value, depth, path) => {
|
37
|
-
depths.push(depth)
|
38
|
-
paths.push(path)
|
39
|
-
return value
|
40
|
-
})
|
41
|
-
|
42
|
-
expect(depths).toEqual([0, 1, 2, 2, 1, 2, 1])
|
43
|
-
expect(paths[0]).toEqual([])
|
44
|
-
expect(paths[1]).toEqual(['root'])
|
45
|
-
expect(paths[2]).toEqual(['root', 'a'])
|
46
|
-
})
|
47
|
-
|
48
|
-
test('visit traverses all nodes', () => {
|
49
|
-
const visited: string[] = []
|
50
|
-
Tree.visit(sampleTree, node => visited.push(node.value))
|
51
|
-
|
52
|
-
expect(visited).toEqual(['root', 'a', 'a1', 'a2', 'b', 'b1', 'c'])
|
53
|
-
})
|
54
|
-
|
55
|
-
test('find locates node', () => {
|
56
|
-
const found = Tree.find(sampleTree, value => value === 'b1')
|
57
|
-
expect(found?.value).toBe('b1')
|
58
|
-
|
59
|
-
const notFound = Tree.find(sampleTree, value => value === 'x')
|
60
|
-
expect(notFound).toBeUndefined()
|
61
|
-
})
|
62
|
-
|
63
|
-
test('filter removes non-matching nodes', () => {
|
64
|
-
const filtered = Tree.filter(sampleTree, value => !value.includes('2'))
|
65
|
-
|
66
|
-
expect(filtered).toBeDefined()
|
67
|
-
expect(Tree.flatten(filtered!)).toEqual(['root', 'a', 'a1', 'b', 'b1', 'c'])
|
68
|
-
})
|
69
|
-
|
70
|
-
test('sort orders children', () => {
|
71
|
-
const sorted = Tree.sort(sampleTree, (a, b) => b.localeCompare(a))
|
72
|
-
|
73
|
-
expect(sorted.children.map(c => c.value)).toEqual(['c', 'b', 'a'])
|
74
|
-
expect(sorted.children[2]!.children.map(c => c.value)).toEqual(['a2', 'a1'])
|
75
|
-
})
|
76
|
-
|
77
|
-
test('flatten returns all values', () => {
|
78
|
-
const flat = Tree.flatten(sampleTree)
|
79
|
-
expect(flat).toEqual(['root', 'a', 'a1', 'a2', 'b', 'b1', 'c'])
|
80
|
-
})
|
81
|
-
|
82
|
-
test('depth calculates tree depth', () => {
|
83
|
-
expect(Tree.depth(Tree.node('single'))).toBe(0)
|
84
|
-
expect(Tree.depth(sampleTree)).toBe(2)
|
85
|
-
})
|
86
|
-
|
87
|
-
test('count counts all nodes', () => {
|
88
|
-
expect(Tree.count(Tree.node('single'))).toBe(1)
|
89
|
-
expect(Tree.count(sampleTree)).toBe(7)
|
90
|
-
})
|
91
|
-
|
92
|
-
test('isLeaf identifies leaf nodes', () => {
|
93
|
-
expect(Tree.isLeaf(sampleTree)).toBe(false)
|
94
|
-
expect(Tree.isLeaf(sampleTree.children[0]!)).toBe(false)
|
95
|
-
expect(Tree.isLeaf(sampleTree.children[0]!.children[0]!)).toBe(true)
|
96
|
-
})
|
97
|
-
|
98
|
-
test('leaves gets all leaf nodes', () => {
|
99
|
-
const leafNodes = Tree.leaves(sampleTree)
|
100
|
-
expect(leafNodes.map(n => n.value)).toEqual(['a1', 'a2', 'b1', 'c'])
|
101
|
-
})
|
102
|
-
|
103
|
-
test('fromList builds tree from flat list', () => {
|
104
|
-
const items = [
|
105
|
-
{ id: '1', name: 'root' },
|
106
|
-
{ id: '2', parentId: '1', name: 'child1' },
|
107
|
-
{ id: '3', parentId: '1', name: 'child2' },
|
108
|
-
{ id: '4', parentId: '2', name: 'grandchild' },
|
109
|
-
]
|
110
|
-
|
111
|
-
const trees = Tree.fromList(items, undefined)
|
112
|
-
expect(trees).toHaveLength(1)
|
113
|
-
expect(trees[0]!.value.name).toBe('root')
|
114
|
-
expect(trees[0]!.children).toHaveLength(2)
|
115
|
-
expect(trees[0]!.children[0]!.children[0]!.value.name).toBe('grandchild')
|
116
|
-
})
|
117
|
-
})
|