@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,583 @@
|
|
|
1
|
+
import { For, Show, createMemo } from 'solid-js'
|
|
2
|
+
import { A } from '@solidjs/router'
|
|
3
|
+
|
|
4
|
+
import { type Types } from '../context/index.ts'
|
|
5
|
+
|
|
6
|
+
import { type Kind, labelOf, shortOf } from '../util/kind.ts'
|
|
7
|
+
import { useSlugFor } from '../hooks/index.ts'
|
|
8
|
+
|
|
9
|
+
import { Markdown } from './Markdown.tsx'
|
|
10
|
+
import { Comment } from './Comment.tsx'
|
|
11
|
+
import { Syntax } from './Syntax.tsx'
|
|
12
|
+
import { Link } from './Link.tsx'
|
|
13
|
+
|
|
14
|
+
type T = Types.Type
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Render an arbitrary type. The body re-evaluates when `props.type` changes
|
|
18
|
+
* so that navigating between pages with different type shapes swaps the
|
|
19
|
+
* sub-renderer instead of freezing on the original branch (a classic Solid
|
|
20
|
+
* pitfall where a top-level `switch` in a component runs only on mount).
|
|
21
|
+
*/
|
|
22
|
+
export const Type = (props: { type: T | undefined }): any => <>{() => renderType(props.type)}</>
|
|
23
|
+
|
|
24
|
+
const renderType = (t: T | undefined): any => {
|
|
25
|
+
if (!t) return null
|
|
26
|
+
switch (t.kind) {
|
|
27
|
+
case 'intrinsic':
|
|
28
|
+
return <Syntax.Kw>{t.name}</Syntax.Kw>
|
|
29
|
+
case 'literal':
|
|
30
|
+
if (typeof t.value === 'string') return <span class="text-fg">"{t.value}"</span>
|
|
31
|
+
if (t.value === null) return <Syntax.Kw>null</Syntax.Kw>
|
|
32
|
+
return <span>{String(t.value)}</span>
|
|
33
|
+
case 'reference':
|
|
34
|
+
return <Type.ReferenceType type={t} />
|
|
35
|
+
case 'array':
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<Type type={t.elementType} />
|
|
39
|
+
<Syntax.Punct>[]</Syntax.Punct>
|
|
40
|
+
</>
|
|
41
|
+
)
|
|
42
|
+
case 'tuple':
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<Syntax.Punct>[</Syntax.Punct>
|
|
46
|
+
<For each={t.elements}>
|
|
47
|
+
{(el, i) => (
|
|
48
|
+
<>
|
|
49
|
+
<Show when={i() > 0}>
|
|
50
|
+
<Syntax.Punct>{', '}</Syntax.Punct>
|
|
51
|
+
</Show>
|
|
52
|
+
<TupleElement el={el} />
|
|
53
|
+
</>
|
|
54
|
+
)}
|
|
55
|
+
</For>
|
|
56
|
+
<Syntax.Punct>]</Syntax.Punct>
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
case 'union':
|
|
60
|
+
return <Type.Join sep=" | " items={t.types} />
|
|
61
|
+
case 'intersection':
|
|
62
|
+
return <Type.Join sep=" & " items={t.types} />
|
|
63
|
+
case 'function-type':
|
|
64
|
+
return (
|
|
65
|
+
<Show when={t.signatures[0]} fallback={<Syntax.Kw>function</Syntax.Kw>}>
|
|
66
|
+
{(sig) => <Type.SignatureExpr sig={sig()} arrow />}
|
|
67
|
+
</Show>
|
|
68
|
+
)
|
|
69
|
+
case 'record':
|
|
70
|
+
return <Type.RecordType type={t} />
|
|
71
|
+
case 'type-operator':
|
|
72
|
+
return (
|
|
73
|
+
<>
|
|
74
|
+
<Syntax.Kw>{t.operator}</Syntax.Kw>
|
|
75
|
+
<span> </span>
|
|
76
|
+
<Type type={t.target} />
|
|
77
|
+
</>
|
|
78
|
+
)
|
|
79
|
+
case 'conditional':
|
|
80
|
+
return <Type.ConditionalType type={t} />
|
|
81
|
+
case 'infer':
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<Syntax.Kw>infer </Syntax.Kw>
|
|
85
|
+
<Syntax.Name>{t.name}</Syntax.Name>
|
|
86
|
+
<Show when={t.constraint}>
|
|
87
|
+
<>
|
|
88
|
+
<Syntax.Kw> extends </Syntax.Kw>
|
|
89
|
+
<Type type={t.constraint!} />
|
|
90
|
+
</>
|
|
91
|
+
</Show>
|
|
92
|
+
</>
|
|
93
|
+
)
|
|
94
|
+
case 'indexed-access':
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<Type type={t.object} />
|
|
98
|
+
<Syntax.Punct>[</Syntax.Punct>
|
|
99
|
+
<Type type={t.index} />
|
|
100
|
+
<Syntax.Punct>]</Syntax.Punct>
|
|
101
|
+
</>
|
|
102
|
+
)
|
|
103
|
+
case 'mapped':
|
|
104
|
+
return (
|
|
105
|
+
<>
|
|
106
|
+
<Syntax.Punct>{'{ '}</Syntax.Punct>
|
|
107
|
+
<Show when={t.readonly}>
|
|
108
|
+
<Syntax.Kw>readonly </Syntax.Kw>
|
|
109
|
+
</Show>
|
|
110
|
+
<Syntax.Punct>[</Syntax.Punct>
|
|
111
|
+
<Syntax.Name>{t.typeParameter.name}</Syntax.Name>
|
|
112
|
+
<Show when={t.typeParameter.constraint}>
|
|
113
|
+
<>
|
|
114
|
+
<Syntax.Kw> in </Syntax.Kw>
|
|
115
|
+
<Type type={t.typeParameter.constraint!} />
|
|
116
|
+
</>
|
|
117
|
+
</Show>
|
|
118
|
+
<Show when={t.nameType}>
|
|
119
|
+
<>
|
|
120
|
+
<Syntax.Kw> as </Syntax.Kw>
|
|
121
|
+
<Type type={t.nameType!} />
|
|
122
|
+
</>
|
|
123
|
+
</Show>
|
|
124
|
+
<Syntax.Punct>]</Syntax.Punct>
|
|
125
|
+
<Show when={t.optional}>
|
|
126
|
+
<Syntax.Punct>?</Syntax.Punct>
|
|
127
|
+
</Show>
|
|
128
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
129
|
+
<Type type={t.type} />
|
|
130
|
+
<Syntax.Punct>{' }'}</Syntax.Punct>
|
|
131
|
+
</>
|
|
132
|
+
)
|
|
133
|
+
case 'query':
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
<Syntax.Kw>typeof </Syntax.Kw>
|
|
137
|
+
<Syntax.Name>{t.name}</Syntax.Name>
|
|
138
|
+
<Type.TypeArgs args={t.args} />
|
|
139
|
+
</>
|
|
140
|
+
)
|
|
141
|
+
case 'template-literal':
|
|
142
|
+
return (
|
|
143
|
+
<>
|
|
144
|
+
<span class="text-fg">
|
|
145
|
+
{'`'}
|
|
146
|
+
{t.head}
|
|
147
|
+
</span>
|
|
148
|
+
<For each={t.spans}>
|
|
149
|
+
{(sp) => (
|
|
150
|
+
<>
|
|
151
|
+
<Syntax.Punct>{'${'}</Syntax.Punct>
|
|
152
|
+
<Type type={sp.type} />
|
|
153
|
+
<Syntax.Punct>{'}'}</Syntax.Punct>
|
|
154
|
+
<span class="text-fg">{sp.literal}</span>
|
|
155
|
+
</>
|
|
156
|
+
)}
|
|
157
|
+
</For>
|
|
158
|
+
<span class="text-fg">{'`'}</span>
|
|
159
|
+
</>
|
|
160
|
+
)
|
|
161
|
+
case 'predicate':
|
|
162
|
+
return (
|
|
163
|
+
<>
|
|
164
|
+
<Show when={t.asserts}>
|
|
165
|
+
<Syntax.Kw>asserts </Syntax.Kw>
|
|
166
|
+
</Show>
|
|
167
|
+
<Syntax.Name>{t.parameter}</Syntax.Name>
|
|
168
|
+
<Show when={t.type}>
|
|
169
|
+
<>
|
|
170
|
+
<Syntax.Kw> is </Syntax.Kw>
|
|
171
|
+
<Type type={t.type!} />
|
|
172
|
+
</>
|
|
173
|
+
</Show>
|
|
174
|
+
</>
|
|
175
|
+
)
|
|
176
|
+
case 'import-type':
|
|
177
|
+
return (
|
|
178
|
+
<>
|
|
179
|
+
<Show when={t.isTypeOf}>
|
|
180
|
+
<Syntax.Kw>typeof </Syntax.Kw>
|
|
181
|
+
</Show>
|
|
182
|
+
<Syntax.Kw>import</Syntax.Kw>
|
|
183
|
+
<Syntax.Punct>(</Syntax.Punct>
|
|
184
|
+
<span class="text-fg">"{t.argument}"</span>
|
|
185
|
+
<Syntax.Punct>)</Syntax.Punct>
|
|
186
|
+
<Show when={t.qualifier}>
|
|
187
|
+
<>
|
|
188
|
+
<Syntax.Punct>.</Syntax.Punct>
|
|
189
|
+
<Syntax.Name>{t.qualifier!}</Syntax.Name>
|
|
190
|
+
</>
|
|
191
|
+
</Show>
|
|
192
|
+
<Type.TypeArgs args={t.args} />
|
|
193
|
+
</>
|
|
194
|
+
)
|
|
195
|
+
case 'unknown':
|
|
196
|
+
return <Syntax.Name>{t.text}</Syntax.Name>
|
|
197
|
+
default:
|
|
198
|
+
return <Syntax.Name>{(t as { kind: string }).kind}</Syntax.Name>
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
Type.Join = (props: { sep: string; items: T[] }) => (
|
|
203
|
+
<For each={props.items}>
|
|
204
|
+
{(t, i) => (
|
|
205
|
+
<>
|
|
206
|
+
<Show when={i() > 0}>
|
|
207
|
+
<Syntax.Punct>{props.sep}</Syntax.Punct>
|
|
208
|
+
</Show>
|
|
209
|
+
<Type type={t} />
|
|
210
|
+
</>
|
|
211
|
+
)}
|
|
212
|
+
</For>
|
|
213
|
+
)
|
|
214
|
+
|
|
215
|
+
Type.TypeArgs = (props: { args?: T[] }) => (
|
|
216
|
+
<Show when={props.args?.length}>
|
|
217
|
+
<Syntax.Punct>{'<'}</Syntax.Punct>
|
|
218
|
+
<Type.Join sep=", " items={props.args!} />
|
|
219
|
+
<Syntax.Punct>{'>'}</Syntax.Punct>
|
|
220
|
+
</Show>
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
Type.ReferenceType = (props: { type: Types.Type<'reference'> }) => {
|
|
224
|
+
const t = props.type
|
|
225
|
+
return (
|
|
226
|
+
<>
|
|
227
|
+
<Link.Type
|
|
228
|
+
id={t.type === 'internal' ? t.targetId : undefined}
|
|
229
|
+
name={t.name}
|
|
230
|
+
external={t.type === 'external' ? t.external : undefined}
|
|
231
|
+
/>
|
|
232
|
+
<Type.TypeArgs args={t.args} />
|
|
233
|
+
</>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Conditional type. Right-nested chains (`A extends B ? X : C extends D ? …`)
|
|
239
|
+
* are flattened and rendered as an aligned `: ` ladder, the way Prettier
|
|
240
|
+
* formats long conditional-type maps, instead of one runaway inline line.
|
|
241
|
+
*/
|
|
242
|
+
Type.ConditionalType = (props: { type: Types.Type<'conditional'> }) => {
|
|
243
|
+
const chain = createMemo(() => {
|
|
244
|
+
const branches: Types.Type<'conditional'>[] = []
|
|
245
|
+
let cur: Types.Type | undefined = props.type
|
|
246
|
+
while (cur?.kind === 'conditional') {
|
|
247
|
+
branches.push(cur)
|
|
248
|
+
cur = cur.false
|
|
249
|
+
}
|
|
250
|
+
return { branches, tail: cur }
|
|
251
|
+
})
|
|
252
|
+
const head = (b: Types.Type<'conditional'>) => (
|
|
253
|
+
<>
|
|
254
|
+
<Type type={b.check} />
|
|
255
|
+
<Syntax.Kw> extends </Syntax.Kw>
|
|
256
|
+
<Type type={b.extends} />
|
|
257
|
+
<Syntax.Punct> ? </Syntax.Punct>
|
|
258
|
+
<Type type={b.true} />
|
|
259
|
+
</>
|
|
260
|
+
)
|
|
261
|
+
return (
|
|
262
|
+
<Show
|
|
263
|
+
when={chain().branches.length > 1}
|
|
264
|
+
fallback={
|
|
265
|
+
<>
|
|
266
|
+
{head(props.type)}
|
|
267
|
+
<Syntax.Punct> : </Syntax.Punct>
|
|
268
|
+
<Type type={props.type.false} />
|
|
269
|
+
</>
|
|
270
|
+
}
|
|
271
|
+
>
|
|
272
|
+
<span class="inline-flex flex-col align-top">
|
|
273
|
+
<For each={chain().branches}>
|
|
274
|
+
{(b, i) => (
|
|
275
|
+
<span classList={{ 'pl-4': i() > 0 }}>
|
|
276
|
+
<Show when={i() > 0}>
|
|
277
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
278
|
+
</Show>
|
|
279
|
+
{head(b)}
|
|
280
|
+
</span>
|
|
281
|
+
)}
|
|
282
|
+
</For>
|
|
283
|
+
<span class="pl-4">
|
|
284
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
285
|
+
<Type type={chain().tail} />
|
|
286
|
+
</span>
|
|
287
|
+
</span>
|
|
288
|
+
</Show>
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
Type.RecordType = (props: { type: Types.Type<'record'> }) => {
|
|
293
|
+
const decl = props.type
|
|
294
|
+
const onlySignatures =
|
|
295
|
+
decl.callSignatures?.length === 1 &&
|
|
296
|
+
!decl.properties.length &&
|
|
297
|
+
!decl.methods?.length &&
|
|
298
|
+
!decl.indexSignature &&
|
|
299
|
+
!decl.constructSignatures?.length
|
|
300
|
+
if (onlySignatures) return <Type.SignatureExpr sig={decl.callSignatures![0]!} arrow />
|
|
301
|
+
|
|
302
|
+
// Every member kind, flattened to renderers so a single `<For>` lays them
|
|
303
|
+
// out with consistent `; ` separators.
|
|
304
|
+
const members = (): (() => any)[] => [
|
|
305
|
+
...decl.properties.map((p) => () => <RecordProperty prop={p} />),
|
|
306
|
+
...(decl.methods ?? []).flatMap((m) => m.signatures.map((sig) => () => <RecordMethod name={m.name} sig={sig} />)),
|
|
307
|
+
...(decl.indexSignature ? [() => <RecordIndex sig={decl.indexSignature!} />] : []),
|
|
308
|
+
...(decl.callSignatures ?? []).map((sig) => () => <Type.SignatureExpr sig={sig} />),
|
|
309
|
+
...(decl.constructSignatures ?? []).map((sig) => () => (
|
|
310
|
+
<>
|
|
311
|
+
<Syntax.Kw>new </Syntax.Kw>
|
|
312
|
+
<Type.SignatureExpr sig={sig} />
|
|
313
|
+
</>
|
|
314
|
+
)),
|
|
315
|
+
]
|
|
316
|
+
|
|
317
|
+
return (
|
|
318
|
+
<Show when={members().length} fallback={<Syntax.Punct>{'{}'}</Syntax.Punct>}>
|
|
319
|
+
<Syntax.Punct>{'{ '}</Syntax.Punct>
|
|
320
|
+
<For each={members()}>
|
|
321
|
+
{(render, i) => (
|
|
322
|
+
<>
|
|
323
|
+
<Show when={i() > 0}>
|
|
324
|
+
<Syntax.Punct>{'; '}</Syntax.Punct>
|
|
325
|
+
</Show>
|
|
326
|
+
{render()}
|
|
327
|
+
</>
|
|
328
|
+
)}
|
|
329
|
+
</For>
|
|
330
|
+
<Syntax.Punct>{' }'}</Syntax.Punct>
|
|
331
|
+
</Show>
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const RecordProperty = (props: { prop: Types.Part<'property'> }) => (
|
|
336
|
+
<>
|
|
337
|
+
<Syntax.Name>{props.prop.name}</Syntax.Name>
|
|
338
|
+
<Show when={props.prop.optional}>
|
|
339
|
+
<Syntax.Punct>?</Syntax.Punct>
|
|
340
|
+
</Show>
|
|
341
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
342
|
+
<Type type={props.prop.type} />
|
|
343
|
+
</>
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
const RecordMethod = (props: { name: string; sig: Types.Part<'signature'> }) => (
|
|
347
|
+
<>
|
|
348
|
+
<Syntax.Name>{props.name}</Syntax.Name>
|
|
349
|
+
<Type.SignatureExpr sig={props.sig} />
|
|
350
|
+
</>
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
const RecordIndex = (props: { sig: Types.Part<'index-signature'> }) => (
|
|
354
|
+
<>
|
|
355
|
+
<Syntax.Punct>[</Syntax.Punct>
|
|
356
|
+
<Syntax.Name>{props.sig.parameter.name}</Syntax.Name>
|
|
357
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
358
|
+
<Type type={props.sig.parameter.type} />
|
|
359
|
+
<Syntax.Punct>]: </Syntax.Punct>
|
|
360
|
+
<Type type={props.sig.type} />
|
|
361
|
+
</>
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
const TupleElement = (props: { el: Types.Part<'tuple-element'> }) => (
|
|
365
|
+
<>
|
|
366
|
+
<Show when={props.el.rest}>
|
|
367
|
+
<Syntax.Punct>...</Syntax.Punct>
|
|
368
|
+
</Show>
|
|
369
|
+
<Show when={props.el.name}>
|
|
370
|
+
<>
|
|
371
|
+
<Syntax.Name>{props.el.name!}</Syntax.Name>
|
|
372
|
+
<Show when={props.el.optional}>
|
|
373
|
+
<Syntax.Punct>?</Syntax.Punct>
|
|
374
|
+
</Show>
|
|
375
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
376
|
+
</>
|
|
377
|
+
</Show>
|
|
378
|
+
<Type type={props.el.type} />
|
|
379
|
+
<Show when={!props.el.name && props.el.optional}>
|
|
380
|
+
<Syntax.Punct>?</Syntax.Punct>
|
|
381
|
+
</Show>
|
|
382
|
+
</>
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
Type.SignatureExpr = (props: { sig: Types.Part<'signature'>; arrow?: boolean }) => (
|
|
386
|
+
<>
|
|
387
|
+
<Type.Generics generics={props.sig.generics} />
|
|
388
|
+
<Syntax.Punct>(</Syntax.Punct>
|
|
389
|
+
<For each={props.sig.params}>
|
|
390
|
+
{(p, i) => (
|
|
391
|
+
<>
|
|
392
|
+
<Show when={i() > 0}>
|
|
393
|
+
<Syntax.Punct>{', '}</Syntax.Punct>
|
|
394
|
+
</Show>
|
|
395
|
+
<Show when={p.rest}>
|
|
396
|
+
<Syntax.Punct>...</Syntax.Punct>
|
|
397
|
+
</Show>
|
|
398
|
+
<Syntax.Name>{p.name}</Syntax.Name>
|
|
399
|
+
<Show when={p.optional || p.default != null}>
|
|
400
|
+
<Syntax.Punct>?</Syntax.Punct>
|
|
401
|
+
</Show>
|
|
402
|
+
<Syntax.Punct>: </Syntax.Punct>
|
|
403
|
+
<Type type={p.type} />
|
|
404
|
+
</>
|
|
405
|
+
)}
|
|
406
|
+
</For>
|
|
407
|
+
<Syntax.Punct>)</Syntax.Punct>
|
|
408
|
+
<Syntax.Punct>{props.arrow ? ' => ' : ': '}</Syntax.Punct>
|
|
409
|
+
<Type type={props.sig.return} />
|
|
410
|
+
</>
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
/** Type parameter list — `<T extends C = D>`. */
|
|
414
|
+
Type.Generics = (props: { generics?: Types.Part<'generic'>[] }) => (
|
|
415
|
+
<Show when={props.generics?.length}>
|
|
416
|
+
<Syntax.Punct>{'<'}</Syntax.Punct>
|
|
417
|
+
<For each={props.generics!}>
|
|
418
|
+
{(tp, i) => (
|
|
419
|
+
<>
|
|
420
|
+
<Show when={i() > 0}>
|
|
421
|
+
<Syntax.Punct>{', '}</Syntax.Punct>
|
|
422
|
+
</Show>
|
|
423
|
+
<Syntax.Name>{tp.name}</Syntax.Name>
|
|
424
|
+
<Show when={tp.constraint}>
|
|
425
|
+
<>
|
|
426
|
+
<Syntax.Kw> extends </Syntax.Kw>
|
|
427
|
+
<Type type={tp.constraint!} />
|
|
428
|
+
</>
|
|
429
|
+
</Show>
|
|
430
|
+
<Show when={tp.default}>
|
|
431
|
+
<>
|
|
432
|
+
<Syntax.Punct> = </Syntax.Punct>
|
|
433
|
+
<Type type={tp.default!} />
|
|
434
|
+
</>
|
|
435
|
+
</Show>
|
|
436
|
+
</>
|
|
437
|
+
)}
|
|
438
|
+
</For>
|
|
439
|
+
<Syntax.Punct>{'>'}</Syntax.Punct>
|
|
440
|
+
</Show>
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
Type.TypeBlock = (props: { type: T | undefined }) => (
|
|
444
|
+
<code class="font-mono text-[0.85em] leading-relaxed">
|
|
445
|
+
<Type type={props.type} />
|
|
446
|
+
</code>
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
Type.TypeBox = (props: { type: T | undefined; class?: string }) => (
|
|
450
|
+
<div class={`codeblock ${props.class ?? ''}`}>
|
|
451
|
+
<Type type={props.type} />
|
|
452
|
+
</div>
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
Type.Inline = (props: { type?: Types.Type; text: string }) => (
|
|
456
|
+
<>
|
|
457
|
+
<Show when={props.type}>
|
|
458
|
+
<div class="font-mono text-sm mb-1">
|
|
459
|
+
<Type type={props.type!} />
|
|
460
|
+
</div>
|
|
461
|
+
</Show>
|
|
462
|
+
<Show when={props.text?.trim()}>
|
|
463
|
+
<Markdown.Inline source={props.text} />
|
|
464
|
+
</Show>
|
|
465
|
+
</>
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Single-glyph badge for a declaration kind. Use in dense lists (sidebar,
|
|
470
|
+
* member cards, search palette) where a `K` / `ƒ` cue is enough.
|
|
471
|
+
*/
|
|
472
|
+
Type.KindBadge = (props: { kind: Kind | string; class?: string }) => (
|
|
473
|
+
<span class={`font-mono text-xs text-mute text-center ${props.class ?? ''}`} title={labelOf(props.kind)}>
|
|
474
|
+
{shortOf(props.kind)}
|
|
475
|
+
</span>
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
/** Tracked uppercase label for a declaration kind (`MODULE`, `FUNCTION`, …). */
|
|
479
|
+
Type.KindLabel = (props: { kind: Kind | string; class?: string }) => (
|
|
480
|
+
<span class={`text-xs uppercase tracking-wider text-mute ${props.class ?? ''}`}>{labelOf(props.kind)}</span>
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Declaration name rendered as a link to its own page when a routable id
|
|
485
|
+
* resolves. Used in compact module-export lists where the signature is
|
|
486
|
+
* read-only context and the name itself is the navigation target.
|
|
487
|
+
*/
|
|
488
|
+
Type.NameLink = (props: { id?: number; name: string; class?: string }) => {
|
|
489
|
+
const slugs = useSlugFor()
|
|
490
|
+
const slug = () => (props.id != null ? slugs.byId(props.id) : undefined)
|
|
491
|
+
return (
|
|
492
|
+
<Show when={slug()} fallback={<span class={props.class}>{props.name}</span>}>
|
|
493
|
+
{(s) => (
|
|
494
|
+
<A
|
|
495
|
+
href={`/${s()}`}
|
|
496
|
+
class={`${props.class ?? ''} hover:opacity-70 underline decoration-line decoration-dotted underline-offset-[3px]`}
|
|
497
|
+
>
|
|
498
|
+
{props.name}
|
|
499
|
+
</A>
|
|
500
|
+
)}
|
|
501
|
+
</Show>
|
|
502
|
+
)
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const Punct = (p: { children: string }) => <span class="text-mute">{p.children}</span>
|
|
506
|
+
const Kw = (p: { children: string }) => <span class="text-accent">{p.children}</span>
|
|
507
|
+
|
|
508
|
+
const isOptional = (p: Types.Part<'parameter'>): boolean => p.optional || p.default != null
|
|
509
|
+
|
|
510
|
+
Type.SignatureLine = (props: {
|
|
511
|
+
sig: Types.Part<'signature'>
|
|
512
|
+
name?: string
|
|
513
|
+
/** Owning declaration id — when set, the name renders as a link to its page. */
|
|
514
|
+
id?: number
|
|
515
|
+
kind?: 'function' | 'method' | 'constructor'
|
|
516
|
+
}) => (
|
|
517
|
+
<div class="font-mono text-sm leading-relaxed py-2">
|
|
518
|
+
<Show when={props.kind === 'constructor'}>
|
|
519
|
+
<Kw>new </Kw>
|
|
520
|
+
</Show>
|
|
521
|
+
<Show when={props.name}>
|
|
522
|
+
<Type.NameLink id={props.id} name={props.name!} class="font-semibold" />
|
|
523
|
+
</Show>
|
|
524
|
+
<Type.Generics generics={props.sig.generics} />
|
|
525
|
+
<Punct>(</Punct>
|
|
526
|
+
<For each={props.sig.params}>
|
|
527
|
+
{(p, i) => (
|
|
528
|
+
<>
|
|
529
|
+
<Show when={i() > 0}>
|
|
530
|
+
<Punct>{', '}</Punct>
|
|
531
|
+
</Show>
|
|
532
|
+
<Show when={p.rest}>
|
|
533
|
+
<Punct>...</Punct>
|
|
534
|
+
</Show>
|
|
535
|
+
<span>{p.name}</span>
|
|
536
|
+
<Show when={isOptional(p)}>
|
|
537
|
+
<Punct>?</Punct>
|
|
538
|
+
</Show>
|
|
539
|
+
<Punct>: </Punct>
|
|
540
|
+
<Type type={p.type} />
|
|
541
|
+
</>
|
|
542
|
+
)}
|
|
543
|
+
</For>
|
|
544
|
+
<Punct>)</Punct>
|
|
545
|
+
<Punct>: </Punct>
|
|
546
|
+
<Type type={props.sig.return} />
|
|
547
|
+
</div>
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Type signature + its doc block. Parameter descriptions come from the
|
|
552
|
+
* `@param` tags inside `sig.comment` and are rendered by `<Comment>` itself,
|
|
553
|
+
* so there's no separate parameter table here.
|
|
554
|
+
*/
|
|
555
|
+
Type.Signature = (props: {
|
|
556
|
+
sig: Types.Part<'signature'>
|
|
557
|
+
name?: string
|
|
558
|
+
id?: number
|
|
559
|
+
kind?: 'function' | 'method' | 'constructor'
|
|
560
|
+
}) => {
|
|
561
|
+
return (
|
|
562
|
+
<div class="mb-8">
|
|
563
|
+
<Type.SignatureLine sig={props.sig} name={props.name} id={props.id} kind={props.kind} />
|
|
564
|
+
<Show when={props.sig.comment}>
|
|
565
|
+
<div class="mt-2">
|
|
566
|
+
<Comment comment={props.sig.comment} />
|
|
567
|
+
</div>
|
|
568
|
+
</Show>
|
|
569
|
+
</div>
|
|
570
|
+
)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
Type.SignatureCompact = (props: {
|
|
574
|
+
sig: Types.Part<'signature'>
|
|
575
|
+
name?: string
|
|
576
|
+
id?: number
|
|
577
|
+
kind?: 'function' | 'method' | 'constructor'
|
|
578
|
+
}) => (
|
|
579
|
+
<>
|
|
580
|
+
<Type.SignatureLine sig={props.sig} name={props.name} id={props.id} kind={props.kind} />
|
|
581
|
+
<Comment comment={props.sig.comment} />
|
|
582
|
+
</>
|
|
583
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './LivePreview/index.ts'
|
|
2
|
+
export * from './Breadcrumb.tsx'
|
|
3
|
+
export * from './Code/index.tsx'
|
|
4
|
+
export * from './Comment.tsx'
|
|
5
|
+
export * from './Declaration.tsx'
|
|
6
|
+
export * from './Header.tsx'
|
|
7
|
+
export * from './Layout.tsx'
|
|
8
|
+
export * from './Link.tsx'
|
|
9
|
+
export * from './Markdown.tsx'
|
|
10
|
+
export * from './Page.tsx'
|
|
11
|
+
export * from './References.tsx'
|
|
12
|
+
export * from './Sidebar.tsx'
|
|
13
|
+
// export * from './Source.tsx'
|
|
14
|
+
export * from './Syntax.tsx'
|
|
15
|
+
export * from './Type.tsx'
|