@publish.os/nextjs 0.0.1-alpha.2 → 0.0.1-alpha.4
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 -9
- 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 +1043 -124
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +1031 -111
- 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 +202 -0
- package/dist/kernel/routes/agent/markdown.d.cts +58 -0
- package/dist/kernel/routes/agent/markdown.d.ts +58 -0
- package/dist/kernel/routes/agent/markdown.js +174 -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 +293 -0
- package/dist/kernel/routes/metadata/feed.d.cts +20 -0
- package/dist/kernel/routes/metadata/feed.d.ts +20 -0
- package/dist/kernel/routes/metadata/feed.js +265 -0
- package/dist/kernel/routes/metadata/llms.cjs +239 -0
- package/dist/kernel/routes/metadata/llms.d.cts +26 -0
- package/dist/kernel/routes/metadata/llms.d.ts +26 -0
- package/dist/kernel/routes/metadata/llms.js +211 -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 +59 -5
- 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 +123 -0
- package/dist/kernel/routes/metadata/sitemap.cjs +192 -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 +166 -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 +59 -38
- package/release/package.json +23 -0
- package/release/pnpm-lock.yaml +1192 -0
- package/release/release.json +39 -0
- 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,203 @@
|
|
|
1
|
+
// src/kernel/routes/pages/root.tsx
|
|
2
|
+
import { cacheLife, cacheTag } from "next/cache";
|
|
3
|
+
|
|
4
|
+
// src/cache/tags.ts
|
|
5
|
+
import { createHash } from "crypto";
|
|
6
|
+
var MAX_TAG_LEN = 256;
|
|
7
|
+
var MAX_SEGMENT_LEN = 80;
|
|
8
|
+
var TAG_PATTERN = /^[a-z0-9:_./-]+$/;
|
|
9
|
+
function sha256(value) {
|
|
10
|
+
return createHash("sha256").update(value).digest("hex").slice(0, 16);
|
|
11
|
+
}
|
|
12
|
+
function safeSegment(value) {
|
|
13
|
+
const raw = value.trim().toLowerCase() || "root";
|
|
14
|
+
const normalized = raw.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/^\//, "").replace(/\/$/, "").replace(/[^a-z0-9:_./-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
15
|
+
const segment = normalized || "root";
|
|
16
|
+
if (segment.length <= MAX_SEGMENT_LEN) return segment;
|
|
17
|
+
return `${segment.slice(0, 48)}.${sha256(segment)}`;
|
|
18
|
+
}
|
|
19
|
+
function assertTag(tag) {
|
|
20
|
+
if (tag.length > MAX_TAG_LEN || !TAG_PATTERN.test(tag)) {
|
|
21
|
+
return `tag:${sha256(tag)}`;
|
|
22
|
+
}
|
|
23
|
+
return tag;
|
|
24
|
+
}
|
|
25
|
+
var tags = {
|
|
26
|
+
site() {
|
|
27
|
+
return "site";
|
|
28
|
+
},
|
|
29
|
+
pages() {
|
|
30
|
+
return "pages";
|
|
31
|
+
},
|
|
32
|
+
group(group) {
|
|
33
|
+
return assertTag(`group:${safeSegment(group)}`);
|
|
34
|
+
},
|
|
35
|
+
page(group, slug) {
|
|
36
|
+
const path = Array.isArray(slug) ? slug.join("/") : slug;
|
|
37
|
+
return assertTag(`page:${safeSegment(group)}:${safeSegment(path)}`);
|
|
38
|
+
},
|
|
39
|
+
manifest(contentHash) {
|
|
40
|
+
return assertTag(`manifest:${safeSegment(contentHash)}`);
|
|
41
|
+
},
|
|
42
|
+
sitemap() {
|
|
43
|
+
return "sitemap";
|
|
44
|
+
},
|
|
45
|
+
robots() {
|
|
46
|
+
return "robots";
|
|
47
|
+
},
|
|
48
|
+
llms(scope = "root") {
|
|
49
|
+
return assertTag(`llms:${safeSegment(scope)}`);
|
|
50
|
+
},
|
|
51
|
+
feed(format, scope = "site") {
|
|
52
|
+
return assertTag(`feed:${safeSegment(format)}:${safeSegment(scope)}`);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// src/internal/utils/logger.ts
|
|
57
|
+
var isDev = process.env.NODE_ENV !== "production";
|
|
58
|
+
var isDebugEnabled = process.env.NEXT_PRIVATE_DEBUG_CACHE === "1";
|
|
59
|
+
var log = {
|
|
60
|
+
debug(...args) {
|
|
61
|
+
if (isDev && isDebugEnabled) console.debug("[publish.os:debug]", ...args);
|
|
62
|
+
},
|
|
63
|
+
info(...args) {
|
|
64
|
+
console.log("[publish.os]", ...args);
|
|
65
|
+
},
|
|
66
|
+
warn(...args) {
|
|
67
|
+
console.warn("[publish.os:warn]", ...args);
|
|
68
|
+
},
|
|
69
|
+
error(...args) {
|
|
70
|
+
console.error("[publish.os:error]", ...args);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/kernel/routes/pages/agent-metadata.ts
|
|
75
|
+
function normalizePath(path) {
|
|
76
|
+
const prefixed = path.startsWith("/") ? path : `/${path}`;
|
|
77
|
+
if (prefixed === "/") return prefixed;
|
|
78
|
+
return prefixed.replace(/\/+$/, "");
|
|
79
|
+
}
|
|
80
|
+
function agentReadableAlternates({
|
|
81
|
+
canonicalPath,
|
|
82
|
+
manifest,
|
|
83
|
+
markdownPath
|
|
84
|
+
}) {
|
|
85
|
+
return {
|
|
86
|
+
...manifest.site.url ? { canonical: normalizePath(canonicalPath) } : {},
|
|
87
|
+
types: {
|
|
88
|
+
...markdownPath ? { "text/markdown": normalizePath(markdownPath) } : {},
|
|
89
|
+
"text/plain": "/llms.txt"
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/kernel/routes/pages/social-metadata.ts
|
|
95
|
+
function isDevelopment() {
|
|
96
|
+
return process.env.NODE_ENV === "development";
|
|
97
|
+
}
|
|
98
|
+
function absoluteUrl(path, siteUrl) {
|
|
99
|
+
if (/^https:\/\//.test(path)) return path;
|
|
100
|
+
if (isDevelopment()) return path;
|
|
101
|
+
if (!siteUrl) return path;
|
|
102
|
+
return new URL(path, siteUrl).toString();
|
|
103
|
+
}
|
|
104
|
+
function createSocialMetadata({
|
|
105
|
+
canonicalPath,
|
|
106
|
+
description,
|
|
107
|
+
manifest,
|
|
108
|
+
ogManifest,
|
|
109
|
+
title,
|
|
110
|
+
type = "website"
|
|
111
|
+
}) {
|
|
112
|
+
const key = ogManifest?.routes?.[canonicalPath];
|
|
113
|
+
const rootKey = ogManifest?.routes?.["/"];
|
|
114
|
+
const entry = (key ? ogManifest?.entries?.[key] : void 0) ?? (rootKey ? ogManifest?.entries?.[rootKey] : void 0);
|
|
115
|
+
if (!entry) {
|
|
116
|
+
return {
|
|
117
|
+
openGraph: {
|
|
118
|
+
description,
|
|
119
|
+
title,
|
|
120
|
+
type,
|
|
121
|
+
url: canonicalPath
|
|
122
|
+
},
|
|
123
|
+
twitter: {
|
|
124
|
+
card: "summary",
|
|
125
|
+
description,
|
|
126
|
+
title
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const imageUrl = absoluteUrl(entry.url, manifest.site.url);
|
|
131
|
+
return {
|
|
132
|
+
openGraph: {
|
|
133
|
+
description,
|
|
134
|
+
images: [
|
|
135
|
+
{
|
|
136
|
+
alt: entry.alt,
|
|
137
|
+
height: entry.height,
|
|
138
|
+
url: imageUrl,
|
|
139
|
+
width: entry.width
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
siteName: manifest.site.name,
|
|
143
|
+
title,
|
|
144
|
+
type,
|
|
145
|
+
url: canonicalPath
|
|
146
|
+
},
|
|
147
|
+
twitter: {
|
|
148
|
+
card: "summary_large_image",
|
|
149
|
+
description,
|
|
150
|
+
images: [imageUrl],
|
|
151
|
+
title
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/kernel/routes/pages/root.tsx
|
|
157
|
+
import { jsx } from "react/jsx-runtime";
|
|
158
|
+
var rootManifest;
|
|
159
|
+
var rootPage;
|
|
160
|
+
async function CachedRootPage() {
|
|
161
|
+
"use cache";
|
|
162
|
+
cacheLife("page");
|
|
163
|
+
cacheTag(tags.site());
|
|
164
|
+
if (!rootManifest || !rootPage) return null;
|
|
165
|
+
cacheTag(tags.manifest(rootManifest.contentHash));
|
|
166
|
+
log.debug("[cache]", "root");
|
|
167
|
+
const RootPage = rootPage;
|
|
168
|
+
return /* @__PURE__ */ jsx(RootPage, { site: rootManifest.site, tree: rootManifest.tree });
|
|
169
|
+
}
|
|
170
|
+
function createRootPage({ manifest, RootPage }) {
|
|
171
|
+
rootManifest = manifest;
|
|
172
|
+
rootPage = RootPage;
|
|
173
|
+
return async function Page() {
|
|
174
|
+
log.debug("[render]", "root");
|
|
175
|
+
return /* @__PURE__ */ jsx(CachedRootPage, {});
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function createRootMetadata({
|
|
179
|
+
manifest,
|
|
180
|
+
ogManifest
|
|
181
|
+
}) {
|
|
182
|
+
const description = manifest.site.description;
|
|
183
|
+
return {
|
|
184
|
+
title: manifest.site.name,
|
|
185
|
+
description,
|
|
186
|
+
alternates: agentReadableAlternates({
|
|
187
|
+
canonicalPath: "/",
|
|
188
|
+
manifest,
|
|
189
|
+
markdownPath: "/sitemap.md"
|
|
190
|
+
}),
|
|
191
|
+
...createSocialMetadata({
|
|
192
|
+
canonicalPath: "/",
|
|
193
|
+
description,
|
|
194
|
+
manifest,
|
|
195
|
+
ogManifest,
|
|
196
|
+
title: manifest.site.name
|
|
197
|
+
})
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
createRootMetadata,
|
|
202
|
+
createRootPage
|
|
203
|
+
};
|
|
@@ -0,0 +1,345 @@
|
|
|
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/keyboard-shortcuts.tsx
|
|
22
|
+
var keyboard_shortcuts_exports = {};
|
|
23
|
+
__export(keyboard_shortcuts_exports, {
|
|
24
|
+
KeyboardShortcutsProvider: () => KeyboardShortcutsProvider,
|
|
25
|
+
formatShortcut: () => formatShortcut,
|
|
26
|
+
useShortcut: () => useShortcut,
|
|
27
|
+
useShortcutRegistry: () => useShortcutRegistry
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(keyboard_shortcuts_exports);
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var DEFAULT_OPTIONS = {
|
|
33
|
+
description: "",
|
|
34
|
+
enabled: true,
|
|
35
|
+
enableOnContentEditable: false,
|
|
36
|
+
enableOnFormFields: false,
|
|
37
|
+
enableWhileComposing: false,
|
|
38
|
+
group: "",
|
|
39
|
+
preventDefault: true,
|
|
40
|
+
priority: 0,
|
|
41
|
+
stopPropagation: false
|
|
42
|
+
};
|
|
43
|
+
var MODIFIER_TOKENS = /* @__PURE__ */ new Set([
|
|
44
|
+
"mod",
|
|
45
|
+
"meta",
|
|
46
|
+
"ctrl",
|
|
47
|
+
"alt",
|
|
48
|
+
"shift"
|
|
49
|
+
]);
|
|
50
|
+
var KEY_ALIASES = {
|
|
51
|
+
cmd: "meta",
|
|
52
|
+
command: "meta",
|
|
53
|
+
control: "ctrl",
|
|
54
|
+
del: "delete",
|
|
55
|
+
down: "arrowdown",
|
|
56
|
+
esc: "escape",
|
|
57
|
+
ins: "insert",
|
|
58
|
+
left: "arrowleft",
|
|
59
|
+
opt: "alt",
|
|
60
|
+
option: "alt",
|
|
61
|
+
plus: "+",
|
|
62
|
+
return: "enter",
|
|
63
|
+
right: "arrowright",
|
|
64
|
+
space: " ",
|
|
65
|
+
spacebar: " ",
|
|
66
|
+
up: "arrowup"
|
|
67
|
+
};
|
|
68
|
+
var EDITABLE_TAGS = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]);
|
|
69
|
+
var SYMBOLS_MAC = {
|
|
70
|
+
" ": "Space",
|
|
71
|
+
alt: "\u2325",
|
|
72
|
+
arrowdown: "\u2193",
|
|
73
|
+
arrowleft: "\u2190",
|
|
74
|
+
arrowright: "\u2192",
|
|
75
|
+
arrowup: "\u2191",
|
|
76
|
+
backspace: "\u232B",
|
|
77
|
+
ctrl: "\u2303",
|
|
78
|
+
delete: "\u2326",
|
|
79
|
+
enter: "\u21B5",
|
|
80
|
+
escape: "\u238B",
|
|
81
|
+
meta: "\u2318",
|
|
82
|
+
shift: "\u21E7"
|
|
83
|
+
};
|
|
84
|
+
var LABELS_OTHER = {
|
|
85
|
+
" ": "Space",
|
|
86
|
+
alt: "Alt",
|
|
87
|
+
arrowdown: "\u2193",
|
|
88
|
+
arrowleft: "\u2190",
|
|
89
|
+
arrowright: "\u2192",
|
|
90
|
+
arrowup: "\u2191",
|
|
91
|
+
backspace: "Backspace",
|
|
92
|
+
ctrl: "Ctrl",
|
|
93
|
+
delete: "Delete",
|
|
94
|
+
enter: "Enter",
|
|
95
|
+
escape: "Esc",
|
|
96
|
+
meta: "Win",
|
|
97
|
+
shift: "Shift"
|
|
98
|
+
};
|
|
99
|
+
function platform() {
|
|
100
|
+
if (typeof navigator === "undefined") return "";
|
|
101
|
+
return navigator.platform ?? "";
|
|
102
|
+
}
|
|
103
|
+
function isMacPlatform() {
|
|
104
|
+
return /mac|iphone|ipad|ipod/i.test(platform());
|
|
105
|
+
}
|
|
106
|
+
function parseChord(input) {
|
|
107
|
+
const source = input.trim();
|
|
108
|
+
const rawParts = source.split("+").map((part) => part.trim().toLowerCase()).filter(Boolean);
|
|
109
|
+
if (rawParts.length === 0) {
|
|
110
|
+
throw new Error(`useShortcut: empty key combo "${input}"`);
|
|
111
|
+
}
|
|
112
|
+
let alt = false;
|
|
113
|
+
let ctrl = false;
|
|
114
|
+
let key = "";
|
|
115
|
+
let meta = false;
|
|
116
|
+
let shift = false;
|
|
117
|
+
for (const part of rawParts) {
|
|
118
|
+
const aliased = KEY_ALIASES[part] ?? part;
|
|
119
|
+
if (MODIFIER_TOKENS.has(aliased)) {
|
|
120
|
+
switch (aliased) {
|
|
121
|
+
case "mod":
|
|
122
|
+
if (isMacPlatform()) meta = true;
|
|
123
|
+
else ctrl = true;
|
|
124
|
+
break;
|
|
125
|
+
case "meta":
|
|
126
|
+
meta = true;
|
|
127
|
+
break;
|
|
128
|
+
case "ctrl":
|
|
129
|
+
ctrl = true;
|
|
130
|
+
break;
|
|
131
|
+
case "alt":
|
|
132
|
+
alt = true;
|
|
133
|
+
break;
|
|
134
|
+
case "shift":
|
|
135
|
+
shift = true;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (key) {
|
|
141
|
+
throw new Error(
|
|
142
|
+
`useShortcut: combo "${input}" has more than one non-modifier key`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
key = aliased;
|
|
146
|
+
}
|
|
147
|
+
if (!key) {
|
|
148
|
+
throw new Error(`useShortcut: combo "${input}" has no non-modifier key`);
|
|
149
|
+
}
|
|
150
|
+
return { alt, ctrl, key, meta, shift, source };
|
|
151
|
+
}
|
|
152
|
+
function codeToLogicalKey(code) {
|
|
153
|
+
if (code.length === 4 && code.startsWith("Key")) {
|
|
154
|
+
return code[3]?.toLowerCase() ?? null;
|
|
155
|
+
}
|
|
156
|
+
if (code.length === 6 && code.startsWith("Digit")) {
|
|
157
|
+
return code[5] ?? null;
|
|
158
|
+
}
|
|
159
|
+
switch (code) {
|
|
160
|
+
case "Backquote":
|
|
161
|
+
return "`";
|
|
162
|
+
case "Backslash":
|
|
163
|
+
return "\\";
|
|
164
|
+
case "BracketLeft":
|
|
165
|
+
return "[";
|
|
166
|
+
case "BracketRight":
|
|
167
|
+
return "]";
|
|
168
|
+
case "Comma":
|
|
169
|
+
return ",";
|
|
170
|
+
case "Equal":
|
|
171
|
+
return "=";
|
|
172
|
+
case "Minus":
|
|
173
|
+
return "-";
|
|
174
|
+
case "Period":
|
|
175
|
+
return ".";
|
|
176
|
+
case "Quote":
|
|
177
|
+
return "'";
|
|
178
|
+
case "Semicolon":
|
|
179
|
+
return ";";
|
|
180
|
+
case "Slash":
|
|
181
|
+
return "/";
|
|
182
|
+
default:
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function chordMatches(event, chord) {
|
|
187
|
+
if (event.metaKey !== chord.meta || event.ctrlKey !== chord.ctrl || event.altKey !== chord.alt) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
const keyIsSingleChar = chord.key.length === 1;
|
|
191
|
+
if (!keyIsSingleChar && event.shiftKey !== chord.shift) return false;
|
|
192
|
+
if (keyIsSingleChar && chord.shift && !event.shiftKey) return false;
|
|
193
|
+
if (event.key.toLowerCase() === chord.key) return true;
|
|
194
|
+
const logicalKey = codeToLogicalKey(event.code);
|
|
195
|
+
return logicalKey !== null && logicalKey === chord.key;
|
|
196
|
+
}
|
|
197
|
+
function inspectTarget(target) {
|
|
198
|
+
if (!(target instanceof HTMLElement)) {
|
|
199
|
+
return { isContentEditable: false, isFormField: false };
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
isContentEditable: target.isContentEditable,
|
|
203
|
+
isFormField: EDITABLE_TAGS.has(target.tagName)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function resolvedOptions(options) {
|
|
207
|
+
return { ...DEFAULT_OPTIONS, ...options };
|
|
208
|
+
}
|
|
209
|
+
var ShortcutContext = (0, import_react.createContext)(null);
|
|
210
|
+
function KeyboardShortcutsProvider({
|
|
211
|
+
children
|
|
212
|
+
}) {
|
|
213
|
+
const registry = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
214
|
+
const ordered = (0, import_react.useRef)([]);
|
|
215
|
+
const rebuildOrder = (0, import_react.useCallback)(() => {
|
|
216
|
+
const next = Array.from(registry.current.values());
|
|
217
|
+
next.sort((a, b) => b.priority - a.priority);
|
|
218
|
+
ordered.current = next;
|
|
219
|
+
}, []);
|
|
220
|
+
const register = (0, import_react.useCallback)(
|
|
221
|
+
(registration) => {
|
|
222
|
+
registry.current.set(registration.id, registration);
|
|
223
|
+
rebuildOrder();
|
|
224
|
+
return () => {
|
|
225
|
+
registry.current.delete(registration.id);
|
|
226
|
+
rebuildOrder();
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
[rebuildOrder]
|
|
230
|
+
);
|
|
231
|
+
const list = (0, import_react.useCallback)(() => {
|
|
232
|
+
const items = [];
|
|
233
|
+
for (const registration of registry.current.values()) {
|
|
234
|
+
const { options } = registration.ref.current;
|
|
235
|
+
items.push({
|
|
236
|
+
description: options.description,
|
|
237
|
+
enabled: options.enabled,
|
|
238
|
+
group: options.group,
|
|
239
|
+
id: registration.id,
|
|
240
|
+
source: registration.chords.map((chord) => chord.source)
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return items;
|
|
244
|
+
}, []);
|
|
245
|
+
const handleKeyDown = (0, import_react.useCallback)((event) => {
|
|
246
|
+
const registrations = ordered.current;
|
|
247
|
+
if (registrations.length === 0) return;
|
|
248
|
+
let target = null;
|
|
249
|
+
for (const registration of registrations) {
|
|
250
|
+
const { handler, options } = registration.ref.current;
|
|
251
|
+
if (!options.enabled) continue;
|
|
252
|
+
if ((event.isComposing || event.keyCode === 229) && !options.enableWhileComposing) {
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
let matched = false;
|
|
256
|
+
for (const chord of registration.chords) {
|
|
257
|
+
if (chordMatches(event, chord)) {
|
|
258
|
+
matched = true;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (!matched) continue;
|
|
263
|
+
target ??= inspectTarget(event.target);
|
|
264
|
+
if (target.isFormField && !options.enableOnFormFields) continue;
|
|
265
|
+
if (target.isContentEditable && !options.enableOnContentEditable) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (options.preventDefault) event.preventDefault();
|
|
269
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
270
|
+
handler(event);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}, []);
|
|
274
|
+
(0, import_react.useEffect)(() => {
|
|
275
|
+
window.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
276
|
+
return () => {
|
|
277
|
+
window.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
278
|
+
};
|
|
279
|
+
}, [handleKeyDown]);
|
|
280
|
+
const api = (0, import_react.useMemo)(
|
|
281
|
+
() => ({ list, register }),
|
|
282
|
+
[list, register]
|
|
283
|
+
);
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShortcutContext, { value: api, children });
|
|
285
|
+
}
|
|
286
|
+
function useShortcut(combo, handler, options) {
|
|
287
|
+
const api = (0, import_react.use)(ShortcutContext);
|
|
288
|
+
if (!api) {
|
|
289
|
+
throw new Error(
|
|
290
|
+
"useShortcut must be used within <KeyboardShortcutsProvider>."
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
const id = (0, import_react.useId)();
|
|
294
|
+
const comboKey = typeof combo === "string" ? combo : combo.join("\0");
|
|
295
|
+
const chords = (0, import_react.useMemo)(() => {
|
|
296
|
+
return comboKey.split("\0").map(parseChord);
|
|
297
|
+
}, [comboKey]);
|
|
298
|
+
const optionsPriority = options?.priority ?? DEFAULT_OPTIONS.priority;
|
|
299
|
+
const live = (0, import_react.useRef)({
|
|
300
|
+
handler,
|
|
301
|
+
options: resolvedOptions(options)
|
|
302
|
+
});
|
|
303
|
+
live.current.handler = handler;
|
|
304
|
+
live.current.options = resolvedOptions(options);
|
|
305
|
+
(0, import_react.useEffect)(() => {
|
|
306
|
+
return api.register({ chords, id, priority: optionsPriority, ref: live });
|
|
307
|
+
}, [api, chords, id, optionsPriority]);
|
|
308
|
+
}
|
|
309
|
+
function useShortcutRegistry() {
|
|
310
|
+
const api = (0, import_react.use)(ShortcutContext);
|
|
311
|
+
if (!api) {
|
|
312
|
+
throw new Error(
|
|
313
|
+
"useShortcutRegistry must be used within <KeyboardShortcutsProvider>."
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
return { list: api.list };
|
|
317
|
+
}
|
|
318
|
+
function formatShortcut(source) {
|
|
319
|
+
const chord = parseChord(source);
|
|
320
|
+
const labels = isMacPlatform() ? SYMBOLS_MAC : LABELS_OTHER;
|
|
321
|
+
const tokens = [];
|
|
322
|
+
const push = (name) => tokens.push(labels[name] ?? name);
|
|
323
|
+
if (isMacPlatform()) {
|
|
324
|
+
if (chord.ctrl) push("ctrl");
|
|
325
|
+
if (chord.alt) push("alt");
|
|
326
|
+
if (chord.shift) push("shift");
|
|
327
|
+
if (chord.meta) push("meta");
|
|
328
|
+
} else {
|
|
329
|
+
if (chord.meta) push("meta");
|
|
330
|
+
if (chord.ctrl) push("ctrl");
|
|
331
|
+
if (chord.alt) push("alt");
|
|
332
|
+
if (chord.shift) push("shift");
|
|
333
|
+
}
|
|
334
|
+
tokens.push(
|
|
335
|
+
labels[chord.key] ?? (chord.key.length === 1 ? chord.key.toUpperCase() : chord.key.replace(/^\w/, (character) => character.toUpperCase()))
|
|
336
|
+
);
|
|
337
|
+
return tokens;
|
|
338
|
+
}
|
|
339
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
340
|
+
0 && (module.exports = {
|
|
341
|
+
KeyboardShortcutsProvider,
|
|
342
|
+
formatShortcut,
|
|
343
|
+
useShortcut,
|
|
344
|
+
useShortcutRegistry
|
|
345
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type Modifier = "mod" | "meta" | "ctrl" | "alt" | "shift";
|
|
5
|
+
type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
6
|
+
interface ShortcutOptions {
|
|
7
|
+
description?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
enableOnContentEditable?: boolean;
|
|
10
|
+
enableOnFormFields?: boolean;
|
|
11
|
+
enableWhileComposing?: boolean;
|
|
12
|
+
group?: string;
|
|
13
|
+
preventDefault?: boolean;
|
|
14
|
+
priority?: number;
|
|
15
|
+
stopPropagation?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type ShortcutRegistryItem = {
|
|
18
|
+
description: string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
group: string;
|
|
21
|
+
id: string;
|
|
22
|
+
source: string[];
|
|
23
|
+
};
|
|
24
|
+
type ShortcutRegistryApi = {
|
|
25
|
+
list: () => readonly ShortcutRegistryItem[];
|
|
26
|
+
};
|
|
27
|
+
declare function KeyboardShortcutsProvider({ children, }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function useShortcut(combo: string | readonly string[], handler: ShortcutHandler, options?: ShortcutOptions): void;
|
|
31
|
+
declare function useShortcutRegistry(): ShortcutRegistryApi;
|
|
32
|
+
declare function formatShortcut(source: string): string[];
|
|
33
|
+
|
|
34
|
+
export { KeyboardShortcutsProvider, type Modifier, type ShortcutHandler, type ShortcutOptions, type ShortcutRegistryApi, type ShortcutRegistryItem, formatShortcut, useShortcut, useShortcutRegistry };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type Modifier = "mod" | "meta" | "ctrl" | "alt" | "shift";
|
|
5
|
+
type ShortcutHandler = (event: KeyboardEvent) => void;
|
|
6
|
+
interface ShortcutOptions {
|
|
7
|
+
description?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
enableOnContentEditable?: boolean;
|
|
10
|
+
enableOnFormFields?: boolean;
|
|
11
|
+
enableWhileComposing?: boolean;
|
|
12
|
+
group?: string;
|
|
13
|
+
preventDefault?: boolean;
|
|
14
|
+
priority?: number;
|
|
15
|
+
stopPropagation?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type ShortcutRegistryItem = {
|
|
18
|
+
description: string;
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
group: string;
|
|
21
|
+
id: string;
|
|
22
|
+
source: string[];
|
|
23
|
+
};
|
|
24
|
+
type ShortcutRegistryApi = {
|
|
25
|
+
list: () => readonly ShortcutRegistryItem[];
|
|
26
|
+
};
|
|
27
|
+
declare function KeyboardShortcutsProvider({ children, }: {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function useShortcut(combo: string | readonly string[], handler: ShortcutHandler, options?: ShortcutOptions): void;
|
|
31
|
+
declare function useShortcutRegistry(): ShortcutRegistryApi;
|
|
32
|
+
declare function formatShortcut(source: string): string[];
|
|
33
|
+
|
|
34
|
+
export { KeyboardShortcutsProvider, type Modifier, type ShortcutHandler, type ShortcutOptions, type ShortcutRegistryApi, type ShortcutRegistryItem, formatShortcut, useShortcut, useShortcutRegistry };
|