fromsrc 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/dist/access.d.ts +23 -0
- package/dist/access.js +54 -0
- package/dist/adapter.d.ts +31 -0
- package/dist/adapter.js +59 -0
- package/dist/adapterastro.d.ts +6 -0
- package/dist/adapterastro.js +6 -0
- package/dist/adapterbrowser.d.ts +6 -0
- package/dist/adapterbrowser.js +38 -0
- package/dist/adapternext.d.ts +6 -0
- package/dist/adapternext.js +49 -0
- package/dist/adapterreactrouter.d.ts +6 -0
- package/dist/adapterreactrouter.js +37 -0
- package/dist/adapterremix.d.ts +6 -0
- package/dist/adapterremix.js +41 -0
- package/dist/adaptertanstack.d.ts +6 -0
- package/dist/adaptertanstack.js +38 -0
- package/dist/adaptervite.d.ts +6 -0
- package/dist/adaptervite.js +6 -0
- package/dist/algolia.d.ts +16 -0
- package/dist/algolia.js +83 -0
- package/dist/analytics.d.ts +31 -0
- package/dist/analytics.js +61 -0
- package/dist/ansi.d.ts +5 -0
- package/dist/ansi.js +192 -0
- package/dist/api.d.ts +30 -0
- package/dist/api.js +75 -0
- package/dist/astro.d.ts +3 -0
- package/dist/astro.js +3 -0
- package/dist/audit.d.ts +19 -0
- package/dist/audit.js +78 -0
- package/dist/autotype.d.ts +17 -0
- package/dist/autotype.js +73 -0
- package/dist/batch.d.ts +22 -0
- package/dist/batch.js +68 -0
- package/dist/browser.d.ts +5 -0
- package/dist/browser.js +53 -0
- package/dist/changelog.d.ts +27 -0
- package/dist/changelog.js +87 -0
- package/dist/changelogutil.d.ts +20 -0
- package/dist/changelogutil.js +84 -0
- package/dist/cli.d.ts +24 -0
- package/dist/cli.js +76 -0
- package/dist/client.d.ts +212 -0
- package/dist/client.js +202 -0
- package/dist/codesample.d.ts +20 -0
- package/dist/codesample.js +115 -0
- package/dist/collapse.d.ts +5 -0
- package/dist/collapse.js +101 -0
- package/dist/collections.d.ts +32 -0
- package/dist/collections.js +82 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +54 -0
- package/dist/components/alert.d.ts +18 -0
- package/dist/components/alert.js +30 -0
- package/dist/components/announce.d.ts +11 -0
- package/dist/components/announce.js +38 -0
- package/dist/components/autofill.d.ts +27 -0
- package/dist/components/autofill.js +152 -0
- package/dist/components/avatar.d.ts +42 -0
- package/dist/components/avatar.js +67 -0
- package/dist/components/avatarstack.d.ts +23 -0
- package/dist/components/avatarstack.js +54 -0
- package/dist/components/backtotop.d.ts +20 -0
- package/dist/components/backtotop.js +42 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +25 -0
- package/dist/components/banner.d.ts +21 -0
- package/dist/components/banner.js +63 -0
- package/dist/components/breadcrumb.d.ts +25 -0
- package/dist/components/breadcrumb.js +35 -0
- package/dist/components/breadcrumbnav.d.ts +15 -0
- package/dist/components/breadcrumbnav.js +60 -0
- package/dist/components/button.d.ts +22 -0
- package/dist/components/button.js +47 -0
- package/dist/components/callout.d.ts +26 -0
- package/dist/components/callout.js +91 -0
- package/dist/components/cards.d.ts +34 -0
- package/dist/components/cards.js +24 -0
- package/dist/components/changelog.d.ts +34 -0
- package/dist/components/changelog.js +50 -0
- package/dist/components/checkbox.d.ts +26 -0
- package/dist/components/checkbox.js +80 -0
- package/dist/components/code.d.ts +27 -0
- package/dist/components/code.js +36 -0
- package/dist/components/codeblock.d.ts +12 -0
- package/dist/components/codeblock.js +102 -0
- package/dist/components/codecopy.d.ts +12 -0
- package/dist/components/codecopy.js +56 -0
- package/dist/components/codegroup.d.ts +22 -0
- package/dist/components/codegroup.js +134 -0
- package/dist/components/collapsible.d.ts +29 -0
- package/dist/components/collapsible.js +64 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +138 -0
- package/dist/components/compare.d.ts +54 -0
- package/dist/components/compare.js +88 -0
- package/dist/components/content.d.ts +12 -0
- package/dist/components/content.js +232 -0
- package/dist/components/copyable.d.ts +25 -0
- package/dist/components/copyable.js +51 -0
- package/dist/components/copybutton.d.ts +11 -0
- package/dist/components/copybutton.js +50 -0
- package/dist/components/countdown.d.ts +18 -0
- package/dist/components/countdown.js +112 -0
- package/dist/components/create.d.ts +10 -0
- package/dist/components/create.js +149 -0
- package/dist/components/definition.d.ts +43 -0
- package/dist/components/definition.js +46 -0
- package/dist/components/diffview.d.ts +12 -0
- package/dist/components/diffview.js +129 -0
- package/dist/components/divider.d.ts +19 -0
- package/dist/components/divider.js +24 -0
- package/dist/components/docheader.d.ts +17 -0
- package/dist/components/docheader.js +24 -0
- package/dist/components/doclinkcard.d.ts +19 -0
- package/dist/components/doclinkcard.js +37 -0
- package/dist/components/docslayout.d.ts +14 -0
- package/dist/components/docslayout.js +24 -0
- package/dist/components/dropdown.d.ts +23 -0
- package/dist/components/dropdown.js +134 -0
- package/dist/components/dynamiccode.d.ts +12 -0
- package/dist/components/dynamiccode.js +40 -0
- package/dist/components/editlink.d.ts +15 -0
- package/dist/components/editlink.js +45 -0
- package/dist/components/embed.d.ts +45 -0
- package/dist/components/embed.js +85 -0
- package/dist/components/endpoint.d.ts +58 -0
- package/dist/components/endpoint.js +100 -0
- package/dist/components/errormessage.d.ts +11 -0
- package/dist/components/errormessage.js +10 -0
- package/dist/components/expandcode.d.ts +13 -0
- package/dist/components/expandcode.js +58 -0
- package/dist/components/feature.d.ts +31 -0
- package/dist/components/feature.js +58 -0
- package/dist/components/featuregrid.d.ts +17 -0
- package/dist/components/featuregrid.js +36 -0
- package/dist/components/feedback.d.ts +14 -0
- package/dist/components/feedback.js +62 -0
- package/dist/components/feedbackwidget.d.ts +14 -0
- package/dist/components/feedbackwidget.js +106 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +133 -0
- package/dist/components/folder.d.ts +15 -0
- package/dist/components/folder.js +102 -0
- package/dist/components/footer.d.ts +16 -0
- package/dist/components/footer.js +28 -0
- package/dist/components/formlabel.d.ts +24 -0
- package/dist/components/formlabel.js +27 -0
- package/dist/components/github.d.ts +14 -0
- package/dist/components/github.js +99 -0
- package/dist/components/graph.d.ts +36 -0
- package/dist/components/graph.js +210 -0
- package/dist/components/heading.d.ts +25 -0
- package/dist/components/heading.js +82 -0
- package/dist/components/headingcopy.d.ts +3 -0
- package/dist/components/headingcopy.js +31 -0
- package/dist/components/hero.d.ts +16 -0
- package/dist/components/hero.js +28 -0
- package/dist/components/highlight.d.ts +41 -0
- package/dist/components/highlight.js +42 -0
- package/dist/components/hover.d.ts +23 -0
- package/dist/components/hover.js +79 -0
- package/dist/components/icons.d.ts +30 -0
- package/dist/components/icons.js +419 -0
- package/dist/components/inlinetoc.d.ts +19 -0
- package/dist/components/inlinetoc.js +28 -0
- package/dist/components/input.d.ts +25 -0
- package/dist/components/input.js +42 -0
- package/dist/components/install.d.ts +10 -0
- package/dist/components/install.js +149 -0
- package/dist/components/kbd.d.ts +22 -0
- package/dist/components/kbd.js +30 -0
- package/dist/components/langicon.d.ts +8 -0
- package/dist/components/langicon.js +48 -0
- package/dist/components/language.d.ts +17 -0
- package/dist/components/language.js +123 -0
- package/dist/components/lastupdated.d.ts +12 -0
- package/dist/components/lastupdated.js +44 -0
- package/dist/components/link.d.ts +14 -0
- package/dist/components/link.js +53 -0
- package/dist/components/linkcard.d.ts +33 -0
- package/dist/components/linkcard.js +50 -0
- package/dist/components/list.d.ts +50 -0
- package/dist/components/list.js +55 -0
- package/dist/components/math.d.ts +34 -0
- package/dist/components/math.js +63 -0
- package/dist/components/mermaid.d.ts +19 -0
- package/dist/components/mermaid.js +79 -0
- package/dist/components/mobilenav.d.ts +17 -0
- package/dist/components/mobilenav.js +263 -0
- package/dist/components/modal.d.ts +18 -0
- package/dist/components/modal.js +69 -0
- package/dist/components/navbar.d.ts +19 -0
- package/dist/components/navbar.js +45 -0
- package/dist/components/navlink.d.ts +14 -0
- package/dist/components/navlink.js +77 -0
- package/dist/components/note.d.ts +28 -0
- package/dist/components/note.js +60 -0
- package/dist/components/openapi.d.ts +14 -0
- package/dist/components/openapi.js +145 -0
- package/dist/components/openapischema.d.ts +13 -0
- package/dist/components/openapischema.js +51 -0
- package/dist/components/openapitags.d.ts +13 -0
- package/dist/components/openapitags.js +20 -0
- package/dist/components/pagetransition.d.ts +13 -0
- package/dist/components/pagetransition.js +37 -0
- package/dist/components/pagination.d.ts +26 -0
- package/dist/components/pagination.js +68 -0
- package/dist/components/panel.d.ts +25 -0
- package/dist/components/panel.js +75 -0
- package/dist/components/playground.d.ts +14 -0
- package/dist/components/playground.js +89 -0
- package/dist/components/popover.d.ts +18 -0
- package/dist/components/popover.js +109 -0
- package/dist/components/prelink.d.ts +10 -0
- package/dist/components/prelink.js +46 -0
- package/dist/components/prevnext.d.ts +17 -0
- package/dist/components/prevnext.js +43 -0
- package/dist/components/progress.d.ts +30 -0
- package/dist/components/progress.js +74 -0
- package/dist/components/property.d.ts +24 -0
- package/dist/components/property.js +44 -0
- package/dist/components/quote.d.ts +44 -0
- package/dist/components/quote.js +41 -0
- package/dist/components/radio.d.ts +48 -0
- package/dist/components/radio.js +140 -0
- package/dist/components/rating.d.ts +22 -0
- package/dist/components/rating.js +100 -0
- package/dist/components/readtime.d.ts +17 -0
- package/dist/components/readtime.js +26 -0
- package/dist/components/recent.d.ts +12 -0
- package/dist/components/recent.js +23 -0
- package/dist/components/responsive.d.ts +35 -0
- package/dist/components/responsive.js +73 -0
- package/dist/components/results.d.ts +20 -0
- package/dist/components/results.js +72 -0
- package/dist/components/screenshot.d.ts +33 -0
- package/dist/components/screenshot.js +52 -0
- package/dist/components/scrollprogress.d.ts +12 -0
- package/dist/components/scrollprogress.js +56 -0
- package/dist/components/scrollspy.d.ts +18 -0
- package/dist/components/scrollspy.js +51 -0
- package/dist/components/search.d.ts +19 -0
- package/dist/components/search.js +228 -0
- package/dist/components/searchbutton.d.ts +10 -0
- package/dist/components/searchbutton.js +51 -0
- package/dist/components/searchdialog.d.ts +19 -0
- package/dist/components/searchdialog.js +108 -0
- package/dist/components/searcher.d.ts +12 -0
- package/dist/components/searcher.js +121 -0
- package/dist/components/select.d.ts +39 -0
- package/dist/components/select.js +162 -0
- package/dist/components/shortcuts.d.ts +17 -0
- package/dist/components/shortcuts.js +62 -0
- package/dist/components/sidebar.d.ts +35 -0
- package/dist/components/sidebar.js +215 -0
- package/dist/components/sidebarfilter.d.ts +13 -0
- package/dist/components/sidebarfilter.js +50 -0
- package/dist/components/skeleton.d.ts +40 -0
- package/dist/components/skeleton.js +59 -0
- package/dist/components/skiplink.d.ts +12 -0
- package/dist/components/skiplink.js +21 -0
- package/dist/components/spinner.d.ts +34 -0
- package/dist/components/spinner.js +56 -0
- package/dist/components/status.d.ts +27 -0
- package/dist/components/status.js +63 -0
- package/dist/components/steps.d.ts +30 -0
- package/dist/components/steps.js +15 -0
- package/dist/components/switch.d.ts +26 -0
- package/dist/components/switch.js +79 -0
- package/dist/components/table.d.ts +36 -0
- package/dist/components/table.js +138 -0
- package/dist/components/tabnav.d.ts +30 -0
- package/dist/components/tabnav.js +199 -0
- package/dist/components/tabs.d.ts +15 -0
- package/dist/components/tabs.js +96 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +38 -0
- package/dist/components/terminal.d.ts +48 -0
- package/dist/components/terminal.js +62 -0
- package/dist/components/textarea.d.ts +30 -0
- package/dist/components/textarea.js +100 -0
- package/dist/components/theme.d.ts +11 -0
- package/dist/components/theme.js +66 -0
- package/dist/components/themeprovider.d.ts +19 -0
- package/dist/components/themeprovider.js +58 -0
- package/dist/components/toast.d.ts +31 -0
- package/dist/components/toast.js +107 -0
- package/dist/components/toc/default.d.ts +21 -0
- package/dist/components/toc/default.js +100 -0
- package/dist/components/toc/hook.d.ts +13 -0
- package/dist/components/toc/hook.js +125 -0
- package/dist/components/toc/index.d.ts +15 -0
- package/dist/components/toc/index.js +44 -0
- package/dist/components/toc/inline.d.ts +20 -0
- package/dist/components/toc/inline.js +75 -0
- package/dist/components/toc/minimal.d.ts +22 -0
- package/dist/components/toc/minimal.js +136 -0
- package/dist/components/toc/zigzag.d.ts +18 -0
- package/dist/components/toc/zigzag.js +57 -0
- package/dist/components/tocprogress.d.ts +17 -0
- package/dist/components/tocprogress.js +67 -0
- package/dist/components/tooltip.d.ts +19 -0
- package/dist/components/tooltip.js +76 -0
- package/dist/components/trigger.d.ts +8 -0
- package/dist/components/trigger.js +13 -0
- package/dist/components/twoslash.d.ts +9 -0
- package/dist/components/twoslash.js +52 -0
- package/dist/components/typetable.d.ts +21 -0
- package/dist/components/typetable.js +68 -0
- package/dist/components/typewriter.d.ts +20 -0
- package/dist/components/typewriter.js +50 -0
- package/dist/components/version.d.ts +29 -0
- package/dist/components/version.js +181 -0
- package/dist/components/video.d.ts +33 -0
- package/dist/components/video.js +147 -0
- package/dist/components/zoom.d.ts +9 -0
- package/dist/components/zoom.js +110 -0
- package/dist/config.d.ts +54 -0
- package/dist/config.js +102 -0
- package/dist/content.d.ts +83 -0
- package/dist/content.js +464 -0
- package/dist/contentcache.d.ts +28 -0
- package/dist/contentcache.js +76 -0
- package/dist/contentdiff.d.ts +19 -0
- package/dist/contentdiff.js +48 -0
- package/dist/contributors.d.ts +22 -0
- package/dist/contributors.js +64 -0
- package/dist/diff.d.ts +25 -0
- package/dist/diff.js +117 -0
- package/dist/draft.d.ts +33 -0
- package/dist/draft.js +62 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +50 -0
- package/dist/export.d.ts +9 -0
- package/dist/export.js +32 -0
- package/dist/frontmatter.d.ts +19 -0
- package/dist/frontmatter.js +65 -0
- package/dist/github.d.ts +15 -0
- package/dist/github.js +254 -0
- package/dist/gitsource.d.ts +23 -0
- package/dist/gitsource.js +50 -0
- package/dist/hash.d.ts +21 -0
- package/dist/hash.js +65 -0
- package/dist/highlight.d.ts +18 -0
- package/dist/highlight.js +90 -0
- package/dist/hooks/anchor.d.ts +7 -0
- package/dist/hooks/anchor.js +44 -0
- package/dist/hooks/arrownav.d.ts +11 -0
- package/dist/hooks/arrownav.js +49 -0
- package/dist/hooks/async.d.ts +9 -0
- package/dist/hooks/async.js +28 -0
- package/dist/hooks/battery.d.ts +8 -0
- package/dist/hooks/battery.js +34 -0
- package/dist/hooks/breakpoint.d.ts +6 -0
- package/dist/hooks/breakpoint.js +34 -0
- package/dist/hooks/clickoutside.d.ts +11 -0
- package/dist/hooks/clickoutside.js +19 -0
- package/dist/hooks/clipboard-paste.d.ts +8 -0
- package/dist/hooks/clipboard-paste.js +18 -0
- package/dist/hooks/clipboard.d.ts +9 -0
- package/dist/hooks/clipboard.js +24 -0
- package/dist/hooks/colorscheme.d.ts +4 -0
- package/dist/hooks/colorscheme.js +18 -0
- package/dist/hooks/copy.d.ts +12 -0
- package/dist/hooks/copy.js +28 -0
- package/dist/hooks/countdown.d.ts +10 -0
- package/dist/hooks/countdown.js +41 -0
- package/dist/hooks/counter.d.ts +10 -0
- package/dist/hooks/counter.js +12 -0
- package/dist/hooks/debounce.d.ts +9 -0
- package/dist/hooks/debounce.js +16 -0
- package/dist/hooks/documenttitle.d.ts +3 -0
- package/dist/hooks/documenttitle.js +20 -0
- package/dist/hooks/documentvisibility.d.ts +4 -0
- package/dist/hooks/documentvisibility.js +19 -0
- package/dist/hooks/escapekey.d.ts +8 -0
- package/dist/hooks/escapekey.js +18 -0
- package/dist/hooks/eventlistener.d.ts +13 -0
- package/dist/hooks/eventlistener.js +15 -0
- package/dist/hooks/eventsource.d.ts +10 -0
- package/dist/hooks/eventsource.js +31 -0
- package/dist/hooks/eyedropper.d.ts +8 -0
- package/dist/hooks/eyedropper.js +23 -0
- package/dist/hooks/favicon.d.ts +3 -0
- package/dist/hooks/favicon.js +14 -0
- package/dist/hooks/fetch.d.ts +8 -0
- package/dist/hooks/fetch.js +29 -0
- package/dist/hooks/focustrap.d.ts +12 -0
- package/dist/hooks/focustrap.js +62 -0
- package/dist/hooks/focuswithin.d.ts +6 -0
- package/dist/hooks/focuswithin.js +24 -0
- package/dist/hooks/form.d.ts +20 -0
- package/dist/hooks/form.js +42 -0
- package/dist/hooks/fullscreen.d.ts +10 -0
- package/dist/hooks/fullscreen.js +34 -0
- package/dist/hooks/geolocation.d.ts +10 -0
- package/dist/hooks/geolocation.js +38 -0
- package/dist/hooks/hash.d.ts +3 -0
- package/dist/hooks/hash.js +21 -0
- package/dist/hooks/hotkeys.d.ts +11 -0
- package/dist/hooks/hotkeys.js +35 -0
- package/dist/hooks/hover.d.ts +3 -0
- package/dist/hooks/hover.js +22 -0
- package/dist/hooks/idle.d.ts +3 -0
- package/dist/hooks/idle.js +28 -0
- package/dist/hooks/infinitescroll.d.ts +9 -0
- package/dist/hooks/infinitescroll.js +31 -0
- package/dist/hooks/interval.d.ts +3 -0
- package/dist/hooks/interval.js +16 -0
- package/dist/hooks/inview.d.ts +10 -0
- package/dist/hooks/inview.js +28 -0
- package/dist/hooks/keyboard.d.ts +14 -0
- package/dist/hooks/keyboard.js +82 -0
- package/dist/hooks/keypress.d.ts +3 -0
- package/dist/hooks/keypress.js +23 -0
- package/dist/hooks/list.d.ts +14 -0
- package/dist/hooks/list.js +28 -0
- package/dist/hooks/longpress.d.ts +10 -0
- package/dist/hooks/longpress.js +24 -0
- package/dist/hooks/map.d.ts +12 -0
- package/dist/hooks/map.js +23 -0
- package/dist/hooks/measure.d.ts +16 -0
- package/dist/hooks/measure.js +34 -0
- package/dist/hooks/media.d.ts +33 -0
- package/dist/hooks/media.js +35 -0
- package/dist/hooks/mediarecorder.d.ts +11 -0
- package/dist/hooks/mediarecorder.js +37 -0
- package/dist/hooks/mounted.d.ts +3 -0
- package/dist/hooks/mounted.js +12 -0
- package/dist/hooks/mouseposition.d.ts +7 -0
- package/dist/hooks/mouseposition.js +16 -0
- package/dist/hooks/networkstate.d.ts +10 -0
- package/dist/hooks/networkstate.js +34 -0
- package/dist/hooks/online.d.ts +3 -0
- package/dist/hooks/online.js +20 -0
- package/dist/hooks/orientation.d.ts +8 -0
- package/dist/hooks/orientation.js +20 -0
- package/dist/hooks/os.d.ts +4 -0
- package/dist/hooks/os.js +15 -0
- package/dist/hooks/pageleave.d.ts +3 -0
- package/dist/hooks/pageleave.js +18 -0
- package/dist/hooks/pagination.d.ts +26 -0
- package/dist/hooks/pagination.js +49 -0
- package/dist/hooks/permission.d.ts +5 -0
- package/dist/hooks/permission.js +29 -0
- package/dist/hooks/preferredlanguage.d.ts +3 -0
- package/dist/hooks/preferredlanguage.js +17 -0
- package/dist/hooks/previous.d.ts +3 -0
- package/dist/hooks/previous.js +12 -0
- package/dist/hooks/queue.d.ts +11 -0
- package/dist/hooks/queue.js +23 -0
- package/dist/hooks/readprogress.d.ts +6 -0
- package/dist/hooks/readprogress.js +32 -0
- package/dist/hooks/resizeobserver.d.ts +10 -0
- package/dist/hooks/resizeobserver.js +25 -0
- package/dist/hooks/script.d.ts +4 -0
- package/dist/hooks/script.js +30 -0
- package/dist/hooks/scrolldirection.d.ts +4 -0
- package/dist/hooks/scrolldirection.js +33 -0
- package/dist/hooks/scrolllock.d.ts +3 -0
- package/dist/hooks/scrolllock.js +38 -0
- package/dist/hooks/scrollspy.d.ts +7 -0
- package/dist/hooks/scrollspy.js +28 -0
- package/dist/hooks/scrolltop.d.ts +7 -0
- package/dist/hooks/scrolltop.js +19 -0
- package/dist/hooks/selection.d.ts +12 -0
- package/dist/hooks/selection.js +32 -0
- package/dist/hooks/share.d.ts +13 -0
- package/dist/hooks/share.js +37 -0
- package/dist/hooks/speechrecognition.d.ts +10 -0
- package/dist/hooks/speechrecognition.js +34 -0
- package/dist/hooks/stepper.d.ts +13 -0
- package/dist/hooks/stepper.js +31 -0
- package/dist/hooks/storage.d.ts +5 -0
- package/dist/hooks/storage.js +57 -0
- package/dist/hooks/stylesheet.d.ts +4 -0
- package/dist/hooks/stylesheet.js +30 -0
- package/dist/hooks/textselection.d.ts +7 -0
- package/dist/hooks/textselection.js +24 -0
- package/dist/hooks/throttle.d.ts +3 -0
- package/dist/hooks/throttle.js +28 -0
- package/dist/hooks/toggle.d.ts +13 -0
- package/dist/hooks/toggle.js +10 -0
- package/dist/hooks/undoredo.d.ts +12 -0
- package/dist/hooks/undoredo.js +50 -0
- package/dist/hooks/vibrate.d.ts +7 -0
- package/dist/hooks/vibrate.js +15 -0
- package/dist/hooks/viewtransition.d.ts +9 -0
- package/dist/hooks/viewtransition.js +38 -0
- package/dist/hooks/wakelock.d.ts +9 -0
- package/dist/hooks/wakelock.js +32 -0
- package/dist/hooks/websocket.d.ts +10 -0
- package/dist/hooks/websocket.js +30 -0
- package/dist/hooks/windowsize.d.ts +7 -0
- package/dist/hooks/windowsize.js +17 -0
- package/dist/i18n.d.ts +30 -0
- package/dist/i18n.js +73 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +107 -0
- package/dist/lastmodified.d.ts +4 -0
- package/dist/lastmodified.js +24 -0
- package/dist/linkcheck.d.ts +26 -0
- package/dist/linkcheck.js +113 -0
- package/dist/llms.d.ts +14 -0
- package/dist/llms.js +39 -0
- package/dist/manifest.d.ts +24 -0
- package/dist/manifest.js +31 -0
- package/dist/mcp.d.ts +56 -0
- package/dist/mcp.js +74 -0
- package/dist/mdtoc.d.ts +16 -0
- package/dist/mdtoc.js +59 -0
- package/dist/mdxscope.d.ts +17 -0
- package/dist/mdxscope.js +58 -0
- package/dist/meta.d.ts +19 -0
- package/dist/meta.js +71 -0
- package/dist/migrate.d.ts +17 -0
- package/dist/migrate.js +108 -0
- package/dist/navgen.d.ts +31 -0
- package/dist/navgen.js +147 -0
- package/dist/navtree.d.ts +28 -0
- package/dist/navtree.js +93 -0
- package/dist/next.d.ts +3 -0
- package/dist/next.js +3 -0
- package/dist/oembed.d.ts +20 -0
- package/dist/oembed.js +62 -0
- package/dist/ogimage.d.ts +45 -0
- package/dist/ogimage.js +62 -0
- package/dist/openapi.d.ts +6 -0
- package/dist/openapi.js +141 -0
- package/dist/openapiguard.d.ts +22 -0
- package/dist/openapiguard.js +87 -0
- package/dist/openapiutil.d.ts +72 -0
- package/dist/openapiutil.js +61 -0
- package/dist/orama.d.ts +16 -0
- package/dist/orama.js +100 -0
- package/dist/pipeline.d.ts +19 -0
- package/dist/pipeline.js +40 -0
- package/dist/preload.d.ts +15 -0
- package/dist/preload.js +19 -0
- package/dist/ranking.d.ts +28 -0
- package/dist/ranking.js +95 -0
- package/dist/reactrouter.d.ts +3 -0
- package/dist/reactrouter.js +3 -0
- package/dist/readtime.d.ts +3 -0
- package/dist/readtime.js +8 -0
- package/dist/redirects.d.ts +27 -0
- package/dist/redirects.js +74 -0
- package/dist/rehype.d.ts +5 -0
- package/dist/rehype.js +30 -0
- package/dist/rehypeautolink.d.ts +11 -0
- package/dist/rehypeautolink.js +43 -0
- package/dist/rehypecode.d.ts +6 -0
- package/dist/rehypecode.js +68 -0
- package/dist/rehypecopy.d.ts +6 -0
- package/dist/rehypecopy.js +29 -0
- package/dist/rehypeinline.d.ts +6 -0
- package/dist/rehypeinline.js +32 -0
- package/dist/rehypelinks.d.ts +10 -0
- package/dist/rehypelinks.js +49 -0
- package/dist/rehyperaw.d.ts +6 -0
- package/dist/rehyperaw.js +27 -0
- package/dist/rehypeslug.d.ts +7 -0
- package/dist/rehypeslug.js +39 -0
- package/dist/rehypetablewrap.d.ts +9 -0
- package/dist/rehypetablewrap.js +24 -0
- package/dist/rehypetoc.d.ts +16 -0
- package/dist/rehypetoc.js +61 -0
- package/dist/remark.d.ts +6 -0
- package/dist/remark.js +48 -0
- package/dist/remarkadmonition.d.ts +6 -0
- package/dist/remarkadmonition.js +78 -0
- package/dist/remarkannotation.d.ts +10 -0
- package/dist/remarkannotation.js +65 -0
- package/dist/remarkbadge.d.ts +6 -0
- package/dist/remarkbadge.js +40 -0
- package/dist/remarkblockmath.d.ts +6 -0
- package/dist/remarkblockmath.js +57 -0
- package/dist/remarkcallout.d.ts +6 -0
- package/dist/remarkcallout.js +65 -0
- package/dist/remarkcaption.d.ts +6 -0
- package/dist/remarkcaption.js +48 -0
- package/dist/remarkcodetitle.d.ts +6 -0
- package/dist/remarkcodetitle.js +39 -0
- package/dist/remarkcolumns.d.ts +6 -0
- package/dist/remarkcolumns.js +67 -0
- package/dist/remarkdetails.d.ts +6 -0
- package/dist/remarkdetails.js +61 -0
- package/dist/remarkdirective.d.ts +7 -0
- package/dist/remarkdirective.js +98 -0
- package/dist/remarkembed.d.ts +6 -0
- package/dist/remarkembed.js +72 -0
- package/dist/remarkfiletree.d.ts +6 -0
- package/dist/remarkfiletree.js +67 -0
- package/dist/remarkfootnote.d.ts +6 -0
- package/dist/remarkfootnote.js +63 -0
- package/dist/remarkgfm.d.ts +6 -0
- package/dist/remarkgfm.js +60 -0
- package/dist/remarkheadingid.d.ts +6 -0
- package/dist/remarkheadingid.js +40 -0
- package/dist/remarkimage.d.ts +11 -0
- package/dist/remarkimage.js +91 -0
- package/dist/remarkinclude.d.ts +10 -0
- package/dist/remarkinclude.js +49 -0
- package/dist/remarkinstall.d.ts +6 -0
- package/dist/remarkinstall.js +52 -0
- package/dist/remarklinkcard.d.ts +6 -0
- package/dist/remarklinkcard.js +38 -0
- package/dist/remarkmath.d.ts +6 -0
- package/dist/remarkmath.js +69 -0
- package/dist/remarkmermaid.d.ts +6 -0
- package/dist/remarkmermaid.js +21 -0
- package/dist/remarkmeta.d.ts +15 -0
- package/dist/remarkmeta.js +63 -0
- package/dist/remarkreadingtime.d.ts +11 -0
- package/dist/remarkreadingtime.js +44 -0
- package/dist/remarksteps.d.ts +6 -0
- package/dist/remarksteps.js +56 -0
- package/dist/remarkstructure.d.ts +18 -0
- package/dist/remarkstructure.js +53 -0
- package/dist/remarktabs.d.ts +6 -0
- package/dist/remarktabs.js +42 -0
- package/dist/remarktoc.d.ts +6 -0
- package/dist/remarktoc.js +47 -0
- package/dist/remarkts2js.d.ts +6 -0
- package/dist/remarkts2js.js +88 -0
- package/dist/remarktwoslash.d.ts +20 -0
- package/dist/remarktwoslash.js +86 -0
- package/dist/remarkvideo.d.ts +16 -0
- package/dist/remarkvideo.js +59 -0
- package/dist/remix.d.ts +3 -0
- package/dist/remix.js +3 -0
- package/dist/schema.d.ts +54 -0
- package/dist/schema.js +17 -0
- package/dist/search.d.ts +24 -0
- package/dist/search.js +155 -0
- package/dist/searchindex.d.ts +28 -0
- package/dist/searchindex.js +184 -0
- package/dist/searchpolicy.d.ts +5 -0
- package/dist/searchpolicy.js +9 -0
- package/dist/searchscore.d.ts +30 -0
- package/dist/searchscore.js +54 -0
- package/dist/searchtypo.d.ts +3 -0
- package/dist/searchtypo.js +47 -0
- package/dist/seo.d.ts +26 -0
- package/dist/seo.js +69 -0
- package/dist/shortcodes.d.ts +13 -0
- package/dist/shortcodes.js +61 -0
- package/dist/sitemap.d.ts +25 -0
- package/dist/sitemap.js +69 -0
- package/dist/snippets.d.ts +18 -0
- package/dist/snippets.js +89 -0
- package/dist/source.d.ts +23 -0
- package/dist/source.js +188 -0
- package/dist/stats.d.ts +25 -0
- package/dist/stats.js +81 -0
- package/dist/tanstack.d.ts +3 -0
- package/dist/tanstack.js +3 -0
- package/dist/testing.d.ts +35 -0
- package/dist/testing.js +134 -0
- package/dist/themeutil.d.ts +31 -0
- package/dist/themeutil.js +92 -0
- package/dist/typegen.d.ts +10 -0
- package/dist/typegen.js +74 -0
- package/dist/types.d.ts +267 -0
- package/dist/types.js +1 -0
- package/dist/validate.d.ts +13 -0
- package/dist/validate.js +78 -0
- package/dist/validator.d.ts +35 -0
- package/dist/validator.js +53 -0
- package/dist/versioning.d.ts +32 -0
- package/dist/versioning.js +62 -0
- package/dist/vite.d.ts +3 -0
- package/dist/vite.js +3 -0
- package/dist/watcher.d.ts +19 -0
- package/dist/watcher.js +82 -0
- package/dist/webhook.d.ts +25 -0
- package/dist/webhook.js +67 -0
- package/dist/workspace.d.ts +26 -0
- package/dist/workspace.js +81 -0
- package/package.json +138 -11
- package/styles/reset.css +3 -0
- package/index.js +0 -3
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useFetch(url, options) {
|
|
5
|
+
const [state, setState] = useState({
|
|
6
|
+
data: null,
|
|
7
|
+
error: null,
|
|
8
|
+
loading: !!url
|
|
9
|
+
});
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!url) return;
|
|
12
|
+
let cancelled = false;
|
|
13
|
+
setState({ data: null, error: null, loading: true });
|
|
14
|
+
fetch(url, options).then((res) => {
|
|
15
|
+
if (!res.ok) throw new Error(res.statusText);
|
|
16
|
+
return res.json();
|
|
17
|
+
}).then((data) => {
|
|
18
|
+
if (!cancelled) setState({ data, error: null, loading: false });
|
|
19
|
+
}).catch((error) => {
|
|
20
|
+
if (!cancelled) setState({ data: null, error, loading: false });
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
cancelled = true;
|
|
24
|
+
};
|
|
25
|
+
}, [url]);
|
|
26
|
+
return state;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useFetch };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const FOCUSABLE_SELECTOR = "button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])";
|
|
4
|
+
interface FocusTrapOptions {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
onEscape?: () => void;
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
restoreFocus?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function useFocusTrap<T extends HTMLElement>(ref: RefObject<T | null>, options: FocusTrapOptions): void;
|
|
11
|
+
|
|
12
|
+
export { FOCUSABLE_SELECTOR, type FocusTrapOptions, useFocusTrap };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const FOCUSABLE_SELECTOR = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
5
|
+
function useFocusTrap(ref, options) {
|
|
6
|
+
const { enabled, onEscape, autoFocus = true, restoreFocus = true } = options;
|
|
7
|
+
const previousFocus = useRef(null);
|
|
8
|
+
const getFocusableElements = useCallback(() => {
|
|
9
|
+
if (!ref.current) return [];
|
|
10
|
+
return Array.from(ref.current.querySelectorAll(FOCUSABLE_SELECTOR));
|
|
11
|
+
}, [ref]);
|
|
12
|
+
const handleKeyDown = useCallback(
|
|
13
|
+
(e) => {
|
|
14
|
+
if (e.key === "Escape" && onEscape) {
|
|
15
|
+
onEscape();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (e.key !== "Tab") return;
|
|
19
|
+
const focusable = getFocusableElements();
|
|
20
|
+
if (focusable.length === 0) return;
|
|
21
|
+
const first = focusable[0];
|
|
22
|
+
const last = focusable[focusable.length - 1];
|
|
23
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
last?.focus();
|
|
26
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
first?.focus();
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[onEscape, getFocusableElements]
|
|
32
|
+
);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!enabled) return;
|
|
35
|
+
previousFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
36
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
37
|
+
return () => {
|
|
38
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
39
|
+
if (restoreFocus) {
|
|
40
|
+
previousFocus.current?.focus();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [enabled, handleKeyDown, restoreFocus]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (!enabled || !autoFocus) return;
|
|
46
|
+
const focusable = getFocusableElements();
|
|
47
|
+
focusable[0]?.focus();
|
|
48
|
+
}, [enabled, autoFocus, getFocusableElements]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!enabled) return;
|
|
51
|
+
const handleFocusIn = (e) => {
|
|
52
|
+
if (!(e.target instanceof Node) || !ref.current?.contains(e.target)) {
|
|
53
|
+
const focusable = getFocusableElements();
|
|
54
|
+
focusable[0]?.focus();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
document.addEventListener("focusin", handleFocusIn);
|
|
58
|
+
return () => document.removeEventListener("focusin", handleFocusIn);
|
|
59
|
+
}, [enabled, ref, getFocusableElements]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { FOCUSABLE_SELECTOR, useFocusTrap };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useFocusWithin() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [focused, setFocused] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const el = ref.current;
|
|
9
|
+
if (!el) return;
|
|
10
|
+
const onFocusIn = () => setFocused(true);
|
|
11
|
+
const onFocusOut = (e) => {
|
|
12
|
+
if (!(e.relatedTarget instanceof Node) || !el.contains(e.relatedTarget)) setFocused(false);
|
|
13
|
+
};
|
|
14
|
+
el.addEventListener("focusin", onFocusIn);
|
|
15
|
+
el.addEventListener("focusout", onFocusOut);
|
|
16
|
+
return () => {
|
|
17
|
+
el.removeEventListener("focusin", onFocusIn);
|
|
18
|
+
el.removeEventListener("focusout", onFocusOut);
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
return [ref, focused];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { useFocusWithin };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type changeevent = {
|
|
2
|
+
target: {
|
|
3
|
+
value: unknown;
|
|
4
|
+
};
|
|
5
|
+
};
|
|
6
|
+
interface FormState<T extends Record<string, unknown>> {
|
|
7
|
+
values: T;
|
|
8
|
+
errors: Partial<Record<keyof T, string>>;
|
|
9
|
+
touched: Partial<Record<keyof T, boolean>>;
|
|
10
|
+
dirty: boolean;
|
|
11
|
+
valid: boolean;
|
|
12
|
+
set: <K extends keyof T>(field: K, value: T[K]) => void;
|
|
13
|
+
setError: (field: keyof T, error: string | undefined) => void;
|
|
14
|
+
reset: () => void;
|
|
15
|
+
handleChange: <K extends keyof T>(field: K) => (e: changeevent) => void;
|
|
16
|
+
handleBlur: (field: keyof T) => () => void;
|
|
17
|
+
}
|
|
18
|
+
declare function useForm<T extends Record<string, unknown>>(initial: T, validate?: (values: T) => Partial<Record<keyof T, string>>): FormState<T>;
|
|
19
|
+
|
|
20
|
+
export { type FormState, useForm };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
function update(values, field, value) {
|
|
5
|
+
return { ...values, [field]: value };
|
|
6
|
+
}
|
|
7
|
+
function useForm(initial, validate) {
|
|
8
|
+
const [values, setValues] = useState(initial);
|
|
9
|
+
const [errors, setErrors] = useState({});
|
|
10
|
+
const [touched, setTouched] = useState({});
|
|
11
|
+
const dirty = JSON.stringify(values) !== JSON.stringify(initial);
|
|
12
|
+
const valid = Object.values(errors).every((e) => !e);
|
|
13
|
+
const set = useCallback(
|
|
14
|
+
(field, value) => {
|
|
15
|
+
setValues((prev) => {
|
|
16
|
+
const next = update(prev, field, value);
|
|
17
|
+
if (validate) setErrors(validate(next));
|
|
18
|
+
return next;
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
[validate]
|
|
22
|
+
);
|
|
23
|
+
const setError = useCallback((field, error) => {
|
|
24
|
+
setErrors((prev) => ({ ...prev, [field]: error }));
|
|
25
|
+
}, []);
|
|
26
|
+
const reset = useCallback(() => {
|
|
27
|
+
setValues(initial);
|
|
28
|
+
setErrors({});
|
|
29
|
+
setTouched({});
|
|
30
|
+
}, [initial]);
|
|
31
|
+
const handleChange = useCallback(
|
|
32
|
+
(field) => (e) => set(field, e.target.value),
|
|
33
|
+
[set]
|
|
34
|
+
);
|
|
35
|
+
const handleBlur = useCallback(
|
|
36
|
+
(field) => () => setTouched((prev) => ({ ...prev, [field]: true })),
|
|
37
|
+
[]
|
|
38
|
+
);
|
|
39
|
+
return { values, errors, touched, dirty, valid, set, setError, reset, handleChange, handleBlur };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useForm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface FullscreenResult {
|
|
2
|
+
isFullscreen: boolean;
|
|
3
|
+
enter: () => Promise<void>;
|
|
4
|
+
exit: () => Promise<void>;
|
|
5
|
+
toggle: () => Promise<void>;
|
|
6
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
7
|
+
}
|
|
8
|
+
declare function useFullscreen(): FullscreenResult;
|
|
9
|
+
|
|
10
|
+
export { type FullscreenResult, useFullscreen };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
function useFullscreen() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
function handler() {
|
|
9
|
+
setIsFullscreen(!!document.fullscreenElement);
|
|
10
|
+
}
|
|
11
|
+
document.addEventListener("fullscreenchange", handler);
|
|
12
|
+
return () => document.removeEventListener("fullscreenchange", handler);
|
|
13
|
+
}, []);
|
|
14
|
+
const enter = useCallback(async () => {
|
|
15
|
+
if (ref.current && !document.fullscreenElement) {
|
|
16
|
+
await ref.current.requestFullscreen();
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
const exit = useCallback(async () => {
|
|
20
|
+
if (document.fullscreenElement) {
|
|
21
|
+
await document.exitFullscreen();
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
const toggle = useCallback(async () => {
|
|
25
|
+
if (document.fullscreenElement) {
|
|
26
|
+
await document.exitFullscreen();
|
|
27
|
+
} else if (ref.current) {
|
|
28
|
+
await ref.current.requestFullscreen();
|
|
29
|
+
}
|
|
30
|
+
}, []);
|
|
31
|
+
return { isFullscreen, enter, exit, toggle, ref };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { useFullscreen };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface GeoPosition {
|
|
2
|
+
latitude: number | null;
|
|
3
|
+
longitude: number | null;
|
|
4
|
+
accuracy: number | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
}
|
|
8
|
+
declare function useGeolocation(watch?: boolean): GeoPosition;
|
|
9
|
+
|
|
10
|
+
export { type GeoPosition, useGeolocation };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useGeolocation(watch = false) {
|
|
5
|
+
const [pos, setPos] = useState({
|
|
6
|
+
latitude: null,
|
|
7
|
+
longitude: null,
|
|
8
|
+
accuracy: null,
|
|
9
|
+
loading: true,
|
|
10
|
+
error: null
|
|
11
|
+
});
|
|
12
|
+
const onSuccess = useCallback((p) => {
|
|
13
|
+
setPos({
|
|
14
|
+
latitude: p.coords.latitude,
|
|
15
|
+
longitude: p.coords.longitude,
|
|
16
|
+
accuracy: p.coords.accuracy,
|
|
17
|
+
loading: false,
|
|
18
|
+
error: null
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
21
|
+
const onError = useCallback((e) => {
|
|
22
|
+
setPos((prev) => ({ ...prev, loading: false, error: e.message }));
|
|
23
|
+
}, []);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
26
|
+
setPos((prev) => ({ ...prev, loading: false, error: "unsupported" }));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
navigator.geolocation.getCurrentPosition(onSuccess, onError);
|
|
30
|
+
if (watch) {
|
|
31
|
+
const id = navigator.geolocation.watchPosition(onSuccess, onError);
|
|
32
|
+
return () => navigator.geolocation.clearWatch(id);
|
|
33
|
+
}
|
|
34
|
+
}, [watch, onSuccess, onError]);
|
|
35
|
+
return pos;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { useGeolocation };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
3
|
+
|
|
4
|
+
function useHash() {
|
|
5
|
+
const [hash, setHash] = useState("");
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setHash(window.location.hash);
|
|
8
|
+
function handle() {
|
|
9
|
+
setHash(window.location.hash);
|
|
10
|
+
}
|
|
11
|
+
window.addEventListener("hashchange", handle);
|
|
12
|
+
return () => window.removeEventListener("hashchange", handle);
|
|
13
|
+
}, []);
|
|
14
|
+
const updateHash = useCallback((newHash) => {
|
|
15
|
+
const formatted = newHash.startsWith("#") ? newHash : `#${newHash}`;
|
|
16
|
+
window.location.hash = formatted;
|
|
17
|
+
}, []);
|
|
18
|
+
return [hash, updateHash];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useHash };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function matches(e, binding) {
|
|
5
|
+
if (e.key.toLowerCase() !== binding.key.toLowerCase()) return false;
|
|
6
|
+
if (binding.ctrl && !e.ctrlKey) return false;
|
|
7
|
+
if (binding.meta && !e.metaKey) return false;
|
|
8
|
+
if (binding.shift && !e.shiftKey) return false;
|
|
9
|
+
if (binding.alt && !e.altKey) return false;
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
function useHotkeys(bindings) {
|
|
13
|
+
const ref = useRef(bindings);
|
|
14
|
+
ref.current = bindings;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
function handle(e) {
|
|
17
|
+
if (!(e.target instanceof HTMLElement)) return;
|
|
18
|
+
const target = e.target;
|
|
19
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const binding of ref.current) {
|
|
23
|
+
if (matches(e, binding)) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
binding.handler();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
window.addEventListener("keydown", handle);
|
|
31
|
+
return () => window.removeEventListener("keydown", handle);
|
|
32
|
+
}, []);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useHotkeys };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useHover() {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [hovered, setHovered] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const el = ref.current;
|
|
9
|
+
if (!el) return;
|
|
10
|
+
const enter = () => setHovered(true);
|
|
11
|
+
const leave = () => setHovered(false);
|
|
12
|
+
el.addEventListener("mouseenter", enter);
|
|
13
|
+
el.addEventListener("mouseleave", leave);
|
|
14
|
+
return () => {
|
|
15
|
+
el.removeEventListener("mouseenter", enter);
|
|
16
|
+
el.removeEventListener("mouseleave", leave);
|
|
17
|
+
};
|
|
18
|
+
}, []);
|
|
19
|
+
return [ref, hovered];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { useHover };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useIdle(timeout = 6e4) {
|
|
5
|
+
const [idle, setIdle] = useState(false);
|
|
6
|
+
const timer = useRef(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
function reset() {
|
|
9
|
+
setIdle(false);
|
|
10
|
+
if (timer.current) clearTimeout(timer.current);
|
|
11
|
+
timer.current = setTimeout(() => setIdle(true), timeout);
|
|
12
|
+
}
|
|
13
|
+
const events = ["mousemove", "keydown", "scroll", "touchstart", "click"];
|
|
14
|
+
for (const event of events) {
|
|
15
|
+
window.addEventListener(event, reset, { passive: true });
|
|
16
|
+
}
|
|
17
|
+
reset();
|
|
18
|
+
return () => {
|
|
19
|
+
for (const event of events) {
|
|
20
|
+
window.removeEventListener(event, reset);
|
|
21
|
+
}
|
|
22
|
+
if (timer.current) clearTimeout(timer.current);
|
|
23
|
+
};
|
|
24
|
+
}, [timeout]);
|
|
25
|
+
return idle;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { useIdle };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface InfiniteScrollResult {
|
|
2
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
3
|
+
loading: boolean;
|
|
4
|
+
done: boolean;
|
|
5
|
+
setDone: (done: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
declare function useInfiniteScroll(onLoadMore: () => Promise<void>, threshold?: number): InfiniteScrollResult;
|
|
8
|
+
|
|
9
|
+
export { type InfiniteScrollResult, useInfiniteScroll };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useInfiniteScroll(onLoadMore, threshold = 200) {
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
const [loading, setLoading] = useState(false);
|
|
7
|
+
const [done, setDone] = useState(false);
|
|
8
|
+
const loadingRef = useRef(false);
|
|
9
|
+
const handleScroll = useCallback(() => {
|
|
10
|
+
if (loadingRef.current || done) return;
|
|
11
|
+
const el = ref.current;
|
|
12
|
+
const target = el || document.documentElement;
|
|
13
|
+
const scrollBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
14
|
+
if (scrollBottom < threshold) {
|
|
15
|
+
loadingRef.current = true;
|
|
16
|
+
setLoading(true);
|
|
17
|
+
onLoadMore().finally(() => {
|
|
18
|
+
loadingRef.current = false;
|
|
19
|
+
setLoading(false);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}, [onLoadMore, threshold, done]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const el = ref.current || window;
|
|
25
|
+
el.addEventListener("scroll", handleScroll, { passive: true });
|
|
26
|
+
return () => el.removeEventListener("scroll", handleScroll);
|
|
27
|
+
}, [handleScroll]);
|
|
28
|
+
return { ref, loading, done, setDone };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { useInfiniteScroll };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useInterval(callback, delay) {
|
|
5
|
+
const savedCallback = useRef(callback);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
savedCallback.current = callback;
|
|
8
|
+
}, [callback]);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (delay === null) return;
|
|
11
|
+
const id = setInterval(() => savedCallback.current(), delay);
|
|
12
|
+
return () => clearInterval(id);
|
|
13
|
+
}, [delay]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useInterval };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
interface InViewOptions {
|
|
4
|
+
threshold?: number;
|
|
5
|
+
rootMargin?: string;
|
|
6
|
+
once?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare function useInView<T extends HTMLElement = HTMLElement>(options?: InViewOptions): [RefObject<T | null>, boolean];
|
|
9
|
+
|
|
10
|
+
export { type InViewOptions, useInView };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useInView(options = {}) {
|
|
5
|
+
const { threshold = 0, rootMargin = "0px", once = false } = options;
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const [inView, setInView] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const element = ref.current;
|
|
10
|
+
if (!element) return;
|
|
11
|
+
const observer = new IntersectionObserver(
|
|
12
|
+
([entry]) => {
|
|
13
|
+
if (!entry) return;
|
|
14
|
+
const visible = entry.isIntersecting;
|
|
15
|
+
setInView(visible);
|
|
16
|
+
if (visible && once) {
|
|
17
|
+
observer.disconnect();
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{ threshold, rootMargin }
|
|
21
|
+
);
|
|
22
|
+
observer.observe(element);
|
|
23
|
+
return () => observer.disconnect();
|
|
24
|
+
}, [threshold, rootMargin, once]);
|
|
25
|
+
return [ref, inView];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { useInView };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DocMeta } from '../content.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../schema.js';
|
|
4
|
+
|
|
5
|
+
declare function useKeyboardNav(docs: DocMeta[], basePath?: string): void;
|
|
6
|
+
interface ShortcutOptions {
|
|
7
|
+
ctrl?: boolean;
|
|
8
|
+
meta?: boolean;
|
|
9
|
+
shift?: boolean;
|
|
10
|
+
preventDefault?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function useKeyboardShortcut(key: string, callback: () => void, options?: ShortcutOptions): void;
|
|
13
|
+
|
|
14
|
+
export { useKeyboardNav, useKeyboardShortcut };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { usePathname, useRouter } from 'next/navigation';
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
function sortDocs(docs) {
|
|
6
|
+
const intro = [];
|
|
7
|
+
const components = [];
|
|
8
|
+
const api = [];
|
|
9
|
+
const other = [];
|
|
10
|
+
for (const doc of docs) {
|
|
11
|
+
if (doc.slug.startsWith("components/")) {
|
|
12
|
+
components.push(doc);
|
|
13
|
+
} else if (doc.slug.startsWith("api/")) {
|
|
14
|
+
api.push(doc);
|
|
15
|
+
} else if (!doc.slug || doc.slug.match(/^[^/]+$/)) {
|
|
16
|
+
intro.push(doc);
|
|
17
|
+
} else {
|
|
18
|
+
other.push(doc);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const sortByOrder = (a, b) => (a.order ?? 999) - (b.order ?? 999);
|
|
22
|
+
return [
|
|
23
|
+
...intro.sort(sortByOrder),
|
|
24
|
+
...components.sort(sortByOrder),
|
|
25
|
+
...api.sort(sortByOrder),
|
|
26
|
+
...other.sort(sortByOrder)
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
function useKeyboardNav(docs, basePath = "/docs") {
|
|
30
|
+
const pathname = usePathname();
|
|
31
|
+
const router = useRouter();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const sorted = sortDocs(docs);
|
|
34
|
+
const paths = sorted.map((d) => d.slug ? `${basePath}/${d.slug}` : basePath);
|
|
35
|
+
const current = paths.indexOf(pathname);
|
|
36
|
+
const handleKeyDown = (e) => {
|
|
37
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
38
|
+
if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
|
|
39
|
+
if (e.key === "ArrowRight" && current < paths.length - 1) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
const next = paths[current + 1];
|
|
42
|
+
if (next) router.push(next);
|
|
43
|
+
}
|
|
44
|
+
if (e.key === "ArrowLeft" && current > 0) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
const prev = paths[current - 1];
|
|
47
|
+
if (prev) router.push(prev);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
51
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
52
|
+
}, [docs, pathname, router, basePath]);
|
|
53
|
+
}
|
|
54
|
+
function editable(target) {
|
|
55
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
56
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA") return true;
|
|
57
|
+
return target.isContentEditable;
|
|
58
|
+
}
|
|
59
|
+
function useKeyboardShortcut(key, callback, options = {}) {
|
|
60
|
+
const callbackRef = useRef(callback);
|
|
61
|
+
callbackRef.current = callback;
|
|
62
|
+
const optionsRef = useRef(options);
|
|
63
|
+
optionsRef.current = options;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
function handler(e) {
|
|
66
|
+
if (editable(e.target)) return;
|
|
67
|
+
const opts = optionsRef.current;
|
|
68
|
+
if (opts.ctrl && !e.ctrlKey) return;
|
|
69
|
+
if (opts.meta && !e.metaKey) return;
|
|
70
|
+
if (opts.shift && !e.shiftKey) return;
|
|
71
|
+
if (e.key.toLowerCase() !== key.toLowerCase()) return;
|
|
72
|
+
if (opts.preventDefault !== false) {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
callbackRef.current();
|
|
76
|
+
}
|
|
77
|
+
window.addEventListener("keydown", handler);
|
|
78
|
+
return () => window.removeEventListener("keydown", handler);
|
|
79
|
+
}, [key]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { useKeyboardNav, useKeyboardShortcut };
|