@lickle/docs 0.0.0-dev.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 +3 -0
- package/dist/esm/_lib/fs/index.js +20 -0
- package/dist/esm/_lib/fs/index.js.map +1 -0
- package/dist/esm/_lib/fs/watch.js +30 -0
- package/dist/esm/_lib/fs/watch.js.map +1 -0
- package/dist/esm/_lib/index.js +9 -0
- package/dist/esm/_lib/index.js.map +1 -0
- package/dist/esm/_lib/jiti/index.js +16 -0
- package/dist/esm/_lib/jiti/index.js.map +1 -0
- package/dist/esm/_lib/path/index.js +42 -0
- package/dist/esm/_lib/path/index.js.map +1 -0
- package/dist/esm/_lib/pkg/index.js +128 -0
- package/dist/esm/_lib/pkg/index.js.map +1 -0
- package/dist/esm/_lib/repo/index.js +100 -0
- package/dist/esm/_lib/repo/index.js.map +1 -0
- package/dist/esm/_lib/slug/index.js +23 -0
- package/dist/esm/_lib/slug/index.js.map +1 -0
- package/dist/esm/_lib/t.js +2 -0
- package/dist/esm/_lib/t.js.map +1 -0
- package/dist/esm/_lib/tsconfig/index.js +12 -0
- package/dist/esm/_lib/tsconfig/index.js.map +1 -0
- package/dist/esm/_lib/util/index.js +54 -0
- package/dist/esm/_lib/util/index.js.map +1 -0
- package/dist/esm/cli/cmd/dev.js +74 -0
- package/dist/esm/cli/cmd/dev.js.map +1 -0
- package/dist/esm/cli/cmd/index.js +4 -0
- package/dist/esm/cli/cmd/index.js.map +1 -0
- package/dist/esm/cli/cmd/init.js +74 -0
- package/dist/esm/cli/cmd/init.js.map +1 -0
- package/dist/esm/cli/cmd/json.js +28 -0
- package/dist/esm/cli/cmd/json.js.map +1 -0
- package/dist/esm/cli/env.js +5 -0
- package/dist/esm/cli/env.js.map +1 -0
- package/dist/esm/cli/index.js +13 -0
- package/dist/esm/cli/index.js.map +1 -0
- package/dist/esm/cli/vite/client/index.jsx +20 -0
- package/dist/esm/cli/vite/client/index.jsx.map +1 -0
- package/dist/esm/cli/vite/index.js +100 -0
- package/dist/esm/cli/vite/index.js.map +1 -0
- package/dist/esm/cli.js +5 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/config/defaults.js +32 -0
- package/dist/esm/config/defaults.js.map +1 -0
- package/dist/esm/config/file.js +48 -0
- package/dist/esm/config/file.js.map +1 -0
- package/dist/esm/config/index.js +7 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/config/load.js +79 -0
- package/dist/esm/config/load.js.map +1 -0
- package/dist/esm/config/types.js +2 -0
- package/dist/esm/config/types.js.map +1 -0
- package/dist/esm/core/index.js +3 -0
- package/dist/esm/core/index.js.map +1 -0
- package/dist/esm/core/project/debug.js +26 -0
- package/dist/esm/core/project/debug.js.map +1 -0
- package/dist/esm/core/project/index.js +39 -0
- package/dist/esm/core/project/index.js.map +1 -0
- package/dist/esm/core/project/naming.js +39 -0
- package/dist/esm/core/project/naming.js.map +1 -0
- package/dist/esm/core/project/routing.js +173 -0
- package/dist/esm/core/project/routing.js.map +1 -0
- package/dist/esm/core/project/types.js +4 -0
- package/dist/esm/core/project/types.js.map +1 -0
- package/dist/esm/core/reflect/index.js +10 -0
- package/dist/esm/core/reflect/index.js.map +1 -0
- package/dist/esm/core/reflect/indexed.js +195 -0
- package/dist/esm/core/reflect/indexed.js.map +1 -0
- package/dist/esm/core/reflect/resolve.js +157 -0
- package/dist/esm/core/reflect/resolve.js.map +1 -0
- package/dist/esm/core/reflect/scan.js +787 -0
- package/dist/esm/core/reflect/scan.js.map +1 -0
- package/dist/esm/core/reflect/state.js +29 -0
- package/dist/esm/core/reflect/state.js.map +1 -0
- package/dist/esm/core/reflect/types.js +16 -0
- package/dist/esm/core/reflect/types.js.map +1 -0
- package/dist/esm/core/reflect/walk.js +106 -0
- package/dist/esm/core/reflect/walk.js.map +1 -0
- package/dist/esm/solidjs/index.js +2 -0
- package/dist/esm/solidjs/index.js.map +1 -0
- package/dist/esm/solidjs/jsx-runtime.js +2 -0
- package/dist/esm/solidjs/jsx-runtime.js.map +1 -0
- package/dist/esm/ui/App.jsx +71 -0
- package/dist/esm/ui/App.jsx.map +1 -0
- package/dist/esm/ui/components/Breadcrumb.jsx +45 -0
- package/dist/esm/ui/components/Breadcrumb.jsx.map +1 -0
- package/dist/esm/ui/components/Code/index.jsx +89 -0
- package/dist/esm/ui/components/Code/index.jsx.map +1 -0
- package/dist/esm/ui/components/Comment.jsx +176 -0
- package/dist/esm/ui/components/Comment.jsx.map +1 -0
- package/dist/esm/ui/components/Declaration.jsx +147 -0
- package/dist/esm/ui/components/Declaration.jsx.map +1 -0
- package/dist/esm/ui/components/Header.jsx +66 -0
- package/dist/esm/ui/components/Header.jsx.map +1 -0
- package/dist/esm/ui/components/Layout.jsx +44 -0
- package/dist/esm/ui/components/Layout.jsx.map +1 -0
- package/dist/esm/ui/components/Link.jsx +34 -0
- package/dist/esm/ui/components/Link.jsx.map +1 -0
- package/dist/esm/ui/components/LivePreview/Example.jsx +76 -0
- package/dist/esm/ui/components/LivePreview/Example.jsx.map +1 -0
- package/dist/esm/ui/components/LivePreview/Sandbox.jsx +25 -0
- package/dist/esm/ui/components/LivePreview/Sandbox.jsx.map +1 -0
- package/dist/esm/ui/components/LivePreview/index.js +4 -0
- package/dist/esm/ui/components/LivePreview/index.js.map +1 -0
- package/dist/esm/ui/components/LivePreview/transform.js +16 -0
- package/dist/esm/ui/components/LivePreview/transform.js.map +1 -0
- package/dist/esm/ui/components/Markdown.jsx +14 -0
- package/dist/esm/ui/components/Markdown.jsx.map +1 -0
- package/dist/esm/ui/components/Page.jsx +121 -0
- package/dist/esm/ui/components/Page.jsx.map +1 -0
- package/dist/esm/ui/components/References.jsx +32 -0
- package/dist/esm/ui/components/References.jsx.map +1 -0
- package/dist/esm/ui/components/SearchPalette.jsx +178 -0
- package/dist/esm/ui/components/SearchPalette.jsx.map +1 -0
- package/dist/esm/ui/components/Sidebar.jsx +63 -0
- package/dist/esm/ui/components/Sidebar.jsx.map +1 -0
- package/dist/esm/ui/components/Syntax.jsx +10 -0
- package/dist/esm/ui/components/Syntax.jsx.map +1 -0
- package/dist/esm/ui/components/ThemeToggle.jsx +25 -0
- package/dist/esm/ui/components/ThemeToggle.jsx.map +1 -0
- package/dist/esm/ui/components/Type.jsx +444 -0
- package/dist/esm/ui/components/Type.jsx.map +1 -0
- package/dist/esm/ui/components/index.js +16 -0
- package/dist/esm/ui/components/index.js.map +1 -0
- package/dist/esm/ui/context/components.jsx +30 -0
- package/dist/esm/ui/context/components.jsx.map +1 -0
- package/dist/esm/ui/context/global.js +15 -0
- package/dist/esm/ui/context/global.js.map +1 -0
- package/dist/esm/ui/context/index.js +5 -0
- package/dist/esm/ui/context/index.js.map +1 -0
- package/dist/esm/ui/context/markup/index.jsx +25 -0
- package/dist/esm/ui/context/markup/index.jsx.map +1 -0
- package/dist/esm/ui/context/markup/markdown.js +34 -0
- package/dist/esm/ui/context/markup/markdown.js.map +1 -0
- package/dist/esm/ui/context/markup/shiki.js +58 -0
- package/dist/esm/ui/context/markup/shiki.js.map +1 -0
- package/dist/esm/ui/context/markup/util.js +22 -0
- package/dist/esm/ui/context/markup/util.js.map +1 -0
- package/dist/esm/ui/context/project/index.jsx +27 -0
- package/dist/esm/ui/context/project/index.jsx.map +1 -0
- package/dist/esm/ui/context/project/indexed.js +47 -0
- package/dist/esm/ui/context/project/indexed.js.map +1 -0
- package/dist/esm/ui/context/project/types.js +2 -0
- package/dist/esm/ui/context/project/types.js.map +1 -0
- package/dist/esm/ui/context/theme.jsx +36 -0
- package/dist/esm/ui/context/theme.jsx.map +1 -0
- package/dist/esm/ui/hooks/index.js +94 -0
- package/dist/esm/ui/hooks/index.js.map +1 -0
- package/dist/esm/ui/index.js +5 -0
- package/dist/esm/ui/index.js.map +1 -0
- package/dist/esm/ui/renderer.jsx +21 -0
- package/dist/esm/ui/renderer.jsx.map +1 -0
- package/dist/esm/ui/util/comment.js +14 -0
- package/dist/esm/ui/util/comment.js.map +1 -0
- package/dist/esm/ui/util/kind.js +85 -0
- package/dist/esm/ui/util/kind.js.map +1 -0
- package/dist/esm/ui/util/markdown.js +66 -0
- package/dist/esm/ui/util/markdown.js.map +1 -0
- package/dist/esm/ui/util/search.js +75 -0
- package/dist/esm/ui/util/search.js.map +1 -0
- package/dist/ts/_lib/fs/index.d.ts +6 -0
- package/dist/ts/_lib/fs/index.d.ts.map +1 -0
- package/dist/ts/_lib/fs/watch.d.ts +14 -0
- package/dist/ts/_lib/fs/watch.d.ts.map +1 -0
- package/dist/ts/_lib/index.d.ts +10 -0
- package/dist/ts/_lib/index.d.ts.map +1 -0
- package/dist/ts/_lib/jiti/index.d.ts +2 -0
- package/dist/ts/_lib/jiti/index.d.ts.map +1 -0
- package/dist/ts/_lib/path/index.d.ts +12 -0
- package/dist/ts/_lib/path/index.d.ts.map +1 -0
- package/dist/ts/_lib/pkg/index.d.ts +28 -0
- package/dist/ts/_lib/pkg/index.d.ts.map +1 -0
- package/dist/ts/_lib/repo/index.d.ts +30 -0
- package/dist/ts/_lib/repo/index.d.ts.map +1 -0
- package/dist/ts/_lib/slug/index.d.ts +4 -0
- package/dist/ts/_lib/slug/index.d.ts.map +1 -0
- package/dist/ts/_lib/t.d.ts +11 -0
- package/dist/ts/_lib/t.d.ts.map +1 -0
- package/dist/ts/_lib/tsconfig/index.d.ts +8 -0
- package/dist/ts/_lib/tsconfig/index.d.ts.map +1 -0
- package/dist/ts/_lib/util/index.d.ts +9 -0
- package/dist/ts/_lib/util/index.d.ts.map +1 -0
- package/dist/ts/cli/cmd/dev.d.ts +27 -0
- package/dist/ts/cli/cmd/dev.d.ts.map +1 -0
- package/dist/ts/cli/cmd/index.d.ts +4 -0
- package/dist/ts/cli/cmd/index.d.ts.map +1 -0
- package/dist/ts/cli/cmd/init.d.ts +14 -0
- package/dist/ts/cli/cmd/init.d.ts.map +1 -0
- package/dist/ts/cli/cmd/json.d.ts +12 -0
- package/dist/ts/cli/cmd/json.d.ts.map +1 -0
- package/dist/ts/cli/env.d.ts +2 -0
- package/dist/ts/cli/env.d.ts.map +1 -0
- package/dist/ts/cli/index.d.ts +78 -0
- package/dist/ts/cli/index.d.ts.map +1 -0
- package/dist/ts/cli/vite/client/index.d.ts +10 -0
- package/dist/ts/cli/vite/client/index.d.ts.map +1 -0
- package/dist/ts/cli/vite/index.d.ts +12 -0
- package/dist/ts/cli/vite/index.d.ts.map +1 -0
- package/dist/ts/cli.d.ts +3 -0
- package/dist/ts/cli.d.ts.map +1 -0
- package/dist/ts/config/defaults.d.ts +10 -0
- package/dist/ts/config/defaults.d.ts.map +1 -0
- package/dist/ts/config/file.d.ts +3 -0
- package/dist/ts/config/file.d.ts.map +1 -0
- package/dist/ts/config/index.d.ts +6 -0
- package/dist/ts/config/index.d.ts.map +1 -0
- package/dist/ts/config/load.d.ts +36 -0
- package/dist/ts/config/load.d.ts.map +1 -0
- package/dist/ts/config/types.d.ts +56 -0
- package/dist/ts/config/types.d.ts.map +1 -0
- package/dist/ts/core/index.d.ts +3 -0
- package/dist/ts/core/index.d.ts.map +1 -0
- package/dist/ts/core/project/debug.d.ts +3 -0
- package/dist/ts/core/project/debug.d.ts.map +1 -0
- package/dist/ts/core/project/index.d.ts +17 -0
- package/dist/ts/core/project/index.d.ts.map +1 -0
- package/dist/ts/core/project/naming.d.ts +23 -0
- package/dist/ts/core/project/naming.d.ts.map +1 -0
- package/dist/ts/core/project/routing.d.ts +61 -0
- package/dist/ts/core/project/routing.d.ts.map +1 -0
- package/dist/ts/core/project/types.d.ts +56 -0
- package/dist/ts/core/project/types.d.ts.map +1 -0
- package/dist/ts/core/reflect/index.d.ts +22 -0
- package/dist/ts/core/reflect/index.d.ts.map +1 -0
- package/dist/ts/core/reflect/indexed.d.ts +83 -0
- package/dist/ts/core/reflect/indexed.d.ts.map +1 -0
- package/dist/ts/core/reflect/resolve.d.ts +3 -0
- package/dist/ts/core/reflect/resolve.d.ts.map +1 -0
- package/dist/ts/core/reflect/scan.d.ts +218 -0
- package/dist/ts/core/reflect/scan.d.ts.map +1 -0
- package/dist/ts/core/reflect/state.d.ts +44 -0
- package/dist/ts/core/reflect/state.d.ts.map +1 -0
- package/dist/ts/core/reflect/types.d.ts +289 -0
- package/dist/ts/core/reflect/types.d.ts.map +1 -0
- package/dist/ts/core/reflect/walk.d.ts +28 -0
- package/dist/ts/core/reflect/walk.d.ts.map +1 -0
- package/dist/ts/solidjs/index.d.ts +2 -0
- package/dist/ts/solidjs/index.d.ts.map +1 -0
- package/dist/ts/solidjs/jsx-runtime.d.ts +2 -0
- package/dist/ts/solidjs/jsx-runtime.d.ts.map +1 -0
- package/dist/ts/ui/App.d.ts +17 -0
- package/dist/ts/ui/App.d.ts.map +1 -0
- package/dist/ts/ui/components/Breadcrumb.d.ts +4 -0
- package/dist/ts/ui/components/Breadcrumb.d.ts.map +1 -0
- package/dist/ts/ui/components/Code/index.d.ts +17 -0
- package/dist/ts/ui/components/Code/index.d.ts.map +1 -0
- package/dist/ts/ui/components/Comment.d.ts +49 -0
- package/dist/ts/ui/components/Comment.d.ts.map +1 -0
- package/dist/ts/ui/components/Declaration.d.ts +122 -0
- package/dist/ts/ui/components/Declaration.d.ts.map +1 -0
- package/dist/ts/ui/components/Header.d.ts +5 -0
- package/dist/ts/ui/components/Header.d.ts.map +1 -0
- package/dist/ts/ui/components/Layout.d.ts +5 -0
- package/dist/ts/ui/components/Layout.d.ts.map +1 -0
- package/dist/ts/ui/components/Link.d.ts +15 -0
- package/dist/ts/ui/components/Link.d.ts.map +1 -0
- package/dist/ts/ui/components/LivePreview/Example.d.ts +16 -0
- package/dist/ts/ui/components/LivePreview/Example.d.ts.map +1 -0
- package/dist/ts/ui/components/LivePreview/Sandbox.d.ts +20 -0
- package/dist/ts/ui/components/LivePreview/Sandbox.d.ts.map +1 -0
- package/dist/ts/ui/components/LivePreview/index.d.ts +4 -0
- package/dist/ts/ui/components/LivePreview/index.d.ts.map +1 -0
- package/dist/ts/ui/components/LivePreview/transform.d.ts +19 -0
- package/dist/ts/ui/components/LivePreview/transform.d.ts.map +1 -0
- package/dist/ts/ui/components/Markdown.d.ts +11 -0
- package/dist/ts/ui/components/Markdown.d.ts.map +1 -0
- package/dist/ts/ui/components/Page.d.ts +21 -0
- package/dist/ts/ui/components/Page.d.ts.map +1 -0
- package/dist/ts/ui/components/References.d.ts +2 -0
- package/dist/ts/ui/components/References.d.ts.map +1 -0
- package/dist/ts/ui/components/SearchPalette.d.ts +5 -0
- package/dist/ts/ui/components/SearchPalette.d.ts.map +1 -0
- package/dist/ts/ui/components/Sidebar.d.ts +5 -0
- package/dist/ts/ui/components/Sidebar.d.ts.map +1 -0
- package/dist/ts/ui/components/Syntax.d.ts +15 -0
- package/dist/ts/ui/components/Syntax.d.ts.map +1 -0
- package/dist/ts/ui/components/ThemeToggle.d.ts +2 -0
- package/dist/ts/ui/components/ThemeToggle.d.ts.map +1 -0
- package/dist/ts/ui/components/Type.d.ts +82 -0
- package/dist/ts/ui/components/Type.d.ts.map +1 -0
- package/dist/ts/ui/components/index.d.ts +15 -0
- package/dist/ts/ui/components/index.d.ts.map +1 -0
- package/dist/ts/ui/context/components.d.ts +124 -0
- package/dist/ts/ui/context/components.d.ts.map +1 -0
- package/dist/ts/ui/context/global.d.ts +210 -0
- package/dist/ts/ui/context/global.d.ts.map +1 -0
- package/dist/ts/ui/context/index.d.ts +5 -0
- package/dist/ts/ui/context/index.d.ts.map +1 -0
- package/dist/ts/ui/context/markup/index.d.ts +20 -0
- package/dist/ts/ui/context/markup/index.d.ts.map +1 -0
- package/dist/ts/ui/context/markup/markdown.d.ts +4 -0
- package/dist/ts/ui/context/markup/markdown.d.ts.map +1 -0
- package/dist/ts/ui/context/markup/shiki.d.ts +17 -0
- package/dist/ts/ui/context/markup/shiki.d.ts.map +1 -0
- package/dist/ts/ui/context/markup/util.d.ts +11 -0
- package/dist/ts/ui/context/markup/util.d.ts.map +1 -0
- package/dist/ts/ui/context/project/index.d.ts +25 -0
- package/dist/ts/ui/context/project/index.d.ts.map +1 -0
- package/dist/ts/ui/context/project/indexed.d.ts +4 -0
- package/dist/ts/ui/context/project/indexed.d.ts.map +1 -0
- package/dist/ts/ui/context/project/types.d.ts +13 -0
- package/dist/ts/ui/context/project/types.d.ts.map +1 -0
- package/dist/ts/ui/context/theme.d.ts +12 -0
- package/dist/ts/ui/context/theme.d.ts.map +1 -0
- package/dist/ts/ui/hooks/index.d.ts +29 -0
- package/dist/ts/ui/hooks/index.d.ts.map +1 -0
- package/dist/ts/ui/index.d.ts +5 -0
- package/dist/ts/ui/index.d.ts.map +1 -0
- package/dist/ts/ui/renderer.d.ts +200 -0
- package/dist/ts/ui/renderer.d.ts.map +1 -0
- package/dist/ts/ui/util/comment.d.ts +4 -0
- package/dist/ts/ui/util/comment.d.ts.map +1 -0
- package/dist/ts/ui/util/kind.d.ts +15 -0
- package/dist/ts/ui/util/kind.d.ts.map +1 -0
- package/dist/ts/ui/util/markdown.d.ts +8 -0
- package/dist/ts/ui/util/markdown.d.ts.map +1 -0
- package/dist/ts/ui/util/search.d.ts +20 -0
- package/dist/ts/ui/util/search.d.ts.map +1 -0
- package/package.json +89 -0
- package/src/_lib/fs/index.ts +23 -0
- package/src/_lib/fs/watch.ts +40 -0
- package/src/_lib/index.ts +9 -0
- package/src/_lib/jiti/index.ts +18 -0
- package/src/_lib/path/index.ts +44 -0
- package/src/_lib/pkg/index.ts +165 -0
- package/src/_lib/repo/index.ts +138 -0
- package/src/_lib/slug/index.ts +26 -0
- package/src/_lib/t.ts +17 -0
- package/src/_lib/tsconfig/index.ts +20 -0
- package/src/_lib/util/index.ts +53 -0
- package/src/cli/cmd/dev.ts +86 -0
- package/src/cli/cmd/index.ts +3 -0
- package/src/cli/cmd/init.ts +80 -0
- package/src/cli/cmd/json.ts +28 -0
- package/src/cli/env.ts +6 -0
- package/src/cli/index.ts +14 -0
- package/src/cli/vite/client/index.html +27 -0
- package/src/cli/vite/client/index.tsx +30 -0
- package/src/cli/vite/client/public/apple-touch-icon.png +0 -0
- package/src/cli/vite/client/public/favicon-96x96.png +0 -0
- package/src/cli/vite/client/public/favicon.ico +0 -0
- package/src/cli/vite/client/public/favicon.svg +1 -0
- package/src/cli/vite/client/public/site.webmanifest +21 -0
- package/src/cli/vite/client/public/web-app-manifest-192x192.png +0 -0
- package/src/cli/vite/client/public/web-app-manifest-512x512.png +0 -0
- package/src/cli/vite/index.ts +115 -0
- package/src/cli.ts +6 -0
- package/src/config/defaults.ts +36 -0
- package/src/config/file.ts +53 -0
- package/src/config/index.ts +11 -0
- package/src/config/load.ts +95 -0
- package/src/config/types.ts +59 -0
- package/src/core/index.ts +2 -0
- package/src/core/project/debug.ts +30 -0
- package/src/core/project/index.ts +58 -0
- package/src/core/project/naming.ts +49 -0
- package/src/core/project/routing.ts +234 -0
- package/src/core/project/types.ts +47 -0
- package/src/core/reflect/index.ts +18 -0
- package/src/core/reflect/indexed.ts +242 -0
- package/src/core/reflect/resolve.ts +159 -0
- package/src/core/reflect/scan.ts +816 -0
- package/src/core/reflect/state.ts +75 -0
- package/src/core/reflect/types.ts +164 -0
- package/src/core/reflect/walk.ts +121 -0
- package/src/solidjs/index.ts +1 -0
- package/src/solidjs/jsx-runtime.ts +1 -0
- package/src/ui/App.tsx +115 -0
- package/src/ui/components/Breadcrumb.tsx +53 -0
- package/src/ui/components/Code/index.tsx +112 -0
- package/src/ui/components/Comment.tsx +221 -0
- package/src/ui/components/Declaration.tsx +210 -0
- package/src/ui/components/Header.tsx +99 -0
- package/src/ui/components/Layout.tsx +62 -0
- package/src/ui/components/Link.tsx +43 -0
- package/src/ui/components/LivePreview/Example.tsx +104 -0
- package/src/ui/components/LivePreview/Sandbox.tsx +36 -0
- package/src/ui/components/LivePreview/index.ts +3 -0
- package/src/ui/components/LivePreview/transform.ts +28 -0
- package/src/ui/components/Markdown.tsx +16 -0
- package/src/ui/components/Page.tsx +162 -0
- package/src/ui/components/References.tsx +34 -0
- package/src/ui/components/SearchPalette.tsx +266 -0
- package/src/ui/components/Sidebar.tsx +107 -0
- package/src/ui/components/Syntax.tsx +10 -0
- package/src/ui/components/ThemeToggle.tsx +50 -0
- package/src/ui/components/Type.tsx +583 -0
- package/src/ui/components/index.ts +15 -0
- package/src/ui/context/components.tsx +103 -0
- package/src/ui/context/global.ts +33 -0
- package/src/ui/context/index.ts +4 -0
- package/src/ui/context/markup/index.tsx +39 -0
- package/src/ui/context/markup/markdown.ts +37 -0
- package/src/ui/context/markup/shiki.ts +72 -0
- package/src/ui/context/markup/util.ts +20 -0
- package/src/ui/context/project/index.tsx +47 -0
- package/src/ui/context/project/indexed.ts +52 -0
- package/src/ui/context/project/types.ts +14 -0
- package/src/ui/context/theme.tsx +45 -0
- package/src/ui/hooks/index.ts +116 -0
- package/src/ui/index.ts +4 -0
- package/src/ui/renderer.tsx +31 -0
- package/src/ui/util/comment.ts +12 -0
- package/src/ui/util/kind.ts +120 -0
- package/src/ui/util/markdown.ts +74 -0
- package/src/ui/util/search.ts +84 -0
- package/theme.css +301 -0
- package/tsconfig.client.json +12 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import ts from 'typescript'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
|
|
4
|
+
import type * as T from './types.ts'
|
|
5
|
+
|
|
6
|
+
/** How a given `exports` clause should populate its targets at resolve time. */
|
|
7
|
+
export type ExportsForm = 'named-local' | 'named-from' | 'star' | 'namespace-from' | 'assignment'
|
|
8
|
+
|
|
9
|
+
export interface ScanOptions {
|
|
10
|
+
rootDir: string
|
|
11
|
+
/** The compiler options for the project. */
|
|
12
|
+
compilerOptions: ts.CompilerOptions
|
|
13
|
+
/** Whether to include a file in the scan. */
|
|
14
|
+
include: (sf: ts.SourceFile) => boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ScanState extends ScanOptions {
|
|
18
|
+
/** Monotonic id source. Every node that needs identity calls this. */
|
|
19
|
+
nextId: () => number
|
|
20
|
+
getPath: (sf: ts.SourceFile) => string
|
|
21
|
+
root: number
|
|
22
|
+
parent: number
|
|
23
|
+
currentStmt: number
|
|
24
|
+
|
|
25
|
+
checker: ts.TypeChecker
|
|
26
|
+
references: T.Type<'reference'>[]
|
|
27
|
+
exports: T.Declaration<'export'>[]
|
|
28
|
+
declarations: T.Declaration[]
|
|
29
|
+
symbolsById: Map<number, ts.Symbol>
|
|
30
|
+
referenceOrigins: Map<number, ts.Node>
|
|
31
|
+
/** Symbol for inferred references, which have no syntactic origin to re-resolve. */
|
|
32
|
+
referenceSymbols: Map<number, ts.Symbol>
|
|
33
|
+
|
|
34
|
+
// ---- deferred export population ----
|
|
35
|
+
/** exports id -> which population strategy resolve should use. */
|
|
36
|
+
exportsForm: Map<number, ExportsForm>
|
|
37
|
+
/** exports id -> source module specifier text, for the `*-from` forms. */
|
|
38
|
+
exportsSpec: Map<number, string>
|
|
39
|
+
/** exports id -> raw `{ name, as? }` entries, for the `named-*` forms. */
|
|
40
|
+
exportsEntries: Map<number, { name: string; as?: string }[]>
|
|
41
|
+
/** exports id -> alias, for `export * as <alias> from '…'`. */
|
|
42
|
+
exportsAlias: Map<number, string>
|
|
43
|
+
/** exports id -> origin node, so resolve can re-ask the checker. */
|
|
44
|
+
exportsOrigin: Map<number, ts.ExportDeclaration | ts.ExportAssignment>
|
|
45
|
+
|
|
46
|
+
/** Source files already scanned — dedups the transitive re-export worklist. */
|
|
47
|
+
seen: Set<ts.SourceFile>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const makeScanState = (checker: ts.TypeChecker, options: ScanOptions): ScanState => {
|
|
51
|
+
const relPath = new WeakMap<ts.SourceFile, string>()
|
|
52
|
+
let id = 0
|
|
53
|
+
const getPath = (sf: ts.SourceFile) => relPath.get(sf) ?? path.relative(options.rootDir, sf.fileName)
|
|
54
|
+
return {
|
|
55
|
+
...options,
|
|
56
|
+
root: 0,
|
|
57
|
+
parent: 0,
|
|
58
|
+
currentStmt: 0,
|
|
59
|
+
checker,
|
|
60
|
+
nextId: () => ++id,
|
|
61
|
+
getPath,
|
|
62
|
+
references: [],
|
|
63
|
+
exports: [],
|
|
64
|
+
declarations: [],
|
|
65
|
+
symbolsById: new Map(),
|
|
66
|
+
referenceOrigins: new Map(),
|
|
67
|
+
referenceSymbols: new Map(),
|
|
68
|
+
exportsForm: new Map(),
|
|
69
|
+
exportsSpec: new Map(),
|
|
70
|
+
exportsEntries: new Map(),
|
|
71
|
+
exportsAlias: new Map(),
|
|
72
|
+
exportsOrigin: new Map(),
|
|
73
|
+
seen: new Set(),
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { is } from '@lickle/is'
|
|
2
|
+
|
|
3
|
+
import type { t } from '../../_lib/index.ts'
|
|
4
|
+
|
|
5
|
+
export type Source = { file: string; line: number; column: number }
|
|
6
|
+
export type Typebase = { parent: number; comment?: Comment; sources: Source[] }
|
|
7
|
+
export type Base = Typebase & { id: number; name: string; exported: boolean }
|
|
8
|
+
|
|
9
|
+
export interface DeclerationDefinitions {
|
|
10
|
+
variable: { type: Type; defaultValue?: string }
|
|
11
|
+
function: { signatures: Part<'signature'>[] }
|
|
12
|
+
class: {
|
|
13
|
+
generics?: Part<'generic'>[]
|
|
14
|
+
extends?: Type[]
|
|
15
|
+
implements?: Type[]
|
|
16
|
+
constructors: Part<'signature'>[]
|
|
17
|
+
properties: Part<'property'>[]
|
|
18
|
+
methods: Part<'method'>[]
|
|
19
|
+
indexSignature?: Part<'index-signature'>
|
|
20
|
+
}
|
|
21
|
+
interface: {
|
|
22
|
+
generics?: Part<'generic'>[]
|
|
23
|
+
extends?: Type[]
|
|
24
|
+
properties: Part<'property'>[]
|
|
25
|
+
methods: Part<'method'>[]
|
|
26
|
+
callSignatures?: Part<'signature'>[]
|
|
27
|
+
constructSignatures?: Part<'signature'>[]
|
|
28
|
+
indexSignature?: Part<'index-signature'>
|
|
29
|
+
}
|
|
30
|
+
'type-alias': { generics?: Part<'generic'>[]; type: Type }
|
|
31
|
+
export: { names: { name: string; ref: number }[]; star: boolean }
|
|
32
|
+
enum: { const?: boolean; members: Part<'enum-member'>[] }
|
|
33
|
+
namespace: {}
|
|
34
|
+
module: { path: string }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type ReferenceTypeMap = t.MapKind<
|
|
38
|
+
{
|
|
39
|
+
internal: { targetId: number }
|
|
40
|
+
external: { external: 'stdlib' | 'package' | 'anonymous' | 'type-parameter' }
|
|
41
|
+
},
|
|
42
|
+
'type'
|
|
43
|
+
>
|
|
44
|
+
|
|
45
|
+
export interface TypeDefinitions {
|
|
46
|
+
intrinsic: { name: IntrinsicName }
|
|
47
|
+
literal: { value: string | number | boolean | bigint | null }
|
|
48
|
+
reference: { id: number; name: string; owner: number; args?: Type[] } & ReferenceTypeMap[keyof ReferenceTypeMap]
|
|
49
|
+
union: { types: Type[] }
|
|
50
|
+
intersection: { types: Type[] }
|
|
51
|
+
array: { elementType: Type }
|
|
52
|
+
tuple: { elements: Part<'tuple-element'>[] }
|
|
53
|
+
'function-type': { signatures: Part<'signature'>[] }
|
|
54
|
+
'type-operator': { operator: 'keyof' | 'readonly' | 'unique'; target: Type }
|
|
55
|
+
/** Inline object type, e.g. `{ x: number; f(): void }`. */
|
|
56
|
+
record: {
|
|
57
|
+
properties: Part<'property'>[]
|
|
58
|
+
methods: Part<'method'>[]
|
|
59
|
+
callSignatures?: Part<'signature'>[]
|
|
60
|
+
constructSignatures?: Part<'signature'>[]
|
|
61
|
+
indexSignature?: Part<'index-signature'>
|
|
62
|
+
}
|
|
63
|
+
conditional: { check: Type; extends: Type; true: Type; false: Type }
|
|
64
|
+
infer: { name: string; constraint?: Type }
|
|
65
|
+
'indexed-access': { object: Type; index: Type }
|
|
66
|
+
mapped: { typeParameter: Part<'generic'>; nameType?: Type; type?: Type; optional?: boolean; readonly?: boolean }
|
|
67
|
+
query: { name: string; args?: Type[] }
|
|
68
|
+
'template-literal': { head: string; spans: { type: Type; literal: string }[] }
|
|
69
|
+
predicate: { parameter: string; asserts?: boolean; type?: Type }
|
|
70
|
+
'import-type': { argument: string; qualifier?: string; isTypeOf?: boolean; args?: Type[] }
|
|
71
|
+
unknown: { text: string; nodeType: string }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface TypeComponentDefinitions {
|
|
75
|
+
signature: { generics?: Part<'generic'>[]; params: Part<'parameter'>[]; return: Type }
|
|
76
|
+
parameter: { name: string; type: Type; rest?: boolean; default?: string; optional: boolean }
|
|
77
|
+
generic: { name: string; constraint?: Type; default?: Type }
|
|
78
|
+
property: { name: string; type: Type; defaultValue?: string; optional?: boolean }
|
|
79
|
+
method: { name: string; signatures: Part<'signature'>[] }
|
|
80
|
+
'index-signature': { parameter: Part<'parameter'>; type: Type }
|
|
81
|
+
'enum-member': { name: string; value?: string | number }
|
|
82
|
+
'tuple-element': { name?: string; type: Type; optional?: boolean; rest?: boolean }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type IntrinsicName =
|
|
86
|
+
| 'string'
|
|
87
|
+
| 'number'
|
|
88
|
+
| 'boolean'
|
|
89
|
+
| 'bigint'
|
|
90
|
+
| 'symbol'
|
|
91
|
+
| 'void'
|
|
92
|
+
| 'undefined'
|
|
93
|
+
| 'null'
|
|
94
|
+
| 'never'
|
|
95
|
+
| 'any'
|
|
96
|
+
| 'unknown'
|
|
97
|
+
| 'object'
|
|
98
|
+
| 'this'
|
|
99
|
+
|
|
100
|
+
// export type Reference = TypeMap['reference']
|
|
101
|
+
|
|
102
|
+
export type Declaration<K extends keyof DeclarationMap = keyof DeclarationMap> = DeclarationMap[K]
|
|
103
|
+
export type Type<K extends keyof TypeMap = keyof TypeMap> = TypeMap[K]
|
|
104
|
+
export type Part<K extends keyof PartMap = keyof PartMap> = PartMap[K]
|
|
105
|
+
export type Any<K extends keyof KindsMap = keyof KindsMap> = KindsMap[K]
|
|
106
|
+
|
|
107
|
+
// ---------------- Guards ----------------
|
|
108
|
+
// prettier-ignore
|
|
109
|
+
const ISD = is.struct({ kind: is.oneOf('variable', 'function', 'class', 'interface', 'type-alias', 'export', 'enum', 'namespace', 'module') }, false)
|
|
110
|
+
export const isDeclaration = (x: any): x is Declaration => ISD(x)
|
|
111
|
+
|
|
112
|
+
// prettier-ignore
|
|
113
|
+
const IST = is.struct({ kind: is.oneOf('intrinsic', 'literal', 'reference', 'union', 'intersection', 'array', 'tuple', 'function-type', 'type-operator', 'record', 'conditional', 'infer', 'indexed-access', 'mapped', 'query', 'template-literal', 'predicate', 'import-type') }, false)
|
|
114
|
+
export const isType = (x: any): x is Type => IST(x)
|
|
115
|
+
|
|
116
|
+
// prettier-ignore
|
|
117
|
+
const ISP = is.struct({ kind: is.oneOf('signature', 'parameter', 'generic', 'property', 'method', 'index-signature', 'enum-member', 'tuple-element') }, false)
|
|
118
|
+
export const isPart = (x: any): x is Part => ISP(x)
|
|
119
|
+
|
|
120
|
+
// prettier-ignore
|
|
121
|
+
const ISK = is.or(ISD, IST, ISP)
|
|
122
|
+
export const isKind = (x: any): x is Any => ISK(x)
|
|
123
|
+
|
|
124
|
+
// ---------------- Remapped with kind and base ----------------
|
|
125
|
+
export type DeclarationMap = t.MapKind<DeclerationDefinitions, 'kind', Base>
|
|
126
|
+
export type TypeMap = t.MapKind<TypeDefinitions, 'kind', Typebase>
|
|
127
|
+
export type PartMap = t.MapKind<TypeComponentDefinitions, 'kind', Typebase>
|
|
128
|
+
export type KindsMap = DeclarationMap & TypeMap & PartMap
|
|
129
|
+
|
|
130
|
+
// ---------------- COMMENTS ----------------
|
|
131
|
+
export type CommentPart = t.MapKindUnion<
|
|
132
|
+
{
|
|
133
|
+
text: { text: string }
|
|
134
|
+
link: { target: string; text?: string; style?: 'code' | 'plain' }
|
|
135
|
+
},
|
|
136
|
+
'kind'
|
|
137
|
+
>
|
|
138
|
+
|
|
139
|
+
export interface CommentTagDefinitions {
|
|
140
|
+
'@param': { name: string; type?: Type; optional?: boolean; default?: string; text: string }
|
|
141
|
+
'@property': { name: string; type?: NoInfer<Type>; optional?: boolean; default?: string; text: string }
|
|
142
|
+
'@returns': { type?: Type; text: string }
|
|
143
|
+
'@throws': { type?: Type; text: string }
|
|
144
|
+
'@type': { type: Type; text: string }
|
|
145
|
+
'@satisfies': { type: Type; text: string }
|
|
146
|
+
'@template': { generics: Part<'generic'>[]; text: string }
|
|
147
|
+
'@see': { target?: string; text: string }
|
|
148
|
+
'@example': { caption?: string; code: string; text?: string }
|
|
149
|
+
'@augments': { class: Type; text: string }
|
|
150
|
+
'@implements': { class: Type; text: string }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface Comment {
|
|
154
|
+
parts: CommentPart[]
|
|
155
|
+
/** Block tags. Omitted when empty so the common case stays small. */
|
|
156
|
+
tags?: CommentTag[]
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type CommentTagMap = t.MapKind<CommentTagDefinitions, 'tag'>
|
|
160
|
+
export type CommentTag<K extends keyof CommentTagMap = keyof CommentTagMap> =
|
|
161
|
+
| CommentTagMap[K]
|
|
162
|
+
| { tag: string; name?: string; text: string }
|
|
163
|
+
|
|
164
|
+
// ---------------- Utilities ----------------
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type * as T from './types.ts'
|
|
2
|
+
|
|
3
|
+
export interface Visitor {
|
|
4
|
+
onReference: (ref: T.Type<'reference'>) => void
|
|
5
|
+
onSources: (sources: T.Source[]) => void
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Walk a single declaration's substructure. Modules and namespaces are no-ops
|
|
10
|
+
* because their children are just ids — every child is reachable through the
|
|
11
|
+
* flat declaration list separately, so recursing here would double-count.
|
|
12
|
+
*
|
|
13
|
+
* Only the per-decl substructure (signatures, types, parameters, …) is walked.
|
|
14
|
+
*/
|
|
15
|
+
export const Declaration = (d: T.Declaration, v: Visitor): void => {
|
|
16
|
+
switch (d.kind) {
|
|
17
|
+
case 'module':
|
|
18
|
+
case 'namespace':
|
|
19
|
+
return
|
|
20
|
+
case 'variable':
|
|
21
|
+
return Variable(d, v)
|
|
22
|
+
case 'function':
|
|
23
|
+
return Function(d, v)
|
|
24
|
+
case 'class':
|
|
25
|
+
return Class(d, v)
|
|
26
|
+
case 'interface':
|
|
27
|
+
return Interface(d, v)
|
|
28
|
+
case 'type-alias':
|
|
29
|
+
return TypeAlias(d, v)
|
|
30
|
+
case 'enum':
|
|
31
|
+
return Enum(d, v)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Variable = (n: T.Declaration<'variable'>, v: Visitor): void => Type(n.type, v)
|
|
36
|
+
|
|
37
|
+
export const Function = (n: T.Declaration<'function'>, v: Visitor): void => n.signatures.forEach((s) => Signature(s, v))
|
|
38
|
+
|
|
39
|
+
export const Class = (n: T.Declaration<'class'>, v: Visitor): void => {
|
|
40
|
+
n.generics?.forEach((tp) => TypeParameter(tp, v))
|
|
41
|
+
n.extends?.forEach((t) => Type(t, v))
|
|
42
|
+
n.implements?.forEach((t) => Type(t, v))
|
|
43
|
+
n.constructors.forEach((s) => Signature(s, v))
|
|
44
|
+
n.properties.forEach((p) => Property(p, v))
|
|
45
|
+
n.methods.forEach((m) => Method(m, v))
|
|
46
|
+
if (n.indexSignature) IndexSignature(n.indexSignature, v)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Interface = (n: T.Declaration<'interface'>, v: Visitor): void => {
|
|
50
|
+
n.generics?.forEach((tp) => TypeParameter(tp, v))
|
|
51
|
+
n.extends?.forEach((t) => Type(t, v))
|
|
52
|
+
n.properties.forEach((p) => Property(p, v))
|
|
53
|
+
n.methods.forEach((m) => Method(m, v))
|
|
54
|
+
n.callSignatures?.forEach((s) => Signature(s, v))
|
|
55
|
+
n.constructSignatures?.forEach((s) => Signature(s, v))
|
|
56
|
+
if (n.indexSignature) IndexSignature(n.indexSignature, v)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const TypeAlias = (n: T.Declaration<'type-alias'>, v: Visitor): void => {
|
|
60
|
+
n.generics?.forEach((tp) => TypeParameter(tp, v))
|
|
61
|
+
Type(n.type, v)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Enum = (n: T.Declaration<'enum'>, _: Visitor): void => {
|
|
65
|
+
n.members.forEach((_) => {
|
|
66
|
+
// v.onEnumMember(m)
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const Property = (n: T.Part<'property'>, v: Visitor): void => Type(n.type, v)
|
|
71
|
+
|
|
72
|
+
export const Method = (n: T.Part<'method'>, v: Visitor): void => n.signatures.forEach((s) => Signature(s, v))
|
|
73
|
+
|
|
74
|
+
export const IndexSignature = (n: T.Part<'index-signature'>, v: Visitor): void => {
|
|
75
|
+
Parameter(n.parameter, v)
|
|
76
|
+
Type(n.type, v)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Signature = (n: T.Part<'signature'>, v: Visitor): void => {
|
|
80
|
+
n.generics?.forEach((tp) => TypeParameter(tp, v))
|
|
81
|
+
n.params.forEach((p) => Parameter(p, v))
|
|
82
|
+
Type(n.return, v)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const Parameter = (n: T.Part<'parameter'>, v: Visitor): void => Type(n.type, v)
|
|
86
|
+
|
|
87
|
+
export const TypeParameter = (n: T.Part<'generic'>, v: Visitor): void => {
|
|
88
|
+
if (n.constraint) Type(n.constraint, v)
|
|
89
|
+
if (n.default) Type(n.default, v)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const ObjectLiteral = (n: T.Type<'record'>, v: Visitor): void => {
|
|
93
|
+
n.properties.forEach((p) => Property(p, v))
|
|
94
|
+
n.methods.forEach((m) => Method(m, v))
|
|
95
|
+
n.callSignatures?.forEach((s) => Signature(s, v))
|
|
96
|
+
n.constructSignatures?.forEach((s) => Signature(s, v))
|
|
97
|
+
if (n.indexSignature) IndexSignature(n.indexSignature, v)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const Type = (t: T.Type, v: Visitor): void => {
|
|
101
|
+
switch (t.kind) {
|
|
102
|
+
case 'reference':
|
|
103
|
+
v.onReference(t)
|
|
104
|
+
t.args?.forEach((a) => Type(a, v))
|
|
105
|
+
return
|
|
106
|
+
case 'union':
|
|
107
|
+
case 'intersection':
|
|
108
|
+
return t.types.forEach((x) => Type(x, v))
|
|
109
|
+
case 'array':
|
|
110
|
+
return Type(t.elementType, v)
|
|
111
|
+
case 'tuple':
|
|
112
|
+
return t.elements.forEach((el) => Type(el.type, v))
|
|
113
|
+
case 'function-type':
|
|
114
|
+
return t.signatures.forEach((s) => Signature(s, v))
|
|
115
|
+
case 'type-operator':
|
|
116
|
+
return Type(t.target, v)
|
|
117
|
+
case 'record':
|
|
118
|
+
return ObjectLiteral(t, v)
|
|
119
|
+
// intrinsic, literal: nothing to do
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'solid-js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'solid-js/jsx-runtime'
|
package/src/ui/App.tsx
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Show, createMemo, createEffect, type Accessor } from 'solid-js'
|
|
2
|
+
import { Router, Route, useParams, Navigate } from '@solidjs/router'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
ProjectProvider,
|
|
7
|
+
type Components,
|
|
8
|
+
DeclarationScope,
|
|
9
|
+
useProject,
|
|
10
|
+
type Types,
|
|
11
|
+
MarkupProvider,
|
|
12
|
+
} from './context/index.ts'
|
|
13
|
+
import { Link, Page, MarkdownPage, Layout } from './components/index.ts'
|
|
14
|
+
import { setRendered } from './context/global.ts'
|
|
15
|
+
|
|
16
|
+
/** First navigable route slug — the implicit home target. */
|
|
17
|
+
const firstSlug = (routes: Types.RouteNode[]): string | undefined => (routes.find((r) => r.sidebar) ?? routes[0])?.slug
|
|
18
|
+
|
|
19
|
+
/** Resolve the current `/*slug` path to a route and render its page. */
|
|
20
|
+
const PathRoute = () => {
|
|
21
|
+
const params = useParams()
|
|
22
|
+
const project = useProject()
|
|
23
|
+
const route = createMemo(() => project().routeForSlug(params['slug'] ?? ''))
|
|
24
|
+
return (
|
|
25
|
+
<Show when={route()} fallback={<Fallback slug={params['slug']} />}>
|
|
26
|
+
{(r) => <RouteView route={r()} />}
|
|
27
|
+
</Show>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Dispatch a route to the page renderer matching its `page.kind`. */
|
|
32
|
+
const RouteView = (props: { route: Types.RouteNode }) => (
|
|
33
|
+
<Show
|
|
34
|
+
when={props.route.page.kind === 'markdown'}
|
|
35
|
+
fallback={<DeclarationView route={props.route as Types.RouteNode<'declaration' | 'module'>} />}
|
|
36
|
+
>
|
|
37
|
+
<MarkdownPage route={props.route as Types.RouteNode<'markdown'>} />
|
|
38
|
+
</Show>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
const DeclarationView = (props: { route: Types.RouteNode<'declaration' | 'module'> }) => {
|
|
42
|
+
const project = useProject()
|
|
43
|
+
const decl = createMemo(() => project().byId(props.route.page.id))
|
|
44
|
+
return (
|
|
45
|
+
<Show when={decl()} fallback={<NotFound />}>
|
|
46
|
+
{(d) => (
|
|
47
|
+
<DeclarationScope id={d().id}>
|
|
48
|
+
<Page route={props.route} decl={d()} />
|
|
49
|
+
</DeclarationScope>
|
|
50
|
+
)}
|
|
51
|
+
</Show>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Empty path redirects to the first route; anything else is a miss. */
|
|
56
|
+
const Fallback = (props: { slug?: string }) => {
|
|
57
|
+
const project = useProject()
|
|
58
|
+
const first = createMemo(() => firstSlug(project()?.routes ?? []))
|
|
59
|
+
return (
|
|
60
|
+
<Show when={!props.slug && first} fallback={<NotFound />}>
|
|
61
|
+
{(slug) => <Navigate href={`/${slug()}`} />}
|
|
62
|
+
</Show>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Fallback for routes that don't match a registered path. */
|
|
67
|
+
const NotFound = () => (
|
|
68
|
+
<div class="py-20 text-center">
|
|
69
|
+
<h1 class="text-2xl font-semibold mb-2">Not found</h1>
|
|
70
|
+
<p class="text-mute">No page matches this URL.</p>
|
|
71
|
+
<Link href="/">Back home</Link>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Stock route table. Exported on its own so a custom `App` can drop it in
|
|
77
|
+
* under a different root, add prefixes, or compose alongside extra routes.
|
|
78
|
+
*/
|
|
79
|
+
export const Routes = () => <Route path="/*slug" component={PathRoute} />
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* One-shot app shell: theme context, router, default Layout. Replace any
|
|
83
|
+
* one of the pieces — `ThemeProvider`, `Layout`, `Routes` — and you keep
|
|
84
|
+
* the others.
|
|
85
|
+
*/
|
|
86
|
+
export const App = (props: {
|
|
87
|
+
json: Accessor<Types.ProjectJson | null> | Types.ProjectJson | null
|
|
88
|
+
components?: Accessor<Components> | Components
|
|
89
|
+
}) => {
|
|
90
|
+
createEffect(() => {
|
|
91
|
+
setRendered(true)
|
|
92
|
+
return () => setRendered(false)
|
|
93
|
+
})
|
|
94
|
+
return (
|
|
95
|
+
<Show
|
|
96
|
+
when={createMemo(() => (typeof props.json === 'function' ? props.json() : props.json))()}
|
|
97
|
+
fallback={<div>No docs...</div>}
|
|
98
|
+
>
|
|
99
|
+
{(json) => (
|
|
100
|
+
<ProjectProvider
|
|
101
|
+
json={json}
|
|
102
|
+
components={typeof props.components === 'function' ? props.components() : props.components}
|
|
103
|
+
>
|
|
104
|
+
<ThemeProvider>
|
|
105
|
+
<MarkupProvider>
|
|
106
|
+
<Router root={(p) => <Layout>{p.children}</Layout>}>
|
|
107
|
+
<Routes />
|
|
108
|
+
</Router>
|
|
109
|
+
</MarkupProvider>
|
|
110
|
+
</ThemeProvider>
|
|
111
|
+
</ProjectProvider>
|
|
112
|
+
)}
|
|
113
|
+
</Show>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { For, Show, createMemo } from 'solid-js'
|
|
2
|
+
import { A } from '@solidjs/router'
|
|
3
|
+
|
|
4
|
+
import { createSlot, useProject, type Types } from '../context/index.ts'
|
|
5
|
+
|
|
6
|
+
type Crumb = { label: string; href?: string }
|
|
7
|
+
|
|
8
|
+
export const Breadcrumb = createSlot('page.header.breadcrumb', (props: { id: number }) => {
|
|
9
|
+
const project = useProject()
|
|
10
|
+
const crumbs = createMemo(() => buildCrumbs(project(), props.id))
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<nav class="text-xs text-mute mb-3" aria-label="Breadcrumb">
|
|
14
|
+
<ol class="flex items-center gap-1.5 flex-wrap">
|
|
15
|
+
<li>
|
|
16
|
+
<A href="/" class="hover:text-fg">
|
|
17
|
+
{project().name}
|
|
18
|
+
</A>
|
|
19
|
+
</li>
|
|
20
|
+
<For each={crumbs()}>
|
|
21
|
+
{(c, i) => (
|
|
22
|
+
<>
|
|
23
|
+
<li class="text-mute opacity-60">/</li>
|
|
24
|
+
<li>
|
|
25
|
+
<Show when={c.href && i() < crumbs().length - 1} fallback={<span class="text-fg">{c.label}</span>}>
|
|
26
|
+
<A href={c.href!} class="hover:text-fg">
|
|
27
|
+
{c.label}
|
|
28
|
+
</A>
|
|
29
|
+
</Show>
|
|
30
|
+
</li>
|
|
31
|
+
</>
|
|
32
|
+
)}
|
|
33
|
+
</For>
|
|
34
|
+
</ol>
|
|
35
|
+
</nav>
|
|
36
|
+
)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* One crumb per slug segment, so every module level is reachable — each prefix
|
|
41
|
+
* resolves through `routeForSlug`, which returns pages even when they aren't in
|
|
42
|
+
* the sidebar. Levels with no page render as plain text.
|
|
43
|
+
*/
|
|
44
|
+
const buildCrumbs = (project: Types.Project, id: number): Crumb[] => {
|
|
45
|
+
const route = project.routeForId(id)
|
|
46
|
+
if (!route?.slug) return []
|
|
47
|
+
const segs = route.slug.split('/')
|
|
48
|
+
return segs.map((seg, i) => {
|
|
49
|
+
const prefix = segs.slice(0, i + 1).join('/')
|
|
50
|
+
const r = project.routeForSlug(prefix)
|
|
51
|
+
return { label: r?.label ?? seg, href: r ? `/${prefix}` : undefined }
|
|
52
|
+
})
|
|
53
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createEffect, createMemo, createSignal, onCleanup, Show } from 'solid-js'
|
|
2
|
+
import { CodeJar } from 'codejar'
|
|
3
|
+
import { cn } from '@lickle/cn'
|
|
4
|
+
|
|
5
|
+
import { useMarkup, useCodeToHtml, type Highlighter } from '../../context/index.ts'
|
|
6
|
+
|
|
7
|
+
export const Code = (props: { code: string; lang?: string }) => {
|
|
8
|
+
const html = useCodeToHtml({ ...props, structure: 'inline' })
|
|
9
|
+
const visibility = createMemo(() => (html() ? 'opacity-100' : 'opacity-0'))
|
|
10
|
+
const className = createMemo(() => cn('transition-opacity duration-200', visibility()))
|
|
11
|
+
return (
|
|
12
|
+
<code class={className()}>
|
|
13
|
+
<Show when={html()} fallback={<pre class="h-12 w-full" />}>
|
|
14
|
+
{(h) => <pre innerHTML={h()} />}
|
|
15
|
+
</Show>
|
|
16
|
+
</code>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const CodeBlock = (props: { code: string; lang?: string }) => (
|
|
21
|
+
<div class="bg-code-bg border border-line rounded-lg p-4">
|
|
22
|
+
<Code code={props.code} lang={props.lang} />
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
type CodeEditorProps = {
|
|
27
|
+
lang?: string
|
|
28
|
+
readonly?: boolean
|
|
29
|
+
value: () => string
|
|
30
|
+
onChange?: (code: string) => void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const CodeEditor = (props: CodeEditorProps) => {
|
|
34
|
+
const editor = useCodeEditor(props)
|
|
35
|
+
return <div ref={editor.onBind} spellcheck={false} />
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const useCodeEditor = (props: CodeEditorProps) => {
|
|
39
|
+
const markup = useMarkup()
|
|
40
|
+
let _jar: ReturnType<typeof CodeJar> | null = null
|
|
41
|
+
let _host: HTMLElement | null = null
|
|
42
|
+
let initialized = false
|
|
43
|
+
let current = props.value()
|
|
44
|
+
|
|
45
|
+
const [jar, setJar] = createSignal<ReturnType<typeof CodeJar> | null>(null)
|
|
46
|
+
|
|
47
|
+
const setup = (host: HTMLElement, h: Highlighter) => {
|
|
48
|
+
if (initialized) return
|
|
49
|
+
initialized = true
|
|
50
|
+
_jar = CodeJar(
|
|
51
|
+
host,
|
|
52
|
+
(el) => {
|
|
53
|
+
try {
|
|
54
|
+
el.innerHTML = h.codeToHtml({ text: el.textContent ?? '', lang: props.lang })
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.warn('[Editor] highlight failed', err)
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
preserveIdent: true,
|
|
61
|
+
addClosing: true,
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
_jar.updateCode(current)
|
|
66
|
+
_jar.onUpdate(() => {
|
|
67
|
+
current = host.innerText
|
|
68
|
+
props.onChange?.(host.innerText)
|
|
69
|
+
})
|
|
70
|
+
if (props.readonly) host.contentEditable = 'false'
|
|
71
|
+
setJar(_jar)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const teardown = () => {
|
|
75
|
+
_jar?.destroy()
|
|
76
|
+
initialized = false
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const init = () => {
|
|
80
|
+
const h = markup.highlighter()
|
|
81
|
+
const el = _host
|
|
82
|
+
if (h && el) setup(el, h)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
createEffect(init)
|
|
86
|
+
|
|
87
|
+
createEffect(() => {
|
|
88
|
+
const v = props.value()
|
|
89
|
+
const j = jar()
|
|
90
|
+
if (j && current !== v) {
|
|
91
|
+
j.updateCode(v)
|
|
92
|
+
current = v
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
onCleanup(() => {
|
|
97
|
+
jar()?.destroy()
|
|
98
|
+
initialized = false
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const onBind = (h: HTMLElement | null) => {
|
|
102
|
+
if (_host === h) return
|
|
103
|
+
if (!h) {
|
|
104
|
+
teardown()
|
|
105
|
+
_host = null
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
_host = h
|
|
109
|
+
init()
|
|
110
|
+
}
|
|
111
|
+
return { onBind, jar }
|
|
112
|
+
}
|