@inkeep/agents-ui 0.0.0-rc-20260310051343
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 +64 -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 +51 -0
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +275 -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 +9 -0
- package/dist/primitives/hooks/use-anonymous-session.js +45 -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 +12 -0
- package/dist/primitives/hooks/use-conversation-loader.js +41 -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-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 +30 -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 +37 -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 +428 -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 +26 -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 +4565 -0
- package/dist/styled/inkeep.css.js +4569 -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,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as m, useEffect as p } from "react";
|
|
3
|
+
import { useLocalStorage as S } from "./use-local-storage.js";
|
|
4
|
+
const F = ({
|
|
5
|
+
baseUrl: n,
|
|
6
|
+
appId: t,
|
|
7
|
+
getCaptchaHeader: i,
|
|
8
|
+
invalidateCaptcha: u,
|
|
9
|
+
optOutAllAnalytics: y
|
|
10
|
+
}) => {
|
|
11
|
+
const w = t && !y ? `inkeep_session_${t}` : null, [s, r] = S(w), e = m(i);
|
|
12
|
+
e.current = i;
|
|
13
|
+
const f = m(u);
|
|
14
|
+
return f.current = u, p(() => {
|
|
15
|
+
if (!n || !t || s) return;
|
|
16
|
+
const h = `${n}/run/auth/apps/${t}/anonymous-session`;
|
|
17
|
+
(async () => {
|
|
18
|
+
try {
|
|
19
|
+
const c = e.current ? await e.current() : {}, o = await fetch(h, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: { "Content-Type": "application/json", ...c }
|
|
22
|
+
});
|
|
23
|
+
if (!o.ok && o.status === 401) {
|
|
24
|
+
f.current?.();
|
|
25
|
+
const k = e.current ? await e.current() : {}, a = await fetch(h, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: { "Content-Type": "application/json", ...k }
|
|
28
|
+
});
|
|
29
|
+
if (!a.ok) throw new Error(`Failed to fetch anonymous session: ${a.status}`);
|
|
30
|
+
const l = await a.json();
|
|
31
|
+
r(l.token);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!o.ok) throw new Error(`Failed to fetch anonymous session: ${o.status}`);
|
|
35
|
+
const d = await o.json();
|
|
36
|
+
r(d.token);
|
|
37
|
+
} catch (c) {
|
|
38
|
+
console.error("[useAnonymousSession]", c);
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}, [n, t, s, r]), s;
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
F as useAnonymousSession
|
|
45
|
+
};
|
|
@@ -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 c=require("react"),h=({baseUrl:t,appId:o,authToken:n,getCaptchaHeader:i,invalidateCaptcha:u})=>{const s=c.useRef(i);s.current=i;const d=c.useRef(u);return d.current=u,{loadConversation:c.useCallback(async(v,l)=>{if(!t||!n)return null;try{const e=await s.current(),f=`${t}/run/v1/conversations/${v}`,y={...o?{"x-inkeep-app-id":o}:{},Authorization:`Bearer ${n}`},r=await fetch(f,{signal:l,headers:{...y,...e}});if(!r.ok&&r.status===401){d.current?.();const w=await s.current(),a=await fetch(f,{signal:l,headers:{...y,...w}});if(!a.ok)throw new Error(`Failed to load conversation: ${a.status}`);return(await a.json()).data?.messages??[]}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}},[t,o,n])}};exports.useConversationLoader=h;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
9
|
+
export declare const useConversationLoader: ({ baseUrl, appId, authToken, getCaptchaHeader, invalidateCaptcha, }: UseConversationLoaderOptions) => {
|
|
10
|
+
loadConversation: (conversationId: string, signal?: AbortSignal) => Promise<Message[] | null>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as w, useCallback as v } from "react";
|
|
3
|
+
const R = ({
|
|
4
|
+
baseUrl: t,
|
|
5
|
+
appId: o,
|
|
6
|
+
authToken: n,
|
|
7
|
+
getCaptchaHeader: c,
|
|
8
|
+
invalidateCaptcha: i
|
|
9
|
+
}) => {
|
|
10
|
+
const a = w(c);
|
|
11
|
+
a.current = c;
|
|
12
|
+
const u = w(i);
|
|
13
|
+
return u.current = i, { loadConversation: v(
|
|
14
|
+
async (y, d) => {
|
|
15
|
+
if (!t || !n) return null;
|
|
16
|
+
try {
|
|
17
|
+
const r = await a.current(), l = `${t}/run/v1/conversations/${y}`, f = {
|
|
18
|
+
...o ? { "x-inkeep-app-id": o } : {},
|
|
19
|
+
Authorization: `Bearer ${n}`
|
|
20
|
+
}, e = await fetch(l, { signal: d, headers: { ...f, ...r } });
|
|
21
|
+
if (!e.ok && e.status === 401) {
|
|
22
|
+
u.current?.();
|
|
23
|
+
const h = await a.current(), s = await fetch(l, {
|
|
24
|
+
signal: d,
|
|
25
|
+
headers: { ...f, ...h }
|
|
26
|
+
});
|
|
27
|
+
if (!s.ok) throw new Error(`Failed to load conversation: ${s.status}`);
|
|
28
|
+
return (await s.json()).data?.messages ?? [];
|
|
29
|
+
}
|
|
30
|
+
if (!e.ok) throw new Error(`Failed to load conversation: ${e.status}`);
|
|
31
|
+
return (await e.json()).data?.messages ?? [];
|
|
32
|
+
} catch (r) {
|
|
33
|
+
return r instanceof Error && r.name === "AbortError" || console.error("[useConversationLoader]", r), null;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[t, o, n]
|
|
37
|
+
) };
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
R as useConversationLoader
|
|
41
|
+
};
|
|
@@ -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 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 {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as g, useRef as z, useEffect as x } from "react";
|
|
3
|
+
import { useIsMounted as l } from "./use-is-mounted.js";
|
|
4
|
+
const w = {
|
|
5
|
+
width: void 0,
|
|
6
|
+
height: void 0
|
|
7
|
+
};
|
|
8
|
+
function B(t) {
|
|
9
|
+
const { ref: e, box: i = "content-box" } = t, [{ width: v, height: a }, b] = g(w), s = l(), n = z({ ...w }), r = z(void 0);
|
|
10
|
+
return r.current = t.onResize, x(() => {
|
|
11
|
+
if (!e.current || typeof window > "u" || !("ResizeObserver" in window)) return;
|
|
12
|
+
const u = new ResizeObserver(([d]) => {
|
|
13
|
+
const h = i === "border-box" ? "borderBoxSize" : i === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize", o = S(d, h, "inlineSize"), c = S(d, h, "blockSize");
|
|
14
|
+
if (n.current.width !== o || n.current.height !== c) {
|
|
15
|
+
const f = { width: o, height: c };
|
|
16
|
+
n.current.width = o, n.current.height = c, r.current ? r.current(f) : s() && b(f);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return u.observe(e.current, { box: i }), () => {
|
|
20
|
+
u.disconnect();
|
|
21
|
+
};
|
|
22
|
+
}, [i, e, s]), { width: v, height: a };
|
|
23
|
+
}
|
|
24
|
+
function S(t, e, i) {
|
|
25
|
+
return t[e] ? Array.isArray(t[e]) ? t[e][0][i] : (
|
|
26
|
+
// @ts-expect-error: TS doesn't know that box is a key of ResizeObserverEntry
|
|
27
|
+
t[e][i]
|
|
28
|
+
) : e === "contentBoxSize" ? t.contentRect[i === "inlineSize" ? "width" : "height"] : void 0;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
B as useResizeObserver
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react");function n(){const r=o.useRef(null),t=o.useCallback(()=>{const e=r.current;e&&(e.scrollTop===0?e.setAttribute("data-scroll-top",""):e.removeAttribute("data-scroll-top"),e.scrollTop+e.clientHeight>=e.scrollHeight-1?e.setAttribute("data-scroll-bottom",""):e.removeAttribute("data-scroll-bottom"))},[]);return o.useEffect(()=>{const e=r.current;if(e)return t(),e.addEventListener("scroll",t),window.addEventListener("resize",t),()=>{e.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[t]),r}exports.useScrollingFades=n;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as o, useCallback as n, useEffect as s } from "react";
|
|
3
|
+
function i() {
|
|
4
|
+
const r = o(null), t = n(() => {
|
|
5
|
+
const e = r.current;
|
|
6
|
+
e && (e.scrollTop === 0 ? e.setAttribute("data-scroll-top", "") : e.removeAttribute("data-scroll-top"), e.scrollTop + e.clientHeight >= e.scrollHeight - 1 ? e.setAttribute("data-scroll-bottom", "") : e.removeAttribute("data-scroll-bottom"));
|
|
7
|
+
}, []);
|
|
8
|
+
return s(() => {
|
|
9
|
+
const e = r.current;
|
|
10
|
+
if (e)
|
|
11
|
+
return t(), e.addEventListener("scroll", t), window.addEventListener("resize", t), () => {
|
|
12
|
+
e.removeEventListener("scroll", t), window.removeEventListener("resize", t);
|
|
13
|
+
};
|
|
14
|
+
}, [t]), r;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
i as useScrollingFades
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function l(){const[s,e]=t.useState(!1),u=t.useCallback(async()=>(e(!0),setTimeout(()=>{e(!1)},1e3),!0),[]);return[s,u]}exports.useSettleAction=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),R=10;function b(f={}){const{isStreaming:r=!1}=f,o=e.useRef(null),n=e.useRef(!0),l=e.useRef(!1),s=e.useRef(null),u=e.useCallback(()=>{const t=o.current;if(!t)return!0;const{scrollTop:c,scrollHeight:S,clientHeight:m}=t;return S-c-m<=R},[]),i=e.useCallback((t=!0)=>{const c=o.current;c&&(l.current||c.scrollTo({top:c.scrollHeight,behavior:t?"smooth":"auto"}))},[]),a=e.useCallback(()=>{o.current&&(l.current=!0,s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{l.current=!1,r&&u()&&(n.current=!0)},150),r&&!u()&&(n.current=!1))},[r,u]);return e.useEffect(()=>{if(!r){n.current=!0;return}const t=o.current;if(!t)return;const c=new MutationObserver(()=>{n.current&&!l.current&&r&&i(!1)});return c.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>c.disconnect()},[r,i]),e.useEffect(()=>{r&&(n.current=u())},[r,u]),e.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{containerRef:o,scrollToBottom:i,handleScroll:a,isAtBottom:u,shouldAutoScroll:()=>n.current}}exports.useSimpleScroll=b;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface UseSimpleScrollOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether streaming is currently active.
|
|
5
|
+
* When true, auto-scroll behavior is enabled.
|
|
6
|
+
*/
|
|
7
|
+
isStreaming?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function useSimpleScroll(options?: UseSimpleScrollOptions): {
|
|
10
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
11
|
+
scrollToBottom: (smooth?: boolean) => void;
|
|
12
|
+
handleScroll: () => void;
|
|
13
|
+
isAtBottom: () => boolean;
|
|
14
|
+
/** Whether auto-scroll is currently active (not hijacked by user) */
|
|
15
|
+
shouldAutoScroll: () => boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef as l, useCallback as f, useEffect as a } from "react";
|
|
3
|
+
const R = 10;
|
|
4
|
+
function d(m = {}) {
|
|
5
|
+
const { isStreaming: r = !1 } = m, o = l(null), n = l(!0), s = l(!1), u = l(null), c = f(() => {
|
|
6
|
+
const t = o.current;
|
|
7
|
+
if (!t) return !0;
|
|
8
|
+
const { scrollTop: e, scrollHeight: S, clientHeight: T } = t;
|
|
9
|
+
return S - e - T <= R;
|
|
10
|
+
}, []), i = f((t = !0) => {
|
|
11
|
+
const e = o.current;
|
|
12
|
+
e && (s.current || e.scrollTo({
|
|
13
|
+
top: e.scrollHeight,
|
|
14
|
+
behavior: t ? "smooth" : "auto"
|
|
15
|
+
}));
|
|
16
|
+
}, []), h = f(() => {
|
|
17
|
+
o.current && (s.current = !0, u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
18
|
+
s.current = !1, r && c() && (n.current = !0);
|
|
19
|
+
}, 150), r && !c() && (n.current = !1));
|
|
20
|
+
}, [r, c]);
|
|
21
|
+
return a(() => {
|
|
22
|
+
if (!r) {
|
|
23
|
+
n.current = !0;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const t = o.current;
|
|
27
|
+
if (!t) return;
|
|
28
|
+
const e = new MutationObserver(() => {
|
|
29
|
+
n.current && !s.current && r && i(!1);
|
|
30
|
+
});
|
|
31
|
+
return e.observe(t, {
|
|
32
|
+
childList: !0,
|
|
33
|
+
subtree: !0,
|
|
34
|
+
characterData: !0
|
|
35
|
+
}), () => e.disconnect();
|
|
36
|
+
}, [r, i]), a(() => {
|
|
37
|
+
r && (n.current = c());
|
|
38
|
+
}, [r, c]), a(() => () => {
|
|
39
|
+
u.current && clearTimeout(u.current);
|
|
40
|
+
}, []), {
|
|
41
|
+
containerRef: o,
|
|
42
|
+
scrollToBottom: i,
|
|
43
|
+
handleScroll: h,
|
|
44
|
+
isAtBottom: c,
|
|
45
|
+
/** Whether auto-scroll is currently active (not hijacked by user) */
|
|
46
|
+
shouldAutoScroll: () => n.current
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
d as useSimpleScroll
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),u=require("../atoms/shadow/context.cjs");function i(){const e=u.useShadow()?.shadowHost,s=n.useRef(""),o=n.useCallback(t=>{s.current=t},[]),r=n.useCallback((t,a)=>{if(!e){console.warn("useStreamingEvents: No host element available for parent event emission");return}const c=new CustomEvent(`ikp-${t}`,{detail:{...a,conversationId:s.current,timestamp:Date.now()},bubbles:!0,composed:!0});e.dispatchEvent(c)},[e]);return{setConversationId:o,emitToParent:r}}exports.useStreamingEvents=i;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for emitting streaming events that escape the Shadow DOM
|
|
3
|
+
* Allows parent applications to listen to real-time streaming data
|
|
4
|
+
*/
|
|
5
|
+
export declare function useStreamingEvents(): {
|
|
6
|
+
setConversationId: (id: string) => void;
|
|
7
|
+
emitToParent: (eventName: string, data: Record<string, unknown>) => void;
|
|
8
|
+
};
|