@carbon/ai-chat-components 1.7.0 → 1.9.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +16062 -10795
- package/es/components/audio-player/src/audio-player.js +9 -10
- package/es/components/audio-player/src/audio-player.js.map +1 -1
- package/es/components/audio-player/src/providers/base-provider.js +0 -1
- package/es/components/audio-player/src/providers/base-provider.js.map +1 -1
- package/es/components/audio-player/src/providers/native-audio-provider.js +0 -1
- package/es/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
- package/es/components/audio-player/src/providers/soundcloud-provider.js +0 -1
- package/es/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
- package/es/components/audio-player/src/transcript.js +15 -15
- package/es/components/audio-player/src/transcript.js.map +1 -1
- package/es/components/audio-player/src/utils/url-detector.js +0 -1
- package/es/components/audio-player/src/utils/url-detector.js.map +1 -1
- package/es/components/autocomplete/index.d.ts +15 -0
- package/es/components/autocomplete/index.js +11 -0
- package/es/components/autocomplete/index.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item-group.d.ts +44 -0
- package/es/components/autocomplete/src/autocomplete-item-group.js +139 -0
- package/es/components/autocomplete/src/autocomplete-item-group.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item-group.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete-item-group.scss.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item.d.ts +54 -0
- package/es/components/autocomplete/src/autocomplete-item.js +197 -0
- package/es/components/autocomplete/src/autocomplete-item.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete-item.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete-item.scss.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete.d.ts +97 -0
- package/es/components/autocomplete/src/autocomplete.js +321 -0
- package/es/components/autocomplete/src/autocomplete.js.map +1 -0
- package/es/components/autocomplete/src/autocomplete.scss.js +13 -0
- package/es/components/autocomplete/src/autocomplete.scss.js.map +1 -0
- package/es/components/card/src/card-footer.d.ts +1 -1
- package/es/components/card/src/card-footer.js +1 -1
- package/es/components/card/src/card-footer.js.map +1 -1
- package/es/components/card/src/card-footer.scss.js +1 -1
- package/es/components/card/src/card-steps.d.ts +1 -1
- package/es/components/card/src/card-steps.js +28 -28
- package/es/components/card/src/card-steps.js.map +1 -1
- package/es/components/card/src/card-steps.scss.js +1 -1
- package/es/components/card/src/card.scss.js +1 -1
- package/es/components/carousel/src/carousel.js +0 -1
- package/es/components/carousel/src/carousel.js.map +1 -1
- package/es/components/chain-of-thought/src/chain-of-thought-step.js +1 -1
- package/es/components/chain-of-thought/src/chain-of-thought-step.js.map +1 -1
- package/es/components/chain-of-thought/src/tool-call-data.js +4 -4
- package/es/components/chain-of-thought/src/tool-call-data.js.map +1 -1
- package/es/components/chat-button/src/chat-button.d.ts +1 -1
- package/es/components/chat-button/src/chat-button.js +1 -1
- package/es/components/chat-button/src/chat-button.js.map +1 -1
- package/es/components/chat-button/src/chat-button.scss.js +1 -1
- package/es/components/chat-history/src/chat-history.scss.js +1 -1
- package/es/components/chat-history/src/history-content.js +2 -2
- package/es/components/chat-history/src/history-content.js.map +1 -1
- package/es/components/chat-history/src/history-header.js +8 -8
- package/es/components/chat-history/src/history-header.js.map +1 -1
- package/es/components/chat-history/src/history-panel-item-input.d.ts +19 -2
- package/es/components/chat-history/src/history-panel-item-input.js +69 -19
- package/es/components/chat-history/src/history-panel-item-input.js.map +1 -1
- package/es/components/chat-history/src/history-panel-item.d.ts +14 -0
- package/es/components/chat-history/src/history-panel-item.js +59 -27
- package/es/components/chat-history/src/history-panel-item.js.map +1 -1
- package/es/components/chat-history/src/history-toolbar.js +3 -3
- package/es/components/chat-history/src/history-toolbar.js.map +1 -1
- package/es/components/chat-shell/src/chat-header.js +15 -16
- package/es/components/chat-shell/src/chat-header.js.map +1 -1
- package/es/components/chat-shell/src/corner-manager.d.ts +1 -1
- package/es/components/chat-shell/src/corner-manager.js +1 -2
- package/es/components/chat-shell/src/corner-manager.js.map +1 -1
- package/es/components/chat-shell/src/initialization-manager.d.ts +1 -1
- package/es/components/chat-shell/src/initialization-manager.js +1 -2
- package/es/components/chat-shell/src/initialization-manager.js.map +1 -1
- package/es/components/chat-shell/src/resize-observer-manager.js +0 -1
- package/es/components/chat-shell/src/resize-observer-manager.js.map +1 -1
- package/es/components/chat-shell/src/shell.d.ts +1 -1
- package/es/components/chat-shell/src/shell.js +3 -3
- package/es/components/chat-shell/src/shell.js.map +1 -1
- package/es/components/chat-shell/src/slot-observer.d.ts +1 -1
- package/es/components/chat-shell/src/slot-observer.js +1 -2
- package/es/components/chat-shell/src/slot-observer.js.map +1 -1
- package/es/components/chat-shell/src/types.d.ts +1 -1
- package/es/components/chat-shell/src/workspace-manager-utils.d.ts +1 -1
- package/es/components/chat-shell/src/workspace-manager-utils.js +1 -2
- package/es/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
- package/es/components/chat-shell/src/workspace-manager.d.ts +1 -1
- package/es/components/chat-shell/src/workspace-manager.js +1 -2
- package/es/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.d.ts +23 -0
- package/es/components/code-snippet/src/code-snippet.js +111 -36
- package/es/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es/components/code-snippet/src/codemirror/diff-decorator.js +1 -1
- package/es/components/code-snippet/src/codemirror/diff-decorator.js.map +1 -1
- package/es/components/code-snippet/src/codemirror/theme.js +5 -0
- package/es/components/code-snippet/src/codemirror/theme.js.map +1 -1
- package/es/components/code-snippet/src/layout-utils.js +21 -8
- package/es/components/code-snippet/src/layout-utils.js.map +1 -1
- package/es/components/feedback/src/feedback-buttons.js +1 -1
- package/es/components/feedback/src/feedback-buttons.js.map +1 -1
- package/es/components/feedback/src/feedback.js +38 -38
- package/es/components/feedback/src/feedback.js.map +1 -1
- package/es/components/feedback/src/feedback.scss.js +1 -1
- package/es/components/file-uploads/index.d.ts +12 -0
- package/es/components/file-uploads/index.js +10 -0
- package/es/components/file-uploads/index.js.map +1 -0
- package/es/components/file-uploads/src/file-upload-item.d.ts +43 -0
- package/es/components/file-uploads/src/file-upload-item.js +267 -0
- package/es/components/file-uploads/src/file-upload-item.js.map +1 -0
- package/es/components/file-uploads/src/file-upload-item.scss.js +13 -0
- package/es/components/file-uploads/src/file-upload-item.scss.js.map +1 -0
- package/es/components/file-uploads/src/file-uploads.d.ts +87 -0
- package/es/components/file-uploads/src/file-uploads.js +213 -0
- package/es/components/file-uploads/src/file-uploads.js.map +1 -0
- package/es/components/file-uploads/src/file-uploads.scss.js +13 -0
- package/es/components/file-uploads/src/file-uploads.scss.js.map +1 -0
- package/es/components/markdown/index.d.ts +1 -0
- package/es/components/markdown/index.js +1 -0
- package/es/components/markdown/index.js.map +1 -1
- package/es/components/markdown/src/markdown-token-tree.d.ts +8 -0
- package/es/components/markdown/src/markdown-token-tree.js +12 -1
- package/es/components/markdown/src/markdown-token-tree.js.map +1 -1
- package/es/components/markdown/src/markdown.js +4 -0
- package/es/components/markdown/src/markdown.js.map +1 -1
- package/es/components/markdown/src/markdown.scss.js +1 -1
- package/es/components/markdown/src/utils/html-helpers.js.map +1 -1
- package/es/components/prompt-line/index.d.ts +26 -0
- package/es/components/prompt-line/index.js +32 -0
- package/es/components/prompt-line/index.js.map +1 -0
- package/es/components/prompt-line/src/autocomplete-controller.d.ts +178 -0
- package/es/components/prompt-line/src/autocomplete-controller.js +548 -0
- package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -0
- package/es/components/prompt-line/src/error-message.d.ts +50 -0
- package/es/components/prompt-line/src/error-message.js +144 -0
- package/es/components/prompt-line/src/error-message.js.map +1 -0
- package/es/components/prompt-line/src/error-message.scss.js +13 -0
- package/es/components/prompt-line/src/error-message.scss.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-constants.d.ts +17 -0
- package/es/components/prompt-line/src/prompt-line-constants.js +27 -0
- package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-controller.d.ts +155 -0
- package/es/components/prompt-line/src/prompt-line-controller.js +394 -0
- package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.d.ts +34 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.js +51 -0
- package/es/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.d.ts +14 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +340 -0
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-shell.d.ts +72 -0
- package/es/components/prompt-line/src/prompt-line-shell.js +227 -0
- package/es/components/prompt-line/src/prompt-line-shell.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-shell.scss.js +13 -0
- package/es/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line.d.ts +147 -0
- package/es/components/prompt-line/src/prompt-line.js +391 -0
- package/es/components/prompt-line/src/prompt-line.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line.scss.js +13 -0
- package/es/components/prompt-line/src/prompt-line.scss.js.map +1 -0
- package/es/components/prompt-line/src/send-control.d.ts +46 -0
- package/es/components/prompt-line/src/send-control.js +138 -0
- package/es/components/prompt-line/src/send-control.js.map +1 -0
- package/es/components/prompt-line/src/send-control.scss.js +13 -0
- package/es/components/prompt-line/src/send-control.scss.js.map +1 -0
- package/es/components/prompt-line/src/stop-streaming-button.d.ts +42 -0
- package/es/components/prompt-line/src/stop-streaming-button.js +93 -0
- package/es/components/prompt-line/src/stop-streaming-button.js.map +1 -0
- package/es/components/prompt-line/src/stop-streaming-button.scss.js +13 -0
- package/es/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.js +38 -0
- package/es/components/prompt-line/src/tiptap/build-extensions.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +21 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js +127 -0
- package/es/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.d.ts +19 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.js +237 -0
- package/es/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +22 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js +64 -0
- package/es/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.d.ts +17 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.js +46 -0
- package/es/components/prompt-line/src/tiptap/chat-enter.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.d.ts +18 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.js +83 -0
- package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/index.d.ts +42 -0
- package/es/components/prompt-line/src/tiptap/index.js +43 -0
- package/es/components/prompt-line/src/tiptap/index.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/json-utils.d.ts +61 -0
- package/es/components/prompt-line/src/tiptap/json-utils.js +158 -0
- package/es/components/prompt-line/src/tiptap/json-utils.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/keymap.d.ts +31 -0
- package/es/components/prompt-line/src/tiptap/keymap.js +59 -0
- package/es/components/prompt-line/src/tiptap/keymap.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.d.ts +11 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.js +33 -0
- package/es/components/prompt-line/src/tiptap/origin-meta.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.d.ts +16 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.js +85 -0
- package/es/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.d.ts +87 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.js +41 -0
- package/es/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.d.ts +57 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.js +95 -0
- package/es/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.d.ts +36 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.js +41 -0
- package/es/components/prompt-line/src/tiptap/token-node-view.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.js +44 -0
- package/es/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/types.d.ts +161 -0
- package/es/components/prompt-line/src/tiptap/types.js +8 -0
- package/es/components/prompt-line/src/tiptap/types.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.d.ts +30 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.js +104 -0
- package/es/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -0
- package/es/components/prompt-line/src/tiptap/value-sync.d.ts +25 -0
- package/es/components/prompt-line/src/tiptap/value-sync.js +65 -0
- package/es/components/prompt-line/src/tiptap/value-sync.js.map +1 -0
- package/es/components/prompt-line/src/types.d.ts +100 -0
- package/es/components/prompt-line/src/types.js +50 -0
- package/es/components/prompt-line/src/types.js.map +1 -0
- package/es/components/reasoning-steps/src/reasoning-step.d.ts +13 -0
- package/es/components/reasoning-steps/src/reasoning-step.js +38 -0
- package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -1
- package/es/components/reasoning-steps/src/reasoning-steps.d.ts +23 -0
- package/es/components/reasoning-steps/src/reasoning-steps.js +56 -1
- package/es/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
- package/es/components/shared/dynamic-css-var-sheet.js +4 -1
- package/es/components/shared/dynamic-css-var-sheet.js.map +1 -1
- package/es/components/shared/media-utils/script-loader.js +0 -1
- package/es/components/shared/media-utils/script-loader.js.map +1 -1
- package/es/components/table/src/table.scss.js +1 -1
- package/es/components/table/src/table.template.js +9 -9
- package/es/components/table/src/table.template.js.map +1 -1
- package/es/components/toolbar/src/toolbar.js +51 -53
- package/es/components/toolbar/src/toolbar.js.map +1 -1
- package/es/components/video-player/src/providers/base-provider.js +0 -1
- package/es/components/video-player/src/providers/base-provider.js.map +1 -1
- package/es/components/video-player/src/providers/kaltura-provider.js +0 -1
- package/es/components/video-player/src/providers/kaltura-provider.js.map +1 -1
- package/es/components/video-player/src/providers/native-video-provider.js +0 -1
- package/es/components/video-player/src/providers/native-video-provider.js.map +1 -1
- package/es/components/video-player/src/providers/vimeo-provider.js +0 -1
- package/es/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es/components/video-player/src/providers/youtube-provider.js +0 -1
- package/es/components/video-player/src/providers/youtube-provider.js.map +1 -1
- package/es/components/video-player/src/utils/url-detector.js +0 -1
- package/es/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es/components/video-player/src/video-player.js +9 -10
- package/es/components/video-player/src/video-player.js.map +1 -1
- package/es/components/workspace-shell/src/header-collapsible-manager.js +0 -1
- package/es/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
- package/es/components/workspace-shell/src/workspace-shell-header.js +25 -25
- package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -1
- package/es/globals/utils/aria-announcer-manager.d.ts +62 -0
- package/es/globals/utils/aria-announcer-manager.js +125 -0
- package/es/globals/utils/aria-announcer-manager.js.map +1 -0
- package/es/globals/utils/browser-utils.d.ts +10 -0
- package/es/globals/utils/browser-utils.js +37 -0
- package/es/globals/utils/browser-utils.js.map +1 -0
- package/es/globals/utils/dom-utils.d.ts +6 -0
- package/es/globals/utils/dom-utils.js +39 -0
- package/es/globals/utils/dom-utils.js.map +1 -0
- package/{es-custom/react → es/globals}/utils/iconTransform.js +1 -2
- package/es/globals/utils/iconTransform.js.map +1 -0
- package/es/react/__tests__/jest.setup.js +1 -2
- package/es/react/__tests__/jest.setup.js.map +1 -1
- package/es/react/audio-player.js +0 -1
- package/es/react/audio-player.js.map +1 -1
- package/es/react/autocomplete.d.ts +11 -0
- package/es/react/autocomplete.js +36 -0
- package/es/react/autocomplete.js.map +1 -0
- package/es/react/chat-header.js +1 -1
- package/es/react/code-snippet.js +1 -1
- package/es/react/error-message.d.ts +11 -0
- package/es/react/error-message.js +28 -0
- package/es/react/error-message.js.map +1 -0
- package/es/react/file-uploads.d.ts +11 -0
- package/es/react/file-uploads.js +31 -0
- package/es/react/file-uploads.js.map +1 -0
- package/es/react/history/history-panel-item-input.js +1 -0
- package/es/react/history/history-panel-item-input.js.map +1 -1
- package/es/react/history/history-panel-item.js +1 -0
- package/es/react/history/history-panel-item.js.map +1 -1
- package/es/react/hooks/useChatAutocomplete.d.ts +41 -0
- package/es/react/hooks/useChatAutocomplete.js +178 -0
- package/es/react/hooks/useChatAutocomplete.js.map +1 -0
- package/es/react/input-send-control.d.ts +11 -0
- package/es/react/input-send-control.js +32 -0
- package/es/react/input-send-control.js.map +1 -0
- package/es/react/prompt-line-shell.d.ts +18 -0
- package/es/react/prompt-line-shell.js +36 -0
- package/es/react/prompt-line-shell.js.map +1 -0
- package/es/react/prompt-line.d.ts +25 -0
- package/es/react/prompt-line.js +52 -0
- package/es/react/prompt-line.js.map +1 -0
- package/es/react/stop-streaming-button.d.ts +11 -0
- package/es/react/stop-streaming-button.js +28 -0
- package/es/react/stop-streaming-button.js.map +1 -0
- package/es/react/toolbar.js +1 -1
- package/es/react/transcript.js +0 -1
- package/es/react/transcript.js.map +1 -1
- package/es/react/utils/transformSuggestionConfig.d.ts +21 -0
- package/es/react/utils/transformSuggestionConfig.js +67 -0
- package/es/react/utils/transformSuggestionConfig.js.map +1 -0
- package/es/react/video-player.js +0 -1
- package/es/react/video-player.js.map +1 -1
- package/es/testing/PageObjectId.js +1 -2
- package/es/testing/PageObjectId.js.map +1 -1
- package/es-custom/components/audio-player/src/audio-player.js +9 -10
- package/es-custom/components/audio-player/src/audio-player.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/base-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/base-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/native-audio-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/native-audio-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/providers/soundcloud-provider.js +0 -1
- package/es-custom/components/audio-player/src/providers/soundcloud-provider.js.map +1 -1
- package/es-custom/components/audio-player/src/transcript.js +15 -15
- package/es-custom/components/audio-player/src/transcript.js.map +1 -1
- package/es-custom/components/audio-player/src/utils/url-detector.js +0 -1
- package/es-custom/components/audio-player/src/utils/url-detector.js.map +1 -1
- package/es-custom/components/autocomplete/index.d.ts +15 -0
- package/es-custom/components/autocomplete/index.js +11 -0
- package/es-custom/components/autocomplete/index.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.d.ts +44 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.js +139 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete-item-group.scss.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.d.ts +54 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.js +197 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete-item.scss.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete.d.ts +97 -0
- package/es-custom/components/autocomplete/src/autocomplete.js +321 -0
- package/es-custom/components/autocomplete/src/autocomplete.js.map +1 -0
- package/es-custom/components/autocomplete/src/autocomplete.scss.js +13 -0
- package/es-custom/components/autocomplete/src/autocomplete.scss.js.map +1 -0
- package/es-custom/components/card/src/card-footer.d.ts +1 -1
- package/es-custom/components/card/src/card-footer.js +1 -1
- package/es-custom/components/card/src/card-footer.js.map +1 -1
- package/es-custom/components/card/src/card-footer.scss.js +1 -1
- package/es-custom/components/card/src/card-steps.d.ts +1 -1
- package/es-custom/components/card/src/card-steps.js +28 -28
- package/es-custom/components/card/src/card-steps.js.map +1 -1
- package/es-custom/components/card/src/card-steps.scss.js +1 -1
- package/es-custom/components/card/src/card.scss.js +1 -1
- package/es-custom/components/carousel/src/carousel.js +0 -1
- package/es-custom/components/carousel/src/carousel.js.map +1 -1
- package/es-custom/components/chain-of-thought/src/chain-of-thought-step.js +1 -1
- package/es-custom/components/chain-of-thought/src/chain-of-thought-step.js.map +1 -1
- package/es-custom/components/chain-of-thought/src/tool-call-data.js +4 -4
- package/es-custom/components/chain-of-thought/src/tool-call-data.js.map +1 -1
- package/es-custom/components/chat-button/src/chat-button.d.ts +1 -1
- package/es-custom/components/chat-button/src/chat-button.js +1 -1
- package/es-custom/components/chat-button/src/chat-button.js.map +1 -1
- package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
- package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
- package/es-custom/components/chat-history/src/history-content.js +2 -2
- package/es-custom/components/chat-history/src/history-content.js.map +1 -1
- package/es-custom/components/chat-history/src/history-header.js +8 -8
- package/es-custom/components/chat-history/src/history-header.js.map +1 -1
- package/es-custom/components/chat-history/src/history-panel-item-input.d.ts +19 -2
- package/es-custom/components/chat-history/src/history-panel-item-input.js +69 -19
- package/es-custom/components/chat-history/src/history-panel-item-input.js.map +1 -1
- package/es-custom/components/chat-history/src/history-panel-item.d.ts +14 -0
- package/es-custom/components/chat-history/src/history-panel-item.js +59 -27
- package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
- package/es-custom/components/chat-history/src/history-toolbar.js +3 -3
- package/es-custom/components/chat-history/src/history-toolbar.js.map +1 -1
- package/es-custom/components/chat-shell/src/chat-header.js +15 -16
- package/es-custom/components/chat-shell/src/chat-header.js.map +1 -1
- package/es-custom/components/chat-shell/src/corner-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/corner-manager.js +1 -2
- package/es-custom/components/chat-shell/src/corner-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/initialization-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/initialization-manager.js +1 -2
- package/es-custom/components/chat-shell/src/initialization-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/resize-observer-manager.js +0 -1
- package/es-custom/components/chat-shell/src/resize-observer-manager.js.map +1 -1
- package/es-custom/components/chat-shell/src/shell.d.ts +1 -1
- package/es-custom/components/chat-shell/src/shell.js +3 -3
- package/es-custom/components/chat-shell/src/shell.js.map +1 -1
- package/es-custom/components/chat-shell/src/slot-observer.d.ts +1 -1
- package/es-custom/components/chat-shell/src/slot-observer.js +1 -2
- package/es-custom/components/chat-shell/src/slot-observer.js.map +1 -1
- package/es-custom/components/chat-shell/src/types.d.ts +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager-utils.d.ts +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js +1 -2
- package/es-custom/components/chat-shell/src/workspace-manager-utils.js.map +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager.d.ts +1 -1
- package/es-custom/components/chat-shell/src/workspace-manager.js +1 -2
- package/es-custom/components/chat-shell/src/workspace-manager.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.d.ts +23 -0
- package/es-custom/components/code-snippet/src/code-snippet.js +111 -36
- package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.scss.js +1 -1
- package/es-custom/components/code-snippet/src/codemirror/diff-decorator.js +1 -1
- package/es-custom/components/code-snippet/src/codemirror/diff-decorator.js.map +1 -1
- package/es-custom/components/code-snippet/src/codemirror/theme.js +5 -0
- package/es-custom/components/code-snippet/src/codemirror/theme.js.map +1 -1
- package/es-custom/components/code-snippet/src/layout-utils.js +21 -8
- package/es-custom/components/code-snippet/src/layout-utils.js.map +1 -1
- package/es-custom/components/feedback/src/feedback-buttons.js +1 -1
- package/es-custom/components/feedback/src/feedback-buttons.js.map +1 -1
- package/es-custom/components/feedback/src/feedback.js +38 -38
- package/es-custom/components/feedback/src/feedback.js.map +1 -1
- package/es-custom/components/feedback/src/feedback.scss.js +1 -1
- package/es-custom/components/file-uploads/index.d.ts +12 -0
- package/es-custom/components/file-uploads/index.js +10 -0
- package/es-custom/components/file-uploads/index.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-upload-item.d.ts +43 -0
- package/es-custom/components/file-uploads/src/file-upload-item.js +267 -0
- package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-upload-item.scss.js +13 -0
- package/es-custom/components/file-uploads/src/file-upload-item.scss.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-uploads.d.ts +87 -0
- package/es-custom/components/file-uploads/src/file-uploads.js +213 -0
- package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -0
- package/es-custom/components/file-uploads/src/file-uploads.scss.js +13 -0
- package/es-custom/components/file-uploads/src/file-uploads.scss.js.map +1 -0
- package/es-custom/components/markdown/index.d.ts +1 -0
- package/es-custom/components/markdown/index.js +1 -0
- package/es-custom/components/markdown/index.js.map +1 -1
- package/es-custom/components/markdown/src/markdown-token-tree.d.ts +8 -0
- package/es-custom/components/markdown/src/markdown-token-tree.js +12 -1
- package/es-custom/components/markdown/src/markdown-token-tree.js.map +1 -1
- package/es-custom/components/markdown/src/markdown.js +4 -0
- package/es-custom/components/markdown/src/markdown.js.map +1 -1
- package/es-custom/components/markdown/src/markdown.scss.js +1 -1
- package/es-custom/components/markdown/src/utils/html-helpers.js.map +1 -1
- package/es-custom/components/prompt-line/index.d.ts +26 -0
- package/es-custom/components/prompt-line/index.js +32 -0
- package/es-custom/components/prompt-line/index.js.map +1 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.d.ts +178 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.js +548 -0
- package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -0
- package/es-custom/components/prompt-line/src/error-message.d.ts +50 -0
- package/es-custom/components/prompt-line/src/error-message.js +144 -0
- package/es-custom/components/prompt-line/src/error-message.js.map +1 -0
- package/es-custom/components/prompt-line/src/error-message.scss.js +13 -0
- package/es-custom/components/prompt-line/src/error-message.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.d.ts +17 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.js +27 -0
- package/es-custom/components/prompt-line/src/prompt-line-constants.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +155 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.js +394 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.d.ts +34 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js +51 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.d.ts +14 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +340 -0
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.d.ts +72 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.js +227 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +13 -0
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line.d.ts +147 -0
- package/es-custom/components/prompt-line/src/prompt-line.js +391 -0
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line.scss.js +13 -0
- package/es-custom/components/prompt-line/src/prompt-line.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/send-control.d.ts +46 -0
- package/es-custom/components/prompt-line/src/send-control.js +138 -0
- package/es-custom/components/prompt-line/src/send-control.js.map +1 -0
- package/es-custom/components/prompt-line/src/send-control.scss.js +13 -0
- package/es-custom/components/prompt-line/src/send-control.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.d.ts +42 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.js +93 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.js.map +1 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js +13 -0
- package/es-custom/components/prompt-line/src/stop-streaming-button.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js +38 -0
- package/es-custom/components/prompt-line/src/tiptap/build-extensions.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.d.ts +21 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js +127 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-autocomplete.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.d.ts +19 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js +237 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-mention.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.d.ts +22 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js +64 -0
- package/es-custom/components/prompt-line/src/tiptap/carbon-starter-trigger.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.d.ts +17 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js +46 -0
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.d.ts +18 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js +83 -0
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/index.d.ts +42 -0
- package/es-custom/components/prompt-line/src/tiptap/index.js +43 -0
- package/es-custom/components/prompt-line/src/tiptap/index.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.d.ts +61 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js +158 -0
- package/es-custom/components/prompt-line/src/tiptap/json-utils.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.d.ts +31 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.js +59 -0
- package/es-custom/components/prompt-line/src/tiptap/keymap.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.d.ts +11 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.js +33 -0
- package/es-custom/components/prompt-line/src/tiptap/origin-meta.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.d.ts +16 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js +85 -0
- package/es-custom/components/prompt-line/src/tiptap/plain-text-paste.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.d.ts +87 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.js +41 -0
- package/es-custom/components/prompt-line/src/tiptap/render-in-light-dom.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.d.ts +57 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js +95 -0
- package/es-custom/components/prompt-line/src/tiptap/render-token-chip.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.d.ts +36 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.js +41 -0
- package/es-custom/components/prompt-line/src/tiptap/token-node-view.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js +44 -0
- package/es-custom/components/prompt-line/src/tiptap/trigger-utils.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/types.d.ts +161 -0
- package/es-custom/components/prompt-line/src/tiptap/types.js +8 -0
- package/es-custom/components/prompt-line/src/tiptap/types.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.d.ts +30 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js +104 -0
- package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.d.ts +25 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.js +65 -0
- package/es-custom/components/prompt-line/src/tiptap/value-sync.js.map +1 -0
- package/es-custom/components/prompt-line/src/types.d.ts +100 -0
- package/es-custom/components/prompt-line/src/types.js +50 -0
- package/es-custom/components/prompt-line/src/types.js.map +1 -0
- package/es-custom/components/reasoning-steps/src/reasoning-step.d.ts +13 -0
- package/es-custom/components/reasoning-steps/src/reasoning-step.js +38 -0
- package/es-custom/components/reasoning-steps/src/reasoning-step.js.map +1 -1
- package/es-custom/components/reasoning-steps/src/reasoning-steps.d.ts +23 -0
- package/es-custom/components/reasoning-steps/src/reasoning-steps.js +56 -1
- package/es-custom/components/reasoning-steps/src/reasoning-steps.js.map +1 -1
- package/es-custom/components/shared/dynamic-css-var-sheet.js +4 -1
- package/es-custom/components/shared/dynamic-css-var-sheet.js.map +1 -1
- package/es-custom/components/shared/media-utils/script-loader.js +0 -1
- package/es-custom/components/shared/media-utils/script-loader.js.map +1 -1
- package/es-custom/components/table/src/table.scss.js +1 -1
- package/es-custom/components/table/src/table.template.js +9 -9
- package/es-custom/components/table/src/table.template.js.map +1 -1
- package/es-custom/components/toolbar/src/toolbar.js +51 -53
- package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
- package/es-custom/components/video-player/src/providers/base-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/base-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/kaltura-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/kaltura-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/native-video-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/native-video-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/vimeo-provider.js.map +1 -1
- package/es-custom/components/video-player/src/providers/youtube-provider.js +0 -1
- package/es-custom/components/video-player/src/providers/youtube-provider.js.map +1 -1
- package/es-custom/components/video-player/src/utils/url-detector.js +0 -1
- package/es-custom/components/video-player/src/utils/url-detector.js.map +1 -1
- package/es-custom/components/video-player/src/video-player.js +9 -10
- package/es-custom/components/video-player/src/video-player.js.map +1 -1
- package/es-custom/components/workspace-shell/src/header-collapsible-manager.js +0 -1
- package/es-custom/components/workspace-shell/src/header-collapsible-manager.js.map +1 -1
- package/es-custom/components/workspace-shell/src/workspace-shell-header.js +25 -25
- package/es-custom/components/workspace-shell/src/workspace-shell-header.js.map +1 -1
- package/es-custom/globals/utils/aria-announcer-manager.d.ts +62 -0
- package/es-custom/globals/utils/aria-announcer-manager.js +125 -0
- package/es-custom/globals/utils/aria-announcer-manager.js.map +1 -0
- package/es-custom/globals/utils/browser-utils.d.ts +10 -0
- package/es-custom/globals/utils/browser-utils.js +37 -0
- package/es-custom/globals/utils/browser-utils.js.map +1 -0
- package/es-custom/globals/utils/dom-utils.d.ts +6 -0
- package/es-custom/globals/utils/dom-utils.js +39 -0
- package/es-custom/globals/utils/dom-utils.js.map +1 -0
- package/{es/react → es-custom/globals}/utils/iconTransform.js +1 -2
- package/es-custom/globals/utils/iconTransform.js.map +1 -0
- package/es-custom/react/__tests__/jest.setup.js +1 -2
- package/es-custom/react/__tests__/jest.setup.js.map +1 -1
- package/es-custom/react/audio-player.js +0 -1
- package/es-custom/react/audio-player.js.map +1 -1
- package/es-custom/react/autocomplete.d.ts +11 -0
- package/es-custom/react/autocomplete.js +36 -0
- package/es-custom/react/autocomplete.js.map +1 -0
- package/es-custom/react/chat-header.js +1 -1
- package/es-custom/react/code-snippet.js +1 -1
- package/es-custom/react/error-message.d.ts +11 -0
- package/es-custom/react/error-message.js +28 -0
- package/es-custom/react/error-message.js.map +1 -0
- package/es-custom/react/file-uploads.d.ts +11 -0
- package/es-custom/react/file-uploads.js +31 -0
- package/es-custom/react/file-uploads.js.map +1 -0
- package/es-custom/react/history/history-panel-item-input.js +1 -0
- package/es-custom/react/history/history-panel-item-input.js.map +1 -1
- package/es-custom/react/history/history-panel-item.js +1 -0
- package/es-custom/react/history/history-panel-item.js.map +1 -1
- package/es-custom/react/hooks/useChatAutocomplete.d.ts +41 -0
- package/es-custom/react/hooks/useChatAutocomplete.js +178 -0
- package/es-custom/react/hooks/useChatAutocomplete.js.map +1 -0
- package/es-custom/react/input-send-control.d.ts +11 -0
- package/es-custom/react/input-send-control.js +32 -0
- package/es-custom/react/input-send-control.js.map +1 -0
- package/es-custom/react/prompt-line-shell.d.ts +18 -0
- package/es-custom/react/prompt-line-shell.js +36 -0
- package/es-custom/react/prompt-line-shell.js.map +1 -0
- package/es-custom/react/prompt-line.d.ts +25 -0
- package/es-custom/react/prompt-line.js +52 -0
- package/es-custom/react/prompt-line.js.map +1 -0
- package/es-custom/react/stop-streaming-button.d.ts +11 -0
- package/es-custom/react/stop-streaming-button.js +28 -0
- package/es-custom/react/stop-streaming-button.js.map +1 -0
- package/es-custom/react/toolbar.js +1 -1
- package/es-custom/react/transcript.js +0 -1
- package/es-custom/react/transcript.js.map +1 -1
- package/es-custom/react/utils/transformSuggestionConfig.d.ts +21 -0
- package/es-custom/react/utils/transformSuggestionConfig.js +67 -0
- package/es-custom/react/utils/transformSuggestionConfig.js.map +1 -0
- package/es-custom/react/video-player.js +0 -1
- package/es-custom/react/video-player.js.map +1 -1
- package/es-custom/testing/PageObjectId.js +1 -2
- package/es-custom/testing/PageObjectId.js.map +1 -1
- package/package.json +27 -6
- package/scss/_custom-properties.scss +1 -3
- package/scss/_modifiers.scss +17 -49
- package/scss/_tokens-component.scss +1 -3
- package/scss/_tokens-layout.scss +1 -3
- package/scss/_utilities.scss +1 -3
- package/LICENSE +0 -201
- package/es/components/chat-shell/src/aria-announcer-manager.d.ts +0 -40
- package/es/components/chat-shell/src/aria-announcer-manager.js +0 -104
- package/es/components/chat-shell/src/aria-announcer-manager.js.map +0 -1
- package/es/react/utils/iconTransform.js.map +0 -1
- package/es-custom/components/chat-shell/src/aria-announcer-manager.d.ts +0 -40
- package/es-custom/components/chat-shell/src/aria-announcer-manager.js +0 -104
- package/es-custom/components/chat-shell/src/aria-announcer-manager.js.map +0 -1
- package/es-custom/react/utils/iconTransform.js.map +0 -1
- /package/es/{react → globals}/utils/iconTransform.d.ts +0 -0
- /package/es-custom/{react → globals}/utils/iconTransform.d.ts +0 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { Editor } from '@tiptap/core';
|
|
9
|
+
import DocumentNode from '@tiptap/extension-document';
|
|
10
|
+
import HardBreakNode from '@tiptap/extension-hard-break';
|
|
11
|
+
import ParagraphNode from '@tiptap/extension-paragraph';
|
|
12
|
+
import TextNode from '@tiptap/extension-text';
|
|
13
|
+
import { IS_PHONE } from '../../../globals/utils/browser-utils.js';
|
|
14
|
+
import { setVarsForSelector } from '../../shared/dynamic-css-var-sheet.js';
|
|
15
|
+
import { applyEditorStyles } from './tiptap/editor-styles.js';
|
|
16
|
+
import { HISTORY_DEFAULTS } from './tiptap/index.js';
|
|
17
|
+
import { textToDoc } from './tiptap/json-utils.js';
|
|
18
|
+
import { setHostOriginMeta } from './tiptap/origin-meta.js';
|
|
19
|
+
import { PlainTextPaste } from './tiptap/plain-text-paste.js';
|
|
20
|
+
import { Keymap } from './tiptap/keymap.js';
|
|
21
|
+
import { ValueSync } from './tiptap/value-sync.js';
|
|
22
|
+
import { TypingIndicator } from './tiptap/typing-indicator.js';
|
|
23
|
+
import { carbonChatEnter } from './tiptap/chat-enter.js';
|
|
24
|
+
import { UndoRedo } from '@tiptap/extensions';
|
|
25
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @license
|
|
29
|
+
*
|
|
30
|
+
* Copyright IBM Corp. 2026
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Tiptap runtime for `<cds-aichat-prompt-line>`'s rich mode. This module is the
|
|
37
|
+
* **only** place the prompt-line stack imports `@tiptap/*` at runtime, and it
|
|
38
|
+
* is reached exclusively through a dynamic `import()` (see
|
|
39
|
+
* [./prompt-line-rich-loader.ts]). A bundler therefore splits Tiptap into its
|
|
40
|
+
* own lazy chunk, keeping it out of the default bundle for chats that never
|
|
41
|
+
* enable advanced input features.
|
|
42
|
+
*
|
|
43
|
+
* `createRichController()` returns a {@link PromptLineController} backed by a
|
|
44
|
+
* Tiptap `Editor`. It installs the Carbon base bundle — schema (`Document` +
|
|
45
|
+
* `Paragraph` + `Text` + `HardBreak`), undo/redo, placeholder, plain-text
|
|
46
|
+
* paste, the chat keymap (`Mod-Enter`/`Escape`), Enter-to-send
|
|
47
|
+
* (`carbonChatEnter`), value-sync, and the typing indicator — and emits the
|
|
48
|
+
* identical
|
|
49
|
+
* `cds-aichat-prompt-*` events so the shell, React wrapper, and `Input`
|
|
50
|
+
* handlers are mode-agnostic.
|
|
51
|
+
*/
|
|
52
|
+
const PM_KEYBOARD_FOCUS_CLASS = "cds-aichat--input-pm-content--keyboard-focus";
|
|
53
|
+
let keyboardFocusRuleInstalled = false;
|
|
54
|
+
function ensureKeyboardFocusRule() {
|
|
55
|
+
if (keyboardFocusRuleInstalled) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setVarsForSelector(`.${PM_KEYBOARD_FOCUS_CLASS}`, { outline: "revert" });
|
|
59
|
+
keyboardFocusRuleInstalled = true;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Tiptap-backed prompt-line controller. Mirrors the editor lifecycle the
|
|
63
|
+
* element owned before the textarea/rich split.
|
|
64
|
+
*/
|
|
65
|
+
class RichController {
|
|
66
|
+
constructor() {
|
|
67
|
+
this._editor = null;
|
|
68
|
+
this._host = null;
|
|
69
|
+
this._extensions = [];
|
|
70
|
+
this._placeholder = "";
|
|
71
|
+
this._testId = "";
|
|
72
|
+
this._disabled = false;
|
|
73
|
+
this._focusFromMouse = false;
|
|
74
|
+
// -------------------------------------------------------------------------
|
|
75
|
+
// Internals
|
|
76
|
+
// -------------------------------------------------------------------------
|
|
77
|
+
this._setMouseFlag = () => {
|
|
78
|
+
this._focusFromMouse = true;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
mount(host, init) {
|
|
82
|
+
this._host = host;
|
|
83
|
+
this._extensions = init.extensions ?? [];
|
|
84
|
+
this._placeholder = init.placeholder;
|
|
85
|
+
this._testId = init.testId;
|
|
86
|
+
this._disabled = init.disabled;
|
|
87
|
+
host.setAttribute("role", "textbox");
|
|
88
|
+
host.setAttribute("aria-multiline", "true");
|
|
89
|
+
host.setAttribute("spellcheck", "true");
|
|
90
|
+
host.setAttribute("tabindex", "0");
|
|
91
|
+
if (init.ariaLabel) {
|
|
92
|
+
host.setAttribute("aria-label", init.ariaLabel);
|
|
93
|
+
}
|
|
94
|
+
// Pointer/touch before focus marks the next focus as mouse-driven so we
|
|
95
|
+
// suppress the keyboard-focus outline.
|
|
96
|
+
host.addEventListener("pointerdown", this._setMouseFlag);
|
|
97
|
+
host.addEventListener("mousedown", this._setMouseFlag);
|
|
98
|
+
host.addEventListener("touchstart", this._setMouseFlag);
|
|
99
|
+
ensureKeyboardFocusRule();
|
|
100
|
+
// Prefer a structured `content` seed (mentions / custom nodes); otherwise
|
|
101
|
+
// rebuild a doc from the plain-text value (lossless from the textarea).
|
|
102
|
+
const seed = init.content ?? textToDoc(init.value);
|
|
103
|
+
this._editor = this._createEditor(host, seed);
|
|
104
|
+
this._wireEditorEvents(this._editor);
|
|
105
|
+
applyEditorStyles(this._editor.view.dom, IS_PHONE);
|
|
106
|
+
this._applyTestIdToEditorDom();
|
|
107
|
+
this._editor.setEditable(!this._disabled);
|
|
108
|
+
}
|
|
109
|
+
destroy() {
|
|
110
|
+
const host = this._host;
|
|
111
|
+
if (host) {
|
|
112
|
+
host.removeEventListener("pointerdown", this._setMouseFlag);
|
|
113
|
+
host.removeEventListener("mousedown", this._setMouseFlag);
|
|
114
|
+
host.removeEventListener("touchstart", this._setMouseFlag);
|
|
115
|
+
}
|
|
116
|
+
this._editor?.destroy();
|
|
117
|
+
this._editor = null;
|
|
118
|
+
this._host = null;
|
|
119
|
+
}
|
|
120
|
+
getValue() {
|
|
121
|
+
return this._editor?.getText() ?? "";
|
|
122
|
+
}
|
|
123
|
+
setContent(next) {
|
|
124
|
+
const editor = this._editor;
|
|
125
|
+
if (!editor) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (typeof next === "function") {
|
|
129
|
+
const prev = editor.getJSON();
|
|
130
|
+
this._dispatchSetContent(next(prev));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this._dispatchSetContent(next);
|
|
134
|
+
}
|
|
135
|
+
insertContent(content, opts = {}) {
|
|
136
|
+
const editor = this._editor;
|
|
137
|
+
if (!editor) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (typeof opts.at === "number") {
|
|
141
|
+
editor.commands.insertContentAt(opts.at, content);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
editor.commands.insertContent(content);
|
|
145
|
+
}
|
|
146
|
+
clearContent() {
|
|
147
|
+
const editor = this._editor;
|
|
148
|
+
if (!editor) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Tag the clear as host-origin so the carbon-mention/command removal plugin
|
|
152
|
+
// treats the post-send wipe as programmatic (not a user edit) and skips
|
|
153
|
+
// firing `onRemove`. Otherwise a send would strip the just-captured
|
|
154
|
+
// mention/command fields from the host's structured_data sidecar before
|
|
155
|
+
// `doSend` merges them. Mirrors `_dispatchSetContent`.
|
|
156
|
+
editor
|
|
157
|
+
.chain()
|
|
158
|
+
.command(({ tr }) => {
|
|
159
|
+
setHostOriginMeta(tr);
|
|
160
|
+
return true;
|
|
161
|
+
})
|
|
162
|
+
.clearContent(true)
|
|
163
|
+
.run();
|
|
164
|
+
}
|
|
165
|
+
getEditor() {
|
|
166
|
+
return this._editor;
|
|
167
|
+
}
|
|
168
|
+
focus() {
|
|
169
|
+
this._focusFromMouse = true;
|
|
170
|
+
this._editor?.commands.focus();
|
|
171
|
+
}
|
|
172
|
+
blur() {
|
|
173
|
+
this._editor?.commands.blur();
|
|
174
|
+
}
|
|
175
|
+
hasFocus() {
|
|
176
|
+
return this._editor?.isFocused ?? false;
|
|
177
|
+
}
|
|
178
|
+
getSelection() {
|
|
179
|
+
const sel = this._editor?.state.selection;
|
|
180
|
+
return sel ? { from: sel.from, to: sel.to } : { from: 0, to: 0 };
|
|
181
|
+
}
|
|
182
|
+
setTextSelection(pos) {
|
|
183
|
+
this._editor?.commands.setTextSelection(pos);
|
|
184
|
+
}
|
|
185
|
+
selectAll() {
|
|
186
|
+
this._editor?.commands.selectAll();
|
|
187
|
+
}
|
|
188
|
+
setEditable(editable) {
|
|
189
|
+
this._disabled = !editable;
|
|
190
|
+
this._editor?.setEditable(editable);
|
|
191
|
+
}
|
|
192
|
+
setPlaceholder(placeholder) {
|
|
193
|
+
// Placeholder is fixed at editor creation (matches the pre-split element);
|
|
194
|
+
// record it so a later extension-driven recreate keeps the latest value.
|
|
195
|
+
this._placeholder = placeholder;
|
|
196
|
+
}
|
|
197
|
+
setAriaLabel(ariaLabel) {
|
|
198
|
+
if (!this._host) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (ariaLabel) {
|
|
202
|
+
this._host.setAttribute("aria-label", ariaLabel);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
this._host.removeAttribute("aria-label");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
setTestId(testId) {
|
|
209
|
+
this._testId = testId;
|
|
210
|
+
this._applyTestIdToEditorDom();
|
|
211
|
+
}
|
|
212
|
+
setExtensions(extensions) {
|
|
213
|
+
this._extensions = extensions;
|
|
214
|
+
this._recreateEditor();
|
|
215
|
+
}
|
|
216
|
+
undo() {
|
|
217
|
+
return Boolean(this._editor?.commands.undo());
|
|
218
|
+
}
|
|
219
|
+
redo() {
|
|
220
|
+
return Boolean(this._editor?.commands.redo());
|
|
221
|
+
}
|
|
222
|
+
_createEditor(element, content) {
|
|
223
|
+
const baseExtensions = [
|
|
224
|
+
DocumentNode,
|
|
225
|
+
ParagraphNode,
|
|
226
|
+
TextNode,
|
|
227
|
+
HardBreakNode,
|
|
228
|
+
UndoRedo.configure({ ...HISTORY_DEFAULTS }),
|
|
229
|
+
Placeholder.configure({ placeholder: this._placeholder }),
|
|
230
|
+
PlainTextPaste,
|
|
231
|
+
Keymap,
|
|
232
|
+
// Plain Enter sends (non-empty); empty Enter falls through to a newline.
|
|
233
|
+
// Baked into the base bundle so the rich editor and the textarea agree on
|
|
234
|
+
// Enter-to-send without the chat layer wiring it per surface.
|
|
235
|
+
carbonChatEnter(),
|
|
236
|
+
ValueSync,
|
|
237
|
+
TypingIndicator,
|
|
238
|
+
];
|
|
239
|
+
return new Editor({
|
|
240
|
+
element,
|
|
241
|
+
extensions: [...baseExtensions, ...this._extensions],
|
|
242
|
+
content: content ?? undefined,
|
|
243
|
+
autofocus: false,
|
|
244
|
+
injectCSS: false,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
_wireEditorEvents(editor) {
|
|
248
|
+
editor.on("focus", () => {
|
|
249
|
+
const wasMouseFocus = this._focusFromMouse;
|
|
250
|
+
this._focusFromMouse = false;
|
|
251
|
+
if (!wasMouseFocus) {
|
|
252
|
+
editor.view.dom.classList.add(PM_KEYBOARD_FOCUS_CLASS);
|
|
253
|
+
}
|
|
254
|
+
this._dispatch("cds-aichat-prompt-focus", { keyboard: !wasMouseFocus });
|
|
255
|
+
});
|
|
256
|
+
editor.on("blur", () => {
|
|
257
|
+
editor.view.dom.classList.remove(PM_KEYBOARD_FOCUS_CLASS);
|
|
258
|
+
this._dispatch("cds-aichat-prompt-blur");
|
|
259
|
+
});
|
|
260
|
+
// Forward keydown for hosts wanting raw-key access. ValueSync /
|
|
261
|
+
// TypingIndicator emit their own events; don't re-dispatch update here.
|
|
262
|
+
editor.view.dom.addEventListener("keydown", (event) => {
|
|
263
|
+
this._dispatch("cds-aichat-prompt-keydown", { originalEvent: event });
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
_recreateEditor() {
|
|
267
|
+
const host = this._host;
|
|
268
|
+
if (!host) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const previousJson = this._editor?.getJSON();
|
|
272
|
+
const previousSelection = this._editor
|
|
273
|
+
? {
|
|
274
|
+
from: this._editor.state.selection.from,
|
|
275
|
+
to: this._editor.state.selection.to,
|
|
276
|
+
}
|
|
277
|
+
: null;
|
|
278
|
+
const wasFocused = this._editor?.isFocused ?? false;
|
|
279
|
+
this._editor?.destroy();
|
|
280
|
+
this._editor = this._createEditor(host, previousJson);
|
|
281
|
+
this._wireEditorEvents(this._editor);
|
|
282
|
+
applyEditorStyles(this._editor.view.dom, IS_PHONE);
|
|
283
|
+
this._applyTestIdToEditorDom();
|
|
284
|
+
this._editor.setEditable(!this._disabled);
|
|
285
|
+
if (previousSelection) {
|
|
286
|
+
const { size } = this._editor.state.doc.content;
|
|
287
|
+
const from = Math.min(previousSelection.from, size);
|
|
288
|
+
const to = Math.min(previousSelection.to, size);
|
|
289
|
+
this._editor.commands.setTextSelection({ from, to });
|
|
290
|
+
}
|
|
291
|
+
if (wasFocused) {
|
|
292
|
+
this._editor.commands.focus();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
_dispatchSetContent(content) {
|
|
296
|
+
const editor = this._editor;
|
|
297
|
+
if (!editor) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
// Chain a no-op command that meta-tags the accumulator tr as host-origin,
|
|
301
|
+
// then setContent on the same tr so downstream readers (typing-indicator,
|
|
302
|
+
// value-sync's storage flag) recognize the update.
|
|
303
|
+
editor
|
|
304
|
+
.chain()
|
|
305
|
+
.command(({ tr }) => {
|
|
306
|
+
setHostOriginMeta(tr);
|
|
307
|
+
return true;
|
|
308
|
+
})
|
|
309
|
+
.setContent(content, { emitUpdate: true })
|
|
310
|
+
.run();
|
|
311
|
+
}
|
|
312
|
+
// Mirror testId onto the inner ProseMirror contenteditable (not the host
|
|
313
|
+
// wrapper) so Playwright's editable-action helpers (`.fill()`, etc.) accept
|
|
314
|
+
// it. `view.dom` is replaced on each recreate, so re-apply.
|
|
315
|
+
_applyTestIdToEditorDom() {
|
|
316
|
+
const editorDom = this._editor?.view.dom;
|
|
317
|
+
if (!editorDom) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (this._testId) {
|
|
321
|
+
editorDom.setAttribute("data-testid", this._testId);
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
editorDom.removeAttribute("data-testid");
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
_dispatch(name, detail) {
|
|
328
|
+
this._host?.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Construct a Tiptap-backed prompt-line controller. Called by the shell once
|
|
333
|
+
* the lazily-imported runtime module has resolved.
|
|
334
|
+
*/
|
|
335
|
+
function createRichController() {
|
|
336
|
+
return new RichController();
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export { createRichController };
|
|
340
|
+
//# sourceMappingURL=prompt-line-rich-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-line-rich-runtime.js","sources":["../../../../src/components/prompt-line/src/prompt-line-rich-runtime.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;;AAgBG;AA6BH,MAAM,uBAAuB,GAAG,8CAA8C;AAE9E,IAAI,0BAA0B,GAAG,KAAK;AACtC,SAAS,uBAAuB,GAAA;IAC9B,IAAI,0BAA0B,EAAE;QAC9B;IACF;IACA,kBAAkB,CAAC,CAAA,CAAA,EAAI,uBAAuB,CAAA,CAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACxE,0BAA0B,GAAG,IAAI;AACnC;AAEA;;;AAGG;AACH,MAAM,cAAc,CAAA;AAApB,IAAA,WAAA,GAAA;QACU,IAAA,CAAA,OAAO,GAAkB,IAAI;QAC7B,IAAA,CAAA,KAAK,GAAuB,IAAI;QAChC,IAAA,CAAA,WAAW,GAAgB,EAAE;QAC7B,IAAA,CAAA,YAAY,GAAG,EAAE;QACjB,IAAA,CAAA,OAAO,GAAG,EAAE;QACZ,IAAA,CAAA,SAAS,GAAG,KAAK;QACjB,IAAA,CAAA,eAAe,GAAG,KAAK;;;;QA6KvB,IAAA,CAAA,aAAa,GAAG,MAAW;AACjC,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI;AAC7B,QAAA,CAAC;IAuHH;IApSE,KAAK,CAAC,IAAiB,EAAE,IAA8B,EAAA;AACrD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI;QACjB,IAAI,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,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO;QAC3B,IAAI,CAAC,MAAM,EAAE;YACX;QACF;;;;QAIA;AACG,aAAA,KAAK;AACL,aAAA,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,KAAI;YAClB,iBAAiB,CAAC,EAAE,CAAC;AACrB,YAAA,OAAO,IAAI;AACb,QAAA,CAAC;aACA,UAAU,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;AACxC,aAAA,GAAG,EAAE;IACV;;;;IAKQ,uBAAuB,GAAA;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAA8B;QACnE,IAAI,CAAC,SAAS,EAAE;YACd;QACF;AACA,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC;QACrD;aAAO;AACL,YAAA,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC;QAC1C;IACF;IAEQ,SAAS,CAAC,IAAY,EAAE,MAAgB,EAAA;QAC9C,IAAI,CAAC,KAAK,EAAE,aAAa,CACvB,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CACjE;IACH;AACD;AAED;;;AAGG;SACa,oBAAoB,GAAA;IAClC,OAAO,IAAI,cAAc,EAAE;AAC7B;;;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*
|
|
4
|
+
* Copyright IBM Corp. 2026
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
import { LitElement, type PropertyValues } from "lit";
|
|
10
|
+
/**
|
|
11
|
+
* Layout-only composer chrome for the chat input. The shell defines five
|
|
12
|
+
* named slots and the spacing/border treatment around them — it carries no
|
|
13
|
+
* chat-domain logic, builds no Tiptap extensions, and forwards no editor
|
|
14
|
+
* methods.
|
|
15
|
+
*
|
|
16
|
+
* Consumers compose:
|
|
17
|
+
* - `editor` — a `<cds-aichat-prompt-line>` (or equivalent) the consumer
|
|
18
|
+
* owns directly; the shell does not render a fallback.
|
|
19
|
+
* - `message-actions` — action icons to the left of the text area.
|
|
20
|
+
* - `file-uploads` — visual list of files being uploaded.
|
|
21
|
+
* - `autocomplete-content` — suggestion overlay above the input.
|
|
22
|
+
* - `field-messaging` — inline error / status content beneath the
|
|
23
|
+
* autocomplete row (e.g. char-count exceeded message).
|
|
24
|
+
* - `send-control` — send / stop-streaming button.
|
|
25
|
+
*
|
|
26
|
+
* @element cds-aichat-prompt-line-shell
|
|
27
|
+
*/
|
|
28
|
+
declare class PromptLineShellElement extends LitElement {
|
|
29
|
+
static styles: import("lit").CSSResult;
|
|
30
|
+
/** Reflects to attribute so consumer CSS can target the rounded variant. */
|
|
31
|
+
rounded: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Expanded layout: the editor fills its own full-width row, with the
|
|
34
|
+
* message actions and send control on a second row beneath it (actions to
|
|
35
|
+
* the start, send to the end). Reflects so consumer CSS can target the
|
|
36
|
+
* variant. The reflow is driven purely by a container class — the rendered
|
|
37
|
+
* DOM is identical in both modes.
|
|
38
|
+
*/
|
|
39
|
+
expanded: boolean;
|
|
40
|
+
/** Whether the prompt line is in an error state */
|
|
41
|
+
hasError: boolean;
|
|
42
|
+
/** Whether the prompt-line shell is disabled. */
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
private _hasMessageActions;
|
|
45
|
+
private _hasFileUploads;
|
|
46
|
+
private _editorKeyboardFocus;
|
|
47
|
+
/** Watches the slotted file-uploads element for `has-uploads` attribute changes. */
|
|
48
|
+
private _fileUploadsObserver;
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
disconnectedCallback(): void;
|
|
51
|
+
willUpdate(changedProperties: PropertyValues): void;
|
|
52
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
53
|
+
private _handlePromptFocus;
|
|
54
|
+
private _handlePromptBlur;
|
|
55
|
+
private _handleMessageActionsSlotChange;
|
|
56
|
+
private _handleFileUploadsSlotChange;
|
|
57
|
+
/**
|
|
58
|
+
* Derives `_hasMessageActions` from the `message-actions` slot's current
|
|
59
|
+
* occupancy. Consumers may project a writeable passthrough
|
|
60
|
+
* (`data-prompt-line-slot`) into `message-actions`; it is always present even
|
|
61
|
+
* when empty, so only real action content drives the `--has-message-actions`
|
|
62
|
+
* padding treatment.
|
|
63
|
+
*/
|
|
64
|
+
private _updateHasMessageActions;
|
|
65
|
+
private _updateHasFileUploads;
|
|
66
|
+
}
|
|
67
|
+
declare global {
|
|
68
|
+
interface HTMLElementTagNameMap {
|
|
69
|
+
"cds-aichat-prompt-line-shell": PromptLineShellElement;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export default PromptLineShellElement;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { unsafeCSS, css, LitElement, html } from 'lit';
|
|
10
|
+
import { property, state } from 'lit/decorators.js';
|
|
11
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
12
|
+
import { carbonElement } from '../../../globals/decorators/carbon-element.js';
|
|
13
|
+
import prefix from '../../../globals/settings.js';
|
|
14
|
+
import styles from './prompt-line-shell.scss.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
*
|
|
19
|
+
* Copyright IBM Corp. 2026
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Layout-only composer chrome for the chat input. The shell defines five
|
|
26
|
+
* named slots and the spacing/border treatment around them — it carries no
|
|
27
|
+
* chat-domain logic, builds no Tiptap extensions, and forwards no editor
|
|
28
|
+
* methods.
|
|
29
|
+
*
|
|
30
|
+
* Consumers compose:
|
|
31
|
+
* - `editor` — a `<cds-aichat-prompt-line>` (or equivalent) the consumer
|
|
32
|
+
* owns directly; the shell does not render a fallback.
|
|
33
|
+
* - `message-actions` — action icons to the left of the text area.
|
|
34
|
+
* - `file-uploads` — visual list of files being uploaded.
|
|
35
|
+
* - `autocomplete-content` — suggestion overlay above the input.
|
|
36
|
+
* - `field-messaging` — inline error / status content beneath the
|
|
37
|
+
* autocomplete row (e.g. char-count exceeded message).
|
|
38
|
+
* - `send-control` — send / stop-streaming button.
|
|
39
|
+
*
|
|
40
|
+
* @element cds-aichat-prompt-line-shell
|
|
41
|
+
*/
|
|
42
|
+
let PromptLineShellElement = class PromptLineShellElement extends LitElement {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(...arguments);
|
|
45
|
+
/** Reflects to attribute so consumer CSS can target the rounded variant. */
|
|
46
|
+
this.rounded = false;
|
|
47
|
+
/**
|
|
48
|
+
* Expanded layout: the editor fills its own full-width row, with the
|
|
49
|
+
* message actions and send control on a second row beneath it (actions to
|
|
50
|
+
* the start, send to the end). Reflects so consumer CSS can target the
|
|
51
|
+
* variant. The reflow is driven purely by a container class — the rendered
|
|
52
|
+
* DOM is identical in both modes.
|
|
53
|
+
*/
|
|
54
|
+
this.expanded = false;
|
|
55
|
+
/** Whether the prompt line is in an error state */
|
|
56
|
+
this.hasError = false;
|
|
57
|
+
/** Whether the prompt-line shell is disabled. */
|
|
58
|
+
this.disabled = false;
|
|
59
|
+
this._hasMessageActions = false;
|
|
60
|
+
this._hasFileUploads = false;
|
|
61
|
+
this._editorKeyboardFocus = false;
|
|
62
|
+
/** Watches the slotted file-uploads element for `has-uploads` attribute changes. */
|
|
63
|
+
this._fileUploadsObserver = null;
|
|
64
|
+
this._handlePromptFocus = (event) => {
|
|
65
|
+
// Both the textarea controller and the rich runtime pass `{ keyboard: true }`
|
|
66
|
+
// in the event detail when focus arrived via keyboard navigation (no preceding
|
|
67
|
+
// pointer/touch event).
|
|
68
|
+
this._editorKeyboardFocus =
|
|
69
|
+
event.detail?.keyboard === true;
|
|
70
|
+
};
|
|
71
|
+
this._handlePromptBlur = () => {
|
|
72
|
+
this._editorKeyboardFocus = false;
|
|
73
|
+
};
|
|
74
|
+
this._handleMessageActionsSlotChange = () => {
|
|
75
|
+
// Request an update so `willUpdate()` re-derives occupancy from the settled
|
|
76
|
+
// assignment. Deriving there (not here) avoids latching on a transient
|
|
77
|
+
// assignment this event can fire on (see `willUpdate`).
|
|
78
|
+
this.requestUpdate();
|
|
79
|
+
};
|
|
80
|
+
this._handleFileUploadsSlotChange = () => {
|
|
81
|
+
// Reconnect the MutationObserver to whatever element is now slotted so we
|
|
82
|
+
// re-render when its `has-uploads` attribute changes (which doesn't fire a
|
|
83
|
+
// slotchange event).
|
|
84
|
+
this._fileUploadsObserver?.disconnect();
|
|
85
|
+
const slot = this.renderRoot?.querySelector(`slot[name="file-uploads"]`);
|
|
86
|
+
const el = slot?.assignedElements()[0];
|
|
87
|
+
if (el) {
|
|
88
|
+
if (!this._fileUploadsObserver) {
|
|
89
|
+
this._fileUploadsObserver = new MutationObserver(() => this.requestUpdate());
|
|
90
|
+
}
|
|
91
|
+
this._fileUploadsObserver.observe(el, {
|
|
92
|
+
attributes: true,
|
|
93
|
+
attributeFilter: ["has-uploads"],
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
this.requestUpdate();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
connectedCallback() {
|
|
100
|
+
super.connectedCallback();
|
|
101
|
+
this.addEventListener("cds-aichat-prompt-focus", this._handlePromptFocus);
|
|
102
|
+
this.addEventListener("cds-aichat-prompt-blur", this._handlePromptBlur);
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
super.disconnectedCallback();
|
|
106
|
+
this.removeEventListener("cds-aichat-prompt-focus", this._handlePromptFocus);
|
|
107
|
+
this.removeEventListener("cds-aichat-prompt-blur", this._handlePromptBlur);
|
|
108
|
+
this._fileUploadsObserver?.disconnect();
|
|
109
|
+
}
|
|
110
|
+
willUpdate(changedProperties) {
|
|
111
|
+
super.willUpdate(changedProperties);
|
|
112
|
+
// Derive `--has-message-actions` from the settled slot assignment on every
|
|
113
|
+
// update. A bare `slotchange` snapshot can latch on a transient state: a
|
|
114
|
+
// consumer projecting content asynchronously (web-component slotting) or
|
|
115
|
+
// toggling writeable content at runtime can momentarily present the
|
|
116
|
+
// prompt-line passthrough as real action content, and the settled assignment
|
|
117
|
+
// may not emit a follow-up `slotchange`. Left stale, that keeps the reduced
|
|
118
|
+
// start inset and strands the prompt line once the content is removed.
|
|
119
|
+
// Deriving here (rather than snapshotting in the handler) re-reads the
|
|
120
|
+
// settled assignment each render, so the occupancy can't latch.
|
|
121
|
+
this._updateHasMessageActions();
|
|
122
|
+
this._updateHasFileUploads();
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
const containerClasses = {
|
|
126
|
+
[`${prefix}--input-container`]: true,
|
|
127
|
+
[`${prefix}--input-container--has-message-actions`]: this._hasMessageActions,
|
|
128
|
+
[`${prefix}--input-container--expanded`]: this.expanded,
|
|
129
|
+
};
|
|
130
|
+
const uploadsRowClasses = {
|
|
131
|
+
[`${prefix}--input-uploads-and-autocomplete`]: true,
|
|
132
|
+
[`${prefix}--input-uploads-and-autocomplete--has-uploads`]: this._hasFileUploads,
|
|
133
|
+
};
|
|
134
|
+
const textAreaClasses = {
|
|
135
|
+
[`${prefix}--input-text-area`]: true,
|
|
136
|
+
[`${prefix}--input-text-area--keyboard-focus`]: this._editorKeyboardFocus,
|
|
137
|
+
};
|
|
138
|
+
// In expanded mode, render text-area before message-actions to match visual order
|
|
139
|
+
const textAreaContent = html `
|
|
140
|
+
<div class=${classMap(textAreaClasses)}>
|
|
141
|
+
<slot name="editor"></slot>
|
|
142
|
+
</div>
|
|
143
|
+
`;
|
|
144
|
+
const messageActionsContent = html `
|
|
145
|
+
<slot
|
|
146
|
+
name="message-actions"
|
|
147
|
+
@slotchange=${this._handleMessageActionsSlotChange}
|
|
148
|
+
></slot>
|
|
149
|
+
`;
|
|
150
|
+
return html `
|
|
151
|
+
<div class="${prefix}--prompt-line-shell">
|
|
152
|
+
<div class=${classMap(containerClasses)}>
|
|
153
|
+
<div class=${classMap(uploadsRowClasses)}>
|
|
154
|
+
<slot
|
|
155
|
+
name="file-uploads"
|
|
156
|
+
@slotchange=${this._handleFileUploadsSlotChange}
|
|
157
|
+
></slot>
|
|
158
|
+
<slot name="autocomplete-content"></slot>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="${prefix}--field-messaging-container">
|
|
161
|
+
<slot name="field-messaging"></slot>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="${prefix}--input-text-and-actions">
|
|
164
|
+
${this.expanded ? textAreaContent : messageActionsContent}
|
|
165
|
+
${this.expanded ? messageActionsContent : textAreaContent}
|
|
166
|
+
</div>
|
|
167
|
+
<div class="${prefix}--input-send-control-container">
|
|
168
|
+
<slot name="send-control"></slot>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Derives `_hasMessageActions` from the `message-actions` slot's current
|
|
176
|
+
* occupancy. Consumers may project a writeable passthrough
|
|
177
|
+
* (`data-prompt-line-slot`) into `message-actions`; it is always present even
|
|
178
|
+
* when empty, so only real action content drives the `--has-message-actions`
|
|
179
|
+
* padding treatment.
|
|
180
|
+
*/
|
|
181
|
+
_updateHasMessageActions() {
|
|
182
|
+
const slot = this.renderRoot?.querySelector(`slot[name="message-actions"]`);
|
|
183
|
+
this._hasMessageActions = slot
|
|
184
|
+
? slot
|
|
185
|
+
.assignedElements()
|
|
186
|
+
.some((element) => !element.hasAttribute("data-prompt-line-slot"))
|
|
187
|
+
: false;
|
|
188
|
+
}
|
|
189
|
+
_updateHasFileUploads() {
|
|
190
|
+
const slot = this.renderRoot?.querySelector(`slot[name="file-uploads"]`);
|
|
191
|
+
this._hasFileUploads = slot
|
|
192
|
+
? slot.assignedElements().some((el) => el.hasAttribute("has-uploads"))
|
|
193
|
+
: false;
|
|
194
|
+
this.toggleAttribute("has-file-uploads", this._hasFileUploads);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
PromptLineShellElement.styles = css `
|
|
198
|
+
${unsafeCSS(styles)}
|
|
199
|
+
`;
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: Boolean, reflect: true })
|
|
202
|
+
], PromptLineShellElement.prototype, "rounded", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: Boolean, reflect: true })
|
|
205
|
+
], PromptLineShellElement.prototype, "expanded", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: Boolean, reflect: true, attribute: "has-error" })
|
|
208
|
+
], PromptLineShellElement.prototype, "hasError", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: Boolean, reflect: true })
|
|
211
|
+
], PromptLineShellElement.prototype, "disabled", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
state()
|
|
214
|
+
], PromptLineShellElement.prototype, "_hasMessageActions", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
state()
|
|
217
|
+
], PromptLineShellElement.prototype, "_hasFileUploads", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
state()
|
|
220
|
+
], PromptLineShellElement.prototype, "_editorKeyboardFocus", void 0);
|
|
221
|
+
PromptLineShellElement = __decorate([
|
|
222
|
+
carbonElement(`${prefix}-prompt-line-shell`)
|
|
223
|
+
], PromptLineShellElement);
|
|
224
|
+
var PromptLineShellElement$1 = PromptLineShellElement;
|
|
225
|
+
|
|
226
|
+
export { PromptLineShellElement$1 as default };
|
|
227
|
+
//# sourceMappingURL=prompt-line-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-line-shell.js","sources":["../../../../src/components/prompt-line/src/prompt-line-shell.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAWH;;;;;;;;;;;;;;;;;AAiBG;AAEH,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU,CAAA;AAA/C,IAAA,WAAA,GAAA;;;QAOE,IAAA,CAAA,OAAO,GAAG,KAAK;AAEf;;;;;;AAMG;QAEH,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAIhB,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAIhB,IAAA,CAAA,QAAQ,GAAG,KAAK;QAGR,IAAA,CAAA,kBAAkB,GAAG,KAAK;QAG1B,IAAA,CAAA,eAAe,GAAG,KAAK;QAGvB,IAAA,CAAA,oBAAoB,GAAG,KAAK;;QAG5B,IAAA,CAAA,oBAAoB,GAA4B,IAAI;AAqGpD,QAAA,IAAA,CAAA,kBAAkB,GAAG,CAAC,KAAkB,KAAU;;;;AAIxD,YAAA,IAAI,CAAC,oBAAoB;AACtB,gBAAA,KAAK,CAAC,MAAiC,EAAE,QAAQ,KAAK,IAAI;AAC/D,QAAA,CAAC;QAEO,IAAA,CAAA,iBAAiB,GAAG,MAAW;AACrC,YAAA,IAAI,CAAC,oBAAoB,GAAG,KAAK;AACnC,QAAA,CAAC;QAEO,IAAA,CAAA,+BAA+B,GAAG,MAAW;;;;YAInD,IAAI,CAAC,aAAa,EAAE;AACtB,QAAA,CAAC;QAEO,IAAA,CAAA,4BAA4B,GAAG,MAAW;;;;AAIhD,YAAA,IAAI,CAAC,oBAAoB,EAAE,UAAU,EAAE;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,aAAa,CACzC,CAAA,yBAAA,CAA2B,C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