@nikala-ui/docs 0.12.0
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 +22 -0
- package/dist/cli/commands/build.d.ts +5 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +27 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +7 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +32 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +308 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/preview.d.ts +7 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +24 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +7 -0
- package/dist/cli/commands/serve.d.ts.map +1 -0
- package/dist/cli/commands/serve.js +33 -0
- package/dist/cli/commands/serve.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +53 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/client/App.d.ts +5 -0
- package/dist/client/App.d.ts.map +1 -0
- package/dist/client/App.jsx +31 -0
- package/dist/client/App.jsx.map +1 -0
- package/dist/client/app-types.d.ts +14 -0
- package/dist/client/app-types.d.ts.map +1 -0
- package/dist/client/app-types.js +2 -0
- package/dist/client/app-types.js.map +1 -0
- package/dist/client/components/DocsLayoutShell.d.ts +21 -0
- package/dist/client/components/DocsLayoutShell.d.ts.map +1 -0
- package/dist/client/components/DocsLayoutShell.jsx +14 -0
- package/dist/client/components/DocsLayoutShell.jsx.map +1 -0
- package/dist/client/components/DocsPageContent.d.ts +9 -0
- package/dist/client/components/DocsPageContent.d.ts.map +1 -0
- package/dist/client/components/DocsPageContent.jsx +10 -0
- package/dist/client/components/DocsPageContent.jsx.map +1 -0
- package/dist/client/entry.d.ts +2 -0
- package/dist/client/entry.d.ts.map +1 -0
- package/dist/client/entry.jsx +28 -0
- package/dist/client/entry.jsx.map +1 -0
- package/dist/client/index.html +21 -0
- package/dist/client/navigation/page-navigation.d.ts +9 -0
- package/dist/client/navigation/page-navigation.d.ts.map +1 -0
- package/dist/client/navigation/page-navigation.js +51 -0
- package/dist/client/navigation/page-navigation.js.map +1 -0
- package/dist/client/routing/use-docs-router.d.ts +17 -0
- package/dist/client/routing/use-docs-router.d.ts.map +1 -0
- package/dist/client/routing/use-docs-router.js +71 -0
- package/dist/client/routing/use-docs-router.js.map +1 -0
- package/dist/client/ssr-entry.d.ts +3 -0
- package/dist/client/ssr-entry.d.ts.map +1 -0
- package/dist/client/ssr-entry.jsx +13 -0
- package/dist/client/ssr-entry.jsx.map +1 -0
- package/dist/client/style.css +183 -0
- package/dist/client/utils/sidebar.d.ts +2 -0
- package/dist/client/utils/sidebar.d.ts.map +1 -0
- package/dist/client/utils/sidebar.js +2 -0
- package/dist/client/utils/sidebar.js.map +1 -0
- package/dist/components/mdx-components.d.ts +34 -0
- package/dist/components/mdx-components.d.ts.map +1 -0
- package/dist/components/mdx-components.jsx +131 -0
- package/dist/components/mdx-components.jsx.map +1 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +105 -0
- package/dist/config.js.map +1 -0
- package/dist/core/content-scanner.d.ts +10 -0
- package/dist/core/content-scanner.d.ts.map +1 -0
- package/dist/core/content-scanner.js +153 -0
- package/dist/core/content-scanner.js.map +1 -0
- package/dist/core/route-tree.d.ts +19 -0
- package/dist/core/route-tree.d.ts.map +1 -0
- package/dist/core/route-tree.js +176 -0
- package/dist/core/route-tree.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +9 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/mdx/compiler.d.ts +13 -0
- package/dist/mdx/compiler.d.ts.map +1 -0
- package/dist/mdx/compiler.js +38 -0
- package/dist/mdx/compiler.js.map +1 -0
- package/dist/mdx/highlighter.d.ts +22 -0
- package/dist/mdx/highlighter.d.ts.map +1 -0
- package/dist/mdx/highlighter.js +139 -0
- package/dist/mdx/highlighter.js.map +1 -0
- package/dist/mdx/rehype-shiki.d.ts +3 -0
- package/dist/mdx/rehype-shiki.d.ts.map +1 -0
- package/dist/mdx/rehype-shiki.js +83 -0
- package/dist/mdx/rehype-shiki.js.map +1 -0
- package/dist/navigation/index.d.ts +2 -0
- package/dist/navigation/index.d.ts.map +1 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/navigation/sidebar-state.d.ts +6 -0
- package/dist/navigation/sidebar-state.d.ts.map +1 -0
- package/dist/navigation/sidebar-state.js +20 -0
- package/dist/navigation/sidebar-state.js.map +1 -0
- package/dist/navigation/sidebar-tree.d.ts +7 -0
- package/dist/navigation/sidebar-tree.d.ts.map +1 -0
- package/dist/navigation/sidebar-tree.js +11 -0
- package/dist/navigation/sidebar-tree.js.map +1 -0
- package/dist/registry/accordion.json +18 -0
- package/dist/registry/alert.json +18 -0
- package/dist/registry/api-table.json +21 -0
- package/dist/registry/aspect-ratio.json +17 -0
- package/dist/registry/avatar.json +17 -0
- package/dist/registry/badge.json +18 -0
- package/dist/registry/banner.json +19 -0
- package/dist/registry/breadcrumb.json +17 -0
- package/dist/registry/bubble.json +18 -0
- package/dist/registry/button-group.json +20 -0
- package/dist/registry/button.json +21 -0
- package/dist/registry/callout.json +19 -0
- package/dist/registry/card.json +17 -0
- package/dist/registry/checkbox.json +20 -0
- package/dist/registry/code-block.json +26 -0
- package/dist/registry/code-group.json +20 -0
- package/dist/registry/collapsible.json +18 -0
- package/dist/registry/combobox.json +21 -0
- package/dist/registry/command.json +27 -0
- package/dist/registry/component-viewer.json +25 -0
- package/dist/registry/container.json +18 -0
- package/dist/registry/context-menu.json +24 -0
- package/dist/registry/create-active-element.json +13 -0
- package/dist/registry/create-app-updater.json +13 -0
- package/dist/registry/create-audio.json +7 -0
- package/dist/registry/create-battery.json +13 -0
- package/dist/registry/create-chat-scroll.json +13 -0
- package/dist/registry/create-click-outside.json +13 -0
- package/dist/registry/create-clipboard.json +13 -0
- package/dist/registry/create-color-mode.json +13 -0
- package/dist/registry/create-controllable-signal.json +13 -0
- package/dist/registry/create-debounce.json +13 -0
- package/dist/registry/create-disclosure.json +13 -0
- package/dist/registry/create-document-tabs.json +13 -0
- package/dist/registry/create-document-title.json +13 -0
- package/dist/registry/create-drop-zone.json +13 -0
- package/dist/registry/create-event-source.json +13 -0
- package/dist/registry/create-favicon.json +13 -0
- package/dist/registry/create-fetch.json +13 -0
- package/dist/registry/create-focus-trap.json +13 -0
- package/dist/registry/create-form.json +13 -0
- package/dist/registry/create-fullscreen.json +13 -0
- package/dist/registry/create-geolocation.json +13 -0
- package/dist/registry/create-global-shortcut.json +13 -0
- package/dist/registry/create-hover.json +13 -0
- package/dist/registry/create-idle.json +13 -0
- package/dist/registry/create-infinite-scroll.json +13 -0
- package/dist/registry/create-input-mask.json +13 -0
- package/dist/registry/create-intersection-observer.json +13 -0
- package/dist/registry/create-keybindings.json +13 -0
- package/dist/registry/create-lock-scroll.json +13 -0
- package/dist/registry/create-long-press.json +13 -0
- package/dist/registry/create-media-query.json +13 -0
- package/dist/registry/create-mouse-position.json +13 -0
- package/dist/registry/create-network-status.json +13 -0
- package/dist/registry/create-orientation.json +13 -0
- package/dist/registry/create-pagination.json +13 -0
- package/dist/registry/create-permission.json +13 -0
- package/dist/registry/create-previous.json +13 -0
- package/dist/registry/create-resize-observer.json +13 -0
- package/dist/registry/create-scroll-into-view.json +13 -0
- package/dist/registry/create-scroll-position.json +13 -0
- package/dist/registry/create-storage.json +13 -0
- package/dist/registry/create-tauri-window.json +13 -0
- package/dist/registry/create-timer.json +13 -0
- package/dist/registry/create-tiptap-editor.json +34 -0
- package/dist/registry/create-undo-redo.json +13 -0
- package/dist/registry/create-web-notification.json +13 -0
- package/dist/registry/create-websocket.json +13 -0
- package/dist/registry/create-window-size.json +13 -0
- package/dist/registry/dialog.json +21 -0
- package/dist/registry/dropdown-menu.json +22 -0
- package/dist/registry/dropzone.json +21 -0
- package/dist/registry/empty.json +17 -0
- package/dist/registry/field.json +20 -0
- package/dist/registry/file-tree.json +21 -0
- package/dist/registry/footer.json +18 -0
- package/dist/registry/forgot-password-01.json +28 -0
- package/dist/registry/form-message.json +17 -0
- package/dist/registry/form.json +17 -0
- package/dist/registry/hero-01.json +22 -0
- package/dist/registry/hover-card.json +18 -0
- package/dist/registry/icon-button.json +20 -0
- package/dist/registry/index.json +1489 -0
- package/dist/registry/input-group.json +21 -0
- package/dist/registry/input.json +17 -0
- package/dist/registry/kbd.json +18 -0
- package/dist/registry/label.json +18 -0
- package/dist/registry/list.json +20 -0
- package/dist/registry/login-01.json +28 -0
- package/dist/registry/logo.json +17 -0
- package/dist/registry/marker.json +17 -0
- package/dist/registry/marquee.json +17 -0
- package/dist/registry/message.json +17 -0
- package/dist/registry/navbar.json +19 -0
- package/dist/registry/navigation-menu.json +22 -0
- package/dist/registry/number-input.json +24 -0
- package/dist/registry/otp-verification-01.json +26 -0
- package/dist/registry/package-manager-tabs.json +24 -0
- package/dist/registry/pager.json +21 -0
- package/dist/registry/pagination.json +22 -0
- package/dist/registry/pin-input.json +17 -0
- package/dist/registry/popover.json +22 -0
- package/dist/registry/progress.json +18 -0
- package/dist/registry/radio-group.json +18 -0
- package/dist/registry/rating.json +19 -0
- package/dist/registry/register-01.json +31 -0
- package/dist/registry/resizable.json +21 -0
- package/dist/registry/review-card.json +23 -0
- package/dist/registry/rich-text-editor.json +95 -0
- package/dist/registry/scroll-area.json +21 -0
- package/dist/registry/section-heading.json +21 -0
- package/dist/registry/select.json +22 -0
- package/dist/registry/separator.json +17 -0
- package/dist/registry/sheet.json +22 -0
- package/dist/registry/sidebar.json +24 -0
- package/dist/registry/skeleton.json +17 -0
- package/dist/registry/slider.json +18 -0
- package/dist/registry/spinner.json +18 -0
- package/dist/registry/stat.json +19 -0
- package/dist/registry/status.json +18 -0
- package/dist/registry/steps.json +20 -0
- package/dist/registry/switch.json +20 -0
- package/dist/registry/table-of-contents.json +23 -0
- package/dist/registry/table.json +17 -0
- package/dist/registry/tabs.json +20 -0
- package/dist/registry/textarea.json +17 -0
- package/dist/registry/theme-manager.json +39 -0
- package/dist/registry/timeline.json +18 -0
- package/dist/registry/titlebar-tabs.json +24 -0
- package/dist/registry/titlebar.json +26 -0
- package/dist/registry/toast.json +20 -0
- package/dist/registry/toggle-group.json +21 -0
- package/dist/registry/toggle.json +18 -0
- package/dist/registry/tooltip.json +18 -0
- package/dist/registry/updater-modal.json +26 -0
- package/dist/server/index.d.ts +18 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +526 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/plugin.d.ts +10 -0
- package/dist/server/plugin.d.ts.map +1 -0
- package/dist/server/plugin.js +271 -0
- package/dist/server/plugin.js.map +1 -0
- package/dist/themes/default/content/breadcrumbs.d.ts +4 -0
- package/dist/themes/default/content/breadcrumbs.d.ts.map +1 -0
- package/dist/themes/default/content/breadcrumbs.jsx +31 -0
- package/dist/themes/default/content/breadcrumbs.jsx.map +1 -0
- package/dist/themes/default/content/pager.d.ts +5 -0
- package/dist/themes/default/content/pager.d.ts.map +1 -0
- package/dist/themes/default/content/pager.jsx +9 -0
- package/dist/themes/default/content/pager.jsx.map +1 -0
- package/dist/themes/default/content/table-of-contents.d.ts +4 -0
- package/dist/themes/default/content/table-of-contents.d.ts.map +1 -0
- package/dist/themes/default/content/table-of-contents.jsx +19 -0
- package/dist/themes/default/content/table-of-contents.jsx.map +1 -0
- package/dist/themes/default/index.d.ts +11 -0
- package/dist/themes/default/index.d.ts.map +1 -0
- package/dist/themes/default/index.js +30 -0
- package/dist/themes/default/index.js.map +1 -0
- package/dist/themes/default/layout.d.ts +4 -0
- package/dist/themes/default/layout.d.ts.map +1 -0
- package/dist/themes/default/layout.jsx +75 -0
- package/dist/themes/default/layout.jsx.map +1 -0
- package/dist/themes/default/navbar.d.ts +4 -0
- package/dist/themes/default/navbar.d.ts.map +1 -0
- package/dist/themes/default/navbar.jsx +74 -0
- package/dist/themes/default/navbar.jsx.map +1 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.d.ts +4 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.d.ts.map +1 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx +22 -0
- package/dist/themes/default/navigation/mobile-table-of-contents.jsx.map +1 -0
- package/dist/themes/default/navigation/sidebar-tree.d.ts +8 -0
- package/dist/themes/default/navigation/sidebar-tree.d.ts.map +1 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx +100 -0
- package/dist/themes/default/navigation/sidebar-tree.jsx.map +1 -0
- package/dist/themes/default/overlays/search-dialog.d.ts +4 -0
- package/dist/themes/default/overlays/search-dialog.d.ts.map +1 -0
- package/dist/themes/default/overlays/search-dialog.jsx +34 -0
- package/dist/themes/default/overlays/search-dialog.jsx.map +1 -0
- package/dist/themes/default/sidebar.d.ts +4 -0
- package/dist/themes/default/sidebar.d.ts.map +1 -0
- package/dist/themes/default/sidebar.jsx +60 -0
- package/dist/themes/default/sidebar.jsx.map +1 -0
- package/dist/themes/index.d.ts +4 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +5 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/types.d.ts +83 -0
- package/dist/themes/types.d.ts.map +1 -0
- package/dist/themes/types.js +2 -0
- package/dist/themes/types.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/vendor/core-src/index.css +11 -0
- package/dist/vendor/core-src/index.ts +48 -0
- package/dist/vendor/core-src/lib/cn.ts +9 -0
- package/dist/vendor/core-src/registry/blocks/forgot-password-01.tsx +141 -0
- package/dist/vendor/core-src/registry/blocks/hero-01.tsx +28 -0
- package/dist/vendor/core-src/registry/blocks/login-01.tsx +231 -0
- package/dist/vendor/core-src/registry/blocks/otp-verification-01.tsx +170 -0
- package/dist/vendor/core-src/registry/blocks/register-01.tsx +318 -0
- package/dist/vendor/core-src/registry/components/ui/accordion.tsx +128 -0
- package/dist/vendor/core-src/registry/components/ui/alert.tsx +155 -0
- package/dist/vendor/core-src/registry/components/ui/api-table.tsx +117 -0
- package/dist/vendor/core-src/registry/components/ui/aspect-ratio.tsx +31 -0
- package/dist/vendor/core-src/registry/components/ui/avatar.tsx +114 -0
- package/dist/vendor/core-src/registry/components/ui/badge.tsx +56 -0
- package/dist/vendor/core-src/registry/components/ui/banner.tsx +187 -0
- package/dist/vendor/core-src/registry/components/ui/breadcrumb.tsx +136 -0
- package/dist/vendor/core-src/registry/components/ui/bubble.tsx +142 -0
- package/dist/vendor/core-src/registry/components/ui/button-group.tsx +42 -0
- package/dist/vendor/core-src/registry/components/ui/button.tsx +82 -0
- package/dist/vendor/core-src/registry/components/ui/callout.tsx +137 -0
- package/dist/vendor/core-src/registry/components/ui/card.tsx +113 -0
- package/dist/vendor/core-src/registry/components/ui/checkbox.tsx +74 -0
- package/dist/vendor/core-src/registry/components/ui/code-block.tsx +326 -0
- package/dist/vendor/core-src/registry/components/ui/code-group.tsx +105 -0
- package/dist/vendor/core-src/registry/components/ui/collapsible.tsx +73 -0
- package/dist/vendor/core-src/registry/components/ui/combobox.tsx +299 -0
- package/dist/vendor/core-src/registry/components/ui/command.tsx +378 -0
- package/dist/vendor/core-src/registry/components/ui/component-viewer.tsx +363 -0
- package/dist/vendor/core-src/registry/components/ui/container.tsx +45 -0
- package/dist/vendor/core-src/registry/components/ui/context-menu.tsx +237 -0
- package/dist/vendor/core-src/registry/components/ui/dialog.tsx +200 -0
- package/dist/vendor/core-src/registry/components/ui/dropdown-menu.tsx +298 -0
- package/dist/vendor/core-src/registry/components/ui/dropzone.tsx +189 -0
- package/dist/vendor/core-src/registry/components/ui/empty.tsx +83 -0
- package/dist/vendor/core-src/registry/components/ui/field.tsx +71 -0
- package/dist/vendor/core-src/registry/components/ui/file-tree.tsx +181 -0
- package/dist/vendor/core-src/registry/components/ui/footer.tsx +247 -0
- package/dist/vendor/core-src/registry/components/ui/form-message.tsx +36 -0
- package/dist/vendor/core-src/registry/components/ui/form.tsx +21 -0
- package/dist/vendor/core-src/registry/components/ui/hover-card.tsx +105 -0
- package/dist/vendor/core-src/registry/components/ui/icon-button.tsx +34 -0
- package/dist/vendor/core-src/registry/components/ui/input-group.tsx +80 -0
- package/dist/vendor/core-src/registry/components/ui/input.tsx +28 -0
- package/dist/vendor/core-src/registry/components/ui/kbd.tsx +73 -0
- package/dist/vendor/core-src/registry/components/ui/label.tsx +30 -0
- package/dist/vendor/core-src/registry/components/ui/list.tsx +222 -0
- package/dist/vendor/core-src/registry/components/ui/logo.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/marker.tsx +102 -0
- package/dist/vendor/core-src/registry/components/ui/marquee.tsx +118 -0
- package/dist/vendor/core-src/registry/components/ui/message.tsx +168 -0
- package/dist/vendor/core-src/registry/components/ui/navbar.tsx +375 -0
- package/dist/vendor/core-src/registry/components/ui/navigation-menu.tsx +358 -0
- package/dist/vendor/core-src/registry/components/ui/number-input.tsx +150 -0
- package/dist/vendor/core-src/registry/components/ui/package-manager-tabs.tsx +226 -0
- package/dist/vendor/core-src/registry/components/ui/pager.tsx +102 -0
- package/dist/vendor/core-src/registry/components/ui/pagination.tsx +258 -0
- package/dist/vendor/core-src/registry/components/ui/pin-input.tsx +198 -0
- package/dist/vendor/core-src/registry/components/ui/popover.tsx +90 -0
- package/dist/vendor/core-src/registry/components/ui/progress.tsx +66 -0
- package/dist/vendor/core-src/registry/components/ui/radio-group.tsx +95 -0
- package/dist/vendor/core-src/registry/components/ui/rating.tsx +185 -0
- package/dist/vendor/core-src/registry/components/ui/resizable.tsx +195 -0
- package/dist/vendor/core-src/registry/components/ui/review-card.tsx +195 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/bubble-menu.tsx +236 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/editor.tsx +308 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/extensions.ts +116 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/footer.tsx +36 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/image-dialog.tsx +75 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/index.ts +11 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/link-dialog.tsx +48 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/markdown.ts +170 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/slash-command.tsx +301 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/table-controls.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/toolbar.tsx +465 -0
- package/dist/vendor/core-src/registry/components/ui/rich-text-editor/use-editor.ts +231 -0
- package/dist/vendor/core-src/registry/components/ui/scroll-area.tsx +228 -0
- package/dist/vendor/core-src/registry/components/ui/section-heading.tsx +108 -0
- package/dist/vendor/core-src/registry/components/ui/select.tsx +156 -0
- package/dist/vendor/core-src/registry/components/ui/separator.tsx +37 -0
- package/dist/vendor/core-src/registry/components/ui/sheet.tsx +220 -0
- package/dist/vendor/core-src/registry/components/ui/sidebar.tsx +692 -0
- package/dist/vendor/core-src/registry/components/ui/skeleton.tsx +24 -0
- package/dist/vendor/core-src/registry/components/ui/slider.tsx +153 -0
- package/dist/vendor/core-src/registry/components/ui/spinner.tsx +41 -0
- package/dist/vendor/core-src/registry/components/ui/stat.tsx +245 -0
- package/dist/vendor/core-src/registry/components/ui/status.tsx +121 -0
- package/dist/vendor/core-src/registry/components/ui/steps.tsx +198 -0
- package/dist/vendor/core-src/registry/components/ui/switch.tsx +68 -0
- package/dist/vendor/core-src/registry/components/ui/table-of-contents.tsx +131 -0
- package/dist/vendor/core-src/registry/components/ui/table.tsx +160 -0
- package/dist/vendor/core-src/registry/components/ui/tabs.tsx +204 -0
- package/dist/vendor/core-src/registry/components/ui/textarea.tsx +82 -0
- package/dist/vendor/core-src/registry/components/ui/theme-toggle.tsx +238 -0
- package/dist/vendor/core-src/registry/components/ui/timeline.tsx +350 -0
- package/dist/vendor/core-src/registry/components/ui/titlebar-tabs.tsx +773 -0
- package/dist/vendor/core-src/registry/components/ui/titlebar.tsx +468 -0
- package/dist/vendor/core-src/registry/components/ui/toast.tsx +124 -0
- package/dist/vendor/core-src/registry/components/ui/toggle-group.tsx +203 -0
- package/dist/vendor/core-src/registry/components/ui/toggle.tsx +101 -0
- package/dist/vendor/core-src/registry/components/ui/tooltip.tsx +41 -0
- package/dist/vendor/core-src/registry/components/ui/updater-modal.tsx +254 -0
- package/dist/vendor/core-src/registry/index.ts +50 -0
- package/dist/vendor/core-src/registry/metadata.ts +742 -0
- package/dist/vendor/core-src/registry/providers/theme-provider.tsx +216 -0
- package/dist/vendor/core-src/registry/providers/theme-script.tsx +78 -0
- package/dist/vendor/core-src/registry/providers/theme-transitions.ts +139 -0
- package/dist/vendor/hooks-src/create-active-element.ts +51 -0
- package/dist/vendor/hooks-src/create-app-updater.ts +272 -0
- package/dist/vendor/hooks-src/create-audio-video.ts +444 -0
- package/dist/vendor/hooks-src/create-battery.ts +78 -0
- package/dist/vendor/hooks-src/create-chat-scroll.ts +113 -0
- package/dist/vendor/hooks-src/create-click-outside.ts +82 -0
- package/dist/vendor/hooks-src/create-clipboard.ts +69 -0
- package/dist/vendor/hooks-src/create-color-mode.ts +115 -0
- package/dist/vendor/hooks-src/create-controllable-signal.ts +56 -0
- package/dist/vendor/hooks-src/create-debounce.ts +90 -0
- package/dist/vendor/hooks-src/create-disclosure.ts +82 -0
- package/dist/vendor/hooks-src/create-document-tabs.ts +267 -0
- package/dist/vendor/hooks-src/create-document-title.ts +33 -0
- package/dist/vendor/hooks-src/create-drop-zone.ts +317 -0
- package/dist/vendor/hooks-src/create-event-source.ts +126 -0
- package/dist/vendor/hooks-src/create-favicon.ts +52 -0
- package/dist/vendor/hooks-src/create-fetch.ts +93 -0
- package/dist/vendor/hooks-src/create-focus-trap.ts +94 -0
- package/dist/vendor/hooks-src/create-form.ts +200 -0
- package/dist/vendor/hooks-src/create-fullscreen.ts +105 -0
- package/dist/vendor/hooks-src/create-geolocation.ts +140 -0
- package/dist/vendor/hooks-src/create-global-shortcut.ts +140 -0
- package/dist/vendor/hooks-src/create-hover.ts +88 -0
- package/dist/vendor/hooks-src/create-idle.ts +109 -0
- package/dist/vendor/hooks-src/create-infinite-scroll.ts +90 -0
- package/dist/vendor/hooks-src/create-input-mask.ts +109 -0
- package/dist/vendor/hooks-src/create-intersection-observer.ts +82 -0
- package/dist/vendor/hooks-src/create-keybindings.ts +148 -0
- package/dist/vendor/hooks-src/create-lock-scroll.ts +97 -0
- package/dist/vendor/hooks-src/create-long-press.ts +85 -0
- package/dist/vendor/hooks-src/create-media-query.ts +94 -0
- package/dist/vendor/hooks-src/create-mouse-position.ts +87 -0
- package/dist/vendor/hooks-src/create-network-status.ts +100 -0
- package/dist/vendor/hooks-src/create-orientation.ts +129 -0
- package/dist/vendor/hooks-src/create-pagination.ts +208 -0
- package/dist/vendor/hooks-src/create-permission.ts +91 -0
- package/dist/vendor/hooks-src/create-previous.ts +21 -0
- package/dist/vendor/hooks-src/create-resize-observer.ts +89 -0
- package/dist/vendor/hooks-src/create-scroll-into-view.ts +57 -0
- package/dist/vendor/hooks-src/create-scroll-position.ts +129 -0
- package/dist/vendor/hooks-src/create-storage.ts +106 -0
- package/dist/vendor/hooks-src/create-tauri-window.ts +628 -0
- package/dist/vendor/hooks-src/create-timer.ts +150 -0
- package/dist/vendor/hooks-src/create-tiptap-editor.ts +326 -0
- package/dist/vendor/hooks-src/create-undo-redo.ts +100 -0
- package/dist/vendor/hooks-src/create-web-notification.ts +111 -0
- package/dist/vendor/hooks-src/create-websocket.ts +179 -0
- package/dist/vendor/hooks-src/create-window-size.ts +41 -0
- package/dist/vendor/hooks-src/index.ts +48 -0
- package/package.json +87 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { createSignal, createEffect, onCleanup, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export type ScreenOrientationType =
|
|
4
|
+
| "portrait-primary"
|
|
5
|
+
| "portrait-secondary"
|
|
6
|
+
| "landscape-primary"
|
|
7
|
+
| "landscape-secondary"
|
|
8
|
+
| "portrait"
|
|
9
|
+
| "landscape"
|
|
10
|
+
| "unknown";
|
|
11
|
+
|
|
12
|
+
export interface CreateOrientationOptions {
|
|
13
|
+
/** Callback fired when screen orientation changes. */
|
|
14
|
+
onChange?: (orientation: ScreenOrientationType, angle: number) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CreateOrientationReturn {
|
|
18
|
+
/** Signal indicating current orientation type. */
|
|
19
|
+
type: Accessor<ScreenOrientationType>;
|
|
20
|
+
/** Signal indicating current orientation angle in degrees (0, 90, 180, 270). */
|
|
21
|
+
angle: Accessor<number>;
|
|
22
|
+
/** Signal indicating if device screen is in portrait mode. */
|
|
23
|
+
isPortrait: Accessor<boolean>;
|
|
24
|
+
/** Signal indicating if device screen is in landscape mode. */
|
|
25
|
+
isLandscape: Accessor<boolean>;
|
|
26
|
+
/** Lock screen orientation if supported by device/browser. */
|
|
27
|
+
lock: (orientation: string) => Promise<void>;
|
|
28
|
+
/** Unlock screen orientation. */
|
|
29
|
+
unlock: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* SolidJS reactive primitive for observing mobile/desktop screen orientation and angle.
|
|
34
|
+
*/
|
|
35
|
+
export function createOrientation(
|
|
36
|
+
options: CreateOrientationOptions = {}
|
|
37
|
+
): CreateOrientationReturn {
|
|
38
|
+
const [type, setType] = createSignal<ScreenOrientationType>("unknown");
|
|
39
|
+
const [angle, setAngle] = createSignal<number>(0);
|
|
40
|
+
|
|
41
|
+
const getOrientationState = (): { type: ScreenOrientationType; angle: number } => {
|
|
42
|
+
if (typeof window === "undefined") {
|
|
43
|
+
return { type: "unknown", angle: 0 };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (window.screen?.orientation) {
|
|
47
|
+
return {
|
|
48
|
+
type: window.screen.orientation.type as ScreenOrientationType,
|
|
49
|
+
angle: window.screen.orientation.angle || 0,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Fallback for older browsers using window.orientation */
|
|
54
|
+
const legacyAngle = (window as unknown as { orientation?: number }).orientation ?? 0;
|
|
55
|
+
const isPortraitMode = Math.abs(legacyAngle) !== 90;
|
|
56
|
+
return {
|
|
57
|
+
type: isPortraitMode ? "portrait" : "landscape",
|
|
58
|
+
angle: Number(legacyAngle),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
createEffect(() => {
|
|
63
|
+
if (typeof window === "undefined") return;
|
|
64
|
+
|
|
65
|
+
const updateState = (): void => {
|
|
66
|
+
const state = getOrientationState();
|
|
67
|
+
setType(state.type);
|
|
68
|
+
setAngle(state.angle);
|
|
69
|
+
options.onChange?.(state.type, state.angle);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
updateState();
|
|
73
|
+
|
|
74
|
+
if (window.screen?.orientation) {
|
|
75
|
+
window.screen.orientation.addEventListener("change", updateState);
|
|
76
|
+
onCleanup(() => {
|
|
77
|
+
window.screen.orientation.removeEventListener("change", updateState);
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
window.addEventListener("orientationchange", updateState);
|
|
81
|
+
window.addEventListener("resize", updateState);
|
|
82
|
+
onCleanup(() => {
|
|
83
|
+
window.removeEventListener("orientationchange", updateState);
|
|
84
|
+
window.removeEventListener("resize", updateState);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const isPortrait = (): boolean => {
|
|
90
|
+
const currentType = type();
|
|
91
|
+
return currentType.startsWith("portrait");
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const isLandscape = (): boolean => {
|
|
95
|
+
const currentType = type();
|
|
96
|
+
return currentType.startsWith("landscape");
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const lock = async (orientation: string): Promise<void> => {
|
|
100
|
+
if (typeof window !== "undefined" && window.screen?.orientation) {
|
|
101
|
+
const orientationApi = window.screen.orientation as unknown as {
|
|
102
|
+
lock?: (orient: string) => Promise<void>;
|
|
103
|
+
};
|
|
104
|
+
if (typeof orientationApi.lock === "function") {
|
|
105
|
+
await orientationApi.lock(orientation);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const unlock = (): void => {
|
|
111
|
+
if (typeof window !== "undefined" && window.screen?.orientation) {
|
|
112
|
+
const orientationApi = window.screen.orientation as unknown as {
|
|
113
|
+
unlock?: () => void;
|
|
114
|
+
};
|
|
115
|
+
if (typeof orientationApi.unlock === "function") {
|
|
116
|
+
orientationApi.unlock();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
type,
|
|
123
|
+
angle,
|
|
124
|
+
isPortrait,
|
|
125
|
+
isLandscape,
|
|
126
|
+
lock,
|
|
127
|
+
unlock,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { createSignal, createMemo, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export interface CreatePaginationOptions {
|
|
4
|
+
/** Total number of items across all pages, or total count. */
|
|
5
|
+
count?: number | Accessor<number>;
|
|
6
|
+
/** Explicit total number of pages. If provided, overrides count / pageSize calculation. */
|
|
7
|
+
totalPages?: number | Accessor<number>;
|
|
8
|
+
/** Controlled active page number (1-indexed). */
|
|
9
|
+
page?: number | Accessor<number>;
|
|
10
|
+
/** Default active page number for uncontrolled state. Defaults to 1. */
|
|
11
|
+
defaultPage?: number;
|
|
12
|
+
/** Number of items per page. Defaults to 10. */
|
|
13
|
+
pageSize?: number | Accessor<number>;
|
|
14
|
+
/** Number of sibling page buttons visible on each side of the current active page. Defaults to 1. */
|
|
15
|
+
siblingCount?: number | Accessor<number>;
|
|
16
|
+
/** Number of boundary pages visible at the beginning and end. Defaults to 1. */
|
|
17
|
+
boundaries?: number | Accessor<number>;
|
|
18
|
+
/** Callback fired whenever the active page changes. */
|
|
19
|
+
onChange?: (page: number) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CreatePaginationReturn {
|
|
23
|
+
/** Accessor returning the current active page number (1-indexed). */
|
|
24
|
+
page: Accessor<number>;
|
|
25
|
+
/** Accessor returning the calculated total number of pages. */
|
|
26
|
+
totalPages: Accessor<number>;
|
|
27
|
+
/** Accessor returning the active page size. */
|
|
28
|
+
pageSize: Accessor<number>;
|
|
29
|
+
/** Accessor returning an array of page numbers and "ellipsis" strings. */
|
|
30
|
+
range: Accessor<(number | "ellipsis")[]>;
|
|
31
|
+
/** Function to programmatically change to a specific page number. */
|
|
32
|
+
setPage: (page: number) => void;
|
|
33
|
+
/** Function to navigate to the next page. */
|
|
34
|
+
next: () => void;
|
|
35
|
+
/** Function to navigate to the previous page. */
|
|
36
|
+
previous: () => void;
|
|
37
|
+
/** Function to navigate to the first page (1). */
|
|
38
|
+
first: () => void;
|
|
39
|
+
/** Function to navigate to the last page (totalPages). */
|
|
40
|
+
last: () => void;
|
|
41
|
+
/** Accessor indicating whether a next page exists. */
|
|
42
|
+
hasNext: Accessor<boolean>;
|
|
43
|
+
/** Accessor indicating whether a previous page exists. */
|
|
44
|
+
hasPrevious: Accessor<boolean>;
|
|
45
|
+
/** 1-based start index of items on the current page (e.g. 1 for page 1 with pageSize 10). */
|
|
46
|
+
startIndex: Accessor<number>;
|
|
47
|
+
/** 1-based end index of items on the current page (e.g. 10 for page 1 with pageSize 10). */
|
|
48
|
+
endIndex: Accessor<number>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* SolidJS reactive primitive for computing pagination state, dynamic page range with ellipses, and navigation helpers.
|
|
53
|
+
*
|
|
54
|
+
* @param options Pagination configuration options.
|
|
55
|
+
*/
|
|
56
|
+
export function createPagination(options: CreatePaginationOptions = {}): CreatePaginationReturn {
|
|
57
|
+
const getCount = () => {
|
|
58
|
+
const raw = typeof options.count === "function" ? options.count() : options.count ?? 0;
|
|
59
|
+
return Math.max(0, raw);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getPageSize = () => {
|
|
63
|
+
const raw = typeof options.pageSize === "function" ? options.pageSize() : options.pageSize ?? 10;
|
|
64
|
+
return Math.max(1, raw);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getExplicitTotalPages = () => {
|
|
68
|
+
const raw = typeof options.totalPages === "function" ? options.totalPages() : options.totalPages;
|
|
69
|
+
return raw !== undefined ? Math.max(1, raw) : undefined;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getSiblingCount = () => {
|
|
73
|
+
const raw = typeof options.siblingCount === "function" ? options.siblingCount() : options.siblingCount ?? 1;
|
|
74
|
+
return Math.max(0, raw);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const getBoundaries = () => {
|
|
78
|
+
const raw = typeof options.boundaries === "function" ? options.boundaries() : options.boundaries ?? 1;
|
|
79
|
+
return Math.max(0, raw);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const [internalPage, setInternalPage] = createSignal<number>(Math.max(1, options.defaultPage ?? 1));
|
|
83
|
+
|
|
84
|
+
const totalPages = createMemo<number>(() => {
|
|
85
|
+
const explicit = getExplicitTotalPages();
|
|
86
|
+
if (explicit !== undefined) {
|
|
87
|
+
return Math.max(1, explicit);
|
|
88
|
+
}
|
|
89
|
+
const count = getCount();
|
|
90
|
+
const size = getPageSize();
|
|
91
|
+
return Math.max(1, Math.ceil(count / size));
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const rawPage = () => {
|
|
95
|
+
if (typeof options.page === "function") {
|
|
96
|
+
return options.page();
|
|
97
|
+
}
|
|
98
|
+
if (typeof options.page === "number") {
|
|
99
|
+
return options.page;
|
|
100
|
+
}
|
|
101
|
+
return internalPage();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const page = createMemo<number>(() => {
|
|
105
|
+
const p = rawPage();
|
|
106
|
+
const max = totalPages();
|
|
107
|
+
if (p < 1) return 1;
|
|
108
|
+
if (p > max) return max;
|
|
109
|
+
return p;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const setPage = (nextPage: number) => {
|
|
113
|
+
const max = totalPages();
|
|
114
|
+
const clamped = Math.max(1, Math.min(nextPage, max));
|
|
115
|
+
if (typeof options.page !== "function" && typeof options.page !== "number") {
|
|
116
|
+
setInternalPage(clamped);
|
|
117
|
+
}
|
|
118
|
+
options.onChange?.(clamped);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const next = () => setPage(page() + 1);
|
|
122
|
+
const previous = () => setPage(page() - 1);
|
|
123
|
+
const first = () => setPage(1);
|
|
124
|
+
const last = () => setPage(totalPages());
|
|
125
|
+
|
|
126
|
+
const hasNext = createMemo(() => page() < totalPages());
|
|
127
|
+
const hasPrevious = createMemo(() => page() > 1);
|
|
128
|
+
|
|
129
|
+
const startIndex = createMemo(() => {
|
|
130
|
+
const count = getCount();
|
|
131
|
+
if (count === 0 && getExplicitTotalPages() === undefined) return 0;
|
|
132
|
+
return (page() - 1) * getPageSize() + 1;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const endIndex = createMemo(() => {
|
|
136
|
+
const count = getCount();
|
|
137
|
+
const calculated = page() * getPageSize();
|
|
138
|
+
if (count > 0) {
|
|
139
|
+
return Math.min(calculated, count);
|
|
140
|
+
}
|
|
141
|
+
return calculated;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const range = createMemo<(number | "ellipsis")[]>(() => {
|
|
145
|
+
const total = totalPages();
|
|
146
|
+
const current = page();
|
|
147
|
+
const siblings = getSiblingCount();
|
|
148
|
+
const boundaries = getBoundaries();
|
|
149
|
+
|
|
150
|
+
if (total <= 1) {
|
|
151
|
+
return [1];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const pagesSet = new Set<number>();
|
|
155
|
+
|
|
156
|
+
// 1. Boundary pages at the start
|
|
157
|
+
for (let i = 1; i <= Math.min(boundaries, total); i++) {
|
|
158
|
+
pagesSet.add(i);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 2. Sibling pages around current page
|
|
162
|
+
const leftSibling = Math.max(1, current - siblings);
|
|
163
|
+
const rightSibling = Math.min(total, current + siblings);
|
|
164
|
+
for (let i = leftSibling; i <= rightSibling; i++) {
|
|
165
|
+
pagesSet.add(i);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 3. Boundary pages at the end
|
|
169
|
+
for (let i = Math.max(1, total - boundaries + 1); i <= total; i++) {
|
|
170
|
+
pagesSet.add(i);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const sortedPages = Array.from(pagesSet).sort((a, b) => a - b);
|
|
174
|
+
const result: (number | "ellipsis")[] = [];
|
|
175
|
+
|
|
176
|
+
for (let i = 0; i < sortedPages.length; i++) {
|
|
177
|
+
const currentPageNum = sortedPages[i];
|
|
178
|
+
if (i > 0) {
|
|
179
|
+
const prevPageNum = sortedPages[i - 1];
|
|
180
|
+
const gap = currentPageNum - prevPageNum;
|
|
181
|
+
if (gap === 2) {
|
|
182
|
+
result.push(prevPageNum + 1);
|
|
183
|
+
} else if (gap > 2) {
|
|
184
|
+
result.push("ellipsis");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
result.push(currentPageNum);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return result;
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
page,
|
|
195
|
+
totalPages,
|
|
196
|
+
pageSize: getPageSize,
|
|
197
|
+
range,
|
|
198
|
+
setPage,
|
|
199
|
+
next,
|
|
200
|
+
previous,
|
|
201
|
+
first,
|
|
202
|
+
last,
|
|
203
|
+
hasNext,
|
|
204
|
+
hasPrevious,
|
|
205
|
+
startIndex,
|
|
206
|
+
endIndex,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createSignal, createEffect, onCleanup, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export type PermissionNameType =
|
|
4
|
+
| "geolocation"
|
|
5
|
+
| "notifications"
|
|
6
|
+
| "persistent-storage"
|
|
7
|
+
| "push"
|
|
8
|
+
| "screen-wake-lock"
|
|
9
|
+
| "clipboard-read"
|
|
10
|
+
| "clipboard-write"
|
|
11
|
+
| "camera"
|
|
12
|
+
| "microphone"
|
|
13
|
+
| (string & {});
|
|
14
|
+
|
|
15
|
+
export type PermissionStatusState = "granted" | "denied" | "prompt" | "unknown";
|
|
16
|
+
|
|
17
|
+
export interface CreatePermissionOptions {
|
|
18
|
+
/** Permission descriptor or name to query. */
|
|
19
|
+
name: PermissionNameType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface CreatePermissionReturn {
|
|
23
|
+
/** Signal accessor containing current permission status ('granted', 'denied', 'prompt', 'unknown'). */
|
|
24
|
+
state: Accessor<PermissionStatusState>;
|
|
25
|
+
/** Signal accessor indicating whether Permissions API is supported in browser environment. */
|
|
26
|
+
isSupported: Accessor<boolean>;
|
|
27
|
+
/** Imperative function to re-query permission status manually. */
|
|
28
|
+
query: () => Promise<PermissionStatusState>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* SolidJS reactive primitive for querying and observing browser permission status changes.
|
|
33
|
+
*/
|
|
34
|
+
export function createPermission(
|
|
35
|
+
options: PermissionNameType | CreatePermissionOptions
|
|
36
|
+
): CreatePermissionReturn {
|
|
37
|
+
const [state, setState] = createSignal<PermissionStatusState>("unknown");
|
|
38
|
+
|
|
39
|
+
const permissionName = typeof options === "string" ? options : options.name;
|
|
40
|
+
|
|
41
|
+
const isSupported = (): boolean =>
|
|
42
|
+
typeof window !== "undefined" &&
|
|
43
|
+
typeof navigator !== "undefined" &&
|
|
44
|
+
"permissions" in navigator;
|
|
45
|
+
|
|
46
|
+
let permissionStatus: PermissionStatus | null = null;
|
|
47
|
+
|
|
48
|
+
const query = async (): Promise<PermissionStatusState> => {
|
|
49
|
+
if (!isSupported()) {
|
|
50
|
+
setState("unknown");
|
|
51
|
+
return "unknown";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const status = await navigator.permissions.query({
|
|
56
|
+
name: permissionName as PermissionName,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
permissionStatus = status;
|
|
60
|
+
const currentState = status.state as PermissionStatusState;
|
|
61
|
+
setState(currentState);
|
|
62
|
+
|
|
63
|
+
status.onchange = () => {
|
|
64
|
+
setState(status.state as PermissionStatusState);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return currentState;
|
|
68
|
+
} catch {
|
|
69
|
+
setState("unknown");
|
|
70
|
+
return "unknown";
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
createEffect(() => {
|
|
75
|
+
if (!isSupported()) return;
|
|
76
|
+
|
|
77
|
+
query();
|
|
78
|
+
|
|
79
|
+
onCleanup(() => {
|
|
80
|
+
if (permissionStatus) {
|
|
81
|
+
permissionStatus.onchange = null;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
state,
|
|
88
|
+
isSupported,
|
|
89
|
+
query,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createEffect, createSignal, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SolidJS reactive primitive for tracking previous value of a signal accessor.
|
|
5
|
+
*
|
|
6
|
+
* @param source Target reactive signal accessor to observe.
|
|
7
|
+
*/
|
|
8
|
+
export function createPrevious<T>(source: Accessor<T>): Accessor<T | undefined> {
|
|
9
|
+
const [previous, setPrevious] = createSignal<T | undefined>(undefined);
|
|
10
|
+
let current: T = source();
|
|
11
|
+
|
|
12
|
+
createEffect(() => {
|
|
13
|
+
const next = source();
|
|
14
|
+
if (current !== next) {
|
|
15
|
+
setPrevious(() => current);
|
|
16
|
+
current = next;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return previous;
|
|
21
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createEffect, createSignal, onCleanup, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export interface CreateResizeObserverOptions extends ResizeObserverOptions {
|
|
4
|
+
/** Whether the observer is active. Defaults to true. */
|
|
5
|
+
enabled?: boolean | Accessor<boolean>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* SolidJS reactive primitive for observing element size changes via ResizeObserver.
|
|
10
|
+
*
|
|
11
|
+
* @param target Target element or accessor returning HTML element.
|
|
12
|
+
* @param callback Observer callback invoked on element resize events.
|
|
13
|
+
* @param options ResizeObserver options (box, enabled).
|
|
14
|
+
*/
|
|
15
|
+
export function createResizeObserver(
|
|
16
|
+
target: HTMLElement | Accessor<HTMLElement | undefined>,
|
|
17
|
+
callback: ResizeObserverCallback,
|
|
18
|
+
options: CreateResizeObserverOptions = {}
|
|
19
|
+
): void {
|
|
20
|
+
const getTarget = (): HTMLElement | undefined => {
|
|
21
|
+
if (typeof target === "function") {
|
|
22
|
+
return (target as Accessor<HTMLElement | undefined>)();
|
|
23
|
+
}
|
|
24
|
+
return target;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const isEnabled = (): boolean => {
|
|
28
|
+
if (typeof options.enabled === "function") {
|
|
29
|
+
return options.enabled();
|
|
30
|
+
}
|
|
31
|
+
return options.enabled ?? true;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
createEffect(() => {
|
|
35
|
+
if (typeof window === "undefined" || !window.ResizeObserver) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!isEnabled()) return;
|
|
40
|
+
|
|
41
|
+
const el = getTarget();
|
|
42
|
+
if (!el) return;
|
|
43
|
+
|
|
44
|
+
const observer = new ResizeObserver(callback);
|
|
45
|
+
observer.observe(el, { box: options.box });
|
|
46
|
+
|
|
47
|
+
onCleanup(() => {
|
|
48
|
+
observer.disconnect();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface CreateElementSizeReturn {
|
|
54
|
+
/** Accessor for element width in pixels */
|
|
55
|
+
width: Accessor<number>;
|
|
56
|
+
/** Accessor for element height in pixels */
|
|
57
|
+
height: Accessor<number>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* SolidJS reactive primitive returning width and height accessors for a target HTML element.
|
|
62
|
+
*
|
|
63
|
+
* @param target Target element or accessor returning HTML element.
|
|
64
|
+
* @param options ResizeObserver options.
|
|
65
|
+
*/
|
|
66
|
+
export function createElementSize(
|
|
67
|
+
target: HTMLElement | Accessor<HTMLElement | undefined>,
|
|
68
|
+
options: CreateResizeObserverOptions = {}
|
|
69
|
+
): CreateElementSizeReturn {
|
|
70
|
+
const [width, setWidth] = createSignal(0);
|
|
71
|
+
const [height, setHeight] = createSignal(0);
|
|
72
|
+
|
|
73
|
+
createResizeObserver(
|
|
74
|
+
target,
|
|
75
|
+
(entries) => {
|
|
76
|
+
const entry = entries[0];
|
|
77
|
+
if (entry) {
|
|
78
|
+
setWidth(entry.contentRect.width);
|
|
79
|
+
setHeight(entry.contentRect.height);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
options
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
width,
|
|
87
|
+
height,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createEffect, onCleanup, type Accessor } from "solid-js";
|
|
2
|
+
|
|
3
|
+
export interface CreateScrollIntoViewOptions extends ScrollIntoViewOptions {
|
|
4
|
+
/** Whether the element should scroll into view automatically. Defaults to true. */
|
|
5
|
+
enabled?: boolean | Accessor<boolean>;
|
|
6
|
+
/** Delay in milliseconds before executing scrollIntoView. Defaults to 0. */
|
|
7
|
+
delay?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* SolidJS reactive primitive for scrolling a target element into view smooth or auto behavior.
|
|
12
|
+
*/
|
|
13
|
+
export function createScrollIntoView(
|
|
14
|
+
target: HTMLElement | Accessor<HTMLElement | null | undefined> | null | undefined,
|
|
15
|
+
options: CreateScrollIntoViewOptions = {}
|
|
16
|
+
): void {
|
|
17
|
+
const getTarget = (): HTMLElement | null | undefined => {
|
|
18
|
+
if (typeof target === "function") {
|
|
19
|
+
return target();
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const isEnabled = (): boolean => {
|
|
25
|
+
if (typeof options.enabled === "function") {
|
|
26
|
+
return options.enabled();
|
|
27
|
+
}
|
|
28
|
+
return options.enabled ?? true;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
createEffect(() => {
|
|
32
|
+
if (!isEnabled()) return;
|
|
33
|
+
|
|
34
|
+
const el = getTarget();
|
|
35
|
+
if (!el || typeof window === "undefined") return;
|
|
36
|
+
|
|
37
|
+
const scrollOptions: ScrollIntoViewOptions = {
|
|
38
|
+
behavior: options.behavior ?? "smooth",
|
|
39
|
+
block: options.block ?? "nearest",
|
|
40
|
+
inline: options.inline ?? "nearest",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
44
|
+
|
|
45
|
+
if (options.delay && options.delay > 0) {
|
|
46
|
+
timer = setTimeout(() => {
|
|
47
|
+
el.scrollIntoView(scrollOptions);
|
|
48
|
+
}, options.delay);
|
|
49
|
+
} else {
|
|
50
|
+
el.scrollIntoView(scrollOptions);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
onCleanup(() => {
|
|
54
|
+
if (timer) clearTimeout(timer);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|