@publish.os/nextjs 0.0.1-alpha.2 → 0.0.1-alpha.3
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/dist/cache/tags.cjs +3 -0
- package/dist/cache/tags.d.cts +1 -0
- package/dist/cache/tags.d.ts +1 -0
- package/dist/cache/tags.js +3 -0
- package/dist/config.cjs +78 -0
- package/dist/config.d.cts +101 -0
- package/dist/config.d.ts +101 -0
- package/dist/config.js +48 -0
- package/dist/index.cjs +1039 -123
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +1027 -110
- package/dist/kernel/components/blocks/AgentActions.cjs +425 -0
- package/dist/kernel/components/blocks/AgentActions.d.cts +52 -0
- package/dist/kernel/components/blocks/AgentActions.d.ts +52 -0
- package/dist/kernel/components/blocks/AgentActions.js +429 -0
- package/dist/kernel/components/blocks/animated-icon-swap.cjs +101 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.cts +16 -0
- package/dist/kernel/components/blocks/animated-icon-swap.d.ts +16 -0
- package/dist/kernel/components/blocks/animated-icon-swap.js +74 -0
- package/dist/kernel/components/blocks/color-palette.cjs +413 -0
- package/dist/kernel/components/blocks/color-palette.d.cts +7 -0
- package/dist/kernel/components/blocks/color-palette.d.ts +7 -0
- package/dist/kernel/components/blocks/color-palette.js +407 -0
- package/dist/kernel/components/blocks/design-system-preview.cjs +592 -0
- package/dist/kernel/components/blocks/design-system-preview.d.cts +29 -0
- package/dist/kernel/components/blocks/design-system-preview.d.ts +29 -0
- package/dist/kernel/components/blocks/design-system-preview.js +655 -0
- package/dist/kernel/components/blocks/link-playground.cjs +816 -0
- package/dist/kernel/components/blocks/link-playground.d.cts +5 -0
- package/dist/kernel/components/blocks/link-playground.d.ts +5 -0
- package/dist/kernel/components/blocks/link-playground.js +792 -0
- package/dist/kernel/components/blocks/logo-block.cjs +156 -0
- package/dist/kernel/components/blocks/logo-block.d.cts +21 -0
- package/dist/kernel/components/blocks/logo-block.d.ts +21 -0
- package/dist/kernel/components/blocks/logo-block.js +129 -0
- package/dist/{components → kernel/components/blocks}/nav-breadcrumb.cjs +19 -38
- package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +11 -0
- package/dist/kernel/components/blocks/nav-breadcrumb.d.ts +11 -0
- package/dist/{components → kernel/components/blocks}/nav-breadcrumb.js +22 -30
- package/dist/kernel/components/blocks/navbar.cjs +154 -0
- package/dist/kernel/components/blocks/navbar.d.cts +16 -0
- package/dist/kernel/components/blocks/navbar.d.ts +16 -0
- package/dist/kernel/components/blocks/navbar.js +122 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.cjs +735 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +5 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.d.ts +5 -0
- package/dist/kernel/components/blocks/navigation-progress-playground.js +722 -0
- package/dist/kernel/components/blocks/navigation-progress.cjs +270 -0
- package/dist/kernel/components/blocks/navigation-progress.d.cts +16 -0
- package/dist/kernel/components/blocks/navigation-progress.d.ts +16 -0
- package/dist/kernel/components/blocks/navigation-progress.js +249 -0
- package/dist/kernel/components/blocks/next-prev.cjs +142 -0
- package/dist/kernel/components/blocks/next-prev.d.cts +11 -0
- package/dist/kernel/components/blocks/next-prev.d.ts +11 -0
- package/dist/kernel/components/blocks/next-prev.js +105 -0
- package/dist/{components → kernel/components/blocks}/page-list.cjs +7 -16
- package/dist/{components → kernel/components/blocks}/page-list.d.cts +1 -1
- package/dist/{components → kernel/components/blocks}/page-list.d.ts +1 -1
- package/dist/{components → kernel/components/blocks}/page-list.js +6 -5
- package/dist/kernel/components/blocks/search.cjs +717 -0
- package/dist/kernel/components/blocks/search.d.cts +77 -0
- package/dist/kernel/components/blocks/search.d.ts +77 -0
- package/dist/kernel/components/blocks/search.js +697 -0
- package/dist/kernel/components/blocks/sidebar-node.cjs +309 -0
- package/dist/kernel/components/blocks/sidebar-node.d.cts +8 -0
- package/dist/kernel/components/blocks/sidebar-node.d.ts +8 -0
- package/dist/kernel/components/blocks/sidebar-node.js +272 -0
- package/dist/kernel/components/blocks/sidebar.cjs +317 -0
- package/dist/kernel/components/blocks/sidebar.d.cts +33 -0
- package/dist/kernel/components/blocks/sidebar.d.ts +33 -0
- package/dist/kernel/components/blocks/sidebar.js +302 -0
- package/dist/kernel/components/blocks/theme-toggle.cjs +31 -0
- package/dist/kernel/components/blocks/theme-toggle.d.cts +6 -0
- package/dist/kernel/components/blocks/theme-toggle.d.ts +6 -0
- package/dist/kernel/components/blocks/theme-toggle.js +7 -0
- package/dist/kernel/components/blocks/toc.cjs +356 -0
- package/dist/kernel/components/blocks/toc.d.cts +10 -0
- package/dist/kernel/components/blocks/toc.d.ts +10 -0
- package/dist/kernel/components/blocks/toc.js +330 -0
- package/dist/kernel/components/mdx/components/blockquote.cjs +66 -0
- package/dist/kernel/components/mdx/components/blockquote.d.cts +6 -0
- package/dist/kernel/components/mdx/components/blockquote.d.ts +6 -0
- package/dist/kernel/components/mdx/components/blockquote.js +39 -0
- package/dist/kernel/components/mdx/components/callout.cjs +137 -0
- package/dist/kernel/components/mdx/components/callout.d.cts +18 -0
- package/dist/kernel/components/mdx/components/callout.d.ts +18 -0
- package/dist/kernel/components/mdx/components/callout.js +109 -0
- package/dist/kernel/components/mdx/components/code-block.cjs +39 -0
- package/dist/kernel/components/mdx/components/code-block.d.cts +9 -0
- package/dist/kernel/components/mdx/components/code-block.d.ts +9 -0
- package/dist/kernel/components/mdx/components/code-block.js +14 -0
- package/dist/kernel/components/mdx/components/figure-caption.cjs +63 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.cts +6 -0
- package/dist/kernel/components/mdx/components/figure-caption.d.ts +6 -0
- package/dist/kernel/components/mdx/components/figure-caption.js +36 -0
- package/dist/kernel/components/mdx/components/figure.cjs +78 -0
- package/dist/kernel/components/mdx/components/figure.d.cts +10 -0
- package/dist/kernel/components/mdx/components/figure.d.ts +10 -0
- package/dist/kernel/components/mdx/components/figure.js +53 -0
- package/dist/kernel/components/mdx/components/footnotes.cjs +66 -0
- package/dist/kernel/components/mdx/components/footnotes.d.cts +6 -0
- package/dist/kernel/components/mdx/components/footnotes.d.ts +6 -0
- package/dist/kernel/components/mdx/components/footnotes.js +39 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.cjs +108 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +23 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.d.ts +23 -0
- package/dist/kernel/components/mdx/components/heading-copy-link.js +81 -0
- package/dist/kernel/components/mdx/components/heading.cjs +166 -0
- package/dist/kernel/components/mdx/components/heading.d.cts +8 -0
- package/dist/kernel/components/mdx/components/heading.d.ts +8 -0
- package/dist/kernel/components/mdx/components/heading.js +144 -0
- package/dist/kernel/components/mdx/components/hr.cjs +34 -0
- package/dist/kernel/components/mdx/components/hr.d.cts +9 -0
- package/dist/kernel/components/mdx/components/hr.d.ts +9 -0
- package/dist/kernel/components/mdx/components/hr.js +9 -0
- package/dist/kernel/components/mdx/components/image-zoom.cjs +49 -0
- package/dist/kernel/components/mdx/components/image-zoom.d.cts +10 -0
- package/dist/kernel/components/mdx/components/image-zoom.d.ts +10 -0
- package/dist/kernel/components/mdx/components/image-zoom.js +15 -0
- package/dist/kernel/components/mdx/components/image.cjs +192 -0
- package/dist/kernel/components/mdx/components/image.d.cts +21 -0
- package/dist/kernel/components/mdx/components/image.d.ts +21 -0
- package/dist/kernel/components/mdx/components/image.js +157 -0
- package/dist/kernel/components/mdx/components/inline-code.cjs +66 -0
- package/dist/kernel/components/mdx/components/inline-code.d.cts +6 -0
- package/dist/kernel/components/mdx/components/inline-code.d.ts +6 -0
- package/dist/kernel/components/mdx/components/inline-code.js +39 -0
- package/dist/kernel/components/mdx/components/kbd.cjs +34 -0
- package/dist/kernel/components/mdx/components/kbd.d.cts +10 -0
- package/dist/kernel/components/mdx/components/kbd.d.ts +10 -0
- package/dist/kernel/components/mdx/components/kbd.js +9 -0
- package/dist/{components/providers.cjs → kernel/components/mdx/components/link.cjs} +20 -15
- package/dist/kernel/components/mdx/components/link.d.cts +11 -0
- package/dist/kernel/components/mdx/components/link.d.ts +11 -0
- package/dist/kernel/components/mdx/components/link.js +26 -0
- package/dist/kernel/components/mdx/components/paragraph.cjs +87 -0
- package/dist/kernel/components/mdx/components/paragraph.d.cts +5 -0
- package/dist/kernel/components/mdx/components/paragraph.d.ts +5 -0
- package/dist/kernel/components/mdx/components/paragraph.js +60 -0
- package/dist/kernel/components/mdx/components/pre.cjs +66 -0
- package/dist/kernel/components/mdx/components/pre.d.cts +6 -0
- package/dist/kernel/components/mdx/components/pre.d.ts +6 -0
- package/dist/kernel/components/mdx/components/pre.js +39 -0
- package/dist/kernel/components/mdx/components/strikethrough.cjs +63 -0
- package/dist/kernel/components/mdx/components/strikethrough.d.cts +6 -0
- package/dist/kernel/components/mdx/components/strikethrough.d.ts +6 -0
- package/dist/kernel/components/mdx/components/strikethrough.js +36 -0
- package/dist/kernel/components/mdx/components/table.cjs +59 -0
- package/dist/kernel/components/mdx/components/table.d.cts +10 -0
- package/dist/kernel/components/mdx/components/table.d.ts +10 -0
- package/dist/kernel/components/mdx/components/table.js +36 -0
- package/dist/kernel/components/mdx/components/task-list.cjs +88 -0
- package/dist/kernel/components/mdx/components/task-list.d.cts +8 -0
- package/dist/kernel/components/mdx/components/task-list.d.ts +8 -0
- package/dist/kernel/components/mdx/components/task-list.js +60 -0
- package/dist/kernel/components/mdx/components/video-player.cjs +173 -0
- package/dist/kernel/components/mdx/components/video-player.d.cts +18 -0
- package/dist/kernel/components/mdx/components/video-player.d.ts +18 -0
- package/dist/kernel/components/mdx/components/video-player.js +147 -0
- package/dist/kernel/components/mdx/components/video.cjs +185 -0
- package/dist/kernel/components/mdx/components/video.d.cts +15 -0
- package/dist/kernel/components/mdx/components/video.d.ts +15 -0
- package/dist/kernel/components/mdx/components/video.js +162 -0
- package/dist/kernel/components/mdx/error-boundary.cjs +62 -0
- package/dist/{mdx → kernel/components/mdx}/error-boundary.d.cts +3 -8
- package/dist/{mdx → kernel/components/mdx}/error-boundary.d.ts +3 -8
- package/dist/kernel/components/mdx/error-boundary.js +38 -0
- package/dist/{mdx → kernel/components/mdx}/error-fallback.cjs +8 -8
- package/dist/{mdx → kernel/components/mdx}/error-fallback.js +8 -8
- package/dist/kernel/components/mdx/mdx.cjs +141 -0
- package/dist/kernel/components/mdx/mdx.d.cts +22 -0
- package/dist/kernel/components/mdx/mdx.d.ts +22 -0
- package/dist/kernel/components/mdx/mdx.js +109 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.cjs +113 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +10 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.d.ts +10 -0
- package/dist/kernel/components/mdx/rehype-heading-ids.js +86 -0
- package/dist/kernel/components/mdx/types.cjs +18 -0
- package/dist/kernel/components/mdx/types.d.cts +18 -0
- package/dist/kernel/components/mdx/types.d.ts +18 -0
- package/dist/kernel/components/mdx/types.js +0 -0
- package/dist/kernel/components/ui/accordion.cjs +104 -0
- package/dist/kernel/components/ui/accordion.d.cts +16 -0
- package/dist/kernel/components/ui/accordion.d.ts +16 -0
- package/dist/kernel/components/ui/accordion.js +76 -0
- package/dist/kernel/components/ui/badge.cjs +75 -0
- package/dist/kernel/components/ui/badge.d.cts +12 -0
- package/dist/kernel/components/ui/badge.d.ts +12 -0
- package/dist/kernel/components/ui/badge.js +47 -0
- package/dist/kernel/components/ui/breadcrumb-trail.cjs +238 -0
- package/dist/kernel/components/ui/breadcrumb-trail.d.cts +13 -0
- package/dist/kernel/components/ui/breadcrumb-trail.d.ts +13 -0
- package/dist/kernel/components/ui/breadcrumb-trail.js +225 -0
- package/dist/kernel/components/ui/breadcrumb.cjs +399 -0
- package/dist/kernel/components/ui/breadcrumb.d.cts +52 -0
- package/dist/kernel/components/ui/breadcrumb.d.ts +52 -0
- package/dist/kernel/components/ui/breadcrumb.js +365 -0
- package/dist/kernel/components/ui/button-group.cjs +144 -0
- package/dist/kernel/components/ui/button-group.d.cts +19 -0
- package/dist/kernel/components/ui/button-group.d.ts +19 -0
- package/dist/kernel/components/ui/button-group.js +116 -0
- package/dist/kernel/components/ui/button.cjs +147 -0
- package/dist/kernel/components/ui/button.d.cts +23 -0
- package/dist/kernel/components/ui/button.d.ts +23 -0
- package/dist/kernel/components/ui/button.js +121 -0
- package/dist/kernel/components/ui/card.cjs +133 -0
- package/dist/kernel/components/ui/card.d.cts +17 -0
- package/dist/kernel/components/ui/card.d.ts +17 -0
- package/dist/kernel/components/ui/card.js +101 -0
- package/dist/kernel/components/ui/dialog.cjs +149 -0
- package/dist/kernel/components/ui/dialog.d.cts +22 -0
- package/dist/kernel/components/ui/dialog.d.ts +22 -0
- package/dist/kernel/components/ui/dialog.js +118 -0
- package/dist/kernel/components/ui/drawer.cjs +163 -0
- package/dist/kernel/components/ui/drawer.d.cts +24 -0
- package/dist/kernel/components/ui/drawer.d.ts +24 -0
- package/dist/kernel/components/ui/drawer.js +131 -0
- package/dist/kernel/components/ui/input.cjs +96 -0
- package/dist/kernel/components/ui/input.d.cts +18 -0
- package/dist/kernel/components/ui/input.d.ts +18 -0
- package/dist/kernel/components/ui/input.js +70 -0
- package/dist/kernel/components/ui/kbd.cjs +105 -0
- package/dist/kernel/components/ui/kbd.d.cts +13 -0
- package/dist/kernel/components/ui/kbd.d.ts +13 -0
- package/dist/kernel/components/ui/kbd.js +77 -0
- package/dist/kernel/components/ui/link.cjs +253 -0
- package/dist/kernel/components/ui/link.d.cts +31 -0
- package/dist/kernel/components/ui/link.d.ts +31 -0
- package/dist/kernel/components/ui/link.js +217 -0
- package/dist/kernel/components/ui/menu.cjs +301 -0
- package/dist/kernel/components/ui/menu.d.cts +70 -0
- package/dist/kernel/components/ui/menu.d.ts +70 -0
- package/dist/kernel/components/ui/menu.js +256 -0
- package/dist/kernel/components/ui/meta-key.cjs +34 -0
- package/dist/kernel/components/ui/meta-key.d.cts +12 -0
- package/dist/kernel/components/ui/meta-key.d.ts +12 -0
- package/dist/kernel/components/ui/meta-key.js +9 -0
- package/dist/kernel/components/ui/navigation-menu.cjs +253 -0
- package/dist/kernel/components/ui/navigation-menu.d.cts +47 -0
- package/dist/kernel/components/ui/navigation-menu.d.ts +47 -0
- package/dist/kernel/components/ui/navigation-menu.js +216 -0
- package/dist/kernel/components/ui/popover.cjs +168 -0
- package/dist/kernel/components/ui/popover.d.cts +24 -0
- package/dist/kernel/components/ui/popover.d.ts +24 -0
- package/dist/kernel/components/ui/popover.js +136 -0
- package/dist/kernel/components/ui/progress.cjs +112 -0
- package/dist/kernel/components/ui/progress.d.cts +16 -0
- package/dist/kernel/components/ui/progress.d.ts +16 -0
- package/dist/kernel/components/ui/progress.js +84 -0
- package/dist/kernel/components/ui/scroll-area.cjs +413 -0
- package/dist/kernel/components/ui/scroll-area.d.cts +58 -0
- package/dist/kernel/components/ui/scroll-area.d.ts +58 -0
- package/dist/kernel/components/ui/scroll-area.js +390 -0
- package/dist/kernel/components/ui/select.cjs +244 -0
- package/dist/kernel/components/ui/select.d.cts +40 -0
- package/dist/kernel/components/ui/select.d.ts +40 -0
- package/dist/kernel/components/ui/select.js +205 -0
- package/dist/kernel/components/ui/separator.cjs +73 -0
- package/dist/kernel/components/ui/separator.d.cts +8 -0
- package/dist/kernel/components/ui/separator.d.ts +8 -0
- package/dist/kernel/components/ui/separator.js +48 -0
- package/dist/kernel/components/ui/table.cjs +131 -0
- package/dist/kernel/components/ui/table.d.cts +11 -0
- package/dist/kernel/components/ui/table.d.ts +11 -0
- package/dist/kernel/components/ui/table.js +99 -0
- package/dist/kernel/components/ui/tabs.cjs +450 -0
- package/dist/kernel/components/ui/tabs.d.cts +82 -0
- package/dist/kernel/components/ui/tabs.d.ts +82 -0
- package/dist/kernel/components/ui/tabs.js +409 -0
- package/dist/kernel/components/ui/text.cjs +184 -0
- package/dist/kernel/components/ui/text.d.cts +17 -0
- package/dist/kernel/components/ui/text.d.ts +17 -0
- package/dist/kernel/components/ui/text.js +156 -0
- package/dist/kernel/components/ui/theme-toggle.cjs +108 -0
- package/dist/kernel/components/ui/theme-toggle.d.cts +10 -0
- package/dist/kernel/components/ui/theme-toggle.d.ts +10 -0
- package/dist/kernel/components/ui/theme-toggle.js +84 -0
- package/dist/kernel/components/ui/toast.cjs +154 -0
- package/dist/kernel/components/ui/toast.d.cts +26 -0
- package/dist/kernel/components/ui/toast.d.ts +26 -0
- package/dist/kernel/components/ui/toast.js +120 -0
- package/dist/kernel/components/ui/tooltip.cjs +127 -0
- package/dist/kernel/components/ui/tooltip.d.cts +20 -0
- package/dist/kernel/components/ui/tooltip.d.ts +20 -0
- package/dist/kernel/components/ui/tooltip.js +97 -0
- package/dist/kernel/defaults.registry.cjs +541 -0
- package/dist/kernel/defaults.registry.d.cts +469 -0
- package/dist/kernel/defaults.registry.d.ts +469 -0
- package/dist/kernel/defaults.registry.js +516 -0
- package/dist/kernel/routes/agent/markdown.cjs +208 -0
- package/dist/kernel/routes/agent/markdown.d.cts +59 -0
- package/dist/kernel/routes/agent/markdown.d.ts +59 -0
- package/dist/kernel/routes/agent/markdown.js +180 -0
- package/dist/{layouts → kernel/routes/layouts}/group.cjs +39 -15
- package/dist/kernel/routes/layouts/group.d.cts +20 -0
- package/dist/kernel/routes/layouts/group.d.ts +20 -0
- package/dist/{layouts → kernel/routes/layouts}/group.js +39 -15
- package/dist/kernel/routes/metadata/feed.cjs +297 -0
- package/dist/kernel/routes/metadata/feed.d.cts +21 -0
- package/dist/kernel/routes/metadata/feed.d.ts +21 -0
- package/dist/kernel/routes/metadata/feed.js +269 -0
- package/dist/kernel/routes/metadata/llms.cjs +234 -0
- package/dist/kernel/routes/metadata/llms.d.cts +27 -0
- package/dist/kernel/routes/metadata/llms.d.ts +27 -0
- package/dist/kernel/routes/metadata/llms.js +206 -0
- package/dist/kernel/routes/metadata/og-image.cjs +630 -0
- package/dist/kernel/routes/metadata/og-image.d.cts +62 -0
- package/dist/kernel/routes/metadata/og-image.d.ts +62 -0
- package/dist/kernel/routes/metadata/og-image.js +604 -0
- package/dist/{routes → kernel/routes/metadata}/robots.cjs +48 -4
- package/dist/{routes → kernel/routes/metadata}/robots.d.cts +2 -1
- package/dist/{routes → kernel/routes/metadata}/robots.d.ts +2 -1
- package/dist/kernel/routes/metadata/robots.js +113 -0
- package/dist/kernel/routes/metadata/sitemap.cjs +182 -0
- package/dist/kernel/routes/metadata/sitemap.d.cts +8 -0
- package/dist/kernel/routes/metadata/sitemap.d.ts +8 -0
- package/dist/kernel/routes/metadata/sitemap.js +156 -0
- package/dist/{pages → kernel/routes/pages}/group.cjs +107 -6
- package/dist/{pages → kernel/routes/pages}/group.d.cts +4 -2
- package/dist/{pages → kernel/routes/pages}/group.d.ts +4 -2
- package/dist/{pages → kernel/routes/pages}/group.js +107 -6
- package/dist/kernel/routes/pages/leaf.cjs +421 -0
- package/dist/kernel/routes/pages/leaf.d.cts +36 -0
- package/dist/kernel/routes/pages/leaf.d.ts +36 -0
- package/dist/kernel/routes/pages/leaf.js +397 -0
- package/dist/{pages → kernel/routes/pages}/root.cjs +108 -6
- package/dist/{pages → kernel/routes/pages}/root.d.cts +4 -2
- package/dist/{pages → kernel/routes/pages}/root.d.ts +4 -2
- package/dist/kernel/routes/pages/root.js +203 -0
- package/dist/keyboard-shortcuts.cjs +345 -0
- package/dist/keyboard-shortcuts.d.cts +34 -0
- package/dist/keyboard-shortcuts.d.ts +34 -0
- package/dist/keyboard-shortcuts.js +326 -0
- package/dist/resolvers/manifest-resolver.cjs +7 -3
- package/dist/resolvers/manifest-resolver.d.cts +2 -2
- package/dist/resolvers/manifest-resolver.d.ts +2 -2
- package/dist/resolvers/manifest-resolver.js +7 -3
- package/dist/search.cjs +411 -0
- package/dist/search.d.cts +20 -0
- package/dist/search.d.ts +20 -0
- package/dist/search.js +393 -0
- package/dist/types.cjs +12 -0
- package/dist/types.d.cts +132 -7
- package/dist/types.d.ts +132 -7
- package/dist/types.js +5 -0
- package/dist/utils/heading-ids.cjs +119 -0
- package/dist/utils/heading-ids.d.cts +15 -0
- package/dist/utils/heading-ids.d.ts +15 -0
- package/dist/utils/heading-ids.js +90 -0
- package/package.json +36 -39
- package/dist/components/color-palette.cjs +0 -408
- package/dist/components/color-palette.d.cts +0 -5
- package/dist/components/color-palette.d.ts +0 -5
- package/dist/components/color-palette.js +0 -388
- package/dist/components/nav-breadcrumb.d.cts +0 -9
- package/dist/components/nav-breadcrumb.d.ts +0 -9
- package/dist/components/providers.d.cts +0 -8
- package/dist/components/providers.d.ts +0 -8
- package/dist/components/providers.js +0 -20
- package/dist/components/site-header.cjs +0 -302
- package/dist/components/site-header.d.cts +0 -12
- package/dist/components/site-header.d.ts +0 -12
- package/dist/components/site-header.js +0 -268
- package/dist/components/theme-toggle.cjs +0 -147
- package/dist/components/theme-toggle.d.cts +0 -5
- package/dist/components/theme-toggle.d.ts +0 -5
- package/dist/components/theme-toggle.js +0 -123
- package/dist/layouts/group.d.cts +0 -15
- package/dist/layouts/group.d.ts +0 -15
- package/dist/mdx/error-boundary.cjs +0 -94
- package/dist/mdx/error-boundary.js +0 -70
- package/dist/mdx/mdx.cjs +0 -182
- package/dist/mdx/mdx.d.cts +0 -10
- package/dist/mdx/mdx.d.ts +0 -10
- package/dist/mdx/mdx.js +0 -147
- package/dist/pages/leaf.cjs +0 -203
- package/dist/pages/leaf.d.cts +0 -23
- package/dist/pages/leaf.d.ts +0 -23
- package/dist/pages/leaf.js +0 -176
- package/dist/pages/root.js +0 -101
- package/dist/routes/llms.cjs +0 -101
- package/dist/routes/llms.d.cts +0 -7
- package/dist/routes/llms.d.ts +0 -7
- package/dist/routes/llms.js +0 -76
- package/dist/routes/robots.js +0 -69
- package/dist/routes/sitemap.cjs +0 -108
- package/dist/routes/sitemap.d.cts +0 -5
- package/dist/routes/sitemap.d.ts +0 -5
- package/dist/routes/sitemap.js +0 -83
- /package/dist/{mdx → kernel/components/mdx}/error-fallback.d.cts +0 -0
- /package/dist/{mdx → kernel/components/mdx}/error-fallback.d.ts +0 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/kernel/components/blocks/sidebar.tsx
|
|
22
|
+
var sidebar_exports = {};
|
|
23
|
+
__export(sidebar_exports, {
|
|
24
|
+
Sidebar: () => Sidebar
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(sidebar_exports);
|
|
27
|
+
var import_sidebar_node = require("./sidebar-node.js");
|
|
28
|
+
var import_scroll_area = require("../ui/scroll-area.js");
|
|
29
|
+
|
|
30
|
+
// src/utils/cn.ts
|
|
31
|
+
var import_clsx = require("clsx");
|
|
32
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
33
|
+
var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
|
|
34
|
+
extend: {
|
|
35
|
+
classGroups: {
|
|
36
|
+
z: [
|
|
37
|
+
"z-content",
|
|
38
|
+
"z-nav",
|
|
39
|
+
"z-overlay",
|
|
40
|
+
"z-modal",
|
|
41
|
+
"z-search",
|
|
42
|
+
"z-toast",
|
|
43
|
+
"z-progress"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
function cn(...inputs) {
|
|
49
|
+
return twMerge((0, import_clsx.clsx)(inputs));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/kernel/components/blocks/sidebar.tsx
|
|
53
|
+
var import_navigation = require("next/navigation");
|
|
54
|
+
var import_react = require("react");
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
|
+
function normalizePath(path) {
|
|
57
|
+
if (!path) return "";
|
|
58
|
+
const [withoutQuery = ""] = path.split(/[?#]/);
|
|
59
|
+
if (withoutQuery === "/") return "/";
|
|
60
|
+
return withoutQuery.replace(/\/+$/g, "");
|
|
61
|
+
}
|
|
62
|
+
function isExternalHref(href) {
|
|
63
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
64
|
+
}
|
|
65
|
+
function nodeHref(node) {
|
|
66
|
+
if (node.type === "link") return node.href;
|
|
67
|
+
if ("path" in node && typeof node.path === "string") return node.path;
|
|
68
|
+
return void 0;
|
|
69
|
+
}
|
|
70
|
+
function nodeChildren(node) {
|
|
71
|
+
return Array.isArray(node.children) ? node.children : [];
|
|
72
|
+
}
|
|
73
|
+
function nodeKey(node, parentKey) {
|
|
74
|
+
const prefix = parentKey ? `${parentKey}/` : "";
|
|
75
|
+
if (node.type === "page") return `${prefix}page:${node.fileID}`;
|
|
76
|
+
if (node.type === "link") return `${prefix}link:${node.id}`;
|
|
77
|
+
return `${prefix}${node.type}:${node.id}`;
|
|
78
|
+
}
|
|
79
|
+
function isActivePath(path, currentPath) {
|
|
80
|
+
if (!path || isExternalHref(path)) return false;
|
|
81
|
+
const normalizedPath = normalizePath(path);
|
|
82
|
+
const normalizedCurrentPath = normalizePath(currentPath);
|
|
83
|
+
if (!normalizedPath) return false;
|
|
84
|
+
return normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`);
|
|
85
|
+
}
|
|
86
|
+
function isExactActivePath(path, currentPath) {
|
|
87
|
+
if (!path || isExternalHref(path)) return false;
|
|
88
|
+
return normalizePath(path) === normalizePath(currentPath);
|
|
89
|
+
}
|
|
90
|
+
function createActiveIndex({
|
|
91
|
+
currentPath,
|
|
92
|
+
tree
|
|
93
|
+
}) {
|
|
94
|
+
const activeIndex = /* @__PURE__ */ new Map();
|
|
95
|
+
function visit(node) {
|
|
96
|
+
const href = nodeHref(node);
|
|
97
|
+
const exactActive = isExactActivePath(href, currentPath);
|
|
98
|
+
const pathActive = node.type === "page" && isActivePath(href, currentPath);
|
|
99
|
+
const childActive = nodeChildren(node).some(visit);
|
|
100
|
+
const activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
|
|
101
|
+
activeIndex.set(node, {
|
|
102
|
+
activeState,
|
|
103
|
+
initiallyExpanded: exactActive || pathActive || childActive
|
|
104
|
+
});
|
|
105
|
+
return exactActive || pathActive || childActive;
|
|
106
|
+
}
|
|
107
|
+
for (const node of tree) {
|
|
108
|
+
visit(node);
|
|
109
|
+
}
|
|
110
|
+
return activeIndex;
|
|
111
|
+
}
|
|
112
|
+
function safeIdPart(value) {
|
|
113
|
+
return value.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
114
|
+
}
|
|
115
|
+
function nodeContentId({
|
|
116
|
+
instanceId,
|
|
117
|
+
node
|
|
118
|
+
}) {
|
|
119
|
+
const key = "path" in node && node.path ? node.path : node.type === "page" ? node.fileID : node.id;
|
|
120
|
+
return `sidebar-${safeIdPart(instanceId)}-${safeIdPart(key)}`;
|
|
121
|
+
}
|
|
122
|
+
function clampDepth(depth) {
|
|
123
|
+
return Math.min(depth, 12);
|
|
124
|
+
}
|
|
125
|
+
function ExpandableChildren({
|
|
126
|
+
activeIndex,
|
|
127
|
+
activeItemRef,
|
|
128
|
+
contentId,
|
|
129
|
+
currentPath,
|
|
130
|
+
depth,
|
|
131
|
+
expanded,
|
|
132
|
+
instanceId,
|
|
133
|
+
nodes,
|
|
134
|
+
parentExpanded,
|
|
135
|
+
renderChildren
|
|
136
|
+
}) {
|
|
137
|
+
const childFocusable = parentExpanded && expanded;
|
|
138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
"aria-hidden": !expanded,
|
|
142
|
+
className: cn(
|
|
143
|
+
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",
|
|
144
|
+
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
145
|
+
),
|
|
146
|
+
"data-state": expanded ? "open" : "closed",
|
|
147
|
+
id: contentId,
|
|
148
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px py-0.5", children: renderChildren ? nodes.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
149
|
+
SidebarTreeItem,
|
|
150
|
+
{
|
|
151
|
+
activeIndex,
|
|
152
|
+
activeItemRef,
|
|
153
|
+
currentPath,
|
|
154
|
+
depth: clampDepth(depth + 1),
|
|
155
|
+
instanceId,
|
|
156
|
+
itemKey: nodeKey(child, contentId),
|
|
157
|
+
node: child,
|
|
158
|
+
parentExpanded: childFocusable
|
|
159
|
+
},
|
|
160
|
+
nodeKey(child, contentId)
|
|
161
|
+
)) : null }) })
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
var SidebarTreeItem = (0, import_react.memo)(function SidebarTreeItem2({
|
|
166
|
+
activeIndex,
|
|
167
|
+
activeItemRef,
|
|
168
|
+
currentPath,
|
|
169
|
+
depth,
|
|
170
|
+
instanceId,
|
|
171
|
+
itemKey,
|
|
172
|
+
node,
|
|
173
|
+
parentExpanded
|
|
174
|
+
}) {
|
|
175
|
+
const nodes = nodeChildren(node);
|
|
176
|
+
const href = nodeHref(node);
|
|
177
|
+
const activeInfo = activeIndex.get(node);
|
|
178
|
+
const activeState = activeInfo?.activeState;
|
|
179
|
+
const initiallyExpanded = Boolean(activeInfo?.initiallyExpanded);
|
|
180
|
+
const isExpandable = nodes.length > 0 && (node.type === "folder" || node.type === "page");
|
|
181
|
+
const [expanded, setExpanded] = (0, import_react.useState)(initiallyExpanded);
|
|
182
|
+
const [renderChildren, setRenderChildren] = (0, import_react.useState)(initiallyExpanded);
|
|
183
|
+
const interactedRef = (0, import_react.useRef)(false);
|
|
184
|
+
const lastPathRef = (0, import_react.useRef)(normalizePath(currentPath));
|
|
185
|
+
const contentId = nodeContentId({ instanceId, node });
|
|
186
|
+
(0, import_react.useEffect)(() => {
|
|
187
|
+
const normalizedCurrentPath = normalizePath(currentPath);
|
|
188
|
+
const pathChanged = lastPathRef.current !== normalizedCurrentPath;
|
|
189
|
+
if (pathChanged) {
|
|
190
|
+
interactedRef.current = false;
|
|
191
|
+
lastPathRef.current = normalizedCurrentPath;
|
|
192
|
+
}
|
|
193
|
+
if (initiallyExpanded && !expanded && !interactedRef.current) {
|
|
194
|
+
setRenderChildren(true);
|
|
195
|
+
(0, import_react.startTransition)(() => setExpanded(true));
|
|
196
|
+
}
|
|
197
|
+
}, [currentPath, expanded, initiallyExpanded]);
|
|
198
|
+
const toggleExpanded = (0, import_react.useCallback)(() => {
|
|
199
|
+
interactedRef.current = true;
|
|
200
|
+
setRenderChildren(true);
|
|
201
|
+
setExpanded((value) => !value);
|
|
202
|
+
}, []);
|
|
203
|
+
const expandOnNavigate = (0, import_react.useCallback)(() => {
|
|
204
|
+
interactedRef.current = true;
|
|
205
|
+
setRenderChildren(true);
|
|
206
|
+
setExpanded(true);
|
|
207
|
+
}, []);
|
|
208
|
+
const pageWithChildrenLinkClick = node.type === "page" && nodes.length > 0 ? expandOnNavigate : void 0;
|
|
209
|
+
const children = isExpandable && nodes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
210
|
+
ExpandableChildren,
|
|
211
|
+
{
|
|
212
|
+
activeIndex,
|
|
213
|
+
activeItemRef,
|
|
214
|
+
contentId,
|
|
215
|
+
currentPath,
|
|
216
|
+
depth,
|
|
217
|
+
expanded,
|
|
218
|
+
instanceId,
|
|
219
|
+
nodes,
|
|
220
|
+
parentExpanded,
|
|
221
|
+
renderChildren
|
|
222
|
+
}
|
|
223
|
+
) : node.type === "section" && nodes.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px", children: nodes.map((child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
+
SidebarTreeItem2,
|
|
225
|
+
{
|
|
226
|
+
activeIndex,
|
|
227
|
+
activeItemRef,
|
|
228
|
+
currentPath,
|
|
229
|
+
depth,
|
|
230
|
+
instanceId,
|
|
231
|
+
itemKey: nodeKey(child, itemKey),
|
|
232
|
+
node: child,
|
|
233
|
+
parentExpanded
|
|
234
|
+
},
|
|
235
|
+
nodeKey(child, itemKey)
|
|
236
|
+
)) }) : null;
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
+
import_sidebar_node.SidebarNode,
|
|
239
|
+
{
|
|
240
|
+
activeState,
|
|
241
|
+
activeItemRef: activeState === "path-active" ? activeItemRef : void 0,
|
|
242
|
+
contentId: isExpandable ? contentId : void 0,
|
|
243
|
+
depth,
|
|
244
|
+
expanded: isExpandable ? expanded : void 0,
|
|
245
|
+
href,
|
|
246
|
+
isExpandable,
|
|
247
|
+
node,
|
|
248
|
+
onLinkClick: pageWithChildrenLinkClick,
|
|
249
|
+
onToggle: isExpandable ? toggleExpanded : void 0,
|
|
250
|
+
parentExpanded,
|
|
251
|
+
title: node.title,
|
|
252
|
+
children
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
});
|
|
256
|
+
function Sidebar({ className, currentPath, title, tree }) {
|
|
257
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
258
|
+
const resolvedCurrentPath = pathname ?? currentPath ?? "";
|
|
259
|
+
const instanceId = (0, import_react.useId)();
|
|
260
|
+
const activeItemRef = (0, import_react.useRef)(null);
|
|
261
|
+
const activeIndex = (0, import_react.useMemo)(
|
|
262
|
+
() => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
|
|
263
|
+
[resolvedCurrentPath, tree]
|
|
264
|
+
);
|
|
265
|
+
(0, import_react.useEffect)(() => {
|
|
266
|
+
const scrollPath = resolvedCurrentPath;
|
|
267
|
+
const frame = window.requestAnimationFrame(() => {
|
|
268
|
+
if (!scrollPath) return;
|
|
269
|
+
activeItemRef.current?.scrollIntoView({
|
|
270
|
+
block: "nearest",
|
|
271
|
+
inline: "nearest"
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
return () => window.cancelAnimationFrame(frame);
|
|
275
|
+
}, [resolvedCurrentPath]);
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
277
|
+
"nav",
|
|
278
|
+
{
|
|
279
|
+
"aria-label": "Documentation navigation",
|
|
280
|
+
className: cn(
|
|
281
|
+
"flex h-full min-h-0 w-(--layout-sidebar-width) min-w-(--layout-sidebar-width) max-w-(--layout-sidebar-width) flex-col overflow-hidden pb-4",
|
|
282
|
+
className
|
|
283
|
+
),
|
|
284
|
+
children: [
|
|
285
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "shrink-0 px-5 pb-2 pt-5 text-xs font-semibold uppercase tracking-wide text-foreground-3", children: title }) : null,
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
287
|
+
import_scroll_area.ScrollArea,
|
|
288
|
+
{
|
|
289
|
+
className: "min-h-0 flex-1",
|
|
290
|
+
corner: true,
|
|
291
|
+
mask: { height: 24 },
|
|
292
|
+
scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
|
|
293
|
+
variant: "gradient",
|
|
294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
295
|
+
SidebarTreeItem,
|
|
296
|
+
{
|
|
297
|
+
activeIndex,
|
|
298
|
+
activeItemRef,
|
|
299
|
+
currentPath: resolvedCurrentPath,
|
|
300
|
+
depth: 0,
|
|
301
|
+
instanceId,
|
|
302
|
+
itemKey: nodeKey(node, ""),
|
|
303
|
+
node,
|
|
304
|
+
parentExpanded: true
|
|
305
|
+
},
|
|
306
|
+
nodeKey(node, "")
|
|
307
|
+
)) })
|
|
308
|
+
}
|
|
309
|
+
)
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
315
|
+
0 && (module.exports = {
|
|
316
|
+
Sidebar
|
|
317
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TreeNode } from '@publish.os/nextjs/types';
|
|
3
|
+
import { Ref, ReactNode, MouseEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
type SidebarTreeNode = TreeNode & {
|
|
6
|
+
children?: SidebarTreeNode[];
|
|
7
|
+
};
|
|
8
|
+
type SidebarActiveState = "path-active" | "child-path-active";
|
|
9
|
+
type SidebarDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
10
|
+
type SidebarNodePrimitiveProps = {
|
|
11
|
+
activeState?: SidebarActiveState;
|
|
12
|
+
activeItemRef?: Ref<HTMLDivElement>;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
contentId?: string;
|
|
15
|
+
depth: SidebarDepth;
|
|
16
|
+
expanded?: boolean;
|
|
17
|
+
href?: string;
|
|
18
|
+
isExpandable?: boolean;
|
|
19
|
+
node: SidebarTreeNode;
|
|
20
|
+
onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
21
|
+
onToggle?: () => void;
|
|
22
|
+
parentExpanded: boolean;
|
|
23
|
+
title: string;
|
|
24
|
+
};
|
|
25
|
+
type SidebarProps = {
|
|
26
|
+
className?: string;
|
|
27
|
+
currentPath?: string;
|
|
28
|
+
title?: ReactNode;
|
|
29
|
+
tree: SidebarTreeNode[];
|
|
30
|
+
};
|
|
31
|
+
declare function Sidebar({ className, currentPath, title, tree }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Sidebar, type SidebarActiveState, type SidebarDepth, type SidebarNodePrimitiveProps, type SidebarProps, type SidebarTreeNode };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TreeNode } from '@publish.os/nextjs/types';
|
|
3
|
+
import { Ref, ReactNode, MouseEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
type SidebarTreeNode = TreeNode & {
|
|
6
|
+
children?: SidebarTreeNode[];
|
|
7
|
+
};
|
|
8
|
+
type SidebarActiveState = "path-active" | "child-path-active";
|
|
9
|
+
type SidebarDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
10
|
+
type SidebarNodePrimitiveProps = {
|
|
11
|
+
activeState?: SidebarActiveState;
|
|
12
|
+
activeItemRef?: Ref<HTMLDivElement>;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
contentId?: string;
|
|
15
|
+
depth: SidebarDepth;
|
|
16
|
+
expanded?: boolean;
|
|
17
|
+
href?: string;
|
|
18
|
+
isExpandable?: boolean;
|
|
19
|
+
node: SidebarTreeNode;
|
|
20
|
+
onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
21
|
+
onToggle?: () => void;
|
|
22
|
+
parentExpanded: boolean;
|
|
23
|
+
title: string;
|
|
24
|
+
};
|
|
25
|
+
type SidebarProps = {
|
|
26
|
+
className?: string;
|
|
27
|
+
currentPath?: string;
|
|
28
|
+
title?: ReactNode;
|
|
29
|
+
tree: SidebarTreeNode[];
|
|
30
|
+
};
|
|
31
|
+
declare function Sidebar({ className, currentPath, title, tree }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
export { Sidebar, type SidebarActiveState, type SidebarDepth, type SidebarNodePrimitiveProps, type SidebarProps, type SidebarTreeNode };
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/kernel/components/blocks/sidebar.tsx
|
|
4
|
+
import { SidebarNode } from "./sidebar-node.js";
|
|
5
|
+
import { ScrollArea } from "../ui/scroll-area.js";
|
|
6
|
+
|
|
7
|
+
// src/utils/cn.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
10
|
+
var twMerge = extendTailwindMerge({
|
|
11
|
+
extend: {
|
|
12
|
+
classGroups: {
|
|
13
|
+
z: [
|
|
14
|
+
"z-content",
|
|
15
|
+
"z-nav",
|
|
16
|
+
"z-overlay",
|
|
17
|
+
"z-modal",
|
|
18
|
+
"z-search",
|
|
19
|
+
"z-toast",
|
|
20
|
+
"z-progress"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function cn(...inputs) {
|
|
26
|
+
return twMerge(clsx(inputs));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/kernel/components/blocks/sidebar.tsx
|
|
30
|
+
import { usePathname } from "next/navigation";
|
|
31
|
+
import {
|
|
32
|
+
memo,
|
|
33
|
+
startTransition,
|
|
34
|
+
useCallback,
|
|
35
|
+
useEffect,
|
|
36
|
+
useId,
|
|
37
|
+
useMemo,
|
|
38
|
+
useRef,
|
|
39
|
+
useState
|
|
40
|
+
} from "react";
|
|
41
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
42
|
+
function normalizePath(path) {
|
|
43
|
+
if (!path) return "";
|
|
44
|
+
const [withoutQuery = ""] = path.split(/[?#]/);
|
|
45
|
+
if (withoutQuery === "/") return "/";
|
|
46
|
+
return withoutQuery.replace(/\/+$/g, "");
|
|
47
|
+
}
|
|
48
|
+
function isExternalHref(href) {
|
|
49
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
50
|
+
}
|
|
51
|
+
function nodeHref(node) {
|
|
52
|
+
if (node.type === "link") return node.href;
|
|
53
|
+
if ("path" in node && typeof node.path === "string") return node.path;
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
function nodeChildren(node) {
|
|
57
|
+
return Array.isArray(node.children) ? node.children : [];
|
|
58
|
+
}
|
|
59
|
+
function nodeKey(node, parentKey) {
|
|
60
|
+
const prefix = parentKey ? `${parentKey}/` : "";
|
|
61
|
+
if (node.type === "page") return `${prefix}page:${node.fileID}`;
|
|
62
|
+
if (node.type === "link") return `${prefix}link:${node.id}`;
|
|
63
|
+
return `${prefix}${node.type}:${node.id}`;
|
|
64
|
+
}
|
|
65
|
+
function isActivePath(path, currentPath) {
|
|
66
|
+
if (!path || isExternalHref(path)) return false;
|
|
67
|
+
const normalizedPath = normalizePath(path);
|
|
68
|
+
const normalizedCurrentPath = normalizePath(currentPath);
|
|
69
|
+
if (!normalizedPath) return false;
|
|
70
|
+
return normalizedCurrentPath === normalizedPath || normalizedCurrentPath.startsWith(`${normalizedPath}/`);
|
|
71
|
+
}
|
|
72
|
+
function isExactActivePath(path, currentPath) {
|
|
73
|
+
if (!path || isExternalHref(path)) return false;
|
|
74
|
+
return normalizePath(path) === normalizePath(currentPath);
|
|
75
|
+
}
|
|
76
|
+
function createActiveIndex({
|
|
77
|
+
currentPath,
|
|
78
|
+
tree
|
|
79
|
+
}) {
|
|
80
|
+
const activeIndex = /* @__PURE__ */ new Map();
|
|
81
|
+
function visit(node) {
|
|
82
|
+
const href = nodeHref(node);
|
|
83
|
+
const exactActive = isExactActivePath(href, currentPath);
|
|
84
|
+
const pathActive = node.type === "page" && isActivePath(href, currentPath);
|
|
85
|
+
const childActive = nodeChildren(node).some(visit);
|
|
86
|
+
const activeState = exactActive ? "path-active" : childActive || pathActive ? "child-path-active" : void 0;
|
|
87
|
+
activeIndex.set(node, {
|
|
88
|
+
activeState,
|
|
89
|
+
initiallyExpanded: exactActive || pathActive || childActive
|
|
90
|
+
});
|
|
91
|
+
return exactActive || pathActive || childActive;
|
|
92
|
+
}
|
|
93
|
+
for (const node of tree) {
|
|
94
|
+
visit(node);
|
|
95
|
+
}
|
|
96
|
+
return activeIndex;
|
|
97
|
+
}
|
|
98
|
+
function safeIdPart(value) {
|
|
99
|
+
return value.replace(/[^a-zA-Z0-9-]/g, "-");
|
|
100
|
+
}
|
|
101
|
+
function nodeContentId({
|
|
102
|
+
instanceId,
|
|
103
|
+
node
|
|
104
|
+
}) {
|
|
105
|
+
const key = "path" in node && node.path ? node.path : node.type === "page" ? node.fileID : node.id;
|
|
106
|
+
return `sidebar-${safeIdPart(instanceId)}-${safeIdPart(key)}`;
|
|
107
|
+
}
|
|
108
|
+
function clampDepth(depth) {
|
|
109
|
+
return Math.min(depth, 12);
|
|
110
|
+
}
|
|
111
|
+
function ExpandableChildren({
|
|
112
|
+
activeIndex,
|
|
113
|
+
activeItemRef,
|
|
114
|
+
contentId,
|
|
115
|
+
currentPath,
|
|
116
|
+
depth,
|
|
117
|
+
expanded,
|
|
118
|
+
instanceId,
|
|
119
|
+
nodes,
|
|
120
|
+
parentExpanded,
|
|
121
|
+
renderChildren
|
|
122
|
+
}) {
|
|
123
|
+
const childFocusable = parentExpanded && expanded;
|
|
124
|
+
return /* @__PURE__ */ jsx(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
"aria-hidden": !expanded,
|
|
128
|
+
className: cn(
|
|
129
|
+
"grid overflow-hidden transition-[grid-template-rows] duration-300 ease-[cubic-bezier(0.4,0,0.2,1)]",
|
|
130
|
+
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
|
|
131
|
+
),
|
|
132
|
+
"data-state": expanded ? "open" : "closed",
|
|
133
|
+
id: contentId,
|
|
134
|
+
children: /* @__PURE__ */ jsx("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px py-0.5", children: renderChildren ? nodes.map((child) => /* @__PURE__ */ jsx(
|
|
135
|
+
SidebarTreeItem,
|
|
136
|
+
{
|
|
137
|
+
activeIndex,
|
|
138
|
+
activeItemRef,
|
|
139
|
+
currentPath,
|
|
140
|
+
depth: clampDepth(depth + 1),
|
|
141
|
+
instanceId,
|
|
142
|
+
itemKey: nodeKey(child, contentId),
|
|
143
|
+
node: child,
|
|
144
|
+
parentExpanded: childFocusable
|
|
145
|
+
},
|
|
146
|
+
nodeKey(child, contentId)
|
|
147
|
+
)) : null }) })
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
var SidebarTreeItem = memo(function SidebarTreeItem2({
|
|
152
|
+
activeIndex,
|
|
153
|
+
activeItemRef,
|
|
154
|
+
currentPath,
|
|
155
|
+
depth,
|
|
156
|
+
instanceId,
|
|
157
|
+
itemKey,
|
|
158
|
+
node,
|
|
159
|
+
parentExpanded
|
|
160
|
+
}) {
|
|
161
|
+
const nodes = nodeChildren(node);
|
|
162
|
+
const href = nodeHref(node);
|
|
163
|
+
const activeInfo = activeIndex.get(node);
|
|
164
|
+
const activeState = activeInfo?.activeState;
|
|
165
|
+
const initiallyExpanded = Boolean(activeInfo?.initiallyExpanded);
|
|
166
|
+
const isExpandable = nodes.length > 0 && (node.type === "folder" || node.type === "page");
|
|
167
|
+
const [expanded, setExpanded] = useState(initiallyExpanded);
|
|
168
|
+
const [renderChildren, setRenderChildren] = useState(initiallyExpanded);
|
|
169
|
+
const interactedRef = useRef(false);
|
|
170
|
+
const lastPathRef = useRef(normalizePath(currentPath));
|
|
171
|
+
const contentId = nodeContentId({ instanceId, node });
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
const normalizedCurrentPath = normalizePath(currentPath);
|
|
174
|
+
const pathChanged = lastPathRef.current !== normalizedCurrentPath;
|
|
175
|
+
if (pathChanged) {
|
|
176
|
+
interactedRef.current = false;
|
|
177
|
+
lastPathRef.current = normalizedCurrentPath;
|
|
178
|
+
}
|
|
179
|
+
if (initiallyExpanded && !expanded && !interactedRef.current) {
|
|
180
|
+
setRenderChildren(true);
|
|
181
|
+
startTransition(() => setExpanded(true));
|
|
182
|
+
}
|
|
183
|
+
}, [currentPath, expanded, initiallyExpanded]);
|
|
184
|
+
const toggleExpanded = useCallback(() => {
|
|
185
|
+
interactedRef.current = true;
|
|
186
|
+
setRenderChildren(true);
|
|
187
|
+
setExpanded((value) => !value);
|
|
188
|
+
}, []);
|
|
189
|
+
const expandOnNavigate = useCallback(() => {
|
|
190
|
+
interactedRef.current = true;
|
|
191
|
+
setRenderChildren(true);
|
|
192
|
+
setExpanded(true);
|
|
193
|
+
}, []);
|
|
194
|
+
const pageWithChildrenLinkClick = node.type === "page" && nodes.length > 0 ? expandOnNavigate : void 0;
|
|
195
|
+
const children = isExpandable && nodes.length > 0 ? /* @__PURE__ */ jsx(
|
|
196
|
+
ExpandableChildren,
|
|
197
|
+
{
|
|
198
|
+
activeIndex,
|
|
199
|
+
activeItemRef,
|
|
200
|
+
contentId,
|
|
201
|
+
currentPath,
|
|
202
|
+
depth,
|
|
203
|
+
expanded,
|
|
204
|
+
instanceId,
|
|
205
|
+
nodes,
|
|
206
|
+
parentExpanded,
|
|
207
|
+
renderChildren
|
|
208
|
+
}
|
|
209
|
+
) : node.type === "section" && nodes.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px", children: nodes.map((child) => /* @__PURE__ */ jsx(
|
|
210
|
+
SidebarTreeItem2,
|
|
211
|
+
{
|
|
212
|
+
activeIndex,
|
|
213
|
+
activeItemRef,
|
|
214
|
+
currentPath,
|
|
215
|
+
depth,
|
|
216
|
+
instanceId,
|
|
217
|
+
itemKey: nodeKey(child, itemKey),
|
|
218
|
+
node: child,
|
|
219
|
+
parentExpanded
|
|
220
|
+
},
|
|
221
|
+
nodeKey(child, itemKey)
|
|
222
|
+
)) }) : null;
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
SidebarNode,
|
|
225
|
+
{
|
|
226
|
+
activeState,
|
|
227
|
+
activeItemRef: activeState === "path-active" ? activeItemRef : void 0,
|
|
228
|
+
contentId: isExpandable ? contentId : void 0,
|
|
229
|
+
depth,
|
|
230
|
+
expanded: isExpandable ? expanded : void 0,
|
|
231
|
+
href,
|
|
232
|
+
isExpandable,
|
|
233
|
+
node,
|
|
234
|
+
onLinkClick: pageWithChildrenLinkClick,
|
|
235
|
+
onToggle: isExpandable ? toggleExpanded : void 0,
|
|
236
|
+
parentExpanded,
|
|
237
|
+
title: node.title,
|
|
238
|
+
children
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
function Sidebar({ className, currentPath, title, tree }) {
|
|
243
|
+
const pathname = usePathname();
|
|
244
|
+
const resolvedCurrentPath = pathname ?? currentPath ?? "";
|
|
245
|
+
const instanceId = useId();
|
|
246
|
+
const activeItemRef = useRef(null);
|
|
247
|
+
const activeIndex = useMemo(
|
|
248
|
+
() => createActiveIndex({ currentPath: resolvedCurrentPath, tree }),
|
|
249
|
+
[resolvedCurrentPath, tree]
|
|
250
|
+
);
|
|
251
|
+
useEffect(() => {
|
|
252
|
+
const scrollPath = resolvedCurrentPath;
|
|
253
|
+
const frame = window.requestAnimationFrame(() => {
|
|
254
|
+
if (!scrollPath) return;
|
|
255
|
+
activeItemRef.current?.scrollIntoView({
|
|
256
|
+
block: "nearest",
|
|
257
|
+
inline: "nearest"
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
return () => window.cancelAnimationFrame(frame);
|
|
261
|
+
}, [resolvedCurrentPath]);
|
|
262
|
+
return /* @__PURE__ */ jsxs(
|
|
263
|
+
"nav",
|
|
264
|
+
{
|
|
265
|
+
"aria-label": "Documentation navigation",
|
|
266
|
+
className: cn(
|
|
267
|
+
"flex h-full min-h-0 w-(--layout-sidebar-width) min-w-(--layout-sidebar-width) max-w-(--layout-sidebar-width) flex-col overflow-hidden pb-4",
|
|
268
|
+
className
|
|
269
|
+
),
|
|
270
|
+
children: [
|
|
271
|
+
title ? /* @__PURE__ */ jsx("div", { className: "shrink-0 px-5 pb-2 pt-5 text-xs font-semibold uppercase tracking-wide text-foreground-3", children: title }) : null,
|
|
272
|
+
/* @__PURE__ */ jsx(
|
|
273
|
+
ScrollArea,
|
|
274
|
+
{
|
|
275
|
+
className: "min-h-0 flex-1",
|
|
276
|
+
corner: true,
|
|
277
|
+
mask: { height: 24 },
|
|
278
|
+
scrollbarClassName: "opacity-0 transition-opacity data-[hovering]:opacity-100 data-[scrolling]:opacity-100",
|
|
279
|
+
variant: "gradient",
|
|
280
|
+
children: /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-px px-2 py-3", children: tree.map((node) => /* @__PURE__ */ jsx(
|
|
281
|
+
SidebarTreeItem,
|
|
282
|
+
{
|
|
283
|
+
activeIndex,
|
|
284
|
+
activeItemRef,
|
|
285
|
+
currentPath: resolvedCurrentPath,
|
|
286
|
+
depth: 0,
|
|
287
|
+
instanceId,
|
|
288
|
+
itemKey: nodeKey(node, ""),
|
|
289
|
+
node,
|
|
290
|
+
parentExpanded: true
|
|
291
|
+
},
|
|
292
|
+
nodeKey(node, "")
|
|
293
|
+
)) })
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
export {
|
|
301
|
+
Sidebar
|
|
302
|
+
};
|