@carbon/ai-chat-components 1.10.0 → 1.11.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.
Files changed (126) hide show
  1. package/custom-elements.json +736 -775
  2. package/es/components/audio-player/src/utils/url-detector.d.ts +0 -14
  3. package/es/components/audio-player/src/utils/url-detector.js +1 -19
  4. package/es/components/audio-player/src/utils/url-detector.js.map +1 -1
  5. package/es/components/card/src/card-footer.scss.js +1 -1
  6. package/es/components/card/src/card-steps.scss.js +1 -1
  7. package/es/components/card/src/card.scss.js +1 -1
  8. package/es/components/code-snippet/src/codemirror/codemirror-loader.d.ts +0 -5
  9. package/es/components/code-snippet/src/codemirror/codemirror-loader.js +1 -8
  10. package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
  11. package/es/components/markdown/src/markdown-token-tree.js +1 -1
  12. package/es/components/markdown/src/plugins/markdown-it-attrs.d.ts +0 -1
  13. package/es/components/markdown/src/plugins/markdown-it-attrs.js +1 -1
  14. package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
  15. package/es/components/markdown/src/utils/plugin-fallback.js +3 -1
  16. package/es/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  17. package/es/components/markdown/src/utils/table-helpers.d.ts +0 -26
  18. package/es/components/markdown/src/utils/table-helpers.js +1 -4
  19. package/es/components/markdown/src/utils/table-helpers.js.map +1 -1
  20. package/es/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  21. package/es/components/prompt-line/src/prompt-line-constants.d.ts +9 -1
  22. package/es/components/prompt-line/src/prompt-line-constants.js +10 -2
  23. package/es/components/prompt-line/src/prompt-line-constants.js.map +1 -1
  24. package/es/components/prompt-line/src/prompt-line-controller.d.ts +25 -78
  25. package/es/components/prompt-line/src/prompt-line-controller.js +0 -389
  26. package/es/components/prompt-line/src/prompt-line-controller.js.map +1 -1
  27. package/es/components/prompt-line/src/prompt-line-mouse-focus.d.ts +45 -0
  28. package/es/components/prompt-line/src/prompt-line-mouse-focus.js +83 -0
  29. package/es/components/prompt-line/src/prompt-line-mouse-focus.js.map +1 -0
  30. package/es/components/prompt-line/src/prompt-line-rich-runtime.d.ts +0 -2
  31. package/es/components/prompt-line/src/prompt-line-rich-runtime.js +30 -53
  32. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  33. package/es/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +87 -0
  34. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +390 -0
  35. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -0
  36. package/es/components/prompt-line/src/prompt-line.d.ts +1 -1
  37. package/es/components/prompt-line/src/prompt-line.js +6 -5
  38. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  39. package/es/components/prompt-line/src/tiptap/extension-equivalence.d.ts +2 -1
  40. package/es/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
  41. package/es/components/prompt-line/src/tiptap/typing-indicator.js +1 -1
  42. package/es/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
  43. package/es/components/truncated-text/src/truncated-text.js +2 -2
  44. package/es/components/truncated-text/src/truncated-text.js.map +1 -1
  45. package/es/components/video-player/src/utils/url-detector.d.ts +0 -28
  46. package/es/components/video-player/src/utils/url-detector.js +1 -37
  47. package/es/components/video-player/src/utils/url-detector.js.map +1 -1
  48. package/es/globals/utils/browser-utils.d.ts +3 -5
  49. package/es/globals/utils/browser-utils.js +1 -1
  50. package/es/globals/utils/browser-utils.js.map +1 -1
  51. package/es/globals/utils/csv.d.ts +0 -1
  52. package/es/globals/utils/csv.js.map +1 -1
  53. package/es/react/truncated-text.d.ts +12 -0
  54. package/es/react/truncated-text.js +28 -0
  55. package/es/react/truncated-text.js.map +1 -0
  56. package/es/testing/PageObjectId.d.ts +0 -4
  57. package/es/testing/PageObjectId.js.map +1 -1
  58. package/es/testing/load-all-lazy-deps.d.ts +1 -2
  59. package/es/testing/load-all-lazy-deps.js +3 -3
  60. package/es/testing/load-all-lazy-deps.js.map +1 -1
  61. package/es-custom/components/audio-player/src/utils/url-detector.d.ts +0 -14
  62. package/es-custom/components/audio-player/src/utils/url-detector.js +1 -19
  63. package/es-custom/components/audio-player/src/utils/url-detector.js.map +1 -1
  64. package/es-custom/components/card/src/card-footer.scss.js +1 -1
  65. package/es-custom/components/card/src/card-steps.scss.js +1 -1
  66. package/es-custom/components/card/src/card.scss.js +1 -1
  67. package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.d.ts +0 -5
  68. package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.js +1 -8
  69. package/es-custom/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -1
  70. package/es-custom/components/markdown/src/markdown-token-tree.js +1 -1
  71. package/es-custom/components/markdown/src/plugins/markdown-it-attrs.d.ts +0 -1
  72. package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js +1 -1
  73. package/es-custom/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -1
  74. package/es-custom/components/markdown/src/utils/plugin-fallback.js +3 -1
  75. package/es-custom/components/markdown/src/utils/plugin-fallback.js.map +1 -1
  76. package/es-custom/components/markdown/src/utils/table-helpers.d.ts +0 -26
  77. package/es-custom/components/markdown/src/utils/table-helpers.js +1 -4
  78. package/es-custom/components/markdown/src/utils/table-helpers.js.map +1 -1
  79. package/es-custom/components/prompt-line/autocomplete/src/autocomplete.scss.js +1 -1
  80. package/es-custom/components/prompt-line/src/prompt-line-constants.d.ts +9 -1
  81. package/es-custom/components/prompt-line/src/prompt-line-constants.js +10 -2
  82. package/es-custom/components/prompt-line/src/prompt-line-constants.js.map +1 -1
  83. package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +25 -78
  84. package/es-custom/components/prompt-line/src/prompt-line-controller.js +0 -389
  85. package/es-custom/components/prompt-line/src/prompt-line-controller.js.map +1 -1
  86. package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.d.ts +45 -0
  87. package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.js +83 -0
  88. package/es-custom/components/prompt-line/src/prompt-line-mouse-focus.js.map +1 -0
  89. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.d.ts +0 -2
  90. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +30 -53
  91. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  92. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.d.ts +87 -0
  93. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +390 -0
  94. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -0
  95. package/es-custom/components/prompt-line/src/prompt-line.d.ts +1 -1
  96. package/es-custom/components/prompt-line/src/prompt-line.js +6 -5
  97. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  98. package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.d.ts +2 -1
  99. package/es-custom/components/prompt-line/src/tiptap/extension-equivalence.js.map +1 -1
  100. package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js +1 -1
  101. package/es-custom/components/prompt-line/src/tiptap/typing-indicator.js.map +1 -1
  102. package/es-custom/components/truncated-text/src/truncated-text.js +2 -2
  103. package/es-custom/components/truncated-text/src/truncated-text.js.map +1 -1
  104. package/es-custom/components/video-player/src/utils/url-detector.d.ts +0 -28
  105. package/es-custom/components/video-player/src/utils/url-detector.js +1 -37
  106. package/es-custom/components/video-player/src/utils/url-detector.js.map +1 -1
  107. package/es-custom/globals/utils/browser-utils.d.ts +3 -5
  108. package/es-custom/globals/utils/browser-utils.js +1 -1
  109. package/es-custom/globals/utils/browser-utils.js.map +1 -1
  110. package/es-custom/globals/utils/csv.d.ts +0 -1
  111. package/es-custom/globals/utils/csv.js.map +1 -1
  112. package/es-custom/react/truncated-text.d.ts +12 -0
  113. package/es-custom/react/truncated-text.js +28 -0
  114. package/es-custom/react/truncated-text.js.map +1 -0
  115. package/es-custom/testing/PageObjectId.d.ts +0 -4
  116. package/es-custom/testing/PageObjectId.js.map +1 -1
  117. package/es-custom/testing/load-all-lazy-deps.d.ts +1 -2
  118. package/es-custom/testing/load-all-lazy-deps.js +3 -3
  119. package/es-custom/testing/load-all-lazy-deps.js.map +1 -1
  120. package/package.json +3 -4
  121. package/es/components/markdown/src/markdown.template.d.ts +0 -6
  122. package/es/components/markdown/src/markdown.template.js +0 -29
  123. package/es/components/markdown/src/markdown.template.js.map +0 -1
  124. package/es-custom/components/markdown/src/markdown.template.d.ts +0 -6
  125. package/es-custom/components/markdown/src/markdown.template.js +0 -29
  126. package/es-custom/components/markdown/src/markdown.template.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-line.js","sources":["../../../../src/components/prompt-line/src/prompt-line.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * `<cds-aichat-prompt-line>` — the editing-surface layer of the chat input\n * stack.\n *\n * It renders a lightweight `<textarea>` by default and **never statically\n * imports `@tiptap/*`**, so chats that don't use advanced input features ship\n * no Tiptap. When the `rich` property is set, or `ensureEditor()` is called,\n * the element dynamically imports a Tiptap runtime and upgrades the surface in\n * place — text, caret, and focus carry over because the textarea holds plain\n * text. Host `extensions` alone do not trigger it; they are staged for whichever\n * surface mounts. The upgrade is **sticky**: once rich, the element stays rich\n * for the rest of its life.\n *\n * Both modes expose the same imperative API (`getEditor`, `setContent`,\n * `insertContent`, …) and emit the same events, so the React wrapper and\n * `@carbon/ai-chat`'s `Input` are mode-agnostic. `getEditor()` returns `null`\n * in textarea mode (it's a probe — it never triggers a load); call\n * `ensureEditor()` to force the upgrade and resolve with the live editor.\n *\n * The Carbon Tiptap bundle the rich editor installs — schema, value-sync,\n * typing-indicator, plain-text paste, keymap (`Mod-Enter`/`Enter` →\n * `cds-aichat-prompt-send-intent`), placeholder, undo/redo — lives in\n * [./prompt-line-rich-runtime.ts]. Non-chat hosts wanting Tiptap inside Lit\n * should compose their own element against `@tiptap/core` directly.\n *\n * @element cds-aichat-prompt-line\n *\n * @experimental\n */\n\nimport type { Editor, Extension, JSONContent } from '@tiptap/core';\nimport { css, html, LitElement, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\nimport { adoptOnRoot } from '../../shared/dynamic-css-var-sheet.js';\nimport {\n type PromptLineController,\n type PromptLineControllerInit,\n type SetContentUpdater,\n TextareaController,\n} from './prompt-line-controller.js';\nimport {\n getRichRuntimeIfLoaded,\n loadRichRuntime,\n} from './prompt-line-rich-loader.js';\nimport { getRawText, textOffsetToDocPos } from './tiptap/json-utils.js';\n\nimport styles from './prompt-line.scss?lit';\n\n@carbonElement(`${prefix}-prompt-line`)\nclass PromptLineElement extends LitElement {\n static styles = css`\n ${unsafeCSS(styles)}\n `;\n\n /**\n * Host-supplied Tiptap extensions, appended to the carbon bundle when the\n * rich editor mounts. These are *staged*, not a rich-mode trigger: setting\n * them while in textarea mode does not load Tiptap. Select rich explicitly\n * with `rich` or call `ensureEditor()`; the upgrade mounts with these\n * already installed.\n *\n * A new array is compared by value against the set last supplied, so a config\n * update that rebuilds an equivalent one leaves the live editor and its undo\n * history in place, writing any starter `items`/`isOn` through to storage.\n * Only a genuinely different set recreates the editor, preserving content,\n * selection, and focus but resetting history.\n * Extensions built by `buildCarbonExtensions` compare by their source\n * config; anything you supply directly compares by reference, so memoize\n * those (a fresh instance each render reads as a real change).\n */\n @property({ type: Array, attribute: false })\n extensions: Extension[] = [];\n\n /**\n * Initial / current content. Accepts Tiptap-native JSONContent or a plain\n * string. In textarea mode JSONContent is flattened to plain text.\n */\n @property({ type: Object, attribute: false })\n content?: JSONContent | string;\n\n /**\n * Selects the rich Tiptap editor. The element lazy-loads Tiptap and upgrades\n * the textarea in place; the upgrade is sticky (clearing `rich` later keeps\n * the editor). Defaults to the textarea.\n */\n @property({ type: Boolean, reflect: true })\n rich = false;\n\n /** Disables editing. The surface stays mounted but non-editable. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Placeholder text shown when the surface is empty. */\n @property({ type: String })\n placeholder = '';\n\n /** Accessible label for the editing surface. */\n @property({ type: String, attribute: 'aria-label', reflect: true })\n override ariaLabel = '';\n\n /** Test id, applied to the inner editable element. */\n @property({ type: String, attribute: 'test-id' })\n testId = '';\n\n /** Focus the surface on mount. */\n @property({ type: Boolean })\n override autofocus = false;\n\n private _controller: PromptLineController | null = null;\n private _mode: 'textarea' | 'rich' = 'textarea';\n private _editorHost: HTMLElement | null = null;\n private _lastExtensionsRef: Extension[] | null = null;\n /**\n * The `content` value the current surface was seeded with, and whether that\n * seed is still unconsumed. Both are needed: the value catches the echo, and\n * the latch releases after one `updated()` so a later change back to the same\n * value still lands. Comparing on the value alone suppressed it for the life\n * of the surface, dropping `a` in an `a` -> `b` -> `a` sequence.\n */\n private _seededContent?: JSONContent | string;\n private _seedPending = false;\n /** Pending deferred teardown, cancelled if the element is reattached. */\n private _pendingTeardownTimer: ReturnType<typeof setTimeout> | null = null;\n /** Sticky latch — once rich is wanted it never reverts. */\n private _richLatched = false;\n private _upgrading = false;\n /**\n * The element owns the host's composition listeners for both layers — it\n * gates its own textarea→rich upgrade on this, and pushes the state to the\n * active controller via `setComposing` so rich mode can withhold a recreate.\n * One observer, so the two layers cannot disagree.\n */\n private _isComposing = false;\n private _pendingUpgrade = false;\n /**\n * Shared promise for in-flight `ensureEditor()` callers. Created lazily on the\n * first `ensureEditor()` call that needs an upgrade, settled once the rich\n * editor is mounted (`_swapToRich`) or the upgrade can't complete.\n */\n private _richReady: Promise<Editor> | null = null;\n private _resolveRichReady: ((editor: Editor) => void) | null = null;\n private _rejectRichReady: ((reason: Error) => void) | null = null;\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n override firstUpdated(): void {\n this._initializeSurface();\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this._pendingTeardownTimer !== null) {\n // Reattached before the deferred teardown ran — a move, not an unmount.\n // The controller and its editor host travelled with the element, so the\n // Tiptap instance (and its undo history) survives untouched.\n //\n // Unlike `_teardownSurface`, this deliberately leaves `_isComposing` /\n // `_pendingUpgrade` alone: the host div and its composition listeners are\n // still attached, so a later `compositionend` reaches them and releases\n // whatever was parked. Teardown has to reset eagerly only because it\n // discards the listeners that would otherwise do it.\n clearTimeout(this._pendingTeardownTimer);\n this._pendingTeardownTimer = null;\n const root = this._editorHost?.getRootNode();\n if (root instanceof ShadowRoot || root instanceof Document) {\n adoptOnRoot(root);\n }\n return;\n }\n // Reattached after a real teardown. `firstUpdated` is a one-shot, so\n // without this the element would come back permanently inert.\n if (this._isTornDown()) {\n this._initializeSurface();\n }\n }\n\n override updated(changed: Map<string | number | symbol, unknown>): void {\n if (!this._controller) {\n return;\n }\n if (\n (changed.has('rich') || changed.has('extensions')) &&\n this._wantsRich()\n ) {\n this._richLatched = true;\n if (this._mode === 'textarea') {\n void this._upgradeToRich();\n }\n }\n if (\n changed.has('extensions') &&\n this.extensions !== this._lastExtensionsRef\n ) {\n this._lastExtensionsRef = this.extensions;\n if (this._mode === 'rich') {\n this._controller.setExtensions(this.extensions);\n }\n }\n if (changed.has('disabled')) {\n this._controller.setEditable(!this.disabled);\n }\n // The seed echo is skipped once — re-applying it would emit a spurious\n // host-origin change event. Every later update lands, including one that\n // returns to the seed value, and including one alongside an extensions\n // change (which may no-op or recreate; either way the seed is the previous\n // doc).\n if (changed.has('content')) {\n const echoesSeed =\n this._seedPending && this.content === this._seededContent;\n this._seedPending = false;\n if (!echoesSeed) {\n this._controller.setContent(this.content ?? '');\n }\n }\n if (changed.has('placeholder')) {\n this._controller.setPlaceholder(this.placeholder);\n }\n if (changed.has('testId')) {\n this._controller.setTestId(this.testId);\n }\n if (changed.has('ariaLabel')) {\n this._controller.setAriaLabel(this.ariaLabel);\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (!this._controller || this._pendingTeardownTimer !== null) {\n return;\n }\n // Deferred by a task so a reparent — remove and re-append in the same\n // frame — keeps the live editor instead of destroying and rebuilding it.\n // A macrotask rather than a microtask because the reconnect can be\n // scheduled separately from the removal, and rather than a frame callback\n // because those never fire in a background tab, which would leak the\n // editor of a chat that really was unmounted.\n this._pendingTeardownTimer = setTimeout(() => {\n this._pendingTeardownTimer = null;\n this._teardownSurface();\n }, 0);\n }\n\n /** Destroy the editing surface. Deferred from `disconnectedCallback`. */\n private _teardownSurface(): void {\n this._failRichReady(new Error('Input is not currently rendered'));\n this._controller?.destroy();\n this._controller = null;\n this._editorHost?.remove();\n this._editorHost = null;\n this._lastExtensionsRef = null;\n // Back to the default surface. `_richLatched` is the sticky flag, so a late\n // reconnect still comes back rich; leaving `_mode` on 'rich' with no\n // controller would just be a field outliving what it describes.\n this._mode = 'textarea';\n // The host div (and its composition listeners) is gone, so a composition\n // that was in flight can never fire its `compositionend`. Left set, these\n // would park the first upgrade after a reattach forever.\n this._isComposing = false;\n this._pendingUpgrade = false;\n }\n\n /** Mount the editing surface. Runs on first render and on a late reconnect. */\n private _initializeSurface(): void {\n const host = this._mountEditorHost();\n this._lastExtensionsRef = this.extensions;\n this._seededContent = this.content;\n this._seedPending = true;\n this._richLatched = this._wantsRich();\n\n const warmRuntime = this._richLatched ? getRichRuntimeIfLoaded() : null;\n if (warmRuntime) {\n // Runtime already loaded (e.g. preloaded at boot) — mount rich directly,\n // no textarea flash.\n this._mode = 'rich';\n this._controller = warmRuntime.createRichController();\n this._controller.mount(host, this._makeInit());\n } else {\n this._mode = 'textarea';\n this._controller = new TextareaController();\n this._controller.mount(host, this._makeInit());\n if (this._richLatched) {\n void this._upgradeToRich();\n }\n }\n\n if (this.autofocus) {\n // Defer so consumer listeners are attached first.\n Promise.resolve().then(() => this._controller?.focus());\n }\n }\n\n override render() {\n return html`\n <div class=\"frame\">\n <slot name=\"editor\"></slot>\n </div>\n `;\n }\n\n // ---------------------------------------------------------------------------\n // Public methods (delegate to the active controller)\n // ---------------------------------------------------------------------------\n\n /** Returns the live Tiptap editor, or `null` in textarea mode. */\n getEditor(): Editor | null {\n return this._controller?.getEditor() ?? null;\n }\n\n /**\n * Lazily load Tiptap (if not already loaded), upgrade the textarea to the\n * rich editor in place, and resolve with the live editor. Resolves\n * immediately when already rich. Rejects when the surface isn't mounted or\n * the runtime can't load (SSR). Concurrent callers share one in-flight\n * upgrade.\n */\n ensureEditor(): Promise<Editor> {\n if (this._mode === 'rich') {\n const editor = this._controller?.getEditor();\n if (editor) {\n return Promise.resolve(editor);\n }\n }\n // Connected but not yet rendered, or already torn down — nothing to upgrade.\n if (!this._editorHost || !this._controller) {\n return Promise.reject(new Error('Input is not currently rendered'));\n }\n this._richLatched = true;\n if (!this._richReady) {\n this._richReady = new Promise<Editor>((resolve, reject) => {\n this._resolveRichReady = resolve;\n this._rejectRichReady = reject;\n });\n }\n void this._upgradeToRich();\n return this._richReady;\n }\n\n /**\n * Current plain-text value. Works in both modes (in rich mode this mirrors\n * `getEditor()?.getText()`), so callers don't need to branch on `getEditor()`\n * being `null`.\n */\n getValue(): string {\n return this._controller?.getValue() ?? '';\n }\n\n override focus(): void {\n this._controller?.focus();\n }\n\n override blur(): void {\n this._controller?.blur();\n }\n\n /** Returns `true` if the editing surface currently holds focus. */\n hasFocus(): boolean {\n return this._controller?.hasFocus() ?? false;\n }\n\n clearContent(): void {\n this._controller?.clearContent();\n }\n\n setContent(next: JSONContent | string | SetContentUpdater): void {\n this._controller?.setContent(next);\n }\n\n insertContent(\n content: JSONContent | string,\n opts: { at?: number } = {}\n ): void {\n this._controller?.insertContent(content, opts);\n }\n\n setTextSelection(pos: number | { from: number; to: number }): void {\n this._controller?.setTextSelection(pos);\n }\n\n selectAll(): void {\n this._controller?.selectAll();\n }\n\n undo(): boolean {\n return this._controller?.undo() ?? false;\n }\n\n redo(): boolean {\n return this._controller?.redo() ?? false;\n }\n\n // ---------------------------------------------------------------------------\n // Internals\n // ---------------------------------------------------------------------------\n\n private _wantsRich(): boolean {\n return this._richLatched || this.rich;\n }\n\n /**\n * Rendered once and then torn down — the element is inert until something\n * re-runs the mount path. Distinct from \"not yet rendered\", where Lit's own\n * `firstUpdated` still has it.\n */\n private _isTornDown(): boolean {\n return this.hasUpdated && !this._controller;\n }\n\n private _mountEditorHost(): HTMLElement {\n const host = document.createElement('div');\n host.setAttribute('slot', 'editor');\n host.dataset.aichatEditorHost = '';\n this.appendChild(host);\n this._editorHost = host;\n\n // Defer an upgrade requested mid-IME-composition so we don't tear the\n // field out from under the user.\n host.addEventListener('compositionstart', this._onCompositionStart);\n host.addEventListener('compositionend', this._onCompositionEnd);\n\n const root = host.getRootNode();\n if (root instanceof ShadowRoot || root instanceof Document) {\n adoptOnRoot(root);\n }\n return host;\n }\n\n private _onCompositionStart = (): void => {\n this._isComposing = true;\n this._controller?.setComposing(true);\n };\n\n private _onCompositionEnd = (): void => {\n this._isComposing = false;\n this._controller?.setComposing(false);\n if (this._pendingUpgrade) {\n this._pendingUpgrade = false;\n void this._upgradeToRich();\n }\n };\n\n /** Build the controller init from current props (rich seed by default). */\n private _makeInit(valueOverride?: string): PromptLineControllerInit {\n const value =\n valueOverride ??\n (typeof this.content === 'string'\n ? this.content\n : this.content\n ? getRawText(this.content)\n : '');\n return {\n value,\n // On an upgrade we seed losslessly from the textarea's plain text, so\n // the structured `content` prop is only used for the initial mount.\n content: valueOverride === undefined ? this.content : undefined,\n placeholder: this.placeholder,\n disabled: this.disabled,\n ariaLabel: this.ariaLabel,\n testId: this.testId,\n extensions: this.extensions,\n };\n }\n\n /** Resolve any pending `ensureEditor()` callers with the live editor. */\n private _settleRichReady(): void {\n const editor = this._controller?.getEditor();\n if (editor && this._resolveRichReady) {\n this._resolveRichReady(editor);\n this._resolveRichReady = null;\n this._rejectRichReady = null;\n }\n }\n\n /**\n * Reject any pending `ensureEditor()` callers and clear the shared promise so\n * a later call can retry.\n */\n private _failRichReady(reason: Error): void {\n if (this._rejectRichReady) {\n this._rejectRichReady(reason);\n }\n this._resolveRichReady = null;\n this._rejectRichReady = null;\n this._richReady = null;\n }\n\n /** Lazily load Tiptap and swap the textarea for the rich editor in place. */\n private async _upgradeToRich(): Promise<void> {\n if (this._mode === 'rich' || this._upgrading) {\n return;\n }\n this._upgrading = true;\n try {\n const module = getRichRuntimeIfLoaded() ?? (await loadRichRuntime());\n // Bail if disconnected or runtime unavailable (SSR). The `_upgrading`\n // latch already prevents a concurrent upgrade.\n if (!module || !this._editorHost || !this._controller) {\n this._failRichReady(\n new Error(\n module\n ? 'Input is not currently rendered'\n : 'Input editor runtime is unavailable'\n )\n );\n return;\n }\n if (this._isComposing) {\n // Defer until composition ends; `_richReady` stays pending and settles\n // when `_onCompositionEnd` re-runs the upgrade.\n this._pendingUpgrade = true;\n return;\n }\n this._swapToRich(module.createRichController());\n } catch (error) {\n // A failed runtime load or mount must reject pending `ensureEditor()`\n // callers rather than leave them hanging.\n this._failRichReady(\n error instanceof Error ? error : new Error(String(error))\n );\n } finally {\n this._upgrading = false;\n }\n }\n\n private _swapToRich(rich: PromptLineController): void {\n const previous = this._controller;\n const host = this._editorHost;\n if (!previous || !host) {\n return;\n }\n const value = previous.getValue();\n const selection = previous.getSelection();\n const hadFocus = previous.hasFocus();\n\n previous.destroy();\n this._controller = rich;\n this._mode = 'rich';\n // Seeded losslessly from the textarea's text, which already reflects\n // `content`, so an in-flight identical `content` update stays a no-op.\n this._seededContent = this.content;\n this._seedPending = true;\n rich.mount(host, this._makeInit(value));\n\n rich.setTextSelection({\n from: textOffsetToDocPos(value, selection.from),\n to: textOffsetToDocPos(value, selection.to),\n });\n if (hadFocus) {\n rich.focus();\n }\n this._settleRichReady();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-aichat-prompt-line': PromptLineElement;\n }\n}\n\nexport default PromptLineElement;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsDH,IAAM,iBAAiB,G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AAa,CAAC,CAAA,EAAG,MAAM,CAAA,YAAA,CAAc;AAChC,CAAA,EAAA,iBAAiB,CAwftB;AAQD,0BAAe,iBAAiB;;"}
1
+ {"version":3,"file":"prompt-line.js","sources":["../../../../src/components/prompt-line/src/prompt-line.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * `<cds-aichat-prompt-line>` — the editing-surface layer of the chat input\n * stack.\n *\n * It renders a lightweight `<textarea>` by default and **never statically\n * imports `@tiptap/*`**, so chats that don't use advanced input features ship\n * no Tiptap. When the `rich` property is set, or `ensureEditor()` is called,\n * the element dynamically imports a Tiptap runtime and upgrades the surface in\n * place — text, caret, and focus carry over because the textarea holds plain\n * text. Host `extensions` alone do not trigger it; they are staged for whichever\n * surface mounts. The upgrade is **sticky**: once rich, the element stays rich\n * for the rest of its life.\n *\n * Both modes expose the same imperative API (`getEditor`, `setContent`,\n * `insertContent`, …) and emit the same events, so the React wrapper and\n * `@carbon/ai-chat`'s `Input` are mode-agnostic. `getEditor()` returns `null`\n * in textarea mode (it's a probe — it never triggers a load); call\n * `ensureEditor()` to force the upgrade and resolve with the live editor.\n *\n * The Carbon Tiptap bundle the rich editor installs — schema, value-sync,\n * typing-indicator, plain-text paste, keymap (`Mod-Enter`/`Enter` →\n * `cds-aichat-prompt-send-intent`), placeholder, undo/redo — lives in\n * [./prompt-line-rich-runtime.ts]. Non-chat hosts wanting Tiptap inside Lit\n * should compose their own element against `@tiptap/core` directly.\n *\n * @element cds-aichat-prompt-line\n *\n * @experimental\n */\n\nimport type { Editor, Extension, JSONContent } from '@tiptap/core';\nimport { css, html, LitElement, unsafeCSS } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings.js';\nimport { adoptOnRoot } from '../../shared/dynamic-css-var-sheet.js';\nimport type {\n PromptLineController,\n PromptLineControllerInit,\n SetContentUpdater,\n} from './prompt-line-controller.js';\nimport { TextareaController } from './prompt-line-textarea-runtime.js';\nimport {\n getRichRuntimeIfLoaded,\n loadRichRuntime,\n} from './prompt-line-rich-loader.js';\nimport { getRawText, textOffsetToDocPos } from './tiptap/json-utils.js';\n\nimport styles from './prompt-line.scss?lit';\n\n@carbonElement(`${prefix}-prompt-line`)\nclass PromptLineElement extends LitElement {\n static styles = css`\n ${unsafeCSS(styles)}\n `;\n\n /**\n * Host-supplied Tiptap extensions, appended to the carbon bundle when the\n * rich editor mounts. These are *staged*, not a rich-mode trigger: setting\n * them while in textarea mode does not load Tiptap. Select rich explicitly\n * with `rich` or call `ensureEditor()`; the upgrade mounts with these\n * already installed.\n *\n * A new array is compared by value against the set last supplied, so a config\n * update that rebuilds an equivalent one leaves the live editor and its undo\n * history in place, writing any starter `items`/`isOn` through to storage.\n * Only a genuinely different set recreates the editor, preserving content,\n * selection, and focus but resetting history.\n * Extensions built by `buildCarbonExtensions` compare by their source\n * config; anything you supply directly compares by reference, so memoize\n * those (a fresh instance each render reads as a real change).\n */\n @property({ type: Array, attribute: false })\n extensions: Extension[] = [];\n\n /**\n * Initial / current content. Accepts Tiptap-native JSONContent or a plain\n * string. In textarea mode JSONContent is flattened to plain text.\n */\n @property({ type: Object, attribute: false })\n content?: JSONContent | string;\n\n /**\n * Selects the rich Tiptap editor. The element lazy-loads Tiptap and upgrades\n * the textarea in place; the upgrade is sticky (clearing `rich` later keeps\n * the editor). Defaults to the textarea.\n */\n @property({ type: Boolean, reflect: true })\n rich = false;\n\n /** Disables editing. The surface stays mounted but non-editable. */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /** Placeholder text shown when the surface is empty. */\n @property({ type: String })\n placeholder = '';\n\n /** Accessible label for the editing surface. */\n @property({ type: String, attribute: 'aria-label', reflect: true })\n override ariaLabel = 'Message';\n\n /** Test id, applied to the inner editable element. */\n @property({ type: String, attribute: 'test-id' })\n testId = '';\n\n /** Focus the surface on mount. */\n @property({ type: Boolean })\n override autofocus = false;\n\n private _controller: PromptLineController | null = null;\n private _mode: 'textarea' | 'rich' = 'textarea';\n private _editorHost: HTMLElement | null = null;\n private _lastExtensionsRef: Extension[] | null = null;\n /**\n * The `content` value the current surface was seeded with, and whether that\n * seed is still unconsumed. Both are needed: the value catches the echo, and\n * the latch releases after one `updated()` so a later change back to the same\n * value still lands. Comparing on the value alone suppressed it for the life\n * of the surface, dropping `a` in an `a` -> `b` -> `a` sequence.\n */\n private _seededContent?: JSONContent | string;\n private _seedPending = false;\n /** Pending deferred teardown, cancelled if the element is reattached. */\n private _pendingTeardownTimer: ReturnType<typeof setTimeout> | null = null;\n /** Sticky latch — once rich is wanted it never reverts. */\n private _richLatched = false;\n private _upgrading = false;\n /**\n * The element owns the host's composition listeners for both layers — it\n * gates its own textarea→rich upgrade on this, and pushes the state to the\n * active controller via `setComposing` so rich mode can withhold a recreate.\n * One observer, so the two layers cannot disagree.\n */\n private _isComposing = false;\n private _pendingUpgrade = false;\n /**\n * Shared promise for in-flight `ensureEditor()` callers. Created lazily on the\n * first `ensureEditor()` call that needs an upgrade, settled once the rich\n * editor is mounted (`_swapToRich`) or the upgrade can't complete.\n */\n private _richReady: Promise<Editor> | null = null;\n private _resolveRichReady: ((editor: Editor) => void) | null = null;\n private _rejectRichReady: ((reason: Error) => void) | null = null;\n\n // ---------------------------------------------------------------------------\n // Lifecycle\n // ---------------------------------------------------------------------------\n\n override firstUpdated(): void {\n this._initializeSurface();\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this._pendingTeardownTimer !== null) {\n // Reattached before the deferred teardown ran — a move, not an unmount.\n // The controller and its editor host travelled with the element, so the\n // Tiptap instance (and its undo history) survives untouched.\n //\n // Unlike `_teardownSurface`, this deliberately leaves `_isComposing` /\n // `_pendingUpgrade` alone: the host div and its composition listeners are\n // still attached, so a later `compositionend` reaches them and releases\n // whatever was parked. Teardown has to reset eagerly only because it\n // discards the listeners that would otherwise do it.\n clearTimeout(this._pendingTeardownTimer);\n this._pendingTeardownTimer = null;\n const root = this._editorHost?.getRootNode();\n if (root instanceof ShadowRoot || root instanceof Document) {\n adoptOnRoot(root);\n }\n return;\n }\n // Reattached after a real teardown. `firstUpdated` is a one-shot, so\n // without this the element would come back permanently inert.\n if (this._isTornDown()) {\n this._initializeSurface();\n }\n }\n\n override updated(changed: Map<string | number | symbol, unknown>): void {\n if (!this._controller) {\n return;\n }\n if (\n (changed.has('rich') || changed.has('extensions')) &&\n this._wantsRich()\n ) {\n this._richLatched = true;\n if (this._mode === 'textarea') {\n void this._upgradeToRich();\n }\n }\n if (\n changed.has('extensions') &&\n this.extensions !== this._lastExtensionsRef\n ) {\n this._lastExtensionsRef = this.extensions;\n if (this._mode === 'rich') {\n this._controller.setExtensions(this.extensions);\n }\n }\n if (changed.has('disabled')) {\n this._controller.setEditable(!this.disabled);\n }\n // The seed echo is skipped once — re-applying it would emit a spurious\n // host-origin change event. Every later update lands, including one that\n // returns to the seed value, and including one alongside an extensions\n // change (which may no-op or recreate; either way the seed is the previous\n // doc).\n if (changed.has('content')) {\n const echoesSeed =\n this._seedPending && this.content === this._seededContent;\n this._seedPending = false;\n if (!echoesSeed) {\n this._controller.setContent(this.content ?? '');\n }\n }\n if (changed.has('placeholder')) {\n this._controller.setPlaceholder(this.placeholder);\n }\n if (changed.has('testId')) {\n this._controller.setTestId(this.testId);\n }\n if (changed.has('ariaLabel')) {\n this._controller.setAriaLabel(this.ariaLabel);\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (!this._controller || this._pendingTeardownTimer !== null) {\n return;\n }\n // Deferred by a task so a reparent — remove and re-append in the same\n // frame — keeps the live editor instead of destroying and rebuilding it.\n // A macrotask rather than a microtask because the reconnect can be\n // scheduled separately from the removal, and rather than a frame callback\n // because those never fire in a background tab, which would leak the\n // editor of a chat that really was unmounted.\n this._pendingTeardownTimer = setTimeout(() => {\n this._pendingTeardownTimer = null;\n this._teardownSurface();\n }, 0);\n }\n\n /** Destroy the editing surface. Deferred from `disconnectedCallback`. */\n private _teardownSurface(): void {\n this._failRichReady(new Error('Input is not currently rendered'));\n this._controller?.destroy();\n this._controller = null;\n this._editorHost?.remove();\n this._editorHost = null;\n this._lastExtensionsRef = null;\n // Back to the default surface. `_richLatched` is the sticky flag, so a late\n // reconnect still comes back rich; leaving `_mode` on 'rich' with no\n // controller would just be a field outliving what it describes.\n this._mode = 'textarea';\n // The host div (and its composition listeners) is gone, so a composition\n // that was in flight can never fire its `compositionend`. Left set, these\n // would park the first upgrade after a reattach forever.\n this._isComposing = false;\n this._pendingUpgrade = false;\n }\n\n /** Mount the editing surface. Runs on first render and on a late reconnect. */\n private _initializeSurface(): void {\n const host = this._mountEditorHost();\n this._lastExtensionsRef = this.extensions;\n this._seededContent = this.content;\n this._seedPending = true;\n this._richLatched = this._wantsRich();\n\n const warmRuntime = this._richLatched ? getRichRuntimeIfLoaded() : null;\n if (warmRuntime) {\n // Runtime already loaded (e.g. preloaded at boot) — mount rich directly,\n // no textarea flash.\n this._mode = 'rich';\n this._controller = warmRuntime.createRichController();\n this._controller.mount(host, this._makeInit());\n } else {\n this._mode = 'textarea';\n this._controller = new TextareaController();\n this._controller.mount(host, this._makeInit());\n if (this._richLatched) {\n void this._upgradeToRich();\n }\n }\n\n if (this.autofocus) {\n // Defer so consumer listeners are attached first.\n Promise.resolve().then(() => this._controller?.focus(false));\n }\n }\n\n override render() {\n return html`\n <div class=\"frame\">\n <slot name=\"editor\"></slot>\n </div>\n `;\n }\n\n // ---------------------------------------------------------------------------\n // Public methods (delegate to the active controller)\n // ---------------------------------------------------------------------------\n\n /** Returns the live Tiptap editor, or `null` in textarea mode. */\n getEditor(): Editor | null {\n return this._controller?.getEditor() ?? null;\n }\n\n /**\n * Lazily load Tiptap (if not already loaded), upgrade the textarea to the\n * rich editor in place, and resolve with the live editor. Resolves\n * immediately when already rich. Rejects when the surface isn't mounted or\n * the runtime can't load (SSR). Concurrent callers share one in-flight\n * upgrade.\n */\n ensureEditor(): Promise<Editor> {\n if (this._mode === 'rich') {\n const editor = this._controller?.getEditor();\n if (editor) {\n return Promise.resolve(editor);\n }\n }\n // Connected but not yet rendered, or already torn down — nothing to upgrade.\n if (!this._editorHost || !this._controller) {\n return Promise.reject(new Error('Input is not currently rendered'));\n }\n this._richLatched = true;\n if (!this._richReady) {\n this._richReady = new Promise<Editor>((resolve, reject) => {\n this._resolveRichReady = resolve;\n this._rejectRichReady = reject;\n });\n }\n void this._upgradeToRich();\n return this._richReady;\n }\n\n /**\n * Current plain-text value. Works in both modes (in rich mode this mirrors\n * `getEditor()?.getText()`), so callers don't need to branch on `getEditor()`\n * being `null`.\n */\n getValue(): string {\n return this._controller?.getValue() ?? '';\n }\n\n override focus(): void {\n this._controller?.focus(false);\n }\n\n override blur(): void {\n this._controller?.blur();\n }\n\n /** Returns `true` if the editing surface currently holds focus. */\n hasFocus(): boolean {\n return this._controller?.hasFocus() ?? false;\n }\n\n clearContent(): void {\n this._controller?.clearContent();\n }\n\n setContent(next: JSONContent | string | SetContentUpdater): void {\n this._controller?.setContent(next);\n }\n\n insertContent(\n content: JSONContent | string,\n opts: { at?: number } = {}\n ): void {\n this._controller?.insertContent(content, opts);\n }\n\n setTextSelection(pos: number | { from: number; to: number }): void {\n this._controller?.setTextSelection(pos);\n }\n\n selectAll(): void {\n this._controller?.selectAll();\n }\n\n undo(): boolean {\n return this._controller?.undo() ?? false;\n }\n\n redo(): boolean {\n return this._controller?.redo() ?? false;\n }\n\n // ---------------------------------------------------------------------------\n // Internals\n // ---------------------------------------------------------------------------\n\n private _wantsRich(): boolean {\n return this._richLatched || this.rich;\n }\n\n /**\n * Rendered once and then torn down — the element is inert until something\n * re-runs the mount path. Distinct from \"not yet rendered\", where Lit's own\n * `firstUpdated` still has it.\n */\n private _isTornDown(): boolean {\n return this.hasUpdated && !this._controller;\n }\n\n private _mountEditorHost(): HTMLElement {\n const host = document.createElement('div');\n host.setAttribute('slot', 'editor');\n host.dataset.aichatEditorHost = '';\n this.appendChild(host);\n this._editorHost = host;\n\n // Defer an upgrade requested mid-IME-composition so we don't tear the\n // field out from under the user.\n host.addEventListener('compositionstart', this._onCompositionStart);\n host.addEventListener('compositionend', this._onCompositionEnd);\n\n const root = host.getRootNode();\n if (root instanceof ShadowRoot || root instanceof Document) {\n adoptOnRoot(root);\n }\n return host;\n }\n\n private _onCompositionStart = (): void => {\n this._isComposing = true;\n this._controller?.setComposing(true);\n };\n\n private _onCompositionEnd = (): void => {\n this._isComposing = false;\n this._controller?.setComposing(false);\n if (this._pendingUpgrade) {\n this._pendingUpgrade = false;\n void this._upgradeToRich();\n }\n };\n\n /** Build the controller init from current props (rich seed by default). */\n private _makeInit(valueOverride?: string): PromptLineControllerInit {\n const value =\n valueOverride ??\n (typeof this.content === 'string'\n ? this.content\n : this.content\n ? getRawText(this.content)\n : '');\n return {\n value,\n // On an upgrade we seed losslessly from the textarea's plain text, so\n // the structured `content` prop is only used for the initial mount.\n content: valueOverride === undefined ? this.content : undefined,\n placeholder: this.placeholder,\n disabled: this.disabled,\n ariaLabel: this.ariaLabel,\n testId: this.testId,\n extensions: this.extensions,\n };\n }\n\n /** Resolve any pending `ensureEditor()` callers with the live editor. */\n private _settleRichReady(): void {\n const editor = this._controller?.getEditor();\n if (editor && this._resolveRichReady) {\n this._resolveRichReady(editor);\n this._resolveRichReady = null;\n this._rejectRichReady = null;\n }\n }\n\n /**\n * Reject any pending `ensureEditor()` callers and clear the shared promise so\n * a later call can retry.\n */\n private _failRichReady(reason: Error): void {\n if (this._rejectRichReady) {\n this._rejectRichReady(reason);\n }\n this._resolveRichReady = null;\n this._rejectRichReady = null;\n this._richReady = null;\n }\n\n /** Lazily load Tiptap and swap the textarea for the rich editor in place. */\n private async _upgradeToRich(): Promise<void> {\n if (this._mode === 'rich' || this._upgrading) {\n return;\n }\n this._upgrading = true;\n try {\n const module = getRichRuntimeIfLoaded() ?? (await loadRichRuntime());\n // Bail if disconnected or runtime unavailable (SSR). The `_upgrading`\n // latch already prevents a concurrent upgrade.\n if (!module || !this._editorHost || !this._controller) {\n this._failRichReady(\n new Error(\n module\n ? 'Input is not currently rendered'\n : 'Input editor runtime is unavailable'\n )\n );\n return;\n }\n if (this._isComposing) {\n // Defer until composition ends; `_richReady` stays pending and settles\n // when `_onCompositionEnd` re-runs the upgrade.\n this._pendingUpgrade = true;\n return;\n }\n this._swapToRich(module.createRichController());\n } catch (error) {\n // A failed runtime load or mount must reject pending `ensureEditor()`\n // callers rather than leave them hanging.\n this._failRichReady(\n error instanceof Error ? error : new Error(String(error))\n );\n } finally {\n this._upgrading = false;\n }\n }\n\n private _swapToRich(rich: PromptLineController): void {\n const previous = this._controller;\n const host = this._editorHost;\n if (!previous || !host) {\n return;\n }\n const value = previous.getValue();\n const selection = previous.getSelection();\n const hadFocus = previous.hasFocus();\n const hadKeyboardFocus = previous.getKeyboardFocus();\n\n previous.destroy();\n this._controller = rich;\n this._mode = 'rich';\n // Seeded losslessly from the textarea's text, which already reflects\n // `content`, so an in-flight identical `content` update stays a no-op.\n this._seededContent = this.content;\n this._seedPending = true;\n rich.mount(host, this._makeInit(value));\n\n rich.setTextSelection({\n from: textOffsetToDocPos(value, selection.from),\n to: textOffsetToDocPos(value, selection.to),\n });\n if (hadFocus) {\n rich.focus(hadKeyboardFocus);\n }\n this._settleRichReady();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-aichat-prompt-line': PromptLineElement;\n }\n}\n\nexport default PromptLineElement;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAsDH,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU,CAAA;AAA1C,IAAA,WAAA,GAAA;;AAKE;;;;;;;;;;;;;;;AAeG;QAEH,IAAA,CAAA,UAAU,GAAgB,EAAE;AAS5B;;;;AAIG;QAEH,IAAA,CAAA,IAAI,GAAG,KAAK;;QAIZ,IAAA,CAAA,QAAQ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}
@@ -26,7 +26,7 @@
26
26
  import type { Extension } from '@tiptap/core';
27
27
  import type { AutocompleteConfig, StartersConfig, TriggerSuggestionConfig } from './types.js';
28
28
  /** Which carbon factory produced an extension. */
29
- export type ExtensionSourceKind = 'mention' | 'command' | 'autocomplete' | 'starters';
29
+ type ExtensionSourceKind = 'mention' | 'command' | 'autocomplete' | 'starters';
30
30
  /** The config an extension was built from, recorded at build time. */
31
31
  export interface ExtensionSourceDescriptor {
32
32
  kind: ExtensionSourceKind;
@@ -61,3 +61,4 @@ export declare function getExtensionSource(extension: unknown): ExtensionSourceD
61
61
  * reached.
62
62
  */
63
63
  export declare function areExtensionSetsEquivalent(previous: readonly Extension[], next: readonly Extension[]): boolean;
64
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"extension-equivalence.js","sources":["../../../../../src/components/prompt-line/src/tiptap/extension-equivalence.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Value-level equivalence for the extension list handed to\n * `<cds-aichat-prompt-line>`, so a host config update that says the same thing\n * does not recreate the live editor (which resets undo history).\n *\n * The built Tiptap instances cannot be compared directly: `carbonAutocomplete`\n * and `carbonStarterTrigger` capture their config in closures, leaving\n * `.options` empty (two different item lists would compare equal), while\n * `carbonMention` / `carbonCommand` install fresh function identities on every\n * `.configure()` (identical configs would compare unequal). So each factory\n * output is tagged here with the source config it was built from, and\n * equivalence compares those configs instead.\n *\n * Only the appended list is compared. The base bundle (schema, undo/redo,\n * placeholder, keymap, value-sync, ...) is constructed inside the rich runtime\n * and never reaches this module.\n */\n\nimport type { Extension } from '@tiptap/core';\nimport isEqual from 'lodash-es/isEqual.js';\n\nimport type {\n AutocompleteConfig,\n StartersConfig,\n TriggerSuggestionConfig,\n} from './types.js';\n\n/** Which carbon factory produced an extension. */\nexport type ExtensionSourceKind =\n 'mention' | 'command' | 'autocomplete' | 'starters';\n\n/** The config an extension was built from, recorded at build time. */\nexport interface ExtensionSourceDescriptor {\n kind: ExtensionSourceKind;\n config:\n TriggerSuggestionConfig | AutocompleteConfig | StartersConfig | undefined;\n}\n\nconst EXTENSION_SOURCE: unique symbol = Symbol.for(\n 'cds-aichat.prompt-line.extension-source'\n);\n\n/**\n * Record the source config on a built extension. Returns the same instance so\n * factories can tag inline.\n */\nexport function tagExtensionSource<T>(\n extension: T,\n descriptor: ExtensionSourceDescriptor\n): T {\n (extension as Record<symbol, unknown>)[EXTENSION_SOURCE] = descriptor;\n return extension;\n}\n\n/** Read back a descriptor, or `undefined` for host-supplied extensions. */\nexport function getExtensionSource(\n extension: unknown\n): ExtensionSourceDescriptor | undefined {\n if (!extension || typeof extension !== 'object') {\n return undefined;\n }\n return (extension as Record<symbol, unknown>)[EXTENSION_SOURCE] as\n ExtensionSourceDescriptor | undefined;\n}\n\n/**\n * Whether two extension lists install the same editor behavior.\n *\n * Compared positionally — extension order is ProseMirror plugin order, so a\n * reordered list is a genuinely different editor and never reorder-matched.\n *\n * Per pair:\n * - Same instance wins outright. This is the only rule available for\n * host-supplied extensions, whose documented contract already asks hosts to\n * memoize them.\n * - Two carbon extensions of the same kind compare their source configs by\n * value, with functions compared by reference (lodash `isEqual` semantics) —\n * a host that rebuilds its callbacks each render genuinely gets a new editor,\n * same as before.\n * - Starter triggers are always equivalent: every difference they can carry\n * (`items`, `isOn`) is applied to the live editor's storage instead. See\n * `RichController.setExtensions`. `buildCarbonExtensions` installs the\n * extension for an empty list too, so emptying `items` stays a storage write\n * instead of a length change that rejects the pair before this rule is\n * reached.\n */\nexport function areExtensionSetsEquivalent(\n previous: readonly Extension[],\n next: readonly Extension[]\n): boolean {\n if (previous === next) {\n return true;\n }\n if (previous.length !== next.length) {\n return false;\n }\n return previous.every((prevExtension, index) =>\n isExtensionEquivalent(prevExtension, next[index])\n );\n}\n\nfunction isExtensionEquivalent(previous: Extension, next: Extension): boolean {\n if (previous === next) {\n return true;\n }\n const prevSource = getExtensionSource(previous);\n const nextSource = getExtensionSource(next);\n if (!prevSource || !nextSource || prevSource.kind !== nextSource.kind) {\n return false;\n }\n if (prevSource.kind === 'starters') {\n return true;\n }\n return isEqual(prevSource.config, nextSource.config);\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAwCH,MAAM,gBAAgB,GAAkB,MAAM,CAAC,GAAG,CAChD,yCAAyC,CAC1C;AAED;;;AAGG;AACG,SAAU,kBAAkB,CAChC,SAAY,EACZ,UAAqC,EAAA;AAEpC,IAAA,SAAqC,CAAC,gBAAgB,CAAC,GAAG,UAAU;AACrE,IAAA,OAAO,SAAS;AAClB;AAEA;AACM,SAAU,kBAAkB,CAChC,SAAkB,EAAA;IAElB,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AAC/C,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,OAAQ,SAAqC,CAAC,gBAAgB,CACvB;AACzC;AAEA;;;;;;;;;;;;;;;;;;;;AAoBG;AACG,SAAU,0BAA0B,CACxC,QAA8B,EAC9B,IAA0B,EAAA;AAE1B,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI;IACb;IACA,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;AACnC,QAAA,OAAO,KAAK;IACd;IACA,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,KAAK,KACzC,qBAAqB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAClD;AACH;AAEA,SAAS,qBAAqB,CAAC,QAAmB,EAAE,IAAe,EAAA;AACjE,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,OAAO,IAAI;IACb;AACA,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,QAAQ,CAAC;AAC/C,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC;AAC3C,IAAA,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE;AACrE,QAAA,OAAO,KAAK;IACd;AACA,IAAA,IAAI,UAAU,CAAC,IAAI,KAAK,UAAU,EAAE;AAClC,QAAA,OAAO,IAAI;IACb;IACA,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;AACtD;;"}
1
+ {"version":3,"file":"extension-equivalence.js","sources":["../../../../../src/components/prompt-line/src/tiptap/extension-equivalence.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Value-level equivalence for the extension list handed to\n * `<cds-aichat-prompt-line>`, so a host config update that says the same thing\n * does not recreate the live editor (which resets undo history).\n *\n * The built Tiptap instances cannot be compared directly: `carbonAutocomplete`\n * and `carbonStarterTrigger` capture their config in closures, leaving\n * `.options` empty (two different item lists would compare equal), while\n * `carbonMention` / `carbonCommand` install fresh function identities on every\n * `.configure()` (identical configs would compare unequal). So each factory\n * output is tagged here with the source config it was built from, and\n * equivalence compares those configs instead.\n *\n * Only the appended list is compared. The base bundle (schema, undo/redo,\n * placeholder, keymap, value-sync, ...) is constructed inside the rich runtime\n * and never reaches this module.\n */\n\nimport type { Extension } from '@tiptap/core';\nimport isEqual from 'lodash-es/isEqual.js';\n\nimport type {\n AutocompleteConfig,\n StartersConfig,\n TriggerSuggestionConfig,\n} from './types.js';\n\n/** Which carbon factory produced an extension. */\ntype ExtensionSourceKind = 'mention' | 'command' | 'autocomplete' | 'starters';\n\n/** The config an extension was built from, recorded at build time. */\nexport interface ExtensionSourceDescriptor {\n kind: ExtensionSourceKind;\n config:\n TriggerSuggestionConfig | AutocompleteConfig | StartersConfig | undefined;\n}\n\nconst EXTENSION_SOURCE: unique symbol = Symbol.for(\n 'cds-aichat.prompt-line.extension-source'\n);\n\n/**\n * Record the source config on a built extension. Returns the same instance so\n * factories can tag inline.\n */\nexport function tagExtensionSource<T>(\n extension: T,\n descriptor: ExtensionSourceDescriptor\n): T {\n (extension as Record<symbol, unknown>)[EXTENSION_SOURCE] = descriptor;\n return extension;\n}\n\n/** Read back a descriptor, or `undefined` for host-supplied extensions. */\nexport function getExtensionSource(\n extension: unknown\n): ExtensionSourceDescriptor | undefined {\n if (!extension || typeof extension !== 'object') {\n return undefined;\n }\n return (extension as Record<symbol, unknown>)[EXTENSION_SOURCE] as\n ExtensionSourceDescriptor | undefined;\n}\n\n/**\n * Whether two extension lists install the same editor behavior.\n *\n * Compared positionally — extension order is ProseMirror plugin order, so a\n * reordered list is a genuinely different editor and never reorder-matched.\n *\n * Per pair:\n * - Same instance wins outright. This is the only rule available for\n * host-supplied extensions, whose documented contract already asks hosts to\n * memoize them.\n * - Two carbon extensions of the same kind compare their source configs by\n * value, with functions compared by reference (lodash `isEqual` semantics) —\n * a host that rebuilds its callbacks each render genuinely gets a new editor,\n * same as before.\n * - Starter triggers are always equivalent: every difference they can carry\n * (`items`, `isOn`) is applied to the live editor's storage instead. See\n * `RichController.setExtensions`. `buildCarbonExtensions` installs the\n * extension for an empty list too, so emptying `items` stays a storage write\n * instead of a length change that rejects the pair before this rule is\n * reached.\n */\nexport function areExtensionSetsEquivalent(\n previous: readonly Extension[],\n next: readonly Extension[]\n): boolean {\n if (previous === next) {\n return true;\n }\n if (previous.length !== next.length) {\n return false;\n }\n return previous.every((prevExtension, index) =>\n isExtensionEquivalent(prevExtension, next[index])\n );\n}\n\nfunction isExtensionEquivalent(previous: Extension, next: Extension): boolean {\n if (previous === next) {\n return true;\n }\n const prevSource = getExtensionSource(previous);\n const nextSource = getExtensionSource(next);\n if (!prevSource || !nextSource || prevSource.kind !== nextSource.kind) {\n return false;\n }\n if (prevSource.kind === 'starters') {\n return true;\n }\n return isEqual(prevSource.config, nextSource.config);\n}\n"],"names":[],"mappings":";;;;;;;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E;AAClC,QAAA,OAAO,IAAI;IACb;IACA,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC;AACtD;;"}
@@ -7,6 +7,7 @@
7
7
 
8
8
  import { Extension } from '@tiptap/core';
9
9
  import { Plugin } from '@tiptap/pm/state';
10
+ import { TYPING_TIMEOUT_MS } from '../prompt-line-constants.js';
10
11
  import { isHostOrigin } from './origin-meta.js';
11
12
 
12
13
  /**
@@ -32,7 +33,6 @@ import { isHostOrigin } from './origin-meta.js';
32
33
  * The storage `reset()` controller lets the prompt-line / shell wipe typing
33
34
  * state immediately on send.
34
35
  */
35
- const TYPING_TIMEOUT_MS = 5000;
36
36
  const TypingIndicator = Extension.create({
37
37
  name: 'carbonTypingIndicator',
38
38
  addStorage() {
@@ -1 +1 @@
1
- {"version":3,"file":"typing-indicator.js","sources":["../../../../../src/components/prompt-line/src/tiptap/typing-indicator.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Tiptap typing-indicator extension. Emits `cds-aichat-prompt-typing` events\n * on the editor's DOM whenever the user's typing-state changes.\n *\n * Behavior:\n * - Sets `isTyping = true` on the first user-driven doc change.\n * - Restarts a 5-second timer on each subsequent change.\n * - Emits `isTyping = false` after 5 seconds of inactivity.\n * - Skips host-origin transactions (`tr.setMeta(\"aichatOrigin\", \"host\")`).\n * Origin is recorded in storage by `appendTransaction` and read by the\n * view's `update` hook (mirrors the `value-sync` extension pattern).\n *\n * The storage `reset()` controller lets the prompt-line / shell wipe typing\n * state immediately on send.\n */\n\nimport { Extension } from '@tiptap/core';\nimport { Plugin } from '@tiptap/pm/state';\n\nimport { isHostOrigin } from './origin-meta.js';\n\nconst TYPING_TIMEOUT_MS = 5000;\n\nexport interface TypingIndicatorStorage {\n reset(): void;\n /** True iff the most recent doc-changing batch was entirely host-origin. */\n lastTransactionIsHost: boolean;\n}\n\nexport const TypingIndicator = Extension.create<\n unknown,\n TypingIndicatorStorage\n>({\n name: 'carbonTypingIndicator',\n\n addStorage() {\n return { reset: () => {}, lastTransactionIsHost: false };\n },\n\n addProseMirrorPlugins() {\n const { storage } = this;\n let isTyping = false;\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n let editorDom: HTMLElement | null = null;\n\n function emit(typing: boolean): void {\n isTyping = typing;\n if (editorDom) {\n editorDom.dispatchEvent(\n new CustomEvent('cds-aichat-prompt-typing', {\n detail: { isTyping: typing },\n bubbles: true,\n composed: true,\n })\n );\n }\n }\n\n function clearTimer(): void {\n if (timeoutId != null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n }\n\n storage.reset = () => {\n clearTimer();\n if (isTyping) {\n emit(false);\n }\n };\n\n return [\n new Plugin({\n view(view) {\n editorDom = view.dom as HTMLElement;\n return {\n update(view, prevState) {\n if (view.state.doc.eq(prevState.doc)) {\n return;\n }\n if (storage.lastTransactionIsHost) {\n return;\n }\n if (!isTyping) {\n emit(true);\n }\n clearTimer();\n timeoutId = setTimeout(() => emit(false), TYPING_TIMEOUT_MS);\n },\n destroy() {\n clearTimer();\n editorDom = null;\n },\n };\n },\n appendTransaction(transactions) {\n storage.lastTransactionIsHost =\n transactions.length > 0 &&\n transactions.every((tr) => isHostOrigin(tr));\n return null;\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;AAcG;AAOH,MAAM,iBAAiB,GAAG,IAAI;AAQvB,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,CAG7C;AACA,IAAA,IAAI,EAAE,uBAAuB;IAE7B,UAAU,GAAA;AACR,QAAA,OAAO,EAAE,KAAK,EAAE,MAAK,EAAE,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAE;IAC1D,CAAC;IAED,qBAAqB,GAAA;AACnB,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,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wBACD,OAAO,GAAA;AACL,4BAAA,UAAU,EAAE;4BACZ,SAAS,GAAG,IAAI;wBAClB,CAAC;qBACF;gBACH,CAAC;AACD,gBAAA,iBAAiB,CAAC,YAAY,EAAA;AAC5B,oBAAA,OAAO,CAAC,qBAAqB;wBAC3B,YAAY,CAAC,MAAM,GAAG,CAAC;AACvB,4BAAA,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;AAC9C,oBAAA,OAAO,IAAI;gBACb,CAAC;aACF,CAAC;SACH;IACH,CAAC;AACF,CAAA;;"}
1
+ {"version":3,"file":"typing-indicator.js","sources":["../../../../../src/components/prompt-line/src/tiptap/typing-indicator.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Tiptap typing-indicator extension. Emits `cds-aichat-prompt-typing` events\n * on the editor's DOM whenever the user's typing-state changes.\n *\n * Behavior:\n * - Sets `isTyping = true` on the first user-driven doc change.\n * - Restarts a 5-second timer on each subsequent change.\n * - Emits `isTyping = false` after 5 seconds of inactivity.\n * - Skips host-origin transactions (`tr.setMeta(\"aichatOrigin\", \"host\")`).\n * Origin is recorded in storage by `appendTransaction` and read by the\n * view's `update` hook (mirrors the `value-sync` extension pattern).\n *\n * The storage `reset()` controller lets the prompt-line / shell wipe typing\n * state immediately on send.\n */\n\nimport { Extension } from '@tiptap/core';\nimport { Plugin } from '@tiptap/pm/state';\n\nimport { TYPING_TIMEOUT_MS } from '../prompt-line-constants.js';\nimport { isHostOrigin } from './origin-meta.js';\n\nexport interface TypingIndicatorStorage {\n reset(): void;\n /** True iff the most recent doc-changing batch was entirely host-origin. */\n lastTransactionIsHost: boolean;\n}\n\nexport const TypingIndicator = Extension.create<\n unknown,\n TypingIndicatorStorage\n>({\n name: 'carbonTypingIndicator',\n\n addStorage() {\n return { reset: () => {}, lastTransactionIsHost: false };\n },\n\n addProseMirrorPlugins() {\n const { storage } = this;\n let isTyping = false;\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n let editorDom: HTMLElement | null = null;\n\n function emit(typing: boolean): void {\n isTyping = typing;\n if (editorDom) {\n editorDom.dispatchEvent(\n new CustomEvent('cds-aichat-prompt-typing', {\n detail: { isTyping: typing },\n bubbles: true,\n composed: true,\n })\n );\n }\n }\n\n function clearTimer(): void {\n if (timeoutId != null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n }\n\n storage.reset = () => {\n clearTimer();\n if (isTyping) {\n emit(false);\n }\n };\n\n return [\n new Plugin({\n view(view) {\n editorDom = view.dom as HTMLElement;\n return {\n update(view, prevState) {\n if (view.state.doc.eq(prevState.doc)) {\n return;\n }\n if (storage.lastTransactionIsHost) {\n return;\n }\n if (!isTyping) {\n emit(true);\n }\n clearTimer();\n timeoutId = setTimeout(() => emit(false), TYPING_TIMEOUT_MS);\n },\n destroy() {\n clearTimer();\n editorDom = null;\n },\n };\n },\n appendTransaction(transactions) {\n storage.lastTransactionIsHost =\n transactions.length > 0 &&\n transactions.every((tr) => isHostOrigin(tr));\n return null;\n },\n }),\n ];\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;AAcG;AAcI,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,CAG7C;AACA,IAAA,IAAI,EAAE,uBAAuB;IAE7B,UAAU,GAAA;AACR,QAAA,OAAO,EAAE,KAAK,EAAE,MAAK,EAAE,CAAC,EAAE,qBAAqB,EAAE,KAAK,EAAE;IAC1D,CAAC;IAED,qBAAqB,GAAA;AACnB,QAAA,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI;QACxB,IAAI,QAAQ,GAAG,KAAK;QACpB,IAAI,SAAS,GAAyC,IAAI;QAC1D,IAAI,SAAS,GAAuB,IAAI;QAExC,SAAS,IAAI,CAAC,MAAe,EAAA;YAC3B,QAAQ,G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AAO,CAAC,qBAAqB;wBAC3B,YAAY,CAAC,MAAM,GAAG,CAAC;AACvB,4BAAA,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,YAAY,CAAC,EAAE,CAAC,CAAC;AAC9C,oBAAA,OAAO,IAAI;gBACb,CAAC;aACF,CAAC;SACH;IACH,CAAC;AACF,CAAA;;"}
@@ -289,7 +289,7 @@ __decorate([
289
289
  CDSAIChatTruncatedText = __decorate([
290
290
  carbonElement(elementName)
291
291
  ], CDSAIChatTruncatedText);
292
- var CDSAIChatTruncatedText_default = CDSAIChatTruncatedText;
292
+ var CDSAIChatTruncatedText$1 = CDSAIChatTruncatedText;
293
293
 
294
- export { CDSAIChatTruncatedText, blockClass, CDSAIChatTruncatedText_default as default };
294
+ export { CDSAIChatTruncatedText, blockClass, CDSAIChatTruncatedText$1 as default };
295
295
  //# sourceMappingURL=truncated-text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"truncated-text.js","sources":["../../../../src/components/truncated-text/src/truncated-text.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings';\nimport '@carbon/web-components/es/components/tooltip/index.js';\nimport '@carbon/web-components/es/components/button/button.js';\nimport '@carbon/web-components/es/components/link/index.js';\n\nimport styles from './truncated-text.scss?lit';\nimport {\n adoptOnRoot,\n setVarsForSelector,\n clearSelector,\n} from '../../shared/dynamic-css-var-sheet.js';\n\nconst componentName = 'truncated-text';\nexport const blockClass = `${prefix}--${componentName}`;\nconst elementName = `${prefix}-${componentName}`; // cds-aichat-truncated-text\nconst carbonPrefix = 'cds';\n\nconst TRUNCATED_INSTANCE_ATTR = 'data-cds-aichat-truncated-text-id';\nlet truncatedInstanceCounter = 0;\n\n/**\n * TruncatedText.\n *\n * @element cds-aichat-truncated-text\n * @slot - Default slot for custom HTML content (alternative to value property)\n */\n@customElement(elementName)\nclass CDSAIChatTruncatedText extends LitElement {\n /**\n * Specify how the tooltip should align with the content.\n */\n @property({ reflect: true, type: String })\n align = 'top';\n\n /**\n * Specify whether a auto align functionality should be applied\n */\n @property({ type: Boolean, reflect: true })\n autoalign = false;\n\n /**\n * The label on the collapse button.\n */\n @property({ attribute: 'collapse-label', type: String, reflect: true })\n collapseLabel = '';\n\n /**\n * The label on expand button.\n */\n @property({ attribute: 'expand-label', type: String, reflect: true })\n expandLabel = '';\n\n /**\n * Unique identifier for the element.\n */\n @property({ type: String, reflect: true })\n id = '';\n\n /**\n * The maximum number of lines to display before truncation.\n */\n @property({ type: Number, reflect: true })\n lines = 0;\n\n /**\n * The method to display the full text when truncated. Options are \"tooltip\" or \"expand\". if not passed, the text would just be truncated with ellipsis.\n */\n @property({ type: String, reflect: true })\n type: 'tooltip' | 'expand' = 'tooltip';\n\n /**\n * The string value to be truncated.\n */\n @property({ type: String, attribute: 'value', reflect: true })\n value = '';\n\n @state() private _isOverflowing = false;\n @state() private _isExpanded = false;\n @state() private _maxHeight = 'none';\n\n @query(`.${blockClass}_content`) private _textElement!: HTMLElement;\n private _lineHeight = 0;\n private _isLayered = false;\n private _resizeObserver?: ResizeObserver;\n private readonly _truncatedInstanceId = `tt-${++truncatedInstanceCounter}`;\n\n private get _truncatedSelector(): string {\n return `[${TRUNCATED_INSTANCE_ATTR}=\"${this._truncatedInstanceId}\"]`;\n }\n\n private _syncTruncatedVars() {\n setVarsForSelector(this._truncatedSelector, {\n '--line-clamp-value': this.lines === 0 ? 'none' : String(this.lines),\n '--max-height-value': this._maxHeight || 'none',\n });\n }\n\n static styles = styles;\n\n connectedCallback() {\n super.connectedCallback();\n this._isLayered = !!this.closest(`${carbonPrefix}-layer`);\n this.type = this.type || 'tooltip';\n }\n\n disconnectedCallback() {\n this._resizeObserver?.disconnect();\n clearSelector(this._truncatedSelector);\n super.disconnectedCallback();\n }\n\n protected firstUpdated() {\n if (this._textElement) {\n this._textElement.setAttribute(\n TRUNCATED_INSTANCE_ATTR,\n this._truncatedInstanceId\n );\n adoptOnRoot(this.renderRoot as ShadowRoot);\n this._syncTruncatedVars();\n }\n requestAnimationFrame(() => {\n const computedStyle = getComputedStyle(this._textElement);\n this._lineHeight = parseFloat(computedStyle.lineHeight);\n this._setupResizeObserver();\n // Initial overflow check after first render\n this._updateOverflowStatus();\n });\n }\n\n protected updated(changed: Map<string, unknown>) {\n if (changed.has('lines') || changed.has('value')) {\n // Use requestAnimationFrame to ensure DOM is updated before checking overflow\n requestAnimationFrame(() => {\n this._updateOverflowStatus();\n this._updateMaxHeight();\n });\n }\n if (this._textElement) {\n this._syncTruncatedVars();\n }\n }\n\n private _updateMaxHeight() {\n if (this.type !== 'expand') {\n return;\n }\n requestAnimationFrame(() => {\n if (!this._textElement) {\n return;\n }\n this._maxHeight =\n this.lines > 0 && !this._isExpanded\n ? `${this.lines * this._lineHeight}px`\n : `${this._textElement.scrollHeight}px`;\n });\n }\n\n private _setupResizeObserver() {\n if (!this._textElement) {\n return;\n }\n\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n }\n\n this._resizeObserver = new ResizeObserver(() => {\n this._updateOverflowStatus();\n });\n\n this._resizeObserver.observe(this);\n }\n\n private _updateOverflowStatus() {\n if (!this._textElement || this.lines <= 0) {\n return;\n }\n this._updateMaxHeight();\n const { scrollHeight, clientHeight } = this._textElement;\n const buffer = this._lineHeight / 2; // buffer of at least half of line height for a stable outcome\n\n const isOverflowing = scrollHeight > clientHeight + buffer;\n\n if (isOverflowing !== this._isOverflowing) {\n this._isOverflowing = isOverflowing;\n }\n }\n\n private _handleKeydown(evt: KeyboardEvent) {\n const { key } = evt;\n if (key === 'Enter' || key === ' ') {\n this._toggleExpansion();\n }\n }\n\n private _toggleExpansion() {\n this._isExpanded = !this._isExpanded;\n this._updateMaxHeight();\n this._textElement?.classList.add(`${blockClass}_transition`);\n const onTransitionEnd = () => {\n this._textElement?.querySelector('button')?.focus();\n this._textElement?.removeEventListener('transitionend', onTransitionEnd);\n };\n this._textElement?.addEventListener('transitionend', onTransitionEnd);\n\n /**\n * currently you cannot animate line-clamping\n * you can however animate max-height\n * this removes the clamping and then quickly adds it so you can see the ellipsis\n */\n if (this._isExpanded === false) {\n this._textElement?.classList.add(`${blockClass}_content--closing`);\n setTimeout(() => {\n this._textElement?.classList.remove(`${blockClass}_content--closing`);\n }, 100);\n }\n }\n\n private _renderToggleButton() {\n const className = classMap({\n [`${blockClass}_button-collapse`]: this._isExpanded,\n [`${blockClass}_button-expand`]: !this._isExpanded,\n [`${blockClass}_button-layered`]: this._isLayered,\n [`${blockClass}_button-hide`]: !this._isOverflowing && !this._isExpanded,\n });\n const label = this._isExpanded ? this.collapseLabel : this.expandLabel;\n return html`\n <span\n aria-controls=${this.id}\n aria-expanded=${this._isExpanded}\n class=${className}\n @click=${this._toggleExpansion}\n @keydown=${this._handleKeydown}\n role=\"button\"\n tabIndex=\"0\">\n ${label}\n </span>\n `;\n }\n\n private _handleSlotChange() {\n // When slotted content changes, recalculate overflow\n requestAnimationFrame(() => {\n this._updateOverflowStatus();\n });\n }\n\n render() {\n // Always render slot, with value as fallback content\n // This allows styled slotted content to be displayed while value is used for tooltip\n const content = html`<slot @slotchange=${this._handleSlotChange}\n >${this.value}</slot\n >`;\n\n // For tooltip content, always use value property (plain text for tooltip)\n const tooltipContent = this.value;\n\n const contentClasses = classMap({\n [`${blockClass}_content`]: true,\n [`${blockClass}_content--expanded`]: this._isExpanded,\n [`${blockClass}_content--expand-type`]: this.type === 'expand',\n });\n\n const valueBody = html`\n <div id=${this.id} class=${contentClasses}>${content}</div>\n `;\n\n // For tooltip, show plain text in tooltip content\n const tooltipVariant = html`\n <cds-tooltip\n align=${this.align}\n autoalign=${this.autoalign}\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${valueBody}\n <cds-tooltip-content>${tooltipContent}</cds-tooltip-content>\n </cds-tooltip>\n `;\n\n const expandVariant = html`${valueBody} ${this._renderToggleButton()}`;\n\n return this.type === 'tooltip' && this._isOverflowing\n ? tooltipVariant\n : expandVariant;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [elementName]: CDSAIChatTruncatedText;\n }\n}\n\nexport { CDSAIChatTruncatedText };\nexport default CDSAIChatTruncatedText;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAkBH,MAAM,aAAa,GAAG,gBAAgB;MACzB,UAAU,GAAG,GAAG,MAAM,CAAA,EAAA,EAAK,aAAa,CAAA;AACrD,MAAM,WAAW,GAAG,CAAA,EAAG,MAAM,IAAI,aAAa,CAAA,CAAE,CAAC;AACjD,MAAM,YAAY,GAAG,KAAK;AAE1B,MAAM,uBAAuB,GAAG,mCAAmC;AACnE,IAAI,wBAAwB,GAAG,CAAC;AAEhC;;;;;AAKG;AAEH,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU,CAAA;AAA/C,IAAA,WAAA,GAAA;;AACE;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,KAAK;AAEb;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;AAEjB;;AAEG;QAEH,IAAA,CAAA,aAAa,GAAG,EAAE;AAElB;;AAEG;QAEH,IAAA,CAAA,WAAW,GAAG,EAAE;AAEhB;;AAEG;QAEH,IAAA,CAAA,EAAE,GAAG,EAAE;AAEP;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,CAAC;AAET;;AAEG;QAEH,IAAA,CAAA,IAAI,GAAyB,SAAS;AAEtC;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,EAAE;QAEO,IAAA,CAAA,cAAc,GAAG,KAAK;QACtB,IAAA,CAAA,WAAW,GAAG,KAAK;QACnB,IAAA,CAAA,UAAU,GAAG,MA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,EAAA,MAAA,CAAA;AACpB,UAAA,CAAA;AAAhB,IAAA,KAAK;AAA+B,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAEI,UAAA,CAAA;AAAxC,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,QAAA,CAAU;AAAqC,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AArDhE,sBAAsB,GAAA,UAAA,CAAA;IAD3BA,aAAa,CAAC,WAAW;AACpB,CAAA,EAAA,sBAAsB,CAkQ3B;AASD,qCAAe,sBAAsB;;"}
1
+ {"version":3,"file":"truncated-text.js","sources":["../../../../src/components/truncated-text/src/truncated-text.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport prefix from '../../../globals/settings';\nimport '@carbon/web-components/es/components/tooltip/index.js';\nimport '@carbon/web-components/es/components/button/button.js';\nimport '@carbon/web-components/es/components/link/index.js';\n\nimport styles from './truncated-text.scss?lit';\nimport {\n adoptOnRoot,\n setVarsForSelector,\n clearSelector,\n} from '../../shared/dynamic-css-var-sheet.js';\n\nconst componentName = 'truncated-text';\nexport const blockClass = `${prefix}--${componentName}`;\nconst elementName = `${prefix}-${componentName}`; // cds-aichat-truncated-text\nconst carbonPrefix = 'cds';\n\nconst TRUNCATED_INSTANCE_ATTR = 'data-cds-aichat-truncated-text-id';\nlet truncatedInstanceCounter = 0;\n\n/**\n * TruncatedText.\n *\n * @element cds-aichat-truncated-text\n * @slot - Default slot for custom HTML content (alternative to value property)\n */\n@customElement(elementName)\nclass CDSAIChatTruncatedText extends LitElement {\n /**\n * Specify how the tooltip should align with the content.\n */\n @property({ reflect: true, type: String })\n align = 'top';\n\n /**\n * Specify whether a auto align functionality should be applied\n */\n @property({ type: Boolean, reflect: true })\n autoalign = false;\n\n /**\n * The label on the collapse button.\n */\n @property({ attribute: 'collapse-label', type: String, reflect: true })\n collapseLabel = '';\n\n /**\n * The label on expand button.\n */\n @property({ attribute: 'expand-label', type: String, reflect: true })\n expandLabel = '';\n\n /**\n * Unique identifier for the element.\n */\n @property({ type: String, reflect: true })\n id = '';\n\n /**\n * The maximum number of lines to display before truncation.\n */\n @property({ type: Number, reflect: true })\n lines = 0;\n\n /**\n * The method to display the full text when truncated. Options are \"tooltip\" or \"expand\". if not passed, the text would just be truncated with ellipsis.\n */\n @property({ type: String, reflect: true })\n type: 'tooltip' | 'expand' = 'tooltip';\n\n /**\n * The string value to be truncated.\n */\n @property({ type: String, attribute: 'value', reflect: true })\n value = '';\n\n @state() private _isOverflowing = false;\n @state() private _isExpanded = false;\n @state() private _maxHeight = 'none';\n\n @query(`.${blockClass}_content`) private _textElement!: HTMLElement;\n private _lineHeight = 0;\n private _isLayered = false;\n private _resizeObserver?: ResizeObserver;\n private readonly _truncatedInstanceId = `tt-${++truncatedInstanceCounter}`;\n\n private get _truncatedSelector(): string {\n return `[${TRUNCATED_INSTANCE_ATTR}=\"${this._truncatedInstanceId}\"]`;\n }\n\n private _syncTruncatedVars() {\n setVarsForSelector(this._truncatedSelector, {\n '--line-clamp-value': this.lines === 0 ? 'none' : String(this.lines),\n '--max-height-value': this._maxHeight || 'none',\n });\n }\n\n static styles = styles;\n\n connectedCallback() {\n super.connectedCallback();\n this._isLayered = !!this.closest(`${carbonPrefix}-layer`);\n this.type = this.type || 'tooltip';\n }\n\n disconnectedCallback() {\n this._resizeObserver?.disconnect();\n clearSelector(this._truncatedSelector);\n super.disconnectedCallback();\n }\n\n protected firstUpdated() {\n if (this._textElement) {\n this._textElement.setAttribute(\n TRUNCATED_INSTANCE_ATTR,\n this._truncatedInstanceId\n );\n adoptOnRoot(this.renderRoot as ShadowRoot);\n this._syncTruncatedVars();\n }\n requestAnimationFrame(() => {\n const computedStyle = getComputedStyle(this._textElement);\n this._lineHeight = parseFloat(computedStyle.lineHeight);\n this._setupResizeObserver();\n // Initial overflow check after first render\n this._updateOverflowStatus();\n });\n }\n\n protected updated(changed: Map<string, unknown>) {\n if (changed.has('lines') || changed.has('value')) {\n // Use requestAnimationFrame to ensure DOM is updated before checking overflow\n requestAnimationFrame(() => {\n this._updateOverflowStatus();\n this._updateMaxHeight();\n });\n }\n if (this._textElement) {\n this._syncTruncatedVars();\n }\n }\n\n private _updateMaxHeight() {\n if (this.type !== 'expand') {\n return;\n }\n requestAnimationFrame(() => {\n if (!this._textElement) {\n return;\n }\n this._maxHeight =\n this.lines > 0 && !this._isExpanded\n ? `${this.lines * this._lineHeight}px`\n : `${this._textElement.scrollHeight}px`;\n });\n }\n\n private _setupResizeObserver() {\n if (!this._textElement) {\n return;\n }\n\n if (this._resizeObserver) {\n this._resizeObserver.disconnect();\n }\n\n this._resizeObserver = new ResizeObserver(() => {\n this._updateOverflowStatus();\n });\n\n this._resizeObserver.observe(this);\n }\n\n private _updateOverflowStatus() {\n if (!this._textElement || this.lines <= 0) {\n return;\n }\n this._updateMaxHeight();\n const { scrollHeight, clientHeight } = this._textElement;\n const buffer = this._lineHeight / 2; // buffer of at least half of line height for a stable outcome\n\n const isOverflowing = scrollHeight > clientHeight + buffer;\n\n if (isOverflowing !== this._isOverflowing) {\n this._isOverflowing = isOverflowing;\n }\n }\n\n private _handleKeydown(evt: KeyboardEvent) {\n const { key } = evt;\n if (key === 'Enter' || key === ' ') {\n this._toggleExpansion();\n }\n }\n\n private _toggleExpansion() {\n this._isExpanded = !this._isExpanded;\n this._updateMaxHeight();\n this._textElement?.classList.add(`${blockClass}_transition`);\n const onTransitionEnd = () => {\n this._textElement?.querySelector('button')?.focus();\n this._textElement?.removeEventListener('transitionend', onTransitionEnd);\n };\n this._textElement?.addEventListener('transitionend', onTransitionEnd);\n\n /**\n * currently you cannot animate line-clamping\n * you can however animate max-height\n * this removes the clamping and then quickly adds it so you can see the ellipsis\n */\n if (this._isExpanded === false) {\n this._textElement?.classList.add(`${blockClass}_content--closing`);\n setTimeout(() => {\n this._textElement?.classList.remove(`${blockClass}_content--closing`);\n }, 100);\n }\n }\n\n private _renderToggleButton() {\n const className = classMap({\n [`${blockClass}_button-collapse`]: this._isExpanded,\n [`${blockClass}_button-expand`]: !this._isExpanded,\n [`${blockClass}_button-layered`]: this._isLayered,\n [`${blockClass}_button-hide`]: !this._isOverflowing && !this._isExpanded,\n });\n const label = this._isExpanded ? this.collapseLabel : this.expandLabel;\n return html`\n <span\n aria-controls=${this.id}\n aria-expanded=${this._isExpanded}\n class=${className}\n @click=${this._toggleExpansion}\n @keydown=${this._handleKeydown}\n role=\"button\"\n tabIndex=\"0\">\n ${label}\n </span>\n `;\n }\n\n private _handleSlotChange() {\n // When slotted content changes, recalculate overflow\n requestAnimationFrame(() => {\n this._updateOverflowStatus();\n });\n }\n\n render() {\n // Always render slot, with value as fallback content\n // This allows styled slotted content to be displayed while value is used for tooltip\n const content = html`<slot @slotchange=${this._handleSlotChange}\n >${this.value}</slot\n >`;\n\n // For tooltip content, always use value property (plain text for tooltip)\n const tooltipContent = this.value;\n\n const contentClasses = classMap({\n [`${blockClass}_content`]: true,\n [`${blockClass}_content--expanded`]: this._isExpanded,\n [`${blockClass}_content--expand-type`]: this.type === 'expand',\n });\n\n const valueBody = html`\n <div id=${this.id} class=${contentClasses}>${content}</div>\n `;\n\n // For tooltip, show plain text in tooltip content\n const tooltipVariant = html`\n <cds-tooltip\n align=${this.align}\n autoalign=${this.autoalign}\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${valueBody}\n <cds-tooltip-content>${tooltipContent}</cds-tooltip-content>\n </cds-tooltip>\n `;\n\n const expandVariant = html`${valueBody} ${this._renderToggleButton()}`;\n\n return this.type === 'tooltip' && this._isOverflowing\n ? tooltipVariant\n : expandVariant;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n [elementName]: CDSAIChatTruncatedText;\n }\n}\n\nexport { CDSAIChatTruncatedText };\nexport default CDSAIChatTruncatedText;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAkBH,MAAM,aAAa,GAAG,gBAAgB;MACzB,UAAU,GAAG,GAAG,MAAM,CAAA,EAAA,EAAK,aAAa,CAAA;AACrD,MAAM,WAAW,GAAG,CAAA,EAAG,MAAM,IAAI,aAAa,CAAA,CAAE,CAAC;AACjD,MAAM,YAAY,GAAG,KAAK;AAE1B,MAAM,uBAAuB,GAAG,mCAAmC;AACnE,IAAI,wBAAwB,GAAG,CAAC;AAEhC;;;;;AAKG;AAEH,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,UAAU,CAAA;AAA/C,IAAA,WAAA,GAAA;;AACE;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,KAAK;AAEb;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;AAEjB;;AAEG;QAEH,IAAA,CAAA,aAAa,GAAG,EAAE;AAElB;;AAEG;QAEH,IAAA,CAAA,WAAW,GAAG,EAAE;AAEhB;;AAEG;QAEH,IAAA,CAAA,EAAE,GAAG,EAAE;AAEP;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,CAAC;AAET;;AAEG;QAEH,IAAA,CAAA,IAAI,GAAyB,SAAS;AAEtC;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,EAAE;QAEO,IAAA,CAAA,cAAc,GAAG,KAAK;QACtB,IAAA,CAAA,WAAW,GAAG,KAAK;QACnB,IAAA,CAAA,UAAU,GAAG,MAAM;QAG5B,IAAA,CAAA,WAAW,GAAG,CAAC;QACf,IAAA,CAAA,UAAU,GAAG,KAAK;AAET,QAAA,IAAA,CAAA,oBAAoB,GAAG,CAAA,GAAA,EAAM,EAAE,wBAAwB,EAAE;IAyM5E;AAvME,IAA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AAA,CAAA,EAAI,UAAU,CAAA,QAAA,CAAU;AAAqC,CAAA,EAAA,sBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AArDhE,sBAAsB,GAAA,UAAA,CAAA;IAD3BA,aAAa,CAAC,WAAW;AACpB,CAAA,EAAA,sBAAsB,CAkQ3B;AASD,+BAAe,sBAAsB;;"}
@@ -32,31 +32,3 @@ export declare enum VideoSource {
32
32
  * @returns The detected video source type
33
33
  */
34
34
  export declare function detectVideoSource(url: string): VideoSource;
35
- /**
36
- * Check if a URL is a YouTube video
37
- *
38
- * @param url - The URL to check
39
- * @returns True if the URL is a YouTube video
40
- */
41
- export declare function isYouTubeUrl(url: string): boolean;
42
- /**
43
- * Check if a URL is a Vimeo video
44
- *
45
- * @param url - The URL to check
46
- * @returns True if the URL is a Vimeo video
47
- */
48
- export declare function isVimeoUrl(url: string): boolean;
49
- /**
50
- * Check if a URL is a Kaltura video
51
- *
52
- * @param url - The URL to check
53
- * @returns True if the URL is a Kaltura video
54
- */
55
- export declare function isKalturaUrl(url: string): boolean;
56
- /**
57
- * Check if a URL is a native video file
58
- *
59
- * @param url - The URL to check
60
- * @returns True if the URL is a native video file
61
- */
62
- export declare function isNativeVideoUrl(url: string): boolean;
@@ -75,42 +75,6 @@ function detectVideoSource(url) {
75
75
  }
76
76
  return VideoSource.UNKNOWN;
77
77
  }
78
- /**
79
- * Check if a URL is a YouTube video
80
- *
81
- * @param url - The URL to check
82
- * @returns True if the URL is a YouTube video
83
- */
84
- function isYouTubeUrl(url) {
85
- return detectVideoSource(url) === VideoSource.YOUTUBE;
86
- }
87
- /**
88
- * Check if a URL is a Vimeo video
89
- *
90
- * @param url - The URL to check
91
- * @returns True if the URL is a Vimeo video
92
- */
93
- function isVimeoUrl(url) {
94
- return detectVideoSource(url) === VideoSource.VIMEO;
95
- }
96
- /**
97
- * Check if a URL is a Kaltura video
98
- *
99
- * @param url - The URL to check
100
- * @returns True if the URL is a Kaltura video
101
- */
102
- function isKalturaUrl(url) {
103
- return detectVideoSource(url) === VideoSource.KALTURA;
104
- }
105
- /**
106
- * Check if a URL is a native video file
107
- *
108
- * @param url - The URL to check
109
- * @returns True if the URL is a native video file
110
- */
111
- function isNativeVideoUrl(url) {
112
- return detectVideoSource(url) === VideoSource.NATIVE;
113
- }
114
78
 
115
- export { VideoSource, detectVideoSource, isKalturaUrl, isNativeVideoUrl, isVimeoUrl, isYouTubeUrl };
79
+ export { VideoSource, detectVideoSource };
116
80
  //# sourceMappingURL=url-detector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url-detector.js","sources":["../../../../../src/components/video-player/src/utils/url-detector.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Portions of this code are derived from react-player\n * Copyright (c) 2017 Pete Cook\n * Licensed under the MIT License\n * https://github.com/cookpete/react-player/blob/v2.15.1/LICENSE\n *\n * URL patterns and detection logic adapted from:\n * https://github.com/cookpete/react-player/blob/v2.15.1/src/patterns.js\n */\n\n/**\n * Enum representing different video source types\n */\nexport enum VideoSource {\n YOUTUBE = 'youtube',\n VIMEO = 'vimeo',\n KALTURA = 'kaltura',\n NATIVE = 'native',\n UNKNOWN = 'unknown',\n}\n\n/**\n * URL patterns for detecting video sources\n * Derived from react-player v2.15.1\n */\nconst MATCH_URL_YOUTUBE =\n /(?:youtu\\.be\\/|youtube(?:-nocookie|education)?\\.com\\/(?:embed\\/|v\\/|watch\\/|watch\\?v=|watch\\?.+&v=|shorts\\/|live\\/))((\\w|-){11})|youtube\\.com\\/playlist\\?list=|youtube\\.com\\/user\\//;\n\nconst MATCH_URL_VIMEO = /vimeo\\.com\\/(?!progressive_redirect).+/;\n\nconst MATCH_URL_KALTURA =\n /^https?:\\/\\/[a-zA-Z]+\\.kaltura.(com|org)\\/p\\/([0-9]+)\\/sp\\/([0-9]+)00\\/embedIframeJs\\/uiconf_id\\/([0-9]+)\\/partner_id\\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/;\n\nconst VIDEO_EXTENSIONS = /\\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\\d+]+)?($|\\?)/i;\nconst HLS_EXTENSIONS = /\\.(m3u8)($|\\?)/i;\nconst DASH_EXTENSIONS = /\\.(mpd)($|\\?)/i;\n\n/**\n * Detect the video source type from a URL\n *\n * @param url - The video URL to analyze\n * @returns The detected video source type\n */\nexport function detectVideoSource(url: string): VideoSource {\n if (!url || typeof url !== 'string') {\n return VideoSource.UNKNOWN;\n }\n\n // Check for YouTube\n if (MATCH_URL_YOUTUBE.test(url)) {\n return VideoSource.YOUTUBE;\n }\n\n // Check for Vimeo (but not if it's a direct video file)\n if (\n MATCH_URL_VIMEO.test(url) &&\n !VIDEO_EXTENSIONS.test(url) &&\n !HLS_EXTENSIONS.test(url)\n ) {\n return VideoSource.VIMEO;\n }\n\n // Check for Kaltura\n if (MATCH_URL_KALTURA.test(url)) {\n return VideoSource.KALTURA;\n }\n\n // Check for native video files\n if (\n VIDEO_EXTENSIONS.test(url) ||\n HLS_EXTENSIONS.test(url) ||\n DASH_EXTENSIONS.test(url)\n ) {\n return VideoSource.NATIVE;\n }\n\n return VideoSource.UNKNOWN;\n}\n\n/**\n * Check if a URL is a YouTube video\n *\n * @param url - The URL to check\n * @returns True if the URL is a YouTube video\n */\nexport function isYouTubeUrl(url: string): boolean {\n return detectVideoSource(url) === VideoSource.YOUTUBE;\n}\n\n/**\n * Check if a URL is a Vimeo video\n *\n * @param url - The URL to check\n * @returns True if the URL is a Vimeo video\n */\nexport function isVimeoUrl(url: string): boolean {\n return detectVideoSource(url) === VideoSource.VIMEO;\n}\n\n/**\n * Check if a URL is a Kaltura video\n *\n * @param url - The URL to check\n * @returns True if the URL is a Kaltura video\n */\nexport function isKalturaUrl(url: string): boolean {\n return detectVideoSource(url) === VideoSource.KALTURA;\n}\n\n/**\n * Check if a URL is a native video file\n *\n * @param url - The URL to check\n * @returns True if the URL is a native video file\n */\nexport function isNativeVideoUrl(url: string): boolean {\n return detectVideoSource(url) === VideoSource.NATIVE;\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;AAQG;AAEH;;AAEG;IACS;AAAZ,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,WAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,WAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EANW,WAAW,KAAX,WAAW,GAAA,EAAA,CAAA,CAAA;AAQvB;;;AAGG;AACH,MAAM,iBAAiB,GACrB,qLAAqL;AAEvL,MAAM,eAAe,GAAG,wCAAwC;AAEhE,MAAM,iBAAiB,GACrB,gKAAgK;AAElK,MAAM,gBAAgB,GAAG,iDAAiD;AAC1E,MAAM,cAAc,GAAG,iBAAiB;AACxC,MAAM,eAAe,GAAG,gBAAgB;AAExC;;;;;AAKG;AACG,SAAU,iBAAiB,CAAC,GAAW,EAAA;IAC3C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACnC,OAAO,WAAW,CAAC,OAAO;IAC5B;;AAGA,IAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC/B,OAAO,WAAW,CAAC,OAAO;IAC5B;;AAGA,IAAA,IACE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC;AACzB,QAAA,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3B,QAAA,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EACzB;QACA,OAAO,WAAW,CAAC,KAAK;IAC1B;;AAGA,IAAA,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC/B,OAAO,WAAW,CAAC,OAAO;IAC5B;;AAGA,IAAA,IACE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1B,QAAA,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;AACxB,QAAA,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EACzB;QACA,OAAO,WAAW,CAAC,MAAM;IAC3B;IAEA,OAAO,WAAW,CAAC,OAAO;AAC5B;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAW,EAAA;IACtC,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,OAAO;AACvD;AAEA;;;;;AAKG;AACG,SAAU,UAAU,CAAC,GAAW,EAAA;IACpC,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,KAAK;AACrD;AAEA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAW,EAAA;IACtC,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,OAAO;AACvD;AAEA;;;;;AAKG;AACG,SAAU,gBAAgB,CAAC,GAAW,EAAA;IAC1C,OAAO,iBAAiB,CAAC,GAAG,CAAC,KAAK,WAAW,CAAC,MAAM;AACtD;;"}
1
+ {"version":3,"file":"url-detector.js","sources":["../../../../../src/components/video-player/src/utils/url-detector.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Portions of this code are derived from react-player\n * Copyright (c) 2017 Pete Cook\n * Licensed under the MIT License\n * https://github.com/cookpete/react-player/blob/v2.15.1/LICENSE\n *\n * URL patterns and detection logic adapted from:\n * https://github.com/cookpete/react-player/blob/v2.15.1/src/patterns.js\n */\n\n/**\n * Enum representing different video source types\n */\nexport enum VideoSource {\n YOUTUBE = 'youtube',\n VIMEO = 'vimeo',\n KALTURA = 'kaltura',\n NATIVE = 'native',\n UNKNOWN = 'unknown',\n}\n\n/**\n * URL patterns for detecting video sources\n * Derived from react-player v2.15.1\n */\nconst MATCH_URL_YOUTUBE =\n /(?:youtu\\.be\\/|youtube(?:-nocookie|education)?\\.com\\/(?:embed\\/|v\\/|watch\\/|watch\\?v=|watch\\?.+&v=|shorts\\/|live\\/))((\\w|-){11})|youtube\\.com\\/playlist\\?list=|youtube\\.com\\/user\\//;\n\nconst MATCH_URL_VIMEO = /vimeo\\.com\\/(?!progressive_redirect).+/;\n\nconst MATCH_URL_KALTURA =\n /^https?:\\/\\/[a-zA-Z]+\\.kaltura.(com|org)\\/p\\/([0-9]+)\\/sp\\/([0-9]+)00\\/embedIframeJs\\/uiconf_id\\/([0-9]+)\\/partner_id\\/([0-9]+)(.*)entry_id.([a-zA-Z0-9-_].*)$/;\n\nconst VIDEO_EXTENSIONS = /\\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\\d+]+)?($|\\?)/i;\nconst HLS_EXTENSIONS = /\\.(m3u8)($|\\?)/i;\nconst DASH_EXTENSIONS = /\\.(mpd)($|\\?)/i;\n\n/**\n * Detect the video source type from a URL\n *\n * @param url - The video URL to analyze\n * @returns The detected video source type\n */\nexport function detectVideoSource(url: string): VideoSource {\n if (!url || typeof url !== 'string') {\n return VideoSource.UNKNOWN;\n }\n\n // Check for YouTube\n if (MATCH_URL_YOUTUBE.test(url)) {\n return VideoSource.YOUTUBE;\n }\n\n // Check for Vimeo (but not if it's a direct video file)\n if (\n MATCH_URL_VIMEO.test(url) &&\n !VIDEO_EXTENSIONS.test(url) &&\n !HLS_EXTENSIONS.test(url)\n ) {\n return VideoSource.VIMEO;\n }\n\n // Check for Kaltura\n if (MATCH_URL_KALTURA.test(url)) {\n return VideoSource.KALTURA;\n }\n\n // Check for native video files\n if (\n VIDEO_EXTENSIONS.test(url) ||\n HLS_EXTENSIONS.test(url) ||\n DASH_EXTENSIONS.test(url)\n ) {\n return VideoSource.NATIVE;\n }\n\n return Video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A,IACE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC;AAC1B,QAAA,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;AACxB,QAAA,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EACzB;QACA,OAAO,WAAW,CAAC,MAAM;IAC3B;IAEA,OAAO,WAAW,CAAC,OAAO;AAC5B;;"}
@@ -2,9 +2,7 @@
2
2
  * Device detection utilities.
3
3
  */
4
4
  declare function isBrowser(): boolean;
5
- declare const IS_IOS: boolean;
6
- declare const IS_ANDROID: boolean;
7
- declare const IS_MOBILE: boolean;
5
+ export declare const IS_MOBILE: boolean;
8
6
  declare const IS_PHONE: boolean;
9
- declare const IS_PHONE_IN_PORTRAIT_MODE: boolean;
10
- export { isBrowser, IS_IOS, IS_ANDROID, IS_MOBILE, IS_PHONE, IS_PHONE_IN_PORTRAIT_MODE, };
7
+ export declare const IS_PHONE_IN_PORTRAIT_MODE: boolean;
8
+ export { isBrowser, IS_PHONE };
@@ -33,5 +33,5 @@ const IS_PHONE = IS_MOBILE && (screenWidth < 500 || screenHeight < 500);
33
33
  // Assume the phone is in portrait mode if the width is small.
34
34
  const IS_PHONE_IN_PORTRAIT_MODE = IS_PHONE && screenWidth < 500;
35
35
 
36
- export { IS_ANDROID, IS_IOS, IS_MOBILE, IS_PHONE, IS_PHONE_IN_PORTRAIT_MODE, isBrowser };
36
+ export { IS_MOBILE, IS_PHONE, IS_PHONE_IN_PORTRAIT_MODE, isBrowser };
37
37
  //# sourceMappingURL=browser-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-utils.js","sources":["../../../src/globals/utils/browser-utils.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Device detection utilities.\n */\n\nfunction isBrowser(): boolean {\n return typeof window !== 'undefined' && typeof navigator !== 'undefined';\n}\n\nlet screenWidth = 0;\nlet screenHeight = 0;\n\nif (isBrowser()) {\n screenWidth = window.screen.width;\n screenHeight = window.screen.height;\n}\n\nconst IS_IOS = isBrowser() && /iPad|iPhone|iPod/.test(navigator.userAgent);\nconst IS_ANDROID = isBrowser() && /Android/.test(navigator.userAgent);\nconst IS_MOBILE = IS_IOS || IS_ANDROID;\n// The width and height checks here are how we differentiate between mobile android devices and tablets.\nconst IS_PHONE = IS_MOBILE && (screenWidth < 500 || screenHeight < 500);\n// Assume the phone is in portrait mode if the width is small.\nconst IS_PHONE_IN_PORTRAIT_MODE = IS_PHONE && screenWidth < 500;\n\nexport {\n isBrowser,\n IS_IOS,\n IS_ANDROID,\n IS_MOBILE,\n IS_PHONE,\n IS_PHONE_IN_PORTRAIT_MODE,\n};\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;AAEG;AAEH,SAAS,SAAS,GAAA;IAChB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW;AAC1E;AAEA,IAAI,WAAW,GAAG,CAAC;AACnB,IAAI,YAAY,GAAG,CAAC;AAEpB,IAAI,SAAS,EAAE,EAAE;AACf,IAAA,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK;AACjC,IAAA,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM;AACrC;AAEA,MAAM,MAAM,GAAG,SAAS,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS;AACzE,MAAM,UAAU,GAAG,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS;AACpE,MAAM,SAAS,GAAG,MAAM,IAAI;AAC5B;AACA,MAAM,QAAQ,GAAG,SAAS,KAAK,WAAW,GAAG,GAAG,IAAI,YAAY,GAAG,GAAG;AACtE;AACA,MAAM,yBAAyB,GAAG,QAAQ,IAAI,WAAW,GAAG;;"}
1
+ {"version":3,"file":"browser-utils.js","sources":["../../../src/globals/utils/browser-utils.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Device detection utilities.\n */\n\nfunction isBrowser(): boolean {\n return typeof window !== 'undefined' && typeof navigator !== 'undefined';\n}\n\nlet screenWidth = 0;\nlet screenHeight = 0;\n\nif (isBrowser()) {\n screenWidth = window.screen.width;\n screenHeight = window.screen.height;\n}\n\nconst IS_IOS = isBrowser() && /iPad|iPhone|iPod/.test(navigator.userAgent);\nconst IS_ANDROID = isBrowser() && /Android/.test(navigator.userAgent);\nexport const IS_MOBILE = IS_IOS || IS_ANDROID;\n// The width and height checks here are how we differentiate between mobile android devices and tablets.\nconst IS_PHONE = IS_MOBILE && (screenWidth < 500 || screenHeight < 500);\n// Assume the phone is in portrait mode if the width is small.\nexport const IS_PHONE_IN_PORTRAIT_MODE = IS_PHONE && screenWidth < 500;\nexport { isBrowser, IS_PHONE };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;AAEG;AAEH,SAAS,SAAS,GAAA;IAChB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,SAAS,KAAK,WAAW;AAC1E;AAEA,IAAI,WAAW,GAAG,CAAC;AACnB,IAAI,YAAY,GAAG,CAAC;AAEpB,IAAI,SAAS,EAAE,EAAE;AACf,IAAA,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK;AACjC,IAAA,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM;AACrC;AAEA,MAAM,MAAM,GAAG,SAAS,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;AAC1E,MAAM,UAAU,GAAG,SAAS,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;AAC9D,MAAM,SAAS,GAAG,MAAM,IAAI;AACnC;AACA,MAAM,QAAQ,GAAG,SAAS,KAAK,WAAW,GAAG,GAAG,IAAI,YAAY,GAAG,GAAG;AACtE;MACa,yBAAyB,GAAG,QAAQ,IAAI,WAAW,GAAG;;"}
@@ -5,4 +5,3 @@ type CSVValue = string | number | null | undefined;
5
5
  */
6
6
  declare function stringifyCSV(rows: CSVValue[][]): string;
7
7
  export { stringifyCSV };
8
- export type { CSVValue };
@@ -1 +1 @@
1
- {"version":3,"file":"csv.js","sources":["../../../src/globals/utils/csv.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\ntype CSVValue = string | number | null | undefined;\n\n// A field needs quoting when it contains the delimiter, a quote, or a line break.\nconst NEEDS_QUOTING = /[\",\\r\\n]/;\n\nfunction formatField(value: CSVValue): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n const field = String(value);\n\n if (!NEEDS_QUOTING.test(field)) {\n return field;\n }\n\n return `\"${field.replace(/\"/g, '\"\"')}\"`;\n}\n\n/**\n * Serializes rows into an RFC 4180 CSV string. Every record, including the last, is terminated by a\n * newline; an empty input produces an empty string.\n */\nfunction stringifyCSV(rows: CSVValue[][]): string {\n return rows.map((row) => `${row.map(formatField).join(',')}\\n`).join('');\n}\n\nexport { stringifyCSV };\nexport type { CSVValue };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;AACA,MAAM,aAAa,GAAG,UAAU;AAEhC,SAAS,WAAW,CAAC,KAAe,EAAA;IAClC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,QAAA,OAAO,EAAE;IACX;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAE3B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AAC9B,QAAA,OAAO,KAAK;IACd;IAEA,OAAO,CAAA,CAAA,EAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA,CAAA,CAAG;AACzC;AAEA;;;AAGG;AACH,SAAS,YAAY,CAAC,IAAkB,EAAA;AACtC,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA,EAAG,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,EAAA,CAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1E;;"}
1
+ {"version":3,"file":"csv.js","sources":["../../../src/globals/utils/csv.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\ntype CSVValue = string | number | null | undefined;\n\n// A field needs quoting when it contains the delimiter, a quote, or a line break.\nconst NEEDS_QUOTING = /[\",\\r\\n]/;\n\nfunction formatField(value: CSVValue): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n const field = String(value);\n\n if (!NEEDS_QUOTING.test(field)) {\n return field;\n }\n\n return `\"${field.replace(/\"/g, '\"\"')}\"`;\n}\n\n/**\n * Serializes rows into an RFC 4180 CSV string. Every record, including the last, is terminated by a\n * newline; an empty input produces an empty string.\n */\nfunction stringifyCSV(rows: CSVValue[][]): string {\n return rows.map((row) => `${row.map(formatField).join(',')}\\n`).join('');\n}\n\nexport { stringifyCSV };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH;AACA,MAAM,aAAa,GAAG,UAAU;AAEhC,SAAS,WAAW,CAAC,KAAe,EAAA;IAClC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AACzC,QAAA,OAAO,EAAE;IACX;AAEA,IAAA,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAE3B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;AAC9B,QAAA,OAAO,KAAK;IACd;IAEA,OAAO,CAAA,CAAA,EAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA,CAAA,CAAG;AACzC;AAEA;;;AAGG;AACH,SAAS,YAAY,CAAC,IAAkB,EAAA;AACtC,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA,EAAG,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,EAAA,CAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1E;;"}
@@ -0,0 +1,12 @@
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 React from 'react';
10
+ declare const TruncatedText: React.ComponentType<any>;
11
+ export { TruncatedText };
12
+ export default TruncatedText;
@@ -0,0 +1,28 @@
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 { createComponent } from '@lit/react';
9
+ import React from 'react';
10
+ import CDSAIChatTruncatedText from '../components/truncated-text/src/truncated-text.js';
11
+ import { withWebComponentBridge } from './utils/withWebComponentBridge.js';
12
+
13
+ /**
14
+ * @license
15
+ *
16
+ * Copyright IBM Corp. 2026
17
+ *
18
+ * This source code is licensed under the Apache-2.0 license found in the
19
+ * LICENSE file in the root directory of this source tree.
20
+ */
21
+ const TruncatedText = withWebComponentBridge(createComponent({
22
+ tagName: 'cds-aichat-truncated-text',
23
+ elementClass: CDSAIChatTruncatedText,
24
+ react: React,
25
+ }));
26
+
27
+ export { TruncatedText, TruncatedText as default };
28
+ //# sourceMappingURL=truncated-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncated-text.js","sources":["../../src/react/truncated-text.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { createComponent } from '@lit/react';\nimport React from 'react';\n\nimport CDSAIChatTruncatedText from '../components/truncated-text/src/truncated-text.js';\nimport { withWebComponentBridge } from './utils/withWebComponentBridge';\n\nconst TruncatedText = withWebComponentBridge(\n createComponent({\n tagName: 'cds-aichat-truncated-text',\n elementClass: CDSAIChatTruncatedText,\n react: React,\n })\n);\n\nexport { TruncatedText };\nexport default TruncatedText;\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAQH,MAAM,aAAa,GAAG,sBAAsB,CAC1C,eAAe,CAAC;AACd,IAAA,OAAO,EAAE,2BAA2B;AACpC,IAAA,YAAY,EAAE,sBAAsB;AACpC,IAAA,KAAK,EAAE,KAAK;AACb,CAAA,CAAC;;"}
@@ -16,7 +16,3 @@ export declare enum PageObjectId {
16
16
  */
17
17
  HEADER_NAME = "header_name"
18
18
  }
19
- /**
20
- * Ids used for data-testid.
21
- */
22
- export type TestId = PageObjectId;
@@ -1 +1 @@
1
- {"version":3,"file":"PageObjectId.js","sources":["../../src/testing/PageObjectId.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Base enum of data-testid values used in @carbon/ai-chat-components.\n * This enum contains test IDs for low-level components.\n */\nexport enum PageObjectId {\n /**\n * Chat header container element.\n */\n CHAT_HEADER = 'chat_header',\n\n /**\n * Header title element.\n */\n HEADER_TITLE = 'header_title',\n\n /**\n * Header name element.\n */\n HEADER_NAME = 'header_name',\n}\n\n/**\n * Ids used for data-testid.\n */\nexport type TestId = PageObjectId;\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;AAGG;IACS;AAAZ,CAAA,UAAY,YAAY,EAAA;AACtB;;AAEG;AACH,IAAA,YAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAE3B;;AAEG;AACH,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAE7B;;AAEG;AACH,IAAA,YAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC7B,CAAC,EAfW,YAAY,KAAZ,YAAY,GAAA,EAAA,CAAA,CAAA;;"}
1
+ {"version":3,"file":"PageObjectId.js","sources":["../../src/testing/PageObjectId.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\n/**\n * Base enum of data-testid values used in @carbon/ai-chat-components.\n * This enum contains test IDs for low-level components.\n */\nexport enum PageObjectId {\n /**\n * Chat header container element.\n */\n CHAT_HEADER = 'chat_header',\n\n /**\n * Header title element.\n */\n HEADER_TITLE = 'header_title',\n\n /**\n * Header name element.\n */\n HEADER_NAME = 'header_name',\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;AAGG;IACS;AAAZ,CAAA,UAAY,YAAY,EAAA;AACtB;;AAEG;AACH,IAAA,YAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAE3B;;AAEG;AACH,IAAA,YAAA,CAAA,cAAA,CAAA,GAAA,cAA6B;AAE7B;;AAEG;AACH,IAAA,YAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC7B,CAAC,EAfW,YAAY,KAAZ,YAAY,GAAA,EAAA,CAAA,CAAA;;"}
@@ -1,4 +1,3 @@
1
- import { loadCodeSnippetDeps } from '../components/code-snippet/src/codemirror/codemirror-loader.js';
2
1
  import { loadTableDeps } from '../components/table/src/table-loader.js';
3
2
  /**
4
3
  * Preloads all lazily loaded dependencies so test environments (like Jest)
@@ -7,4 +6,4 @@ import { loadTableDeps } from '../components/table/src/table-loader.js';
7
6
  * Consumers can call this once during their test setup files.
8
7
  */
9
8
  export declare function loadAllLazyDeps(): Promise<void>;
10
- export { loadCodeSnippetDeps, loadTableDeps };
9
+ export { loadTableDeps };
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { loadCodeSnippetDeps } from '../components/code-snippet/src/codemirror/codemirror-loader.js';
8
+ import { loadCodeMirrorRuntime } from '../components/code-snippet/src/codemirror/codemirror-loader.js';
9
9
  import { loadTableDeps } from '../components/table/src/table-loader.js';
10
10
 
11
11
  /*
@@ -23,8 +23,8 @@ import { loadTableDeps } from '../components/table/src/table-loader.js';
23
23
  * Consumers can call this once during their test setup files.
24
24
  */
25
25
  async function loadAllLazyDeps() {
26
- await Promise.all([loadCodeSnippetDeps(), loadTableDeps()]);
26
+ await Promise.all([loadCodeMirrorRuntime(), loadTableDeps()]);
27
27
  }
28
28
 
29
- export { loadAllLazyDeps, loadCodeSnippetDeps, loadTableDeps };
29
+ export { loadAllLazyDeps, loadTableDeps };
30
30
  //# sourceMappingURL=load-all-lazy-deps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-all-lazy-deps.js","sources":["../../src/testing/load-all-lazy-deps.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { loadCodeSnippetDeps } from '../components/code-snippet/src/codemirror/codemirror-loader.js';\nimport { loadTableDeps } from '../components/table/src/table-loader.js';\n\n/**\n * Preloads all lazily loaded dependencies so test environments (like Jest)\n * can ensure the heavy components are ready before rendering.\n *\n * Consumers can call this once during their test setup files.\n */\nexport async function loadAllLazyDeps(): Promise<void> {\n await Promise.all([loadCodeSnippetDeps(), loadTableDeps()]);\n}\n\nexport { loadCodeSnippetDeps, loadTableDeps };\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAKH;;;;;AAKG;AACI,eAAe,eAAe,GAAA;AACnC,IAAA,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;AAC7D;;"}
1
+ {"version":3,"file":"load-all-lazy-deps.js","sources":["../../src/testing/load-all-lazy-deps.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { loadCodeMirrorRuntime } from '../components/code-snippet/src/codemirror/codemirror-loader.js';\nimport { loadTableDeps } from '../components/table/src/table-loader.js';\n\n/**\n * Preloads all lazily loaded dependencies so test environments (like Jest)\n * can ensure the heavy components are ready before rendering.\n *\n * Consumers can call this once during their test setup files.\n */\nexport async function loadAllLazyDeps(): Promise<void> {\n await Promise.all([loadCodeMirrorRuntime(), loadTableDeps()]);\n}\n\nexport { loadTableDeps };\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAOG;AAKH;;;;;AAKG;AACI,eAAe,eAAe,GAAA;AACnC,IAAA,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,qBAAqB,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;AAC/D;;"}