@inkeep/agents-ui 0.0.0-dev-20260313222128
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/LICENSE +64 -0
- package/README.md +1 -0
- package/dist/_virtual/index.cjs +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.cjs +1 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +5 -0
- package/dist/_virtual/use-sync-external-store-shim.production.cjs +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +5 -0
- package/dist/color-mode/index.cjs +1 -0
- package/dist/color-mode/index.d.ts +20 -0
- package/dist/color-mode/index.js +170 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +238 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +9 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +68 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +9 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +56 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs +1 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js +8 -0
- package/dist/primitives/atoms/avatars/ai.cjs +1 -0
- package/dist/primitives/atoms/avatars/ai.d.ts +3 -0
- package/dist/primitives/atoms/avatars/ai.js +99 -0
- package/dist/primitives/atoms/avatars/user.cjs +1 -0
- package/dist/primitives/atoms/avatars/user.d.ts +3 -0
- package/dist/primitives/atoms/avatars/user.js +27 -0
- package/dist/primitives/atoms/cmdk/command-score.cjs +1 -0
- package/dist/primitives/atoms/cmdk/command-score.d.ts +1 -0
- package/dist/primitives/atoms/cmdk/command-score.js +46 -0
- package/dist/primitives/atoms/cmdk/index.cjs +1 -0
- package/dist/primitives/atoms/cmdk/index.d.ts +460 -0
- package/dist/primitives/atoms/cmdk/index.js +521 -0
- package/dist/primitives/atoms/codeblock/index.cjs +1 -0
- package/dist/primitives/atoms/codeblock/index.d.ts +10 -0
- package/dist/primitives/atoms/codeblock/index.js +40 -0
- package/dist/primitives/atoms/combobox.cjs +1 -0
- package/dist/primitives/atoms/combobox.js +275 -0
- package/dist/primitives/atoms/custom-styles.cjs +1 -0
- package/dist/primitives/atoms/custom-styles.d.ts +5 -0
- package/dist/primitives/atoms/custom-styles.js +57 -0
- package/dist/primitives/atoms/dialog.cjs +1 -0
- package/dist/primitives/atoms/dialog.d.ts +94 -0
- package/dist/primitives/atoms/dialog.js +227 -0
- package/dist/primitives/atoms/error-boundary.cjs +1 -0
- package/dist/primitives/atoms/error-boundary.d.ts +6 -0
- package/dist/primitives/atoms/error-boundary.js +9 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.cjs +1 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.d.ts +6 -0
- package/dist/primitives/atoms/icons/built-in-icon-renderer.js +51 -0
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -0
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +86 -0
- package/dist/primitives/atoms/icons/built-in-icons.js +89 -0
- package/dist/primitives/atoms/icons/checkbox-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/checkbox-icon.d.ts +1 -0
- package/dist/primitives/atoms/icons/checkbox-icon.js +24 -0
- package/dist/primitives/atoms/icons/collections/bi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/bi.d.ts +4 -0
- package/dist/primitives/atoms/icons/collections/bi.js +49 -0
- package/dist/primitives/atoms/icons/collections/fi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/fi.d.ts +2 -0
- package/dist/primitives/atoms/icons/collections/fi.js +29 -0
- package/dist/primitives/atoms/icons/collections/gr.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/gr.d.ts +2 -0
- package/dist/primitives/atoms/icons/collections/gr.js +21 -0
- package/dist/primitives/atoms/icons/collections/io5.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/io5.d.ts +34 -0
- package/dist/primitives/atoms/icons/collections/io5.js +806 -0
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -0
- package/dist/primitives/atoms/icons/collections/pi.d.ts +4 -0
- package/dist/primitives/atoms/icons/collections/pi.js +49 -0
- package/dist/primitives/atoms/icons/custom-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/custom-icon.d.ts +6 -0
- package/dist/primitives/atoms/icons/custom-icon.js +19 -0
- package/dist/primitives/atoms/icons/generate-icon.cjs +1 -0
- package/dist/primitives/atoms/icons/generate-icon.d.ts +28 -0
- package/dist/primitives/atoms/icons/generate-icon.js +56 -0
- package/dist/primitives/atoms/icons/index.cjs +1 -0
- package/dist/primitives/atoms/icons/index.d.ts +2 -0
- package/dist/primitives/atoms/icons/index.js +6 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.d.ts +2 -0
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +28 -0
- package/dist/primitives/atoms/link.cjs +1 -0
- package/dist/primitives/atoms/link.d.ts +14 -0
- package/dist/primitives/atoms/link.js +35 -0
- package/dist/primitives/atoms/markdown/components.cjs +1 -0
- package/dist/primitives/atoms/markdown/components.d.ts +31 -0
- package/dist/primitives/atoms/markdown/components.js +76 -0
- package/dist/primitives/atoms/markdown/index.cjs +1 -0
- package/dist/primitives/atoms/markdown/index.d.ts +17 -0
- package/dist/primitives/atoms/markdown/index.js +121 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.cjs +1 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.d.ts +1 -0
- package/dist/primitives/atoms/markdown/rehype-inline-code-property.js +12 -0
- package/dist/primitives/atoms/portal-with-theme.cjs +1 -0
- package/dist/primitives/atoms/portal-with-theme.d.ts +2 -0
- package/dist/primitives/atoms/portal-with-theme.js +12 -0
- package/dist/primitives/atoms/portal.cjs +1 -0
- package/dist/primitives/atoms/portal.d.ts +8 -0
- package/dist/primitives/atoms/portal.js +19 -0
- package/dist/primitives/atoms/select.cjs +1 -0
- package/dist/primitives/atoms/select.d.ts +136 -0
- package/dist/primitives/atoms/select.js +785 -0
- package/dist/primitives/atoms/shadow/context.cjs +1 -0
- package/dist/primitives/atoms/shadow/context.d.ts +14 -0
- package/dist/primitives/atoms/shadow/context.js +54 -0
- package/dist/primitives/atoms/shadow/create.cjs +1 -0
- package/dist/primitives/atoms/shadow/create.d.ts +8 -0
- package/dist/primitives/atoms/shadow/create.js +56 -0
- package/dist/primitives/atoms/shadow/index.d.ts +1 -0
- package/dist/primitives/atoms/shadow/root.cjs +1 -0
- package/dist/primitives/atoms/shadow/root.d.ts +5 -0
- package/dist/primitives/atoms/shadow/root.js +22 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.cjs +1 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.d.ts +2 -0
- package/dist/primitives/atoms/shadow/use-ensured-forwarded-ref.js +11 -0
- package/dist/primitives/atoms/shadow/utils.cjs +1 -0
- package/dist/primitives/atoms/shadow/utils.d.ts +9 -0
- package/dist/primitives/atoms/shadow/utils.js +16 -0
- package/dist/primitives/components/chat-bubble/index.cjs +1 -0
- package/dist/primitives/components/chat-bubble/index.d.ts +10 -0
- package/dist/primitives/components/chat-bubble/index.js +38 -0
- package/dist/primitives/components/chat-button.cjs +1 -0
- package/dist/primitives/components/chat-button.d.ts +20 -0
- package/dist/primitives/components/chat-button.js +51 -0
- package/dist/primitives/components/chat-history/index.cjs +1 -0
- package/dist/primitives/components/chat-history/index.d.ts +27 -0
- package/dist/primitives/components/chat-history/index.js +105 -0
- package/dist/primitives/components/data-summaries.cjs +1 -0
- package/dist/primitives/components/data-summaries.d.ts +14 -0
- package/dist/primitives/components/data-summaries.js +38 -0
- package/dist/primitives/components/embedded-chat/chat-provider.cjs +1 -0
- package/dist/primitives/components/embedded-chat/chat-provider.d.ts +19 -0
- package/dist/primitives/components/embedded-chat/chat-provider.js +20 -0
- package/dist/primitives/components/embedded-chat/use-captcha.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-captcha.d.ts +30 -0
- package/dist/primitives/components/embedded-chat/use-captcha.js +67 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.d.ts +9 -0
- package/dist/primitives/components/embedded-chat/use-chat-action.js +41 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +3 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.d.ts +57 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +312 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.d.ts +30 -0
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +159 -0
- package/dist/primitives/components/embedded-chat.cjs +11 -0
- package/dist/primitives/components/embedded-chat.d.ts +461 -0
- package/dist/primitives/components/embedded-chat.js +2051 -0
- package/dist/primitives/components/embedded-search/search-provider.cjs +1 -0
- package/dist/primitives/components/embedded-search/search-provider.d.ts +21 -0
- package/dist/primitives/components/embedded-search/search-provider.js +26 -0
- package/dist/primitives/components/embedded-search/transform-results.cjs +1 -0
- package/dist/primitives/components/embedded-search/transform-results.d.ts +3 -0
- package/dist/primitives/components/embedded-search/transform-results.js +47 -0
- package/dist/primitives/components/embedded-search/url-query.cjs +1 -0
- package/dist/primitives/components/embedded-search/url-query.d.ts +4 -0
- package/dist/primitives/components/embedded-search/url-query.js +12 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.cjs +1 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.d.ts +19 -0
- package/dist/primitives/components/embedded-search/use-inkeep-search.js +35 -0
- package/dist/primitives/components/embedded-search/use-search-filter.cjs +1 -0
- package/dist/primitives/components/embedded-search/use-search-filter.d.ts +1 -0
- package/dist/primitives/components/embedded-search/use-search-filter.js +77 -0
- package/dist/primitives/components/embedded-search.cjs +1 -0
- package/dist/primitives/components/embedded-search.d.ts +249 -0
- package/dist/primitives/components/embedded-search.js +628 -0
- package/dist/primitives/components/factory.cjs +1 -0
- package/dist/primitives/components/factory.d.ts +19 -0
- package/dist/primitives/components/factory.js +39 -0
- package/dist/primitives/components/index.cjs +1 -0
- package/dist/primitives/components/index.d.ts +13 -0
- package/dist/primitives/components/index.js +33 -0
- package/dist/primitives/components/modal/modal-provider.cjs +1 -0
- package/dist/primitives/components/modal/modal-provider.d.ts +12 -0
- package/dist/primitives/components/modal/modal-provider.js +8 -0
- package/dist/primitives/components/modal/use-inkeep-modal.cjs +1 -0
- package/dist/primitives/components/modal/use-inkeep-modal.d.ts +7 -0
- package/dist/primitives/components/modal/use-inkeep-modal.js +9 -0
- package/dist/primitives/components/modal/widget-auto-focus.cjs +1 -0
- package/dist/primitives/components/modal/widget-auto-focus.d.ts +2 -0
- package/dist/primitives/components/modal/widget-auto-focus.js +25 -0
- package/dist/primitives/components/modal.cjs +1 -0
- package/dist/primitives/components/modal.d.ts +18 -0
- package/dist/primitives/components/modal.js +40 -0
- package/dist/primitives/components/presence.cjs +1 -0
- package/dist/primitives/components/presence.d.ts +8 -0
- package/dist/primitives/components/presence.js +26 -0
- package/dist/primitives/components/searchbar.cjs +1 -0
- package/dist/primitives/components/searchbar.d.ts +23 -0
- package/dist/primitives/components/searchbar.js +54 -0
- package/dist/primitives/components/sidebar-chat/index.cjs +1 -0
- package/dist/primitives/components/sidebar-chat/index.d.ts +9 -0
- package/dist/primitives/components/sidebar-chat/index.js +67 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.cjs +1 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.d.ts +5 -0
- package/dist/primitives/components/sidebar-chat/use-sidebar-chat-resizer.js +34 -0
- package/dist/primitives/components/tagline-logo-icon.cjs +1 -0
- package/dist/primitives/components/tagline-logo-icon.d.ts +1 -0
- package/dist/primitives/components/tagline-logo-icon.js +26 -0
- package/dist/primitives/components/use-component-trigger.cjs +1 -0
- package/dist/primitives/components/use-component-trigger.d.ts +5 -0
- package/dist/primitives/components/use-component-trigger.js +17 -0
- package/dist/primitives/constants/search.cjs +1 -0
- package/dist/primitives/constants/search.d.ts +1 -0
- package/dist/primitives/constants/search.js +5 -0
- package/dist/primitives/hooks/index.cjs +1 -0
- package/dist/primitives/hooks/index.d.ts +12 -0
- package/dist/primitives/hooks/index.js +26 -0
- package/dist/primitives/hooks/use-anonymous-session.cjs +1 -0
- package/dist/primitives/hooks/use-anonymous-session.d.ts +12 -0
- package/dist/primitives/hooks/use-anonymous-session.js +82 -0
- package/dist/primitives/hooks/use-boolean.cjs +1 -0
- package/dist/primitives/hooks/use-boolean.d.ts +10 -0
- package/dist/primitives/hooks/use-boolean.js +17 -0
- package/dist/primitives/hooks/use-component-classnames.cjs +1 -0
- package/dist/primitives/hooks/use-component-classnames.d.ts +6 -0
- package/dist/primitives/hooks/use-component-classnames.js +14 -0
- package/dist/primitives/hooks/use-container-size.cjs +1 -0
- package/dist/primitives/hooks/use-container-size.d.ts +5 -0
- package/dist/primitives/hooks/use-container-size.js +18 -0
- package/dist/primitives/hooks/use-conversation-loader.cjs +1 -0
- package/dist/primitives/hooks/use-conversation-loader.d.ts +13 -0
- package/dist/primitives/hooks/use-conversation-loader.js +36 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.cjs +1 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.d.ts +3 -0
- package/dist/primitives/hooks/use-copy-to-clipboard.js +24 -0
- package/dist/primitives/hooks/use-debounce.cjs +1 -0
- package/dist/primitives/hooks/use-debounce.d.ts +1 -0
- package/dist/primitives/hooks/use-debounce.js +16 -0
- package/dist/primitives/hooks/use-inkeep-api-client.cjs +1 -0
- package/dist/primitives/hooks/use-inkeep-api-client.d.ts +33 -0
- package/dist/primitives/hooks/use-inkeep-api-client.js +87 -0
- package/dist/primitives/hooks/use-inkeep-open-state.cjs +1 -0
- package/dist/primitives/hooks/use-inkeep-open-state.d.ts +18 -0
- package/dist/primitives/hooks/use-inkeep-open-state.js +47 -0
- package/dist/primitives/hooks/use-instant-update.cjs +1 -0
- package/dist/primitives/hooks/use-instant-update.d.ts +16 -0
- package/dist/primitives/hooks/use-instant-update.js +16 -0
- package/dist/primitives/hooks/use-is-mounted.cjs +1 -0
- package/dist/primitives/hooks/use-is-mounted.d.ts +1 -0
- package/dist/primitives/hooks/use-is-mounted.js +11 -0
- package/dist/primitives/hooks/use-local-storage.cjs +1 -0
- package/dist/primitives/hooks/use-local-storage.d.ts +8 -0
- package/dist/primitives/hooks/use-local-storage.js +26 -0
- package/dist/primitives/hooks/use-media-query.cjs +1 -0
- package/dist/primitives/hooks/use-media-query.d.ts +1 -0
- package/dist/primitives/hooks/use-media-query.js +14 -0
- package/dist/primitives/hooks/use-resize-observer.cjs +1 -0
- package/dist/primitives/hooks/use-resize-observer.d.ts +12 -0
- package/dist/primitives/hooks/use-resize-observer.js +32 -0
- package/dist/primitives/hooks/use-scrolling-fades.cjs +1 -0
- package/dist/primitives/hooks/use-scrolling-fades.d.ts +2 -0
- package/dist/primitives/hooks/use-scrolling-fades.js +18 -0
- package/dist/primitives/hooks/use-settle-action.cjs +1 -0
- package/dist/primitives/hooks/use-settle-action.d.ts +3 -0
- package/dist/primitives/hooks/use-settle-action.js +11 -0
- package/dist/primitives/hooks/use-simple-scroll.cjs +1 -0
- package/dist/primitives/hooks/use-simple-scroll.d.ts +16 -0
- package/dist/primitives/hooks/use-simple-scroll.js +51 -0
- package/dist/primitives/hooks/use-streaming-events.cjs +1 -0
- package/dist/primitives/hooks/use-streaming-events.d.ts +8 -0
- package/dist/primitives/hooks/use-streaming-events.js +33 -0
- package/dist/primitives/index.cjs +1 -0
- package/dist/primitives/index.d.ts +13 -0
- package/dist/primitives/index.js +174 -0
- package/dist/primitives/providers/attachment-item-provider.cjs +1 -0
- package/dist/primitives/providers/attachment-item-provider.d.ts +9 -0
- package/dist/primitives/providers/attachment-item-provider.js +13 -0
- package/dist/primitives/providers/attachments-bar-provider.cjs +1 -0
- package/dist/primitives/providers/attachments-bar-provider.d.ts +30 -0
- package/dist/primitives/providers/attachments-bar-provider.js +57 -0
- package/dist/primitives/providers/base-events-provider.cjs +1 -0
- package/dist/primitives/providers/base-events-provider.d.ts +8 -0
- package/dist/primitives/providers/base-events-provider.js +37 -0
- package/dist/primitives/providers/chat-bubble-provider.cjs +1 -0
- package/dist/primitives/providers/chat-bubble-provider.d.ts +22 -0
- package/dist/primitives/providers/chat-bubble-provider.js +19 -0
- package/dist/primitives/providers/chat-form-provider.cjs +1 -0
- package/dist/primitives/providers/chat-form-provider.d.ts +26 -0
- package/dist/primitives/providers/chat-form-provider.js +109 -0
- package/dist/primitives/providers/chat-history-provider.cjs +1 -0
- package/dist/primitives/providers/chat-history-provider.d.ts +32 -0
- package/dist/primitives/providers/chat-history-provider.js +105 -0
- package/dist/primitives/providers/config-provider.cjs +1 -0
- package/dist/primitives/providers/config-provider.d.ts +24 -0
- package/dist/primitives/providers/config-provider.js +40 -0
- package/dist/primitives/providers/feedback-item-provider.cjs +1 -0
- package/dist/primitives/providers/feedback-item-provider.d.ts +10 -0
- package/dist/primitives/providers/feedback-item-provider.js +16 -0
- package/dist/primitives/providers/feedback-provider.cjs +1 -0
- package/dist/primitives/providers/feedback-provider.d.ts +16 -0
- package/dist/primitives/providers/feedback-provider.js +83 -0
- package/dist/primitives/providers/form-field-provider.cjs +1 -0
- package/dist/primitives/providers/form-field-provider.d.ts +15 -0
- package/dist/primitives/providers/form-field-provider.js +17 -0
- package/dist/primitives/providers/help-menu-provider.cjs +1 -0
- package/dist/primitives/providers/help-menu-provider.d.ts +11 -0
- package/dist/primitives/providers/help-menu-provider.js +19 -0
- package/dist/primitives/providers/hover-popover-provider.cjs +1 -0
- package/dist/primitives/providers/hover-popover-provider.d.ts +10 -0
- package/dist/primitives/providers/hover-popover-provider.js +13 -0
- package/dist/primitives/providers/index.cjs +1 -0
- package/dist/primitives/providers/index.d.ts +19 -0
- package/dist/primitives/providers/index.js +65 -0
- package/dist/primitives/providers/markdown-provider.cjs +1 -0
- package/dist/primitives/providers/markdown-provider.d.ts +9 -0
- package/dist/primitives/providers/markdown-provider.js +8 -0
- package/dist/primitives/providers/message-attachments-provider.cjs +1 -0
- package/dist/primitives/providers/message-attachments-provider.d.ts +13 -0
- package/dist/primitives/providers/message-attachments-provider.js +27 -0
- package/dist/primitives/providers/message-provider.cjs +1 -0
- package/dist/primitives/providers/message-provider.d.ts +10 -0
- package/dist/primitives/providers/message-provider.js +14 -0
- package/dist/primitives/providers/root-provider.cjs +1 -0
- package/dist/primitives/providers/root-provider.d.ts +8 -0
- package/dist/primitives/providers/root-provider.js +21 -0
- package/dist/primitives/providers/search-events-provider.cjs +1 -0
- package/dist/primitives/providers/search-events-provider.d.ts +8 -0
- package/dist/primitives/providers/search-events-provider.js +17 -0
- package/dist/primitives/providers/sidebar-chat-provider.cjs +1 -0
- package/dist/primitives/providers/sidebar-chat-provider.d.ts +61 -0
- package/dist/primitives/providers/sidebar-chat-provider.js +37 -0
- package/dist/primitives/providers/source-item-provider.cjs +1 -0
- package/dist/primitives/providers/source-item-provider.d.ts +12 -0
- package/dist/primitives/providers/source-item-provider.js +13 -0
- package/dist/primitives/providers/theme-provider.cjs +3 -0
- package/dist/primitives/providers/theme-provider.d.ts +3 -0
- package/dist/primitives/providers/theme-provider.js +79 -0
- package/dist/primitives/providers/widget-provider.cjs +1 -0
- package/dist/primitives/providers/widget-provider.d.ts +10 -0
- package/dist/primitives/providers/widget-provider.js +8 -0
- package/dist/primitives/utils/component-ids.cjs +1 -0
- package/dist/primitives/utils/component-ids.d.ts +662 -0
- package/dist/primitives/utils/component-ids.js +361 -0
- package/dist/primitives/utils/compose-event-handlers.cjs +1 -0
- package/dist/primitives/utils/compose-event-handlers.d.ts +3 -0
- package/dist/primitives/utils/compose-event-handlers.js +10 -0
- package/dist/primitives/utils/compose-refs.cjs +1 -0
- package/dist/primitives/utils/compose-refs.d.ts +5 -0
- package/dist/primitives/utils/compose-refs.js +30 -0
- package/dist/primitives/utils/default-settings.cjs +1 -0
- package/dist/primitives/utils/default-settings.d.ts +169 -0
- package/dist/primitives/utils/default-settings.js +52 -0
- package/dist/primitives/utils/form.cjs +1 -0
- package/dist/primitives/utils/form.d.ts +3 -0
- package/dist/primitives/utils/form.js +19 -0
- package/dist/primitives/utils/generate-uid.cjs +1 -0
- package/dist/primitives/utils/generate-uid.d.ts +2 -0
- package/dist/primitives/utils/generate-uid.js +14 -0
- package/dist/primitives/utils/get-message-metadata.d.ts +8 -0
- package/dist/primitives/utils/get-source-icon.cjs +1 -0
- package/dist/primitives/utils/get-source-icon.d.ts +2 -0
- package/dist/primitives/utils/get-source-icon.js +11 -0
- package/dist/primitives/utils/highlight-emphasis.cjs +1 -0
- package/dist/primitives/utils/highlight-emphasis.d.ts +4 -0
- package/dist/primitives/utils/highlight-emphasis.js +15 -0
- package/dist/primitives/utils/merge-props.cjs +1 -0
- package/dist/primitives/utils/merge-props.d.ts +7 -0
- package/dist/primitives/utils/merge-props.js +41 -0
- package/dist/primitives/utils/misc.cjs +1 -0
- package/dist/primitives/utils/misc.d.ts +12 -0
- package/dist/primitives/utils/misc.js +31 -0
- package/dist/primitives/utils/split-props.cjs +1 -0
- package/dist/primitives/utils/split-props.d.ts +14 -0
- package/dist/primitives/utils/split-props.js +10 -0
- package/dist/react/chat-button-modal.cjs +1 -0
- package/dist/react/chat-button-modal.d.ts +22 -0
- package/dist/react/chat-button-modal.js +41 -0
- package/dist/react/chat-button.cjs +1 -0
- package/dist/react/chat-button.d.ts +28 -0
- package/dist/react/chat-button.js +73 -0
- package/dist/react/embedded-chat.cjs +1 -0
- package/dist/react/embedded-chat.d.ts +15 -0
- package/dist/react/embedded-chat.js +431 -0
- package/dist/react/embedded-search-and-chat.cjs +1 -0
- package/dist/react/embedded-search-and-chat.d.ts +40 -0
- package/dist/react/embedded-search-and-chat.impl.cjs +1 -0
- package/dist/react/embedded-search-and-chat.impl.d.ts +9 -0
- package/dist/react/embedded-search-and-chat.impl.js +43 -0
- package/dist/react/embedded-search-and-chat.js +66 -0
- package/dist/react/embedded-search.cjs +1 -0
- package/dist/react/embedded-search.d.ts +17 -0
- package/dist/react/embedded-search.js +181 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +13 -0
- package/dist/react/index.js +238 -0
- package/dist/react/modal.chat.cjs +1 -0
- package/dist/react/modal.chat.d.ts +9 -0
- package/dist/react/modal.chat.js +21 -0
- package/dist/react/modal.cjs +1 -0
- package/dist/react/modal.d.ts +23 -0
- package/dist/react/modal.js +27 -0
- package/dist/react/modal.search-and-chat.cjs +1 -0
- package/dist/react/modal.search-and-chat.d.ts +6 -0
- package/dist/react/modal.search-and-chat.js +27 -0
- package/dist/react/modal.search.cjs +1 -0
- package/dist/react/modal.search.d.ts +6 -0
- package/dist/react/modal.search.js +21 -0
- package/dist/react/searchbar.cjs +1 -0
- package/dist/react/searchbar.d.ts +13 -0
- package/dist/react/searchbar.js +68 -0
- package/dist/react/sidebar-chat.cjs +1 -0
- package/dist/react/sidebar-chat.d.ts +4 -0
- package/dist/react/sidebar-chat.js +53 -0
- package/dist/react/utils.cjs +1 -0
- package/dist/react/utils.d.ts +6 -0
- package/dist/react/utils.js +20 -0
- package/dist/react/widget-toggle.cjs +1 -0
- package/dist/react/widget-toggle.d.ts +14 -0
- package/dist/react/widget-toggle.js +65 -0
- package/dist/styled/components/chat-bubble.cjs +1 -0
- package/dist/styled/components/chat-bubble.d.ts +5 -0
- package/dist/styled/components/chat-bubble.js +70 -0
- package/dist/styled/components/chat-button.cjs +1 -0
- package/dist/styled/components/chat-button.d.ts +9 -0
- package/dist/styled/components/chat-button.js +60 -0
- package/dist/styled/components/chat-history.cjs +1 -0
- package/dist/styled/components/chat-history.d.ts +15 -0
- package/dist/styled/components/chat-history.js +197 -0
- package/dist/styled/components/data-summary-group.cjs +1 -0
- package/dist/styled/components/data-summary-group.d.ts +11 -0
- package/dist/styled/components/data-summary-group.js +96 -0
- package/dist/styled/components/embedded-chat/session-loading.cjs +1 -0
- package/dist/styled/components/embedded-chat/session-loading.d.ts +1 -0
- package/dist/styled/components/embedded-chat/session-loading.js +23 -0
- package/dist/styled/components/embedded-chat.cjs +1 -0
- package/dist/styled/components/embedded-chat.d.ts +211 -0
- package/dist/styled/components/embedded-chat.js +1997 -0
- package/dist/styled/components/embedded-search/results-loading.cjs +1 -0
- package/dist/styled/components/embedded-search/results-loading.d.ts +1 -0
- package/dist/styled/components/embedded-search/results-loading.js +39 -0
- package/dist/styled/components/embedded-search.cjs +1 -0
- package/dist/styled/components/embedded-search.d.ts +73 -0
- package/dist/styled/components/embedded-search.js +680 -0
- package/dist/styled/components/index.cjs +1 -0
- package/dist/styled/components/index.d.ts +13 -0
- package/dist/styled/components/index.js +28 -0
- package/dist/styled/components/loading-indicator.cjs +1 -0
- package/dist/styled/components/loading-indicator.d.ts +1 -0
- package/dist/styled/components/loading-indicator.js +36 -0
- package/dist/styled/components/message.cjs +1 -0
- package/dist/styled/components/message.d.ts +4 -0
- package/dist/styled/components/message.js +333 -0
- package/dist/styled/components/modal.cjs +1 -0
- package/dist/styled/components/modal.d.ts +6 -0
- package/dist/styled/components/modal.js +46 -0
- package/dist/styled/components/searchbar.cjs +1 -0
- package/dist/styled/components/searchbar.d.ts +11 -0
- package/dist/styled/components/searchbar.js +81 -0
- package/dist/styled/components/shadow.cjs +1 -0
- package/dist/styled/components/shadow.d.ts +3 -0
- package/dist/styled/components/shadow.js +8 -0
- package/dist/styled/components/sidebar-chat.cjs +1 -0
- package/dist/styled/components/sidebar-chat.d.ts +6 -0
- package/dist/styled/components/sidebar-chat.js +90 -0
- package/dist/styled/components/ui/markdown-styles.cjs +1 -0
- package/dist/styled/components/ui/markdown-styles.d.ts +23 -0
- package/dist/styled/components/ui/markdown-styles.js +39 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.cjs +1 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.d.ts +7 -0
- package/dist/styled/components/ui/recipes/ai-chat-page-wrapper.js +33 -0
- package/dist/styled/components/ui/recipes/attachment.cjs +1 -0
- package/dist/styled/components/ui/recipes/attachment.d.ts +4 -0
- package/dist/styled/components/ui/recipes/attachment.js +28 -0
- package/dist/styled/components/ui/recipes/button.cjs +1 -0
- package/dist/styled/components/ui/recipes/button.d.ts +6 -0
- package/dist/styled/components/ui/recipes/button.js +87 -0
- package/dist/styled/components/ui/recipes/checkbox.cjs +1 -0
- package/dist/styled/components/ui/recipes/checkbox.d.ts +4 -0
- package/dist/styled/components/ui/recipes/checkbox.js +23 -0
- package/dist/styled/components/ui/recipes/citation.cjs +1 -0
- package/dist/styled/components/ui/recipes/citation.d.ts +4 -0
- package/dist/styled/components/ui/recipes/citation.js +75 -0
- package/dist/styled/components/ui/recipes/combobox.cjs +1 -0
- package/dist/styled/components/ui/recipes/combobox.d.ts +4 -0
- package/dist/styled/components/ui/recipes/combobox.js +57 -0
- package/dist/styled/components/ui/recipes/icon.cjs +1 -0
- package/dist/styled/components/ui/recipes/icon.d.ts +2 -0
- package/dist/styled/components/ui/recipes/icon.js +6 -0
- package/dist/styled/components/ui/recipes/index.cjs +1 -0
- package/dist/styled/components/ui/recipes/index.d.ts +16 -0
- package/dist/styled/components/ui/recipes/index.js +39 -0
- package/dist/styled/components/ui/recipes/input.cjs +1 -0
- package/dist/styled/components/ui/recipes/input.d.ts +5 -0
- package/dist/styled/components/ui/recipes/input.js +34 -0
- package/dist/styled/components/ui/recipes/link.cjs +1 -0
- package/dist/styled/components/ui/recipes/link.d.ts +2 -0
- package/dist/styled/components/ui/recipes/link.js +13 -0
- package/dist/styled/components/ui/recipes/markdown.cjs +1 -0
- package/dist/styled/components/ui/recipes/markdown.d.ts +16 -0
- package/dist/styled/components/ui/recipes/markdown.js +103 -0
- package/dist/styled/components/ui/recipes/modal.cjs +1 -0
- package/dist/styled/components/ui/recipes/modal.d.ts +4 -0
- package/dist/styled/components/ui/recipes/modal.js +59 -0
- package/dist/styled/components/ui/recipes/popover.cjs +1 -0
- package/dist/styled/components/ui/recipes/popover.d.ts +4 -0
- package/dist/styled/components/ui/recipes/popover.js +20 -0
- package/dist/styled/components/ui/recipes/scrollable.cjs +1 -0
- package/dist/styled/components/ui/recipes/scrollable.d.ts +4 -0
- package/dist/styled/components/ui/recipes/scrollable.js +15 -0
- package/dist/styled/components/ui/recipes/select.cjs +1 -0
- package/dist/styled/components/ui/recipes/select.d.ts +4 -0
- package/dist/styled/components/ui/recipes/select.js +38 -0
- package/dist/styled/components/ui/recipes/skeleton.cjs +1 -0
- package/dist/styled/components/ui/recipes/skeleton.d.ts +2 -0
- package/dist/styled/components/ui/recipes/skeleton.js +16 -0
- package/dist/styled/components/ui/recipes/widget-toggle.cjs +1 -0
- package/dist/styled/components/ui/recipes/widget-toggle.d.ts +4 -0
- package/dist/styled/components/ui/recipes/widget-toggle.js +35 -0
- package/dist/styled/index.cjs +1 -0
- package/dist/styled/index.d.ts +2 -0
- package/dist/styled/index.js +200 -0
- package/dist/styled/inkeep.css.cjs +4567 -0
- package/dist/styled/inkeep.css.js +4571 -0
- package/dist/styled/utils.cjs +1 -0
- package/dist/styled/utils.d.ts +4 -0
- package/dist/styled/utils.js +11 -0
- package/dist/theme/color-utils.cjs +1 -0
- package/dist/theme/color-utils.d.ts +1 -0
- package/dist/theme/color-utils.js +21 -0
- package/dist/theme/colors.cjs +1 -0
- package/dist/theme/colors.d.ts +104 -0
- package/dist/theme/colors.js +143 -0
- package/dist/theme/index.cjs +1 -0
- package/dist/theme/index.d.ts +125 -0
- package/dist/theme/index.js +58 -0
- package/dist/theme/utils/create-css-variables.cjs +1 -0
- package/dist/theme/utils/create-css-variables.d.ts +2 -0
- package/dist/theme/utils/create-css-variables.js +24 -0
- package/dist/theme/utils/generate-theme-variables.cjs +1 -0
- package/dist/theme/utils/generate-theme-variables.d.ts +3 -0
- package/dist/theme/utils/generate-theme-variables.js +34 -0
- package/dist/types/color-mode.d.ts +44 -0
- package/dist/types/config/ai.d.ts +269 -0
- package/dist/types/config/base.d.ts +358 -0
- package/dist/types/config/components.d.ts +16 -0
- package/dist/types/config/filters.d.ts +17 -0
- package/dist/types/config/index.d.ts +36 -0
- package/dist/types/config/open-settings.d.ts +70 -0
- package/dist/types/config/search.d.ts +95 -0
- package/dist/types/config/settings/actions.d.ts +112 -0
- package/dist/types/config/settings/form.d.ts +83 -0
- package/dist/types/config/settings/jsonschema.d.ts +105 -0
- package/dist/types/config/settings/workflow.d.ts +86 -0
- package/dist/types/events.d.ts +188 -0
- package/dist/types/icons/built-in.d.ts +1 -0
- package/dist/types/icons/custom.d.ts +33 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/js/index.d.ts +55 -0
- package/dist/types/message.d.ts +43 -0
- package/dist/types/shadow.d.ts +15 -0
- package/dist/types/sources.d.ts +100 -0
- package/dist/types/theme.d.ts +25 -0
- package/dist/types/widget.d.ts +27 -0
- package/package.json +140 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as s, useCallback as E, useEffect as k } from "react";
|
|
3
|
+
import { useLocalStorage as D } from "./use-local-storage.js";
|
|
4
|
+
import { useInkeepApiClient as F } from "./use-inkeep-api-client.js";
|
|
5
|
+
const M = 30 * 1e3, b = 2147483647, L = () => {
|
|
6
|
+
}, j = async () => ({});
|
|
7
|
+
function w(t) {
|
|
8
|
+
return new Date(t.expiresAt).getTime() - M <= Date.now();
|
|
9
|
+
}
|
|
10
|
+
const X = ({
|
|
11
|
+
baseUrl: t,
|
|
12
|
+
appId: e,
|
|
13
|
+
getCaptchaHeader: C,
|
|
14
|
+
invalidateCaptcha: d,
|
|
15
|
+
optOutAllAnalytics: g
|
|
16
|
+
}) => {
|
|
17
|
+
const _ = e && !g ? `inkeep_session_${e}` : null, [i, T] = D(_), { fetchWithAuth: R } = F({
|
|
18
|
+
appId: e,
|
|
19
|
+
authToken: void 0,
|
|
20
|
+
getCaptchaHeader: C ?? j,
|
|
21
|
+
invalidateCaptcha: d ?? L
|
|
22
|
+
}), l = s(t);
|
|
23
|
+
l.current = t;
|
|
24
|
+
const h = s(e);
|
|
25
|
+
h.current = e;
|
|
26
|
+
const u = s(i);
|
|
27
|
+
u.current = i;
|
|
28
|
+
const S = s(T);
|
|
29
|
+
S.current = T;
|
|
30
|
+
const p = s(R);
|
|
31
|
+
p.current = R;
|
|
32
|
+
const f = s(null), r = E(async (n) => {
|
|
33
|
+
if (!l.current || !h.current) return null;
|
|
34
|
+
if (!n && f.current)
|
|
35
|
+
return f.current;
|
|
36
|
+
const o = `${l.current}/run/auth/apps/${h.current}/anonymous-session`, a = (async () => {
|
|
37
|
+
try {
|
|
38
|
+
const c = { "Content-Type": "application/json" }, x = u.current?.token;
|
|
39
|
+
x && (c.Authorization = `Bearer ${x}`);
|
|
40
|
+
const A = await p.current(o, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: c,
|
|
43
|
+
signal: n
|
|
44
|
+
});
|
|
45
|
+
if (!A.ok) throw new Error(`Failed to fetch anonymous session: ${A.status}`);
|
|
46
|
+
const y = await A.json();
|
|
47
|
+
return S.current({ token: y.token, expiresAt: y.expiresAt }), y.token;
|
|
48
|
+
} catch (c) {
|
|
49
|
+
return c instanceof Error && c.name === "AbortError" || console.error("[anonymous-session] fetch failed", c), null;
|
|
50
|
+
} finally {
|
|
51
|
+
n || (f.current = null);
|
|
52
|
+
}
|
|
53
|
+
})();
|
|
54
|
+
return n || (f.current = a), a;
|
|
55
|
+
}, []), v = s(!1);
|
|
56
|
+
k(() => {
|
|
57
|
+
if (!t || !e) return;
|
|
58
|
+
const n = !v.current;
|
|
59
|
+
if (v.current = !0, !n && u.current && !w(u.current) || f.current) return;
|
|
60
|
+
const o = new AbortController();
|
|
61
|
+
return r(o.signal), () => o.abort();
|
|
62
|
+
}, [t, e, r]), k(() => {
|
|
63
|
+
if (!t || !e || !i?.expiresAt) return;
|
|
64
|
+
const m = new Date(i.expiresAt).getTime() - M - Date.now();
|
|
65
|
+
if (m <= 0) return;
|
|
66
|
+
const a = setTimeout(() => r(), Math.min(m, b));
|
|
67
|
+
return () => clearTimeout(a);
|
|
68
|
+
}, [t, e, i?.expiresAt, r]), k(() => {
|
|
69
|
+
if (!t || !e) return;
|
|
70
|
+
const n = () => {
|
|
71
|
+
if (document.visibilityState !== "visible") return;
|
|
72
|
+
const o = u.current;
|
|
73
|
+
(!o || w(o)) && r();
|
|
74
|
+
};
|
|
75
|
+
return document.addEventListener("visibilitychange", n), () => document.removeEventListener("visibilitychange", n);
|
|
76
|
+
}, [t, e, r]);
|
|
77
|
+
const $ = E(() => r(), [r]);
|
|
78
|
+
return { sessionToken: i?.token ?? null, refreshSession: $ };
|
|
79
|
+
};
|
|
80
|
+
export {
|
|
81
|
+
X as useAnonymousSession
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function n(s=!1){if(typeof s!="boolean")throw new Error("defaultValue must be `true` or `false`");const[o,e]=t.useState(s),l=t.useCallback(()=>{e(!0)},[]),a=t.useCallback(()=>{e(!1)},[]),u=t.useCallback(()=>{e(r=>!r)},[]);return{value:o,setValue:e,setTrue:l,setFalse:a,toggle:u}}exports.useBoolean=n;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
type UseBooleanReturn = {
|
|
3
|
+
value: boolean;
|
|
4
|
+
setValue: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
setTrue: () => void;
|
|
6
|
+
setFalse: () => void;
|
|
7
|
+
toggle: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function useBoolean(defaultValue?: boolean): UseBooleanReturn;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as n, useCallback as t } from "react";
|
|
3
|
+
function f(o = !1) {
|
|
4
|
+
if (typeof o != "boolean")
|
|
5
|
+
throw new Error("defaultValue must be `true` or `false`");
|
|
6
|
+
const [s, e] = n(o), r = t(() => {
|
|
7
|
+
e(!0);
|
|
8
|
+
}, []), l = t(() => {
|
|
9
|
+
e(!1);
|
|
10
|
+
}, []), u = t(() => {
|
|
11
|
+
e((a) => !a);
|
|
12
|
+
}, []);
|
|
13
|
+
return { value: s, setValue: e, setTrue: r, setFalse: l, toggle: u };
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
f as useBoolean
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../providers/config-provider.cjs"),a=require("../providers/markdown-provider.cjs"),c=require("../utils/misc.cjs");function m(e,n){const{prefix:s}=i.useInkeepConfig(),o=a.useChatMarkdown(),t=u(e,o)?o?.componentStyles?.[e]:void 0,r=`${s}-${c.toKebabCase(e)}`;return[n,t,r].filter(Boolean).join(" ")}function u(e,n){return!!n?.componentStyles&&e in n.componentStyles}exports.useComponentClassNames=m;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentID } from '../utils/component-ids';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to compute class names for a component based on its ID, user-provided classes,
|
|
4
|
+
* global configuration, and prefixing rules.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useComponentClassNames(id: ComponentID, userClassName?: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useInkeepConfig as m } from "../providers/config-provider.js";
|
|
3
|
+
import { useChatMarkdown as a } from "../providers/markdown-provider.js";
|
|
4
|
+
import { toKebabCase as i } from "../utils/misc.js";
|
|
5
|
+
function u(o, n) {
|
|
6
|
+
const { prefix: t } = m(), e = a(), s = p(o, e) ? e?.componentStyles?.[o] : void 0, r = `${t}-${i(o)}`;
|
|
7
|
+
return [n, s, r].filter(Boolean).join(" ");
|
|
8
|
+
}
|
|
9
|
+
function p(o, n) {
|
|
10
|
+
return !!n?.componentStyles && o in n.componentStyles;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
u as useComponentClassNames
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function o(){const e=t.useRef(null),[r,s]=t.useState({width:0,height:0});return t.useEffect(()=>{if(!e.current)return;const n=new ResizeObserver(([i])=>{const{width:c,height:u}=i.contentRect;s({width:c,height:u})});return n.observe(e.current),()=>{n.disconnect()}},[e]),[e,r]}exports.useContainerSize=o;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as o, useState as u, useEffect as f } from "react";
|
|
3
|
+
function z() {
|
|
4
|
+
const e = o(null), [n, r] = u({ width: 0, height: 0 });
|
|
5
|
+
return f(() => {
|
|
6
|
+
if (!e.current) return;
|
|
7
|
+
const t = new ResizeObserver(([s]) => {
|
|
8
|
+
const { width: i, height: c } = s.contentRect;
|
|
9
|
+
r({ width: i, height: c });
|
|
10
|
+
});
|
|
11
|
+
return t.observe(e.current), () => {
|
|
12
|
+
t.disconnect();
|
|
13
|
+
};
|
|
14
|
+
}, [e]), [e, n];
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
z as useContainerSize
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),v=require("./use-inkeep-api-client.cjs"),C=()=>{},p=({baseUrl:o,appId:s,authToken:n,getCaptchaHeader:a,invalidateCaptcha:i,refreshSession:c})=>{const{fetchWithAuth:t}=v.useInkeepApiClient({appId:s,authToken:n,getCaptchaHeader:a,invalidateCaptcha:i??C,refreshSession:c});return{loadConversation:d.useCallback(async(u,l)=>{if(!o||!n)return null;try{const e=`${o}/run/v1/conversations/${u}`,r=await t(e,{signal:l});if(!r.ok)throw new Error(`Failed to load conversation: ${r.status}`);return(await r.json()).data?.messages??[]}catch(e){return e instanceof Error&&e.name==="AbortError"||console.error("[useConversationLoader]",e),null}},[o,n,t])}};exports.useConversationLoader=p;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Message } from '../../types/index.ts';
|
|
2
|
+
interface UseConversationLoaderOptions {
|
|
3
|
+
baseUrl: string | undefined;
|
|
4
|
+
appId: string | undefined;
|
|
5
|
+
authToken: string | null;
|
|
6
|
+
getCaptchaHeader: () => Promise<Record<string, string>>;
|
|
7
|
+
invalidateCaptcha?: () => void;
|
|
8
|
+
refreshSession?: () => Promise<string | null>;
|
|
9
|
+
}
|
|
10
|
+
export declare const useConversationLoader: ({ baseUrl, appId, authToken, getCaptchaHeader, invalidateCaptcha, refreshSession, }: UseConversationLoaderOptions) => {
|
|
11
|
+
loadConversation: (conversationId: string, signal?: AbortSignal) => Promise<Message[] | null>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as d } from "react";
|
|
3
|
+
import { useInkeepApiClient as v } from "./use-inkeep-api-client.js";
|
|
4
|
+
const f = () => {
|
|
5
|
+
}, w = ({
|
|
6
|
+
baseUrl: r,
|
|
7
|
+
appId: s,
|
|
8
|
+
authToken: n,
|
|
9
|
+
getCaptchaHeader: a,
|
|
10
|
+
invalidateCaptcha: i,
|
|
11
|
+
refreshSession: c
|
|
12
|
+
}) => {
|
|
13
|
+
const { fetchWithAuth: e } = v({
|
|
14
|
+
appId: s,
|
|
15
|
+
authToken: n,
|
|
16
|
+
getCaptchaHeader: a,
|
|
17
|
+
invalidateCaptcha: i ?? f,
|
|
18
|
+
refreshSession: c
|
|
19
|
+
});
|
|
20
|
+
return { loadConversation: d(
|
|
21
|
+
async (l, u) => {
|
|
22
|
+
if (!r || !n) return null;
|
|
23
|
+
try {
|
|
24
|
+
const o = `${r}/run/v1/conversations/${l}`, t = await e(o, { signal: u });
|
|
25
|
+
if (!t.ok) throw new Error(`Failed to load conversation: ${t.status}`);
|
|
26
|
+
return (await t.json()).data?.messages ?? [];
|
|
27
|
+
} catch (o) {
|
|
28
|
+
return o instanceof Error && o.name === "AbortError" || console.error("[useConversationLoader]", o), null;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
[r, n, e]
|
|
32
|
+
) };
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
w as useConversationLoader
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),i=require("marked");function s(){const[a,e]=r.useState(!1),l=r.useCallback(async o=>{if(!navigator?.clipboard)return console.warn("Clipboard not supported"),!1;try{const t=await i.marked.parse(o),n={"text/plain":new Blob([o],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})};return await navigator.clipboard.write([new ClipboardItem(n)]),e(!0),setTimeout(()=>{e(!1)},1e3),!0}catch(t){return console.warn("Copy failed",t),e(!1),!1}},[]);return[a,l]}exports.useCopyToClipboard=s;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as n, useCallback as i } from "react";
|
|
3
|
+
import { marked as p } from "marked";
|
|
4
|
+
function u() {
|
|
5
|
+
const [r, e] = n(!1), a = i(async (o) => {
|
|
6
|
+
if (!navigator?.clipboard)
|
|
7
|
+
return console.warn("Clipboard not supported"), !1;
|
|
8
|
+
try {
|
|
9
|
+
const t = await p.parse(o), l = {
|
|
10
|
+
"text/plain": new Blob([o], { type: "text/plain" }),
|
|
11
|
+
"text/html": new Blob([t], { type: "text/html" })
|
|
12
|
+
};
|
|
13
|
+
return await navigator.clipboard.write([new ClipboardItem(l)]), e(!0), setTimeout(() => {
|
|
14
|
+
e(!1);
|
|
15
|
+
}, 1e3), !0;
|
|
16
|
+
} catch (t) {
|
|
17
|
+
return console.warn("Copy failed", t), e(!1), !1;
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
return [r, a];
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
u as useCopyToClipboard
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function r(e,t){const[n,c]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>{c(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}exports.useDebounce=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as c, useEffect as r } from "react";
|
|
3
|
+
function i(e, t) {
|
|
4
|
+
const [u, n] = c(e);
|
|
5
|
+
return r(() => {
|
|
6
|
+
const o = setTimeout(() => {
|
|
7
|
+
n(e);
|
|
8
|
+
}, t);
|
|
9
|
+
return () => {
|
|
10
|
+
clearTimeout(o);
|
|
11
|
+
};
|
|
12
|
+
}, [e, t]), u;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
i as useDebounce
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react");function y(e,r){if(e===400&&typeof r=="object"&&r!==null){const t=(r.detail??"").toLowerCase();if(t.includes("challenge")||t.includes("proof-of-work"))return"pow"}if(e===401&&typeof r=="object"&&r!==null){const t=r.detail??"";if(t.includes("Invalid end-user JWT")||t.includes("Bearer token required"))return"session"}return null}function H(e){if(!e)return{};if(e instanceof Headers){const r={};return e.forEach((t,c)=>{r[c]=t}),r}return Array.isArray(e)?Object.fromEntries(e):e}function p(e,r,t,c){return{...e?{"x-inkeep-app-id":e}:{},...r?{Authorization:`Bearer ${r}`}:{},...H(c),...t}}function g({appId:e,authToken:r,getCaptchaHeader:t,invalidateCaptcha:c,refreshSession:R}){const a=u.useRef(e);a.current=e;const i=u.useRef(r);i.current=r;const o=u.useRef(t);o.current=t;const w=u.useRef(c);w.current=c;const h=u.useRef(R);return h.current=R,{fetchWithAuth:u.useCallback(async(l,s)=>{const C=await o.current(),j=p(a.current,i.current,C,s?.headers),n=await fetch(l,{...s,headers:j});if(n.status!==400&&n.status!==401)return n;let A;try{A=await n.clone().json()}catch{return n}const k=y(n.status,A);if(k==="pow"){w.current();const f=await o.current(),d=p(a.current,i.current,f,s?.headers);return fetch(l,{...s,headers:d})}if(k==="session"&&h.current){const f=await h.current();if(!f)return n;const d=await o.current(),E=p(a.current,f,d,s?.headers);return fetch(l,{...s,headers:E})}return n},[])}}exports.parseAuthError=y;exports.useInkeepApiClient=g;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
interface UseInkeepApiClientOptions {
|
|
2
|
+
appId: string | undefined;
|
|
3
|
+
/** The bearer token to send as Authorization — pass undefined for unauthenticated calls. */
|
|
4
|
+
authToken: string | null | undefined;
|
|
5
|
+
getCaptchaHeader: () => Promise<Record<string, string>>;
|
|
6
|
+
invalidateCaptcha: () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Called when a 401 session error is detected.
|
|
9
|
+
* Should refresh the anonymous session and return the new token, or null on failure.
|
|
10
|
+
* Hook point for future rolling-token support — pass undefined to skip session retry.
|
|
11
|
+
*/
|
|
12
|
+
refreshSession?: () => Promise<string | null>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parses an API error response body to determine the failure type.
|
|
16
|
+
*
|
|
17
|
+
* The Run API returns:
|
|
18
|
+
* - 400 + detail containing "challenge" or "proof-of-work" → PoW failure
|
|
19
|
+
* - 401 + detail matching JWT/bearer messages → session token failure
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseAuthError(status: number, body: unknown): 'pow' | 'session' | null;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a stable `fetchWithAuth` function that automatically:
|
|
24
|
+
* - Injects auth headers (x-inkeep-app-id, Authorization, x-inkeep-challenge-solution)
|
|
25
|
+
* - Retries once on PoW errors (400) with a fresh captcha solution
|
|
26
|
+
* - Retries once on session errors (401) by refreshing the session token (when refreshSession is provided)
|
|
27
|
+
*
|
|
28
|
+
* All options are kept in refs so `fetchWithAuth` is created once and never needs to be re-created.
|
|
29
|
+
*/
|
|
30
|
+
export declare function useInkeepApiClient({ appId, authToken, getCaptchaHeader, invalidateCaptcha, refreshSession, }: UseInkeepApiClientOptions): {
|
|
31
|
+
fetchWithAuth: (url: string, init?: RequestInit) => Promise<Response>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as u, useCallback as y } from "react";
|
|
3
|
+
function E(e, r) {
|
|
4
|
+
if (e === 400 && typeof r == "object" && r !== null) {
|
|
5
|
+
const t = (r.detail ?? "").toLowerCase();
|
|
6
|
+
if (t.includes("challenge") || t.includes("proof-of-work")) return "pow";
|
|
7
|
+
}
|
|
8
|
+
if (e === 401 && typeof r == "object" && r !== null) {
|
|
9
|
+
const t = r.detail ?? "";
|
|
10
|
+
if (t.includes("Invalid end-user JWT") || t.includes("Bearer token required"))
|
|
11
|
+
return "session";
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function m(e) {
|
|
16
|
+
if (!e) return {};
|
|
17
|
+
if (e instanceof Headers) {
|
|
18
|
+
const r = {};
|
|
19
|
+
return e.forEach((t, c) => {
|
|
20
|
+
r[c] = t;
|
|
21
|
+
}), r;
|
|
22
|
+
}
|
|
23
|
+
return Array.isArray(e) ? Object.fromEntries(e) : e;
|
|
24
|
+
}
|
|
25
|
+
function p(e, r, t, c) {
|
|
26
|
+
return {
|
|
27
|
+
...e ? { "x-inkeep-app-id": e } : {},
|
|
28
|
+
...r ? { Authorization: `Bearer ${r}` } : {},
|
|
29
|
+
...m(c),
|
|
30
|
+
// captcha last — must not be overridden by caller headers
|
|
31
|
+
...t
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function x({
|
|
35
|
+
appId: e,
|
|
36
|
+
authToken: r,
|
|
37
|
+
getCaptchaHeader: t,
|
|
38
|
+
invalidateCaptcha: c,
|
|
39
|
+
refreshSession: w
|
|
40
|
+
}) {
|
|
41
|
+
const a = u(e);
|
|
42
|
+
a.current = e;
|
|
43
|
+
const i = u(r);
|
|
44
|
+
i.current = r;
|
|
45
|
+
const o = u(t);
|
|
46
|
+
o.current = t;
|
|
47
|
+
const A = u(c);
|
|
48
|
+
A.current = c;
|
|
49
|
+
const h = u(w);
|
|
50
|
+
return h.current = w, { fetchWithAuth: y(async (d, s) => {
|
|
51
|
+
const C = await o.current(), H = p(
|
|
52
|
+
a.current,
|
|
53
|
+
i.current,
|
|
54
|
+
C,
|
|
55
|
+
s?.headers
|
|
56
|
+
), n = await fetch(d, { ...s, headers: H });
|
|
57
|
+
if (n.status !== 400 && n.status !== 401) return n;
|
|
58
|
+
let R;
|
|
59
|
+
try {
|
|
60
|
+
R = await n.clone().json();
|
|
61
|
+
} catch {
|
|
62
|
+
return n;
|
|
63
|
+
}
|
|
64
|
+
const k = E(n.status, R);
|
|
65
|
+
if (k === "pow") {
|
|
66
|
+
A.current();
|
|
67
|
+
const f = await o.current(), l = p(
|
|
68
|
+
a.current,
|
|
69
|
+
i.current,
|
|
70
|
+
f,
|
|
71
|
+
s?.headers
|
|
72
|
+
);
|
|
73
|
+
return fetch(d, { ...s, headers: l });
|
|
74
|
+
}
|
|
75
|
+
if (k === "session" && h.current) {
|
|
76
|
+
const f = await h.current();
|
|
77
|
+
if (!f) return n;
|
|
78
|
+
const l = await o.current(), j = p(a.current, f, l, s?.headers);
|
|
79
|
+
return fetch(d, { ...s, headers: j });
|
|
80
|
+
}
|
|
81
|
+
return n;
|
|
82
|
+
}, []) };
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
E as parseAuthError,
|
|
86
|
+
x as useInkeepApiClient
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),S=require("@radix-ui/react-use-controllable-state"),v=require("../providers/base-events-provider.cjs"),y=require("../components/use-component-trigger.cjs"),C=(f,r)=>{const{isOpen:g,onOpenChange:p,defaultOpen:a=!1,shortcutKey:o,triggerSelector:d=r.defaultTriggerSelector}=f??{},{logEvent:m}=v.useBaseEvents(),[t=a,n]=S.useControllableState({prop:g,defaultProp:a??!1,onChange:p}),c=d||r.defaultTriggerSelector;y.useComponentTrigger({triggerSelector:c,onTriggerClick:c?()=>n(!t):void 0});const u=s.useRef(!0);s.useEffect(()=>{if(u.current){u.current=!1;return}m({eventName:t?`${r.eventNamePrefix}_opened`:`${r.eventNamePrefix}_closed`,properties:{}})},[t,r.eventNamePrefix]);const i=s.useRef(t);return i.current=t,s.useEffect(()=>{const l=e=>{o&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===o.toLowerCase()&&(e.preventDefault(),e.stopPropagation(),n(!0)),e.key==="Escape"&&i.current&&(e.preventDefault(),n(!1))};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o,n]),{isOpen:t,setOpen:n,shortcutKey:o}};exports.useInkeepOpenState=C;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseOpenSettings } from '../../types/index.ts';
|
|
2
|
+
import { SetStateAction } from 'react';
|
|
3
|
+
export interface UseInkeepOpenStateOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The prefix for event names when logging open/close events
|
|
6
|
+
* e.g., 'modal' will log 'modal_opened' and 'modal_closed'
|
|
7
|
+
*/
|
|
8
|
+
eventNamePrefix: string;
|
|
9
|
+
/**
|
|
10
|
+
* Default trigger selector to use if none provided
|
|
11
|
+
*/
|
|
12
|
+
defaultTriggerSelector?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const useInkeepOpenState: <T extends BaseOpenSettings>(props: T | undefined, options: UseInkeepOpenStateOptions) => {
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
setOpen: (value: SetStateAction<boolean>) => void;
|
|
17
|
+
shortcutKey: string | null | undefined;
|
|
18
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as l, useEffect as u } from "react";
|
|
3
|
+
import { useControllableState as v } from "@radix-ui/react-use-controllable-state";
|
|
4
|
+
import { useBaseEvents as C } from "../providers/base-events-provider.js";
|
|
5
|
+
import { useComponentTrigger as S } from "../components/use-component-trigger.js";
|
|
6
|
+
const P = (p, t) => {
|
|
7
|
+
const {
|
|
8
|
+
isOpen: g,
|
|
9
|
+
onOpenChange: m,
|
|
10
|
+
defaultOpen: s = !1,
|
|
11
|
+
shortcutKey: o,
|
|
12
|
+
triggerSelector: d = t.defaultTriggerSelector
|
|
13
|
+
} = p ?? {}, { logEvent: y } = C(), [r = s, n] = v({
|
|
14
|
+
prop: g,
|
|
15
|
+
defaultProp: s ?? !1,
|
|
16
|
+
onChange: m
|
|
17
|
+
}), a = d || t.defaultTriggerSelector;
|
|
18
|
+
S({
|
|
19
|
+
triggerSelector: a,
|
|
20
|
+
onTriggerClick: a ? () => n(!r) : void 0
|
|
21
|
+
});
|
|
22
|
+
const c = l(!0);
|
|
23
|
+
u(() => {
|
|
24
|
+
if (c.current) {
|
|
25
|
+
c.current = !1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
y({
|
|
29
|
+
eventName: r ? `${t.eventNamePrefix}_opened` : `${t.eventNamePrefix}_closed`,
|
|
30
|
+
properties: {}
|
|
31
|
+
});
|
|
32
|
+
}, [r, t.eventNamePrefix]);
|
|
33
|
+
const f = l(r);
|
|
34
|
+
return f.current = r, u(() => {
|
|
35
|
+
const i = (e) => {
|
|
36
|
+
o && (e.metaKey || e.ctrlKey) && e.key.toLowerCase() === o.toLowerCase() && (e.preventDefault(), e.stopPropagation(), n(!0)), e.key === "Escape" && f.current && (e.preventDefault(), n(!1));
|
|
37
|
+
};
|
|
38
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
39
|
+
}, [o, n]), {
|
|
40
|
+
isOpen: r,
|
|
41
|
+
setOpen: n,
|
|
42
|
+
shortcutKey: o
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
P as useInkeepOpenState
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function u(){const[e,s]=t.useState(!1);t.useEffect(()=>{if(e){const n=setTimeout(()=>s(!1),0);return()=>clearTimeout(n)}},[e]);const a=t.useCallback(()=>s(!0),[]);return{disabled:e,disableTransition:a}}exports.useInstantUpdate=u;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for temporarily disabling transitions/animations.
|
|
3
|
+
* Useful when you need to prevent unwanted transition effects during state changes.
|
|
4
|
+
*
|
|
5
|
+
* const { disabled, disableTransition } = useInstantUpdate();
|
|
6
|
+
*
|
|
7
|
+
* // Disable transitions before a state change
|
|
8
|
+
* const handleClick = () => {
|
|
9
|
+
* disableTransition();
|
|
10
|
+
* // State change here...
|
|
11
|
+
* };
|
|
12
|
+
*/
|
|
13
|
+
export declare function useInstantUpdate(): {
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
disableTransition: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as i, useEffect as n, useCallback as r } from "react";
|
|
3
|
+
function o() {
|
|
4
|
+
const [e, t] = i(!1);
|
|
5
|
+
n(() => {
|
|
6
|
+
if (e) {
|
|
7
|
+
const a = setTimeout(() => t(!1), 0);
|
|
8
|
+
return () => clearTimeout(a);
|
|
9
|
+
}
|
|
10
|
+
}, [e]);
|
|
11
|
+
const s = r(() => t(!0), []);
|
|
12
|
+
return { disabled: e, disableTransition: s };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
o as useInstantUpdate
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function u(){const e=t.useRef(!1);return t.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.useCallback(()=>e.current,[])}exports.useIsMounted=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMounted(): () => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as r, useEffect as t, useCallback as u } from "react";
|
|
3
|
+
function s() {
|
|
4
|
+
const e = r(!1);
|
|
5
|
+
return t(() => (e.current = !0, () => {
|
|
6
|
+
e.current = !1;
|
|
7
|
+
}), []), u(() => e.current, []);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
s as useIsMounted
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),u=t=>{const[l,o]=r.useState(()=>{if(!t)return null;try{const e=localStorage.getItem(t);return e!==null?JSON.parse(e):null}catch{return null}}),a=r.useCallback(e=>{if(o(e),!!t)try{e===null?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(e))}catch{}},[t]);return[l,a]};exports.useLocalStorage=u;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syncs a value with localStorage. Pass `null` as the key to disable persistence
|
|
3
|
+
* (state still works in-memory but nothing is read from or written to localStorage).
|
|
4
|
+
*
|
|
5
|
+
* Gracefully handles environments where localStorage is unavailable (e.g. private
|
|
6
|
+
* browsing, iframe sandboxing, storage quota exceeded).
|
|
7
|
+
*/
|
|
8
|
+
export declare const useLocalStorage: <T>(key: string | null) => [T | null, (value: T | null) => void];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as n, useCallback as a } from "react";
|
|
3
|
+
const u = (t) => {
|
|
4
|
+
const [r, l] = n(() => {
|
|
5
|
+
if (!t) return null;
|
|
6
|
+
try {
|
|
7
|
+
const e = localStorage.getItem(t);
|
|
8
|
+
return e !== null ? JSON.parse(e) : null;
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}), o = a(
|
|
13
|
+
(e) => {
|
|
14
|
+
if (l(e), !!t)
|
|
15
|
+
try {
|
|
16
|
+
e === null ? localStorage.removeItem(t) : localStorage.setItem(t, JSON.stringify(e));
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
[t]
|
|
21
|
+
);
|
|
22
|
+
return [r, o];
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
u as useLocalStorage
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),i=t=>{const[c,s]=a.useState(!1);return a.useEffect(()=>{const e=window.matchMedia(t);s(e.matches);const n=r=>s(r.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)},[t]),c};exports.useMediaQuery=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useMediaQuery: (query: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as r, useEffect as i } from "react";
|
|
3
|
+
const m = (t) => {
|
|
4
|
+
const [a, s] = r(!1);
|
|
5
|
+
return i(() => {
|
|
6
|
+
const e = window.matchMedia(t);
|
|
7
|
+
s(e.matches);
|
|
8
|
+
const n = (c) => s(c.matches);
|
|
9
|
+
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
10
|
+
}, [t]), a;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
m as useMediaQuery
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),g=require("./use-is-mounted.cjs"),S={width:void 0,height:void 0};function l(t){const{ref:e,box:i="content-box"}=t,[{width:w,height:a},b]=r.useState(S),u=g.useIsMounted(),n=r.useRef({...S}),o=r.useRef(void 0);return o.current=t.onResize,r.useEffect(()=>{if(!e.current||typeof window>"u"||!("ResizeObserver"in window))return;const d=new ResizeObserver(([h])=>{const f=i==="border-box"?"borderBoxSize":i==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",s=v(h,f,"inlineSize"),c=v(h,f,"blockSize");if(n.current.width!==s||n.current.height!==c){const z={width:s,height:c};n.current.width=s,n.current.height=c,o.current?o.current(z):u()&&b(z)}});return d.observe(e.current,{box:i}),()=>{d.disconnect()}},[i,e,u]),{width:w,height:a}}function v(t,e,i){return t[e]?Array.isArray(t[e])?t[e][0][i]:t[e][i]:e==="contentBoxSize"?t.contentRect[i==="inlineSize"?"width":"height"]:void 0}exports.useResizeObserver=l;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
type Size = {
|
|
3
|
+
width: number | undefined;
|
|
4
|
+
height: number | undefined;
|
|
5
|
+
};
|
|
6
|
+
type UseResizeObserverOptions<T extends HTMLElement = HTMLElement> = {
|
|
7
|
+
ref: RefObject<T | null>;
|
|
8
|
+
onResize?: (size: Size) => void;
|
|
9
|
+
box?: 'border-box' | 'content-box' | 'device-pixel-content-box';
|
|
10
|
+
};
|
|
11
|
+
export declare function useResizeObserver<T extends HTMLElement = HTMLElement>(options: UseResizeObserverOptions<T>): Size;
|
|
12
|
+
export {};
|