@carbon/ai-chat-components 1.8.0-rc.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 +15967 -10853
- package/es/components/audio-player/src/audio-player.js +0 -1
- 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 +1 -1
- 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.scss.js +1 -1
- package/es/components/chat-history/src/chat-history.scss.js +1 -1
- package/es/components/chat-shell/src/chat-header.js +0 -1
- 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.js +2 -2
- 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/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 +11 -0
- package/es/components/code-snippet/src/code-snippet.js +37 -5
- 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/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.js +1 -0
- 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/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/shared/media-utils/script-loader.js +0 -1
- package/es/components/shared/media-utils/script-loader.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 +0 -1
- 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/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/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 +0 -1
- 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 +1 -1
- 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.scss.js +1 -1
- package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
- package/es-custom/components/chat-shell/src/chat-header.js +0 -1
- 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.js +2 -2
- 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/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 +11 -0
- package/es-custom/components/code-snippet/src/code-snippet.js +37 -5
- 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/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.js +1 -0
- 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/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/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/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 +0 -1
- 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/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/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 +24 -3
- package/scss/_custom-properties.scss +1 -3
- 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,59 @@
|
|
|
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 { Extension } from '@tiptap/core';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
*
|
|
13
|
+
* Copyright IBM Corp. 2026
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Tiptap keymap extension for the prompt-line.
|
|
20
|
+
*
|
|
21
|
+
* - `Mod-Enter` → emit `cds-aichat-prompt-send-intent`. The shell decides
|
|
22
|
+
* whether to honor (re-dispatch as `cds-aichat-input-send`) or gate
|
|
23
|
+
* (`isSendDisabled` per PLAN.md decision 19).
|
|
24
|
+
* - `Escape` → blur the editor.
|
|
25
|
+
* - Plain `Enter` is not bound here. `<cds-aichat-prompt-line>` adds
|
|
26
|
+
* `carbonChatEnter` to its base bundle for "Enter sends, Shift-Enter
|
|
27
|
+
* newlines"; this extension stays Enter-agnostic so it can be reused on its
|
|
28
|
+
* own.
|
|
29
|
+
*
|
|
30
|
+
* Undo / redo come from the `UndoRedo` extension. ArrowUp / ArrowDown /
|
|
31
|
+
* Enter / Escape forwarding to the active autocomplete list is **not** done
|
|
32
|
+
* here — the `AutocompleteController` (see ../autocomplete-controller.ts)
|
|
33
|
+
* installs its own capture-phase keydown listener on the editor view DOM
|
|
34
|
+
* when a trigger is active and a list element is registered, and
|
|
35
|
+
* re-dispatches those keys on the list. The Tiptap suggestion factories
|
|
36
|
+
* (`carbonMention`, `carbonAutocomplete`) deliberately return `false` from
|
|
37
|
+
* `onKeyDown` so they don't consume those keys either.
|
|
38
|
+
*/
|
|
39
|
+
const Keymap = Extension.create({
|
|
40
|
+
name: "carbonChatKeymap",
|
|
41
|
+
addKeyboardShortcuts() {
|
|
42
|
+
return {
|
|
43
|
+
"Mod-Enter": ({ editor }) => {
|
|
44
|
+
editor.view.dom.dispatchEvent(new CustomEvent("cds-aichat-prompt-send-intent", {
|
|
45
|
+
bubbles: true,
|
|
46
|
+
composed: true,
|
|
47
|
+
}));
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
Escape: ({ editor }) => {
|
|
51
|
+
editor.view.dom.blur();
|
|
52
|
+
return true;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export { Keymap };
|
|
59
|
+
//# sourceMappingURL=keymap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.js","sources":["../../../../../src/components/prompt-line/src/tiptap/keymap.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;;;;;;AAoBG;AAII,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AACrC,IAAA,IAAI,EAAE,kBAAkB;IAExB,oBAAoB,GAAA;QAClB,OAAO;AACL,YAAA,WAAW,EAAE,CAAC,EAAE,MAAM,EAAE,KAAI;gBAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAC3B,IAAI,WAAW,CAAC,+BAA+B,EAAE;AAC/C,oBAAA,OAAO,EAAE,IAAI;AACb,oBAAA,QAAQ,EAAE,IAAI;AACf,iBAAA,CAAC,CACH;AACD,gBAAA,OAAO,IAAI;YACb,CAAC;AACD,YAAA,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAI;AACpB,gBAAA,MAAM,CAAC,IAAI,CAAC,GAAmB,CAAC,IAAI,EAAE;AACvC,gBAAA,OAAO,IAAI;YACb,CAAC;SACF;IACH,CAAC;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 type { Transaction } from "@tiptap/pm/state";
|
|
10
|
+
export declare function setHostOriginMeta(tr: Transaction): Transaction;
|
|
11
|
+
export declare function isHostOrigin(tr: Transaction): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2026
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Tag a transaction as host-originated so the value-sync extension (and any
|
|
18
|
+
* other origin-aware reader) can suppress its own change-event emission for
|
|
19
|
+
* the round-trip. Replaces the legacy `external-update-flag.ts` WeakMap; the
|
|
20
|
+
* meta key is shared with consumer code that dispatches transactions via
|
|
21
|
+
* `getEditor()?.view.dispatch(tr)` and wants to opt out of the change loop.
|
|
22
|
+
*/
|
|
23
|
+
const HOST_ORIGIN_META_KEY = "aichatOrigin";
|
|
24
|
+
const HOST_ORIGIN_VALUE = "host";
|
|
25
|
+
function setHostOriginMeta(tr) {
|
|
26
|
+
return tr.setMeta(HOST_ORIGIN_META_KEY, HOST_ORIGIN_VALUE);
|
|
27
|
+
}
|
|
28
|
+
function isHostOrigin(tr) {
|
|
29
|
+
return tr.getMeta(HOST_ORIGIN_META_KEY) === HOST_ORIGIN_VALUE;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { isHostOrigin, setHostOriginMeta };
|
|
33
|
+
//# sourceMappingURL=origin-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin-meta.js","sources":["../../../../../src/components/prompt-line/src/tiptap/origin-meta.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;;;;;;AAMG;AACH,MAAM,oBAAoB,GAAG,cAAc;AAC3C,MAAM,iBAAiB,GAAG,MAAM;AAE1B,SAAU,iBAAiB,CAAC,EAAe,EAAA;IAC/C,OAAO,EAAE,CAAC,OAAO,CAAC,oBAAoB,EAAE,iBAAiB,CAAC;AAC5D;AAEM,SAAU,YAAY,CAAC,EAAe,EAAA;IAC1C,OAAO,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,KAAK,iBAAiB;AAC/D;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Tiptap plain-text-paste extension. Intercepts paste/drop events,
|
|
11
|
+
* extracts plain text, and inserts it as paragraph nodes split on
|
|
12
|
+
* newlines. Schema-agnostic — only requires `paragraph` and `text`
|
|
13
|
+
* nodes.
|
|
14
|
+
*/
|
|
15
|
+
import { Extension } from "@tiptap/core";
|
|
16
|
+
export declare const PlainTextPaste: Extension<any, any>;
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { Extension } from '@tiptap/core';
|
|
9
|
+
import { Plugin } from '@tiptap/pm/state';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
*
|
|
14
|
+
* Copyright IBM Corp. 2026
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Tiptap plain-text-paste extension. Intercepts paste/drop events,
|
|
21
|
+
* extracts plain text, and inserts it as paragraph nodes split on
|
|
22
|
+
* newlines. Schema-agnostic — only requires `paragraph` and `text`
|
|
23
|
+
* nodes.
|
|
24
|
+
*/
|
|
25
|
+
function linesToNodes(schema, lines) {
|
|
26
|
+
return lines.map((line) => {
|
|
27
|
+
if (line.length === 0) {
|
|
28
|
+
return schema.nodes.paragraph.create();
|
|
29
|
+
}
|
|
30
|
+
return schema.nodes.paragraph.create(null, schema.text(line));
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function createPastePlugin() {
|
|
34
|
+
return new Plugin({
|
|
35
|
+
props: {
|
|
36
|
+
handlePaste(view, event, _slice) {
|
|
37
|
+
const text = event.clipboardData?.getData("text/plain");
|
|
38
|
+
if (text == null) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const { schema } = view.state;
|
|
42
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
43
|
+
const nodes = linesToNodes(schema, lines);
|
|
44
|
+
const { from, to } = view.state.selection;
|
|
45
|
+
const tr = view.state.tr.replaceWith(from, to, nodes);
|
|
46
|
+
view.dispatch(tr.scrollIntoView());
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
handleDrop(view, event, _slice, moved) {
|
|
50
|
+
// Allow internal drag-and-drop (moved content within the editor)
|
|
51
|
+
if (moved) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
// Block external drops to prevent rich content
|
|
55
|
+
const text = event.dataTransfer?.getData("text/plain");
|
|
56
|
+
if (!text) {
|
|
57
|
+
return true; // block the drop
|
|
58
|
+
}
|
|
59
|
+
const { schema } = view.state;
|
|
60
|
+
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
61
|
+
const nodes = linesToNodes(schema, lines);
|
|
62
|
+
const pos = view.posAtCoords({
|
|
63
|
+
left: event.clientX,
|
|
64
|
+
top: event.clientY,
|
|
65
|
+
});
|
|
66
|
+
if (!pos) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
const tr = view.state.tr.replaceWith(pos.pos, pos.pos, nodes);
|
|
70
|
+
view.dispatch(tr.scrollIntoView());
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
return true;
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const PlainTextPaste = Extension.create({
|
|
78
|
+
name: "carbonPlainTextPaste",
|
|
79
|
+
addProseMirrorPlugins() {
|
|
80
|
+
return [createPastePlugin()];
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export { PlainTextPaste };
|
|
85
|
+
//# sourceMappingURL=plain-text-paste.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plain-text-paste.js","sources":["../../../../../src/components/prompt-line/src/tiptap/plain-text-paste.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;AAKG;AAMH,SAAS,YAAY,CAAC,MAAc,EAAE,KAAe,EAAA;AACnD,IAAA,OAAO,KA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-2.0 license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* `renderInLightDom` is the generic light-DOM portal handshake. The chat —
|
|
11
|
+
* including the Tiptap editor — runs inside a shadow root, so a host-authored
|
|
12
|
+
* `addNodeView` cannot reach the page's stylesheet. This helper builds a
|
|
13
|
+
* shadow-side container and dispatches a `cds-aichat-light-dom-portal` event;
|
|
14
|
+
* the chat's portal container catches it, mounts the supplied content into the
|
|
15
|
+
* page's LIGHT DOM, and projects it back into the container via a `<slot>`.
|
|
16
|
+
*
|
|
17
|
+
* `renderTokenChip` is a thin token-specific wrapper over this primitive.
|
|
18
|
+
*/
|
|
19
|
+
import type { ReactNode } from "react";
|
|
20
|
+
/** Wire event for the generic light-DOM portal handshake. */
|
|
21
|
+
export declare const LIGHT_DOM_PORTAL_EVENT = "cds-aichat-light-dom-portal";
|
|
22
|
+
export interface RenderInLightDomArgs {
|
|
23
|
+
/**
|
|
24
|
+
* Content to render in the page's light DOM. An `HTMLElement` is appended
|
|
25
|
+
* directly. A `ReactNode` is `createPortal`-ed by the chat's React tree —
|
|
26
|
+
* the same path the token `renderCustomToken` ReactNode case uses; it relies
|
|
27
|
+
* on the host and chat sharing a single React instance.
|
|
28
|
+
*/
|
|
29
|
+
content: HTMLElement | ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Where to dispatch the handshake event. A host `addNodeView` should pass
|
|
32
|
+
* `editor.view.dom` so the event reaches the listener on the chat wrapper.
|
|
33
|
+
* Defaults to the returned `container` (the event bubbles and is composed).
|
|
34
|
+
*/
|
|
35
|
+
dispatchTarget?: EventTarget;
|
|
36
|
+
/**
|
|
37
|
+
* Optional element shown inside the `<slot>` until the portal commits on the
|
|
38
|
+
* next frame.
|
|
39
|
+
*/
|
|
40
|
+
fallback?: HTMLElement;
|
|
41
|
+
/**
|
|
42
|
+
* Opaque metadata forwarded verbatim in the event detail. The portal
|
|
43
|
+
* container does not read it; listeners may.
|
|
44
|
+
*/
|
|
45
|
+
meta?: Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Tag used for the shadow-side container AND the page-light-DOM host
|
|
48
|
+
* element the portal creates. Defaults to `"span"`, which suits inline
|
|
49
|
+
* content like a token chip. Use `"div"` when the projected content is
|
|
50
|
+
* block-level (e.g. an atom-block Tiptap node containing a
|
|
51
|
+
* `<cds-aichat-code-snippet>`) — a `<span>` wrapper would otherwise wrap a
|
|
52
|
+
* `display: block` child in an inline line-box, adding the parent's
|
|
53
|
+
* line-height as phantom leading.
|
|
54
|
+
*/
|
|
55
|
+
containerTag?: "span" | "div";
|
|
56
|
+
}
|
|
57
|
+
export interface RenderInLightDomResult {
|
|
58
|
+
/**
|
|
59
|
+
* The shadow-side container. Place it where the content should appear (e.g.
|
|
60
|
+
* return it as a Tiptap node view `dom`). The portal container injects a
|
|
61
|
+
* `<slot>` into it that projects the light-DOM content into position.
|
|
62
|
+
*/
|
|
63
|
+
container: HTMLElement;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Detail payload for {@link LIGHT_DOM_PORTAL_EVENT}. Exactly one of
|
|
67
|
+
* `htmlElement` / `reactNode` is set.
|
|
68
|
+
*/
|
|
69
|
+
export interface LightDomPortalEventDetail {
|
|
70
|
+
/** Shadow-side container the listener injects a `<slot>` into. */
|
|
71
|
+
container: HTMLElement;
|
|
72
|
+
/** Optional `<slot>` fallback content. */
|
|
73
|
+
fallback?: HTMLElement;
|
|
74
|
+
/** Opaque caller metadata. */
|
|
75
|
+
meta?: Record<string, unknown>;
|
|
76
|
+
/** Set when the caller passed an `HTMLElement`. */
|
|
77
|
+
htmlElement?: HTMLElement;
|
|
78
|
+
/** Set when the caller passed a `ReactNode`. */
|
|
79
|
+
reactNode?: ReactNode;
|
|
80
|
+
/** Tag the listener should use for the page-light-DOM `slot` host element. */
|
|
81
|
+
hostTag?: "span" | "div";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Bridge `content` into the page's light DOM via the slot-projection portal.
|
|
85
|
+
* Returns the shadow-side `container` to place where the content belongs.
|
|
86
|
+
*/
|
|
87
|
+
export declare function renderInLightDom(args: RenderInLightDomArgs): RenderInLightDomResult;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
*
|
|
11
|
+
* Copyright IBM Corp. 2026
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
/** Wire event for the generic light-DOM portal handshake. */
|
|
17
|
+
const LIGHT_DOM_PORTAL_EVENT = "cds-aichat-light-dom-portal";
|
|
18
|
+
/**
|
|
19
|
+
* Bridge `content` into the page's light DOM via the slot-projection portal.
|
|
20
|
+
* Returns the shadow-side `container` to place where the content belongs.
|
|
21
|
+
*/
|
|
22
|
+
function renderInLightDom(args) {
|
|
23
|
+
const containerTag = args.containerTag ?? "span";
|
|
24
|
+
const container = document.createElement(containerTag);
|
|
25
|
+
container.className = "cds-aichat--light-dom-portal-container";
|
|
26
|
+
const detail = {
|
|
27
|
+
container,
|
|
28
|
+
fallback: args.fallback,
|
|
29
|
+
meta: args.meta,
|
|
30
|
+
hostTag: containerTag,
|
|
31
|
+
...(args.content instanceof HTMLElement
|
|
32
|
+
? { htmlElement: args.content }
|
|
33
|
+
: { reactNode: args.content }),
|
|
34
|
+
};
|
|
35
|
+
const event = new CustomEvent(LIGHT_DOM_PORTAL_EVENT, { detail, bubbles: true, composed: true });
|
|
36
|
+
(args.dispatchTarget ?? container).dispatchEvent(event);
|
|
37
|
+
return { container };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { LIGHT_DOM_PORTAL_EVENT, renderInLightDom };
|
|
41
|
+
//# sourceMappingURL=render-in-light-dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-in-light-dom.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-in-light-dom.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAeH;AACO,MAAM,sBAAsB,GAAG;AAkEtC;;;AAGG;AACG,SAAU,gBAAgB,CAC9B,IAA0B,EAAA;AAE1B,IAAA,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,MAAM;IAChD,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC;AACtD,IAAA,SAAS,CAAC,SAAS,GAAG,wCAAwC;AAE9D,IAAA,MAAM,MAAM,GAA8B;QACxC,SAAS;QACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI;AACf,QAAA,OAAO,EAAE,YAAY;AACrB,QAAA,IAAI,IAAI,CAAC,OAAO,YAAY;AAC1B,cAAE,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO;cAC3B,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;KACjC;AAED,IAAA,MAAM,KAAK,GAAG,IAAI,WAAW,CAC3B,sBAAsB,EACtB,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAC1C;IAED,CAAC,IAAI,CAAC,cAAc,IAAI,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC;IAEvD,OAAO,EAAE,SAAS,EAAE;AACtB;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 type { TriggerSuggestionConfig } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Attributes carried by a mention/command JSONContent node. Matches the
|
|
12
|
+
* Tiptap mention shape (`id`, `label`) plus the carbon-specific `value`,
|
|
13
|
+
* `data`, and `trigger` extensions added by `carbonMention`/`carbonCommand`.
|
|
14
|
+
*/
|
|
15
|
+
export interface TokenChipAttrs {
|
|
16
|
+
id?: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
value?: string;
|
|
19
|
+
data?: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* Trigger character to prefix onto the default chip text (e.g.
|
|
22
|
+
* `/summarize` vs `summarize`). Set at insert time by
|
|
23
|
+
* `resolveShowTriggerInChip` — defaults to command nodes only, but is
|
|
24
|
+
* overridable per-config or per-item via `TriggerSuggestionConfig`/
|
|
25
|
+
* `SuggestionItem`'s `showTriggerInChip`.
|
|
26
|
+
*/
|
|
27
|
+
trigger?: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface RenderTokenChipArgs {
|
|
30
|
+
/** Node attrs in mention shape. */
|
|
31
|
+
attrs: TokenChipAttrs;
|
|
32
|
+
/**
|
|
33
|
+
* Subset of the trigger-suggestion config relevant to chip rendering. Only
|
|
34
|
+
* `renderCustomToken` is read; other config fields are ignored.
|
|
35
|
+
*/
|
|
36
|
+
config?: Pick<TriggerSuggestionConfig, "renderCustomToken">;
|
|
37
|
+
/** Token type — usually `"mention"` or `"command"`. */
|
|
38
|
+
type: "mention" | "command" | string;
|
|
39
|
+
/**
|
|
40
|
+
* Where to dispatch the light-DOM portal event when `renderCustomToken`
|
|
41
|
+
* returns custom content. The NodeView passes the editor's `view.dom`
|
|
42
|
+
* (already mounted under the chat wrapper) so the event reaches the portal
|
|
43
|
+
* listener synchronously. When omitted, the event fires from the portal
|
|
44
|
+
* container element itself with `bubbles: true, composed: true` — callers
|
|
45
|
+
* that mount the chip lazily must ensure it lives under a listener subtree
|
|
46
|
+
* before connection.
|
|
47
|
+
*/
|
|
48
|
+
dispatchTarget?: EventTarget;
|
|
49
|
+
/**
|
|
50
|
+
* Visual variant to render. `"composer"` is the live, being-typed token in
|
|
51
|
+
* the prompt-line editor; `"historical"` is a token inside an already-sent
|
|
52
|
+
* message in the transcript. Drives the default chip's color/highlight —
|
|
53
|
+
* see `ensureTokenStyleRules`.
|
|
54
|
+
*/
|
|
55
|
+
context: "composer" | "historical";
|
|
56
|
+
}
|
|
57
|
+
export declare function renderTokenChip(args: RenderTokenChipArgs): HTMLElement;
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { setVarsForSelector } from '../../../shared/dynamic-css-var-sheet.js';
|
|
9
|
+
import { renderInLightDom } from './render-in-light-dom.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
*
|
|
14
|
+
* Copyright IBM Corp. 2026
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
let tokenStyleRulesInstalled = false;
|
|
20
|
+
function ensureTokenStyleRules() {
|
|
21
|
+
if (tokenStyleRulesInstalled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
setVarsForSelector(".cds-aichat--token", { "white-space": "normal" });
|
|
25
|
+
setVarsForSelector('.cds-aichat--token[data-token-context="composer"]', {
|
|
26
|
+
color: "var(--cds-tag-color-blue)",
|
|
27
|
+
});
|
|
28
|
+
setVarsForSelector('.cds-aichat--token[data-token-context="composer"]::selection', { "background-color": "var(--cds-tag-background-blue)" });
|
|
29
|
+
setVarsForSelector('.cds-aichat--token[data-token-context="historical"]', {
|
|
30
|
+
color: "var(--cds-link-secondary)",
|
|
31
|
+
});
|
|
32
|
+
tokenStyleRulesInstalled = true;
|
|
33
|
+
}
|
|
34
|
+
function renderTokenChip(args) {
|
|
35
|
+
const dom = createTokenContainer(args.attrs, args.type, args.context);
|
|
36
|
+
const renderer = args.config?.renderCustomToken;
|
|
37
|
+
if (!renderer) {
|
|
38
|
+
dom.appendChild(createDefaultChip(args.attrs));
|
|
39
|
+
return dom;
|
|
40
|
+
}
|
|
41
|
+
const item = {
|
|
42
|
+
id: typeof args.attrs.id === "string" ? args.attrs.id : "",
|
|
43
|
+
label: typeof args.attrs.label === "string" ? args.attrs.label : "",
|
|
44
|
+
...(args.attrs.data ?? {}),
|
|
45
|
+
};
|
|
46
|
+
let result;
|
|
47
|
+
try {
|
|
48
|
+
result = renderer(item);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.error("Error in renderCustomToken, falling back to default chip:", error);
|
|
53
|
+
dom.appendChild(createDefaultChip(args.attrs));
|
|
54
|
+
return dom;
|
|
55
|
+
}
|
|
56
|
+
if (result == null) {
|
|
57
|
+
dom.appendChild(createDefaultChip(args.attrs));
|
|
58
|
+
return dom;
|
|
59
|
+
}
|
|
60
|
+
// Bridge the custom chip into the page's light DOM via the shared portal
|
|
61
|
+
// handshake. The default chip rides along as the `<slot>` fallback so the
|
|
62
|
+
// token still shows something until the portal commits.
|
|
63
|
+
const { container } = renderInLightDom({
|
|
64
|
+
content: result,
|
|
65
|
+
dispatchTarget: args.dispatchTarget ?? dom,
|
|
66
|
+
fallback: createDefaultChip(args.attrs),
|
|
67
|
+
});
|
|
68
|
+
dom.appendChild(container);
|
|
69
|
+
return dom;
|
|
70
|
+
}
|
|
71
|
+
function createTokenContainer(attrs, type, context) {
|
|
72
|
+
ensureTokenStyleRules();
|
|
73
|
+
const dom = document.createElement("span");
|
|
74
|
+
const value = typeof attrs.value === "string" ? attrs.value : null;
|
|
75
|
+
const label = typeof attrs.label === "string" ? attrs.label : null;
|
|
76
|
+
dom.setAttribute("contenteditable", "false");
|
|
77
|
+
dom.setAttribute("data-token-type", type);
|
|
78
|
+
dom.setAttribute("data-token-context", context);
|
|
79
|
+
dom.setAttribute("data-raw-value", value ?? label ?? "");
|
|
80
|
+
dom.setAttribute("role", "img");
|
|
81
|
+
dom.setAttribute("aria-label", label || value || "");
|
|
82
|
+
dom.className = "cds-aichat--token";
|
|
83
|
+
return dom;
|
|
84
|
+
}
|
|
85
|
+
function createDefaultChip(attrs) {
|
|
86
|
+
const chip = document.createElement("span");
|
|
87
|
+
const label = typeof attrs.label === "string" ? attrs.label : null;
|
|
88
|
+
const value = typeof attrs.value === "string" ? attrs.value : null;
|
|
89
|
+
const trigger = typeof attrs.trigger === "string" ? attrs.trigger : "";
|
|
90
|
+
chip.textContent = `${trigger}${label || value || ""}`;
|
|
91
|
+
return chip;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { renderTokenChip };
|
|
95
|
+
//# sourceMappingURL=render-token-chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-token-chip.js","sources":["../../../../../src/components/prompt-line/src/tiptap/render-token-chip.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAiBH,IAAI,wBAAwB,GAAG,KAAK;AAEpC,SAAS,qBAAqB,GAAA;IAC5B,IAAI,wBAAwB,EAAE;QAC5B;IACF;IACA,kBAAkB,CAAC,oBAAoB,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;IACrE,kBAAkB,CAAC,mDAAmD,EAAE;AACtE,QAAA,KAAK,EAAE,2BAA2B;AACnC,KAAA,CAAC;IACF,kBAAkB,CAChB,8DAA8D,EAC9D,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,CACzD;IACD,kBAAkB,CAAC,qDAAqD,EAAE;AACxE,QAAA,KAAK,EAAE,2BAA2B;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,KAAK,CAAC,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI;AAClE,IAAA,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,KAAK,GAAG,IAAI;AAClE,IAAA,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,EAAE;AACtE,IAAA,IAAI,CAAC,WAAW,GAAG,CAAA,EAAG,OAAO,CAAA,EAAG,KAAK,IAAI,KAAK,IAAI,EAAE,CAAA,CAAE;AACtD,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* `CarbonTokenNodeView` is Tiptap's NodeView for inline tokens (mentions,
|
|
11
|
+
* commands). Via {@link renderTokenChip} it dispatches the light-DOM portal
|
|
12
|
+
* event that consumer-side React portal listeners (`LightDomPortalsContainer`)
|
|
13
|
+
* hydrate into chips.
|
|
14
|
+
*
|
|
15
|
+
* The actual chip-DOM construction (default chip, `renderCustomToken`
|
|
16
|
+
* honoring, and the light-DOM portal handshake) lives in {@link renderTokenChip},
|
|
17
|
+
* which is shared with the chat-side rich user message bubble.
|
|
18
|
+
*/
|
|
19
|
+
import type { Node as PMNode } from "@tiptap/pm/model";
|
|
20
|
+
import type { EditorView, NodeView } from "@tiptap/pm/view";
|
|
21
|
+
import type { TriggerSuggestionConfig } from "./types.js";
|
|
22
|
+
export interface CarbonTokenNodeViewOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Custom renderer from the trigger-suggestion config. When omitted, the
|
|
25
|
+
* default text chip is used.
|
|
26
|
+
*/
|
|
27
|
+
renderCustomToken?: TriggerSuggestionConfig["renderCustomToken"];
|
|
28
|
+
}
|
|
29
|
+
export declare class CarbonTokenNodeView implements NodeView {
|
|
30
|
+
dom: HTMLElement;
|
|
31
|
+
constructor(node: PMNode, view: EditorView, options: CarbonTokenNodeViewOptions);
|
|
32
|
+
stopEvent(): boolean;
|
|
33
|
+
ignoreMutation(): boolean;
|
|
34
|
+
/** Atomic: PM does not track interior content. */
|
|
35
|
+
get contentDOM(): null;
|
|
36
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { renderTokenChip } from './render-token-chip.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license
|
|
12
|
+
*
|
|
13
|
+
* Copyright IBM Corp. 2026
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
class CarbonTokenNodeView {
|
|
19
|
+
constructor(node, view, options) {
|
|
20
|
+
this.dom = renderTokenChip({
|
|
21
|
+
attrs: node.attrs,
|
|
22
|
+
config: { renderCustomToken: options.renderCustomToken },
|
|
23
|
+
type: node.type.name,
|
|
24
|
+
dispatchTarget: view.dom,
|
|
25
|
+
context: "composer",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
stopEvent() {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
ignoreMutation() {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/** Atomic: PM does not track interior content. */
|
|
35
|
+
get contentDOM() {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { CarbonTokenNodeView };
|
|
41
|
+
//# sourceMappingURL=token-node-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-node-view.js","sources":["../../../../../src/components/prompt-line/src/tiptap/token-node-view.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;MA2BU,mBAAmB,CAAA;AAG9B,IAAA,WAAA,CACE,IAAY,EACZ,IAAgB,EAChB,OAAmC,EAAA;AAEnC,QAAA,IAAI,CAAC,GAAG,GAAG,eAAe,CAAC;YACzB,KAAK,EAAE,IAAI,CAAC,KAAuB;AACnC,YAAA,MAAM,EAAE,EAAE,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE;AACxD,YAAA,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,cAAc,EAAE,IAAI,CAAC,GAAG;AACxB,YAAA,OAAO,EAAE,UAAU;AACpB,SAAA,CAAC;IACJ;IAEA,SAAS,GAAA;AACP,QAAA,OAAO,IAAI;IACb;IAEA,cAAc,GAAA;AACZ,QAAA,OAAO,IAAI;IACb;;AAGA,IAAA,IAAI,UAAU,GAAA;AACZ,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Shared helper for the carbon factories' suggestion-render lifecycles to
|
|
11
|
+
* dispatch `cds-aichat-trigger-change` events directly. There is no central
|
|
12
|
+
* bridge extension (per PLAN.md decision 4) — each factory calls this helper
|
|
13
|
+
* from its own `onStart`/`onUpdate`/`onExit` callbacks.
|
|
14
|
+
*
|
|
15
|
+
* **Concurrent transitions:** if two factories transition in the same
|
|
16
|
+
* transaction (rare — would require a host-driven setContent that crosses
|
|
17
|
+
* two trigger contexts), each emits independently and listeners observe a
|
|
18
|
+
* sequence of detail values. Consumers tracking "current trigger" stay
|
|
19
|
+
* correct because the final `onStart`/`onUpdate` wins; `onExit` listeners
|
|
20
|
+
* receive a `null` between the two activations only if the previous trigger's
|
|
21
|
+
* range was actually exited.
|
|
22
|
+
*/
|
|
23
|
+
import type { Editor } from "@tiptap/core";
|
|
24
|
+
import type { TriggerChangeEventDetail } from "./types.js";
|
|
25
|
+
/**
|
|
26
|
+
* Dispatch `cds-aichat-trigger-change` on the editor's DOM if the detail has
|
|
27
|
+
* changed since the last call for the same editor. No-op transitions are
|
|
28
|
+
* coalesced.
|
|
29
|
+
*/
|
|
30
|
+
export declare function dispatchTriggerChange(editor: Editor, detail: TriggerChangeEventDetail | null): void;
|