@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
@@ -24,13 +24,6 @@ function loadCodeMirrorRuntime() {
24
24
  }
25
25
  return runtimePromise;
26
26
  }
27
- /**
28
- * Public helper so tests or higher-level packages can preload the heavy
29
- * CodeMirror dependencies ahead of time (e.g., in Jest setup files).
30
- */
31
- function loadCodeSnippetDeps() {
32
- return loadCodeMirrorRuntime();
33
- }
34
27
 
35
- export { loadCodeMirrorRuntime, loadCodeSnippetDeps };
28
+ export { loadCodeMirrorRuntime };
36
29
  //# sourceMappingURL=codemirror-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codemirror-loader.js","sources":["../../../../../src/components/code-snippet/src/codemirror/codemirror-loader.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\ntype CodeMirrorRuntimeModule = typeof import('./codemirror-runtime.js');\n\nlet runtimePromise: Promise<CodeMirrorRuntimeModule> | null = null;\n\n/**\n * Lazily loads the CodeMirror runtime so that heavy editor dependencies are only\n * pulled into the bundle when the code-snippet component is actually rendered.\n */\nexport function loadCodeMirrorRuntime(): Promise<CodeMirrorRuntimeModule> {\n if (!runtimePromise) {\n runtimePromise = import('./codemirror-runtime.js');\n }\n return runtimePromise;\n}\n\n/**\n * Public helper so tests or higher-level packages can preload the heavy\n * CodeMirror dependencies ahead of time (e.g., in Jest setup files).\n */\nexport function loadCodeSnippetDeps(): Promise<CodeMirrorRuntimeModule> {\n return loadCodeMirrorRuntime();\n}\n\nexport type { CodeMirrorRuntimeModule };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH,IAAI,cAAc,GAA4C,IAAI;AAElE;;;AAGG;SACa,qBAAqB,GAAA;IACnC,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,cAAc,GAAG,OAAO,yBAAyB,CAAC;IACpD;AACA,IAAA,OAAO,cAAc;AACvB;AAEA;;;AAGG;SACa,mBAAmB,GAAA;IACjC,OAAO,qBAAqB,EAAE;AAChC;;"}
1
+ {"version":3,"file":"codemirror-loader.js","sources":["../../../../../src/components/code-snippet/src/codemirror/codemirror-loader.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\ntype CodeMirrorRuntimeModule = typeof import('./codemirror-runtime.js');\n\nlet runtimePromise: Promise<CodeMirrorRuntimeModule> | null = null;\n\n/**\n * Lazily loads the CodeMirror runtime so that heavy editor dependencies are only\n * pulled into the bundle when the code-snippet component is actually rendered.\n */\nexport function loadCodeMirrorRuntime(): Promise<CodeMirrorRuntimeModule> {\n if (!runtimePromise) {\n runtimePromise = import('./codemirror-runtime.js');\n }\n return runtimePromise;\n}\n\nexport type { CodeMirrorRuntimeModule };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH,IAAI,cAAc,GAA4C,IAAI;AAElE;;;AAGG;SACa,qBAAqB,GAAA;IACnC,IAAI,CAAC,cAAc,EAAE;AACnB,QAAA,cAAc,GAAG,OAAO,yBAAyB,CAAC;IACpD;AACA,IAAA,OAAO,cAAc;AACvB;;"}
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import MarkdownIt from 'markdown-it';
9
- import markdownItAttrs from './plugins/markdown-it-attrs.js';
9
+ import { markdownItAttrs } from './plugins/markdown-it-attrs.js';
10
10
  import { markdownItHighlight } from './plugins/markdown-it-highlight.js';
11
11
  import { markdownItTaskLists } from './plugins/markdown-it-task-lists.js';
12
12
 
@@ -4,4 +4,3 @@ import type MarkdownIt from 'markdown-it';
4
4
  * headings, and paragraphs using `{{key=value}}` syntax.
5
5
  */
6
6
  export declare function markdownItAttrs(md: MarkdownIt): void;
7
- export default markdownItAttrs;
@@ -193,5 +193,5 @@ function markdownItAttrs(md) {
193
193
  });
194
194
  }
195
195
 
196
- export { markdownItAttrs as default, markdownItAttrs };
196
+ export { markdownItAttrs };
197
197
  //# sourceMappingURL=markdown-it-attrs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-it-attrs.js","sources":["../../../../../src/components/markdown/src/plugins/markdown-it-attrs.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 * This file is based on markdown-it-attrs by Arve Seljebu\n * Original repository: https://github.com/arve0/markdown-it-attrs\n *\n * The MIT License (MIT)\n *\n * Copyright (c) Arve Seljebu <arve.seljebu@gmail.com> (arve0.github.io)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * ---\n *\n * This file has been rewritten for Carbon AI Chat to cover only the documented\n * attribute syntax:\n *\n * [link](url){{target=_blank rel=noopener}}\n * # Heading {{id=foo}}\n * Paragraph {{class=bar}}\n *\n * Delimiters are fixed to `{{`/`}}` and only `target`, `rel`, `class`, `id`\n * are applied; any other attribute key is silently dropped.\n */\n\nimport type MarkdownIt from 'markdown-it';\nimport type { Token } from 'markdown-it';\n\nconst LEFT = '{{';\nconst RIGHT = '}}';\nconst ALLOWED = new Set(['target', 'rel', 'class', 'id']);\n\ntype AttrPair = [string, string];\n\n/**\n * Parses the body between `{{` and `}}` into a list of allowed attribute pairs.\n * Supports `key=value` and `key=\"quoted value\"`, space-separated. Disallowed\n * keys and malformed fragments are dropped silently.\n */\nfunction parseAttrs(body: string): AttrPair[] {\n const attrs: AttrPair[] = [];\n let key = '';\n let value = '';\n let parsingKey = true;\n let inQuotes = false;\n\n const commit = () => {\n if (key !== '' && ALLOWED.has(key)) {\n attrs.push([key, value]);\n }\n key = '';\n value = '';\n parsingKey = true;\n };\n\n for (let i = 0; i < body.length; i++) {\n const ch = body.charAt(i);\n\n if (ch === '=' && parsingKey) {\n parsingKey = false;\n continue;\n }\n if (ch === '\"' && !parsingKey) {\n inQuotes = !inQuotes;\n continue;\n }\n if (ch === ' ' && !inQuotes) {\n commit();\n continue;\n }\n if (parsingKey) {\n key += ch;\n } else {\n value += ch;\n }\n }\n commit();\n\n return attrs;\n}\n\n/**\n * Applies parsed attributes to a token, merging `class` with any pre-existing\n * class and pushing the rest.\n */\nfunction applyAttrs(token: Token, attrs: AttrPair[]): void {\n for (const [key, value] of attrs) {\n if (key === 'class') {\n token.attrJoin('class', value);\n } else {\n token.attrPush([key, value]);\n }\n }\n}\n\n/**\n * Walks backwards to find the `*_open` token matching the close token at\n * `closeIndex` (same level, matching type). Returns `null` when no match is\n * found, which causes the handler to silently bail.\n */\nfunction findMatchingOpen(tokens: Token[], closeIndex: number): Token | null {\n const close = tokens[closeIndex];\n const openType = close.type.replace(/_close$/, '_open');\n for (let i = closeIndex - 1; i >= 0; i--) {\n if (tokens[i].type === openType && tokens[i].level === close.level) {\n return tokens[i];\n }\n }\n return null;\n}\n\n/**\n * Looks for a `*_close` child (e.g. `link_close`) immediately followed by a\n * text child starting with `{{…}}`. When matched, applies the attributes to\n * the matching opening token and rewrites/removes the text child. Returns\n * true if a mutation occurred so the caller can rescan for additional\n * link-attribute pairs on the same inline token.\n */\nfunction handleInlineAttributes(inlineToken: Token): boolean {\n const children = inlineToken.children;\n if (!children) {\n return false;\n }\n\n for (let i = 1; i < children.length; i++) {\n const prev = children[i - 1];\n const curr = children[i];\n if (prev.nesting !== -1 || curr.type !== 'text') {\n continue;\n }\n if (!curr.content.startsWith(LEFT)) {\n continue;\n }\n const closeIdx = curr.content.indexOf(RIGHT, LEFT.length);\n if (closeIdx === -1) {\n continue;\n }\n\n const openToken = findMatchingOpen(children, i - 1);\n if (!openToken) {\n continue;\n }\n\n const body = curr.content.slice(LEFT.length, closeIdx);\n applyAttrs(openToken, parseAttrs(body));\n\n const remainder = curr.content.slice(closeIdx + RIGHT.length);\n if (remainder.length === 0) {\n children.splice(i, 1);\n } else {\n curr.content = remainder;\n }\n return true;\n }\n\n return false;\n}\n\n/**\n * When the last text child of an `inline` token ends with `}}`, apply the\n * attributes to the matching block's opening token (heading_open /\n * paragraph_open / etc.) and strip them from the rendered text.\n */\nfunction handleEndOfBlock(tokens: Token[], inlineIndex: number): void {\n const children = tokens[inlineIndex].children;\n if (!children || children.length === 0) {\n return;\n }\n const last = children[children.length - 1];\n if (last.type !== 'text' || !last.content.endsWith(RIGHT)) {\n return;\n }\n const openIdx = last.content.lastIndexOf(LEFT);\n if (openIdx === -1) {\n return;\n }\n\n // Find the closing block token that follows this inline.\n let closeIdx = -1;\n for (let i = inlineIndex + 1; i < tokens.length; i++) {\n if (tokens[i].nesting === -1) {\n closeIdx = i;\n break;\n }\n }\n if (closeIdx === -1) {\n return;\n }\n\n const openToken = findMatchingOpen(tokens, closeIdx);\n if (!openToken) {\n return;\n }\n\n const body = last.content.slice(\n openIdx + LEFT.length,\n last.content.length - RIGHT.length\n );\n applyAttrs(openToken, parseAttrs(body));\n\n // Strip `{{…}}` and a single trailing space between the content and the\n // attribute block, so `# Heading {{id=foo}}` does not render as\n // `<h1>Heading </h1>`.\n let trimmed = last.content.slice(0, openIdx);\n if (trimmed.endsWith(' ')) {\n trimmed = trimmed.slice(0, -1);\n }\n last.content = trimmed;\n}\n\n/**\n * Markdown-it plugin that applies a fixed set of HTML attributes to links,\n * headings, and paragraphs using `{{key=value}}` syntax.\n */\nexport function markdownItAttrs(md: MarkdownIt): void {\n md.core.ruler.before('linkify', 'curly_attributes', (state) => {\n const tokens = state.tokens;\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i].type !== 'inline') {\n continue;\n }\n while (handleInlineAttributes(tokens[i])) {\n // Loop until no more link-attribute pairs remain on this inline token.\n }\n handleEndOfBlock(tokens, i);\n }\n });\n}\n\nexport default markdownItAttrs;\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AA4CH,MAAM,IAAI,GAAG,IAAI;AACjB,MAAM,KAAK,GAAG,IAAI;AAClB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAIzD;;;;AAIG;AACH,SAAS,UAAU,CAAC,IAAY,EAAA;IAC9B,MAAM,KAAK,GAAe,EAAE;IAC5B,IAAI,GAAG,GAAG,EAAE;IACZ,IAAI,KAAK,GAAG,EAAE;IACd,IAAI,UAAU,GAAG,IAAI;IACrB,IAAI,QAAQ,GAAG,KAAK;IAEpB,MAAM,MAAM,GAAG,MAAK;QA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YAE1C;AACA,YAAA,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7B;AACF,IAAA,CAAC,CAAC;AACJ;;"}
1
+ {"version":3,"file":"markdown-it-attrs.js","sources":["../../../../../src/components/markdown/src/plugins/markdown-it-attrs.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 * This file is based on markdown-it-attrs by Arve Seljebu\n * Original repository: https://github.com/arve0/markdown-it-attrs\n *\n * The MIT License (MIT)\n *\n * Copyright (c) Arve Seljebu <arve.seljebu@gmail.com> (arve0.github.io)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n * ---\n *\n * This file has been rewritten for Carbon AI Chat to cover only the documented\n * attribute syntax:\n *\n * [link](url){{target=_blank rel=noopener}}\n * # Heading {{id=foo}}\n * Paragraph {{class=bar}}\n *\n * Delimiters are fixed to `{{`/`}}` and only `target`, `rel`, `class`, `id`\n * are applied; any other attribute key is silently dropped.\n */\n\nimport type MarkdownIt from 'markdown-it';\nimport type { Token } from 'markdown-it';\n\nconst LEFT = '{{';\nconst RIGHT = '}}';\nconst ALLOWED = new Set(['target', 'rel', 'class', 'id']);\n\ntype AttrPair = [string, string];\n\n/**\n * Parses the body between `{{` and `}}` into a list of allowed attribute pairs.\n * Supports `key=value` and `key=\"quoted value\"`, space-separated. Disallowed\n * keys and malformed fragments are dropped silently.\n */\nfunction parseAttrs(body: string): AttrPair[] {\n const attrs: AttrPair[] = [];\n let key = '';\n let value = '';\n let parsingKey = true;\n let inQuotes = false;\n\n const commit = () => {\n if (key !== '' && ALLOWED.has(key)) {\n attrs.push([key, value]);\n }\n key = '';\n value = '';\n parsingKey = true;\n };\n\n for (let i = 0; i < body.length; i++) {\n const ch = body.charAt(i);\n\n if (ch === '=' && parsingKey) {\n parsingKey = false;\n continue;\n }\n if (ch === '\"' && !parsingKey) {\n inQuotes = !inQuotes;\n continue;\n }\n if (ch === ' ' && !inQuotes) {\n commit();\n continue;\n }\n if (parsingKey) {\n key += ch;\n } else {\n value += ch;\n }\n }\n commit();\n\n return attrs;\n}\n\n/**\n * Applies parsed attributes to a token, merging `class` with any pre-existing\n * class and pushing the rest.\n */\nfunction applyAttrs(token: Token, attrs: AttrPair[]): void {\n for (const [key, value] of attrs) {\n if (key === 'class') {\n token.attrJoin('class', value);\n } else {\n token.attrPush([key, value]);\n }\n }\n}\n\n/**\n * Walks backwards to find the `*_open` token matching the close token at\n * `closeIndex` (same level, matching type). Returns `null` when no match is\n * found, which causes the handler to silently bail.\n */\nfunction findMatchingOpen(tokens: Token[], closeIndex: number): Token | null {\n const close = tokens[closeIndex];\n const openType = close.type.replace(/_close$/, '_open');\n for (let i = closeIndex - 1; i >= 0; i--) {\n if (tokens[i].type === openType && tokens[i].level === close.level) {\n return tokens[i];\n }\n }\n return null;\n}\n\n/**\n * Looks for a `*_close` child (e.g. `link_close`) immediately followed by a\n * text child starting with `{{…}}`. When matched, applies the attributes to\n * the matching opening token and rewrites/removes the text child. Returns\n * true if a mutation occurred so the caller can rescan for additional\n * link-attribute pairs on the same inline token.\n */\nfunction handleInlineAttributes(inlineToken: Token): boolean {\n const children = inlineToken.children;\n if (!children) {\n return false;\n }\n\n for (let i = 1; i < children.length; i++) {\n const prev = children[i - 1];\n const curr = children[i];\n if (prev.nesting !== -1 || curr.type !== 'text') {\n continue;\n }\n if (!curr.content.startsWith(LEFT)) {\n continue;\n }\n const closeIdx = curr.content.indexOf(RIGHT, LEFT.length);\n if (closeIdx === -1) {\n continue;\n }\n\n const openToken = findMatchingOpen(children, i - 1);\n if (!openToken) {\n continue;\n }\n\n const body = curr.content.slice(LEFT.length, closeIdx);\n applyAttrs(openToken, parseAttrs(body));\n\n const remainder = curr.content.slice(closeIdx + RIGHT.length);\n if (remainder.length === 0) {\n children.splice(i, 1);\n } else {\n curr.content = remainder;\n }\n return true;\n }\n\n return false;\n}\n\n/**\n * When the last text child of an `inline` token ends with `}}`, apply the\n * attributes to the matching block's opening token (heading_open /\n * paragraph_open / etc.) and strip them from the rendered text.\n */\nfunction handleEndOfBlock(tokens: Token[], inlineIndex: number): void {\n const children = tokens[inlineIndex].children;\n if (!children || children.length === 0) {\n return;\n }\n const last = children[children.length - 1];\n if (last.type !== 'text' || !last.content.endsWith(RIGHT)) {\n return;\n }\n const openIdx = last.content.lastIndexOf(LEFT);\n if (openIdx === -1) {\n return;\n }\n\n // Find the closing block token that follows this inline.\n let closeIdx = -1;\n for (let i = inlineIndex + 1; i < tokens.length; i++) {\n if (tokens[i].nesting === -1) {\n closeIdx = i;\n break;\n }\n }\n if (closeIdx === -1) {\n return;\n }\n\n const openToken = findMatchingOpen(tokens, closeIdx);\n if (!openToken) {\n return;\n }\n\n const body = last.content.slice(\n openIdx + LEFT.length,\n last.content.length - RIGHT.length\n );\n applyAttrs(openToken, parseAttrs(body));\n\n // Strip `{{…}}` and a single trailing space between the content and the\n // attribute block, so `# Heading {{id=foo}}` does not render as\n // `<h1>Heading </h1>`.\n let trimmed = last.content.slice(0, openIdx);\n if (trimmed.endsWith(' ')) {\n trimmed = trimmed.slice(0, -1);\n }\n last.content = trimmed;\n}\n\n/**\n * Markdown-it plugin that applies a fixed set of HTML attributes to links,\n * headings, and paragraphs using `{{key=value}}` syntax.\n */\nexport function markdownItAttrs(md: MarkdownIt): void {\n md.core.ruler.before('linkify', 'curly_attributes', (state) => {\n const tokens = state.tokens;\n for (let i = 0; i < tokens.length; i++) {\n if (tokens[i].type !== 'inline') {\n continue;\n }\n while (handleInlineAttributes(tokens[i])) {\n // Loop until no more link-attribute pairs remain on this inline token.\n }\n handleEndOfBlock(tokens, i);\n }\n });\n}\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AA4CH,MAAM,IAAI,GAAG,IAAI;AACjB,MAAM,KAAK,GAAG,IAAI;AAClB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AAIzD;;;;AAIG;AACH,SAAS,UAAU,CAAC,IAAY,EAAA;IAC9B,MAAM,KAAK,GAAe,EAAE;IAC5B,IAAI,GAAG,GAAG,EAAE;IACZ,IAAI,KAAK,GAAG,EAAE;IACd,IAAI,UAAU,GAAG,IAAI;IACrB,IAAI,QAAQ,GAAG,KAAK;IAEpB,MAAM,MAAM,GAAG,MAAK;QAClB,IAAI,GAAG,KAAK,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAClC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B;QACA,GAAG,GAAG,EAAE;QACR,KAAK,GAAG,EAAE;QACV,UAAU,GAAG,IAAI;AACnB,IAAA,CAAC;AAED,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,E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AAO,GAAG,IAAI,CAAC,MAAM,EACrB,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CACnC;IACD,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;;;;AAKvC,IAAA,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC;AAC5C,IAAA,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACzB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;IAChC;AACA,IAAA,IAAI,CAAC,OAAO,GAAG,OAAO;AACxB;AAEA;;;AAGG;AACG,SAAU,eAAe,CAAC,EAAc,EAAA;AAC5C,IAAA,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,kBAAkB,EAAE,CAAC,KAAK,KAAI;AAC5D,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM;AAC3B,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC/B;YACF;YACA,OAAO,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;;YAE1C;AACA,YAAA,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7B;AACF,IAAA,CAAC,CAAC;AACJ;;"}
@@ -33,6 +33,8 @@ const PLUGIN_FALLBACK_SLOT_PREFIX = 'cds-aichat-markdown-renderer-pluginFallback
33
33
  const NATIVELY_HANDLED_TOKEN_TYPES = new Set([
34
34
  'root',
35
35
  'text',
36
+ 'softbreak',
37
+ 'hardbreak',
36
38
  'code_inline',
37
39
  'fence',
38
40
  'html_block',
@@ -225,5 +227,5 @@ function renderFallback(token, node, md, sanitize, options) {
225
227
  return html `<slot name=${slotName}>${fallbackText}</slot>`;
226
228
  }
227
229
 
228
- export { PLUGIN_FALLBACK_SLOT_PREFIX, isNativelyHandled, renderFallback, shouldDelegateToPluginRule };
230
+ export { isNativelyHandled, renderFallback, shouldDelegateToPluginRule };
229
231
  //# sourceMappingURL=plugin-fallback.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-fallback.js","sources":["../../../../../src/components/markdown/src/utils/plugin-fallback.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 { html, TemplateResult } from 'lit';\nimport MarkdownIt, { Token } from 'markdown-it';\n\nimport {\n getPluginOverriddenRules,\n PLUGIN_DELEGABLE_TOKEN_TYPES,\n type TokenTree,\n} from '../markdown-token-tree.js';\nimport { sanitizeHtmlContent } from './lit-directives.js';\nimport { withInstanceNamespace } from './slot-names.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\n\n/**\n * Slot-name prefix shared by every plugin-fallback descriptor. A render-scoped\n * sequence number follows, then the owning element's namespace (see\n * `./slot-names.js`); the markdown component uses this prefix when adopting the\n * light-DOM host so external observers can target plugin output with CSS or\n * query selectors.\n *\n * @internal\n */\nexport const PLUGIN_FALLBACK_SLOT_PREFIX =\n 'cds-aichat-markdown-renderer-pluginFallback';\n\n// Token types our hand-written renderer handles natively (no markdown-it\n// fallback needed).\nconst NATIVELY_HANDLED_TOKEN_TYPES = new Set<string>([\n 'root',\n 'text',\n 'code_inline',\n 'fence',\n 'html_block',\n 'html_inline',\n 'html_container',\n 'inline',\n 'hr',\n 'thematic_break',\n]);\n\n// HTML tags whose paired open/close (or self-contained leaf) is rendered by\n// `renderWithStaticTag`. Anything else falls through to the markdown-it\n// renderer fallback.\nconst NATIVELY_HANDLED_TAGS = new Set<string>([\n 'p',\n 'blockquote',\n 'pre',\n 'hr',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'cds-checkbox',\n 'strong',\n 'em',\n 'code',\n 'del',\n 'sub',\n 'sup',\n 'span',\n 'i',\n 'b',\n 'small',\n 'mark',\n 'ins',\n 's',\n 'kbd',\n 'var',\n 'samp',\n 'cite',\n 'abbr',\n 'dfn',\n 'time',\n 'q',\n 'a',\n 'table',\n 'img',\n // Table internals — their open/close pairs are walked into via children.\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n // Task-list checkbox input element produced by markdown-it-task-lists.\n 'input',\n]);\n\n/**\n * True when the renderer can dispatch `token` itself (hand-written Lit\n * template). False when an unknown plugin-introduced token type or tag should\n * route through `md.renderer.render()`.\n */\nexport function isNativelyHandled(token: Partial<Token>): boolean {\n if (token.type && NATIVELY_HANDLED_TOKEN_TYPES.has(token.type)) {\n return true;\n }\n if (token.tag && NATIVELY_HANDLED_TAGS.has(token.tag)) {\n return true;\n }\n return false;\n}\n\n/**\n * True when the token's type is in the curated delegation allow-list and a\n * user-supplied markdown-it plugin has overridden (or added) the matching\n * `md.renderer.rules[type]`. Native dispatch sites consult this to decide\n * whether to route through `md.renderer.render()` instead of the hand-written\n * Lit template.\n */\nexport function shouldDelegateToPluginRule(\n token: Partial<Token>,\n md: MarkdownIt | undefined\n): boolean {\n if (!token.type || !md) {\n return false;\n }\n if (!PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)) {\n return false;\n }\n return getPluginOverriddenRules(md).has(token.type);\n}\n\nfunction synthesizeCloseToken(openToken: Token): Token {\n const closeType = openToken.type.replace(/_open$/, '_close');\n return {\n type: closeType,\n tag: openToken.tag,\n nesting: -1,\n level: Math.max(0, openToken.level - 1),\n content: '',\n attrs: null,\n children: null,\n markup: openToken.markup,\n block: openToken.block,\n hidden: false,\n map: null,\n info: '',\n meta: null,\n } as Token;\n}\n\n/**\n * Re-emits the original flat markdown-it token sequence beneath `node` so the\n * sequence can be passed to `md.renderer.render()`. `inline` tokens are emitted\n * as-is (markdown-it's renderer reads their `.children` directly).\n */\nfunction flattenSubtree(node: TokenTree): Token[] {\n const tokens: Token[] = [];\n for (const child of node.children) {\n const t = child.token as Token;\n if (t.type === 'inline') {\n tokens.push(t);\n } else if (t.nesting === 1) {\n tokens.push(t);\n tokens.push(...flattenSubtree(child));\n tokens.push(synthesizeCloseToken(t));\n } else {\n tokens.push(t);\n }\n }\n return tokens;\n}\n\n/**\n * Builds the flat token slice to hand to `md.renderer.render()` for a token the\n * native renderer doesn't handle. Leaf tokens render alone; paired-container\n * opens reassemble `[open, ...children, close]` from the tree.\n */\nfunction sliceForFallback(token: Token, node: TokenTree): Token[] {\n if (token.nesting === 1) {\n return [token, ...flattenSubtree(node), synthesizeCloseToken(token)];\n }\n return [token];\n}\n\n/**\n * Renders an unknown token via markdown-it's HTML renderer and emits a named\n * `<slot>` placeholder carrying the token's text as its fallback content. The\n * markdown element adopts a light-DOM `<div slot=\"…\">` host containing the\n * sanitized HTML so consumer-supplied CSS (e.g. KaTeX's stylesheet) reaches the\n * rendered output; the fallback is what a reader sees if that host never\n * arrives — a container claimed the slot and no forwarder was minted — so a\n * stranded host degrades to plain text instead of vanishing.\n *\n * For leaf token types in {@link PLUGIN_DELEGABLE_TOKEN_TYPES} the rendered\n * HTML is cached on the {@link TokenTree} node and inherited across\n * `diffTokenTree` calls when the underlying token is unchanged — so a stable\n * earlier-in-document fence/image/etc. doesn't re-invoke the plugin's rule on\n * every streaming chunk. The cache is tagged with the `MarkdownIt` instance\n * that produced it; a plugin swap (which builds a fresh instance) invalidates\n * the cache automatically.\n */\nexport function renderFallback(\n token: Token,\n node: TokenTree,\n md: MarkdownIt,\n sanitize: boolean,\n options: RenderTokenTreeOptions\n): TemplateResult {\n let safe: string;\n if (node?.cachedHtml && node.cachedHtml.md === md) {\n safe = node.cachedHtml.html;\n } else {\n const slice = sliceForFallback(token, node);\n const htmlStr = md.renderer.render(slice, md.options, {});\n safe = sanitize ? sanitizeHtmlContent(htmlStr) : htmlStr;\n if (\n node &&\n typeof token.type === 'string' &&\n PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)\n ) {\n node.cachedHtml = { md, html: safe };\n }\n }\n\n const index = options.pluginSlotCounter?.next(node) ?? 0;\n const slotName = withInstanceNamespace(\n `${PLUGIN_FALLBACK_SLOT_PREFIX}-${index}`,\n options\n );\n options.recordCustomRender?.({\n slotName,\n kind: 'pluginFallback',\n token,\n html: safe,\n isInline: token.block === false,\n });\n // Text, not `safe`: the rendered markup already exists once as the light-DOM\n // host, and duplicating it inside the slot doubles the DOM of a plugin-heavy\n // message — 40 KaTeX expressions measured 3,288 extra elements. Prefer the\n // author's own source, which is what a formula or diagram token carries, and\n // fall back to the output's text for marker tokens that carry no source.\n const fallbackText = token.content || safe.replace(/<[^>]*>/g, '');\n return html`<slot name=${slotName}>${fallbackText}</slot>`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAcH;;;;;;;;AAQG;AACI,MAAM,2BAA2B,GACtC;AAEF;AACA;AACA,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAS;IACnD,MAAM;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACP,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,IAAI;IACJ,gBAAgB;AACjB,CAAA,CAAC;AAEF;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,GAAG;IACH,YAAY;IACZ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,GAAG;IACH,GAAG;IACH,OAAO;IACP,MAAM;IACN,KAAK;IACL,GAAG;IACH,KAAK;IACL,KAAK;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CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,YAAY,SAAS;AAC5D;;"}
1
+ {"version":3,"file":"plugin-fallback.js","sources":["../../../../../src/components/markdown/src/utils/plugin-fallback.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 { html, TemplateResult } from 'lit';\nimport MarkdownIt, { Token } from 'markdown-it';\n\nimport {\n getPluginOverriddenRules,\n PLUGIN_DELEGABLE_TOKEN_TYPES,\n type TokenTree,\n} from '../markdown-token-tree.js';\nimport { sanitizeHtmlContent } from './lit-directives.js';\nimport { withInstanceNamespace } from './slot-names.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\n\n/**\n * Slot-name prefix shared by every plugin-fallback descriptor. A render-scoped\n * sequence number follows, then the owning element's namespace (see\n * `./slot-names.js`); the markdown component uses this prefix when adopting the\n * light-DOM host so external observers can target plugin output with CSS or\n * query selectors.\n *\n * @internal\n */\nconst PLUGIN_FALLBACK_SLOT_PREFIX =\n 'cds-aichat-markdown-renderer-pluginFallback';\n\n// Token types our hand-written renderer handles natively (no markdown-it\n// fallback needed).\nconst NATIVELY_HANDLED_TOKEN_TYPES = new Set<string>([\n 'root',\n 'text',\n 'softbreak',\n 'hardbreak',\n 'code_inline',\n 'fence',\n 'html_block',\n 'html_inline',\n 'html_container',\n 'inline',\n 'hr',\n 'thematic_break',\n]);\n\n// HTML tags whose paired open/close (or self-contained leaf) is rendered by\n// `renderWithStaticTag`. Anything else falls through to the markdown-it\n// renderer fallback.\nconst NATIVELY_HANDLED_TAGS = new Set<string>([\n 'p',\n 'blockquote',\n 'pre',\n 'hr',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'cds-checkbox',\n 'strong',\n 'em',\n 'code',\n 'del',\n 'sub',\n 'sup',\n 'span',\n 'i',\n 'b',\n 'small',\n 'mark',\n 'ins',\n 's',\n 'kbd',\n 'var',\n 'samp',\n 'cite',\n 'abbr',\n 'dfn',\n 'time',\n 'q',\n 'a',\n 'table',\n 'img',\n // Table internals — their open/close pairs are walked into via children.\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n // Task-list checkbox input element produced by markdown-it-task-lists.\n 'input',\n]);\n\n/**\n * True when the renderer can dispatch `token` itself (hand-written Lit\n * template). False when an unknown plugin-introduced token type or tag should\n * route through `md.renderer.render()`.\n */\nexport function isNativelyHandled(token: Partial<Token>): boolean {\n if (token.type && NATIVELY_HANDLED_TOKEN_TYPES.has(token.type)) {\n return true;\n }\n if (token.tag && NATIVELY_HANDLED_TAGS.has(token.tag)) {\n return true;\n }\n return false;\n}\n\n/**\n * True when the token's type is in the curated delegation allow-list and a\n * user-supplied markdown-it plugin has overridden (or added) the matching\n * `md.renderer.rules[type]`. Native dispatch sites consult this to decide\n * whether to route through `md.renderer.render()` instead of the hand-written\n * Lit template.\n */\nexport function shouldDelegateToPluginRule(\n token: Partial<Token>,\n md: MarkdownIt | undefined\n): boolean {\n if (!token.type || !md) {\n return false;\n }\n if (!PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)) {\n return false;\n }\n return getPluginOverriddenRules(md).has(token.type);\n}\n\nfunction synthesizeCloseToken(openToken: Token): Token {\n const closeType = openToken.type.replace(/_open$/, '_close');\n return {\n type: closeType,\n tag: openToken.tag,\n nesting: -1,\n level: Math.max(0, openToken.level - 1),\n content: '',\n attrs: null,\n children: null,\n markup: openToken.markup,\n block: openToken.block,\n hidden: false,\n map: null,\n info: '',\n meta: null,\n } as Token;\n}\n\n/**\n * Re-emits the original flat markdown-it token sequence beneath `node` so the\n * sequence can be passed to `md.renderer.render()`. `inline` tokens are emitted\n * as-is (markdown-it's renderer reads their `.children` directly).\n */\nfunction flattenSubtree(node: TokenTree): Token[] {\n const tokens: Token[] = [];\n for (const child of node.children) {\n const t = child.token as Token;\n if (t.type === 'inline') {\n tokens.push(t);\n } else if (t.nesting === 1) {\n tokens.push(t);\n tokens.push(...flattenSubtree(child));\n tokens.push(synthesizeCloseToken(t));\n } else {\n tokens.push(t);\n }\n }\n return tokens;\n}\n\n/**\n * Builds the flat token slice to hand to `md.renderer.render()` for a token the\n * native renderer doesn't handle. Leaf tokens render alone; paired-container\n * opens reassemble `[open, ...children, close]` from the tree.\n */\nfunction sliceForFallback(token: Token, node: TokenTree): Token[] {\n if (token.nesting === 1) {\n return [token, ...flattenSubtree(node), synthesizeCloseToken(token)];\n }\n return [token];\n}\n\n/**\n * Renders an unknown token via markdown-it's HTML renderer and emits a named\n * `<slot>` placeholder carrying the token's text as its fallback content. The\n * markdown element adopts a light-DOM `<div slot=\"…\">` host containing the\n * sanitized HTML so consumer-supplied CSS (e.g. KaTeX's stylesheet) reaches the\n * rendered output; the fallback is what a reader sees if that host never\n * arrives — a container claimed the slot and no forwarder was minted — so a\n * stranded host degrades to plain text instead of vanishing.\n *\n * For leaf token types in {@link PLUGIN_DELEGABLE_TOKEN_TYPES} the rendered\n * HTML is cached on the {@link TokenTree} node and inherited across\n * `diffTokenTree` calls when the underlying token is unchanged — so a stable\n * earlier-in-document fence/image/etc. doesn't re-invoke the plugin's rule on\n * every streaming chunk. The cache is tagged with the `MarkdownIt` instance\n * that produced it; a plugin swap (which builds a fresh instance) invalidates\n * the cache automatically.\n */\nexport function renderFallback(\n token: Token,\n node: TokenTree,\n md: MarkdownIt,\n sanitize: boolean,\n options: RenderTokenTreeOptions\n): TemplateResult {\n let safe: string;\n if (node?.cachedHtml && node.cachedHtml.md === md) {\n safe = node.cachedHtml.html;\n } else {\n const slice = sliceForFallback(token, node);\n const htmlStr = md.renderer.render(slice, md.options, {});\n safe = sanitize ? sanitizeHtmlContent(htmlStr) : htmlStr;\n if (\n node &&\n typeof token.type === 'string' &&\n PLUGIN_DELEGABLE_TOKEN_TYPES.has(token.type)\n ) {\n node.cachedHtml = { md, html: safe };\n }\n }\n\n const index = options.pluginSlotCounter?.next(node) ?? 0;\n const slotName = withInstanceNamespace(\n `${PLUGIN_FALLBACK_SLOT_PREFIX}-${index}`,\n options\n );\n options.recordCustomRender?.({\n slotName,\n kind: 'pluginFallback',\n token,\n html: safe,\n isInline: token.block === false,\n });\n // Text, not `safe`: the rendered markup already exists once as the light-DOM\n // host, and duplicating it inside the slot doubles the DOM of a plugin-heavy\n // message — 40 KaTeX expressions measured 3,288 extra elements. Prefer the\n // author's own source, which is what a formula or diagram token carries, and\n // fall back to the output's text for marker tokens that carry no source.\n const fallbackText = token.content || safe.replace(/<[^>]*>/g, '');\n return html`<slot name=${slotName}>${fallbackText}</slot>`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAcH;;;;;;;;AAQG;AACH,MAAM,2BAA2B,GAC/B,6CAA6C;AAE/C;AACA;AACA,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAS;IACnD,MAAM;IACN,MAAM;IACN,WAAW;IACX,WAAW;IACX,aAAa;IACb,OAAO;IACP,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,IAAI;IACJ,gBAAgB;AACjB,CAAA,CAAC;AAEF;AACA;AACA;AACA,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,GAAG;IACH,YAAY;IACZ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,GAAG;IACH,GAAG;IACH,OAAO;IACP,MAAM;IACN,KAAK;IACL,GAAG;IACH,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,GAAG;IACH,GAAG;IACH,OAAO;IACP,KAAK;;IAE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it';
2
2
  import type { Token } from 'markdown-it';
3
3
  import type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';
4
4
  import type { TokenTree } from '../markdown-token-tree';
5
- export declare const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT: ({ count, }: {
6
- count: number;
7
- }) => string;
8
- export declare const DEFAULT_PAGINATION_STATUS_TEXT: ({ start, end, count, }: {
9
- start: number;
10
- end: number;
11
- count: number;
12
- }) => string;
13
5
  /**
14
6
  * One cell of a parsed markdown table. A custom table renderer reads these
15
7
  * from the `headers` and `rows` it is handed.
@@ -24,24 +16,6 @@ export interface TableCellData {
24
16
  */
25
17
  tokens: TokenTree[] | null;
26
18
  }
27
- /**
28
- * Extracts tabular data from a table TokenTree node.
29
- *
30
- * Converts the hierarchical markdown table structure into the flat
31
- * header/rows format expected by the cds-aichat-table component while retaining
32
- * the TokenTree children required for rich rendering within cells.
33
- */
34
- export declare function extractTableData(tableNode: TokenTree): {
35
- headers: TableCellData[];
36
- rows: TableCellData[][];
37
- };
38
- /**
39
- * Recursively extracts plain text content from a TokenTree node.
40
- *
41
- * This is used for table cells and other contexts where we need the
42
- * text content without HTML formatting.
43
- */
44
- export declare function extractTextContent(node: TokenTree): string;
45
19
  /**
46
20
  * Renders the body of the `case "table"` branch of `renderWithStaticTag`.
47
21
  *
@@ -18,9 +18,6 @@ import { isTableAtStreamingTail } from './streaming-table.js';
18
18
  *
19
19
  * @license
20
20
  */
21
- // Default localization functions for table pagination
22
- const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT = ({ count, }) => `${count} items`;
23
- const DEFAULT_PAGINATION_STATUS_TEXT = ({ start, end, count, }) => `${start}–${end} of ${count} items`;
24
21
  /**
25
22
  * Extracts tabular data from a table TokenTree node.
26
23
  *
@@ -202,5 +199,5 @@ function renderTable(token, node, attrs, options, renderToken, slotName) {
202
199
  return defaultTableTemplate;
203
200
  }
204
201
 
205
- export { DEFAULT_PAGINATION_STATUS_TEXT, DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT, extractTableData, extractTextContent, renderTable };
202
+ export { renderTable };
206
203
  //# sourceMappingURL=table-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.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 { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Token } from 'markdown-it';\n\nimport type {\n TableCellContent,\n TableRowContent,\n} from '../../../table/src/table.js';\nimport { combineConsecutiveHtmlInline } from './html-helpers.js';\nimport { isTableAtStreamingTail } from './streaming-table.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\nimport type { TokenTree } from '../markdown-token-tree';\n\n// Default localization functions for table pagination\nexport const DEFAULT_PAGINATION_SUPPLEMENTAL_TEXT = ({\n count,\n}: {\n count: number;\n}) => `${count} items`;\nexport const DEFAULT_PAGINATION_STATUS_TEXT = ({\n start,\n end,\n count,\n}: {\n start: number;\n end: number;\n count: number;\n}) => `${start}–${end} of ${count} items`;\n\n/**\n * One cell of a parsed markdown table. A custom table renderer reads these\n * from the `headers` and `rows` it is handed.\n */\nexport interface TableCellData {\n /** Plain text of the cell, with markdown syntax stripped. */\n text: string;\n /**\n * Token tree for the cell's content, or `null` when the cell is plain\n * text. Render it to keep the links, code spans, and emphasis that `text`\n * drops.\n */\n tokens: TokenTree[] | null;\n}\n\n/**\n * Extracts tabular data from a table TokenTree node.\n *\n * Converts the hierarchical markdown table structure into the flat\n * header/rows format expected by the cds-aichat-table component while retaining\n * the TokenTree children required for rich rendering within cells.\n */\nexport function extractTableData(tableNode: TokenTree): {\n headers: TableCellData[];\n rows: TableCellData[][];\n} {\n const headers: TableCellData[] = [];\n const rows: TableCellData[][] = [];\n\n for (const child of tableNode.children) {\n if (child.token.tag === 'thead') {\n // Extract column headers\n for (const theadChild of child.children) {\n if (theadChild.token.tag === 'tr') {\n for (const thChild of theadChild.children) {\n if (thChild.token.tag === 'th') {\n headers.push(extractCellData(thChild));\n }\n }\n }\n }\n } else if (child.token.tag === 'tbody') {\n // Extract data rows\n for (const tbodyChild of child.children) {\n if (tbodyChild.token.tag === 'tr') {\n const row: TableCellData[] = [];\n for (const tdChild of tbodyChild.children) {\n if (tdChild.token.tag === 'td') {\n row.push(extractCellData(tdChild));\n }\n }\n rows.push(row);\n }\n }\n }\n }\n\n return { headers, rows };\n}\n\n/**\n * Recursively extracts plain text content from a TokenTree node.\n *\n * This is used for table cells and other contexts where we need the\n * text content without HTML formatting.\n */\nexport function extractTextContent(node: TokenTree): string {\n // Handle direct text tokens\n if (node.token.type === 'text') {\n return node.token.content || '';\n }\n\n // Handle inline code\n if (node.token.type === 'code_inline') {\n return node.token.content || '';\n }\n\n if (node.token.type === 'softbreak' || node.token.type === 'hardbreak') {\n return '\\n';\n }\n\n // Recursively extract text from child nodes\n let text = '';\n for (const child of node.children) {\n text += extractTextContent(child);\n }\n\n return text;\n}\n\nfunction extractCellData(node: TokenTree): TableCellData {\n const text = extractTextContent(node);\n const tokens = extractRenderableChildren(node);\n const hasRichContent = tokens.some((child) => child.token.type !== 'text');\n\n return {\n text,\n tokens: hasRichContent ? tokens : null,\n };\n}\n\nfunction extractRenderableChildren(node: TokenTree): TokenTree[] {\n if (node.children.length === 1) {\n const onlyChild = node.children[0];\n if (\n onlyChild.token.type === 'inline' &&\n onlyChild.children &&\n onlyChild.children.length\n ) {\n return onlyChild.children;\n }\n }\n\n return node.children;\n}\n\n/**\n * Renders the body of the `case \"table\"` branch of `renderWithStaticTag`.\n *\n * Lives outside the renderer's switch because it covers three flows: streaming\n * loading state, default Carbon-table rendering, and the `customRenderers.table`\n * slot override.\n *\n * `renderToken` is the recursive renderer the caller dispatched from, passed in\n * to avoid a cycle with `markdown-renderer.ts`. `slotName` is non-undefined when\n * the consumer registered a `table` custom renderer, in which case the result is\n * wrapped in a named `<slot>` and an override descriptor is reported via\n * `recordCustomRender`.\n */\nexport function renderTable(\n token: Token,\n node: TokenTree,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n renderToken: (\n node: TokenTree,\n options: RenderTokenTreeOptions\n ) => TemplateResult,\n slotName: string | undefined\n): TemplateResult {\n const {\n streaming,\n forceTableLoading,\n context: parentContext,\n tableFilterPlaceholderText,\n tablePreviousPageText,\n tableNextPageText,\n tableItemsPerPageText,\n tableDownloadLabelText,\n tableLocale,\n tableGetPaginationSupplementalText,\n tableGetPaginationStatusText,\n } = options;\n\n // Determine if we should show loading state during streaming\n let isLoading = Boolean(forceTableLoading);\n if (\n !isLoading &&\n streaming &&\n parentContext?.parentChildren &&\n parentContext?.currentIndex !== undefined\n ) {\n isLoading = isTableAtStreamingTail(\n parentContext.parentChildren,\n parentContext.currentIndex\n );\n }\n\n const renderCellTokens = (tokens: TokenTree[], contextOverrides = {}) => {\n // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)\n // so each cell is not rendered as separate unsafeHTML + text chunks.\n const normalizedTokens = combineConsecutiveHtmlInline(tokens);\n return html`${repeat(\n normalizedTokens,\n (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`,\n (child, index) =>\n renderToken(child, {\n ...options,\n context: {\n ...options.context,\n ...contextOverrides,\n parentChildren: normalizedTokens,\n currentIndex: index,\n },\n })\n )}`;\n };\n\n const createCellContent = (\n cell: TableCellData,\n contextOverrides?: Record<string, unknown>\n ): TableCellContent => ({\n text: cell.text,\n template: cell.tokens\n ? renderCellTokens(cell.tokens, contextOverrides)\n : null,\n });\n\n // Only extract and process table data when not loading to avoid unnecessary work.\n // During loading, the table shows a skeleton and doesn't need the actual data.\n let headers: TableCellContent[] = [];\n let tableRows: TableRowContent[] = [];\n\n if (!isLoading) {\n const extractedData = extractTableData(node);\n headers = extractedData.headers.map((cell) =>\n createCellContent(cell, { isInThead: true })\n );\n tableRows = extractedData.rows.map((row) => ({\n cells: row.map((cell) => createCellContent(cell)),\n }));\n }\n\n // Always return the same structure to allow Lit to reuse the table element.\n // When isLoading is true, the table component will show a skeleton state.\n // When isLoading is false, it will show the actual data.\n // This prevents recreating the table element and preserves its internal state.\n const defaultTableTemplate = html`<div class=\"cds-aichat-table--square\">\n <cds-aichat-table\n data-rounded\n .headers=${headers}\n .rows=${tableRows}\n .loading=${isLoading}\n .filterPlaceholderText=${tableFilterPlaceholderText}\n .previousPageText=${tablePreviousPageText}\n .nextPageText=${tableNextPageText}\n .itemsPerPageText=${tableItemsPerPageText}\n .downloadLabelText=${tableDownloadLabelText}\n .locale=${tableLocale}\n .getPaginationSupplementalText=${tableGetPaginationSupplementalText}\n .getPaginationStatusText=${tableGetPaginationStatusText}\n ...=${attrs}></cds-aichat-table>\n </div>`;\n\n if (slotName !== undefined) {\n // For the override path we pass the raw extracted cell data (not the\n // Lit-wrapped TableCellContent) so consumers can render however they\n // like. Extract once even when loading so the consumer always gets\n // the data — they can read `isLoading` to choose a skeleton state.\n const { headers: dataHeaders, rows: dataRows } = extractTableData(node);\n options.recordCustomRender?.({\n slotName,\n kind: 'table',\n token,\n data: {\n headers: dataHeaders,\n rows: dataRows,\n isStreaming: !!streaming,\n isLoading,\n },\n });\n return html`<slot name=${slotName}>${defaultTableTemplate}</slot>`;\n }\n\n return defaultTableTemplate;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAeH;AACO,MAAM,oCAAoC,GAAG,CAAC,EACnD,KAAK,GAGN,KAAK,CAAA,EAAG,KAAK;MACD,8BAA8B,GAAG,CAAC,EAC7C,KAAK,EACL,GAAG,EACH,KAAK,GAKN,KAAK,CAAA,EAAG,KAAK,IAAI,GAAG,CAAA,IAAA,EAAO,KAAK,CAAA,MAAA;AAiBjC;;;;;;AAMG;AACG,SAAU,gBAAgB,CAAC,SAAoB,EAAA;IAInD,MAAM,OAAO,GAAoB,EAAE;IACnC,MAAM,IAAI,GAAsB,EAAE;AAElC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A,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;"}
1
+ {"version":3,"file":"table-helpers.js","sources":["../../../../../src/components/markdown/src/utils/table-helpers.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 { html, TemplateResult } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { Token } from 'markdown-it';\n\nimport type {\n TableCellContent,\n TableRowContent,\n} from '../../../table/src/table.js';\nimport { combineConsecutiveHtmlInline } from './html-helpers.js';\nimport { isTableAtStreamingTail } from './streaming-table.js';\nimport type { RenderTokenTreeOptions } from '../markdown-renderer-types.js';\nimport type { TokenTree } from '../markdown-token-tree';\n\n/**\n * One cell of a parsed markdown table. A custom table renderer reads these\n * from the `headers` and `rows` it is handed.\n */\nexport interface TableCellData {\n /** Plain text of the cell, with markdown syntax stripped. */\n text: string;\n /**\n * Token tree for the cell's content, or `null` when the cell is plain\n * text. Render it to keep the links, code spans, and emphasis that `text`\n * drops.\n */\n tokens: TokenTree[] | null;\n}\n\n/**\n * Extracts tabular data from a table TokenTree node.\n *\n * Converts the hierarchical markdown table structure into the flat\n * header/rows format expected by the cds-aichat-table component while retaining\n * the TokenTree children required for rich rendering within cells.\n */\nfunction extractTableData(tableNode: TokenTree): {\n headers: TableCellData[];\n rows: TableCellData[][];\n} {\n const headers: TableCellData[] = [];\n const rows: TableCellData[][] = [];\n\n for (const child of tableNode.children) {\n if (child.token.tag === 'thead') {\n // Extract column headers\n for (const theadChild of child.children) {\n if (theadChild.token.tag === 'tr') {\n for (const thChild of theadChild.children) {\n if (thChild.token.tag === 'th') {\n headers.push(extractCellData(thChild));\n }\n }\n }\n }\n } else if (child.token.tag === 'tbody') {\n // Extract data rows\n for (const tbodyChild of child.children) {\n if (tbodyChild.token.tag === 'tr') {\n const row: TableCellData[] = [];\n for (const tdChild of tbodyChild.children) {\n if (tdChild.token.tag === 'td') {\n row.push(extractCellData(tdChild));\n }\n }\n rows.push(row);\n }\n }\n }\n }\n\n return { headers, rows };\n}\n\n/**\n * Recursively extracts plain text content from a TokenTree node.\n *\n * This is used for table cells and other contexts where we need the\n * text content without HTML formatting.\n */\nfunction extractTextContent(node: TokenTree): string {\n // Handle direct text tokens\n if (node.token.type === 'text') {\n return node.token.content || '';\n }\n\n // Handle inline code\n if (node.token.type === 'code_inline') {\n return node.token.content || '';\n }\n\n if (node.token.type === 'softbreak' || node.token.type === 'hardbreak') {\n return '\\n';\n }\n\n // Recursively extract text from child nodes\n let text = '';\n for (const child of node.children) {\n text += extractTextContent(child);\n }\n\n return text;\n}\n\nfunction extractCellData(node: TokenTree): TableCellData {\n const text = extractTextContent(node);\n const tokens = extractRenderableChildren(node);\n const hasRichContent = tokens.some((child) => child.token.type !== 'text');\n\n return {\n text,\n tokens: hasRichContent ? tokens : null,\n };\n}\n\nfunction extractRenderableChildren(node: TokenTree): TokenTree[] {\n if (node.children.length === 1) {\n const onlyChild = node.children[0];\n if (\n onlyChild.token.type === 'inline' &&\n onlyChild.children &&\n onlyChild.children.length\n ) {\n return onlyChild.children;\n }\n }\n\n return node.children;\n}\n\n/**\n * Renders the body of the `case \"table\"` branch of `renderWithStaticTag`.\n *\n * Lives outside the renderer's switch because it covers three flows: streaming\n * loading state, default Carbon-table rendering, and the `customRenderers.table`\n * slot override.\n *\n * `renderToken` is the recursive renderer the caller dispatched from, passed in\n * to avoid a cycle with `markdown-renderer.ts`. `slotName` is non-undefined when\n * the consumer registered a `table` custom renderer, in which case the result is\n * wrapped in a named `<slot>` and an override descriptor is reported via\n * `recordCustomRender`.\n */\nexport function renderTable(\n token: Token,\n node: TokenTree,\n attrs: Record<string, string>,\n options: RenderTokenTreeOptions,\n renderToken: (\n node: TokenTree,\n options: RenderTokenTreeOptions\n ) => TemplateResult,\n slotName: string | undefined\n): TemplateResult {\n const {\n streaming,\n forceTableLoading,\n context: parentContext,\n tableFilterPlaceholderText,\n tablePreviousPageText,\n tableNextPageText,\n tableItemsPerPageText,\n tableDownloadLabelText,\n tableLocale,\n tableGetPaginationSupplementalText,\n tableGetPaginationStatusText,\n } = options;\n\n // Determine if we should show loading state during streaming\n let isLoading = Boolean(forceTableLoading);\n if (\n !isLoading &&\n streaming &&\n parentContext?.parentChildren &&\n parentContext?.currentIndex !== undefined\n ) {\n isLoading = isTableAtStreamingTail(\n parentContext.parentChildren,\n parentContext.currentIndex\n );\n }\n\n const renderCellTokens = (tokens: TokenTree[], contextOverrides = {}) => {\n // Same as block/inline rendering: merge split raw HTML (e.g. `<a>…</a>`)\n // so each cell is not rendered as separate unsafeHTML + text chunks.\n const normalizedTokens = combineConsecutiveHtmlInline(tokens);\n return html`${repeat(\n normalizedTokens,\n (child, index) => `cell-${index}:${child.token.type}:${child.token.tag}`,\n (child, index) =>\n renderToken(child, {\n ...options,\n context: {\n ...options.context,\n ...contextOverrides,\n parentChildren: normalizedTokens,\n currentIndex: index,\n },\n })\n )}`;\n };\n\n const createCellContent = (\n cell: TableCellData,\n contextOverrides?: Record<string, unknown>\n ): TableCellContent => ({\n text: cell.text,\n template: cell.tokens\n ? renderCellTokens(cell.tokens, contextOverrides)\n : null,\n });\n\n // Only extract and process table data when not loading to avoid unnecessary work.\n // During loading, the table shows a skeleton and doesn't need the actual data.\n let headers: TableCellContent[] = [];\n let tableRows: TableRowContent[] = [];\n\n if (!isLoading) {\n const extractedData = extractTableData(node);\n headers = extractedData.headers.map((cell) =>\n createCellContent(cell, { isInThead: true })\n );\n tableRows = extractedData.rows.map((row) => ({\n cells: row.map((cell) => createCellContent(cell)),\n }));\n }\n\n // Always return the same structure to allow Lit to reuse the table element.\n // When isLoading is true, the table component will show a skeleton state.\n // When isLoading is false, it will show the actual data.\n // This prevents recreating the table element and preserves its internal state.\n const defaultTableTemplate = html`<div class=\"cds-aichat-table--square\">\n <cds-aichat-table\n data-rounded\n .headers=${headers}\n .rows=${tableRows}\n .loading=${isLoading}\n .filterPlaceholderText=${tableFilterPlaceholderText}\n .previousPageText=${tablePreviousPageText}\n .nextPageText=${tableNextPageText}\n .itemsPerPageText=${tableItemsPerPageText}\n .downloadLabelText=${tableDownloadLabelText}\n .locale=${tableLocale}\n .getPaginationSupplementalText=${tableGetPaginationSupplementalText}\n .getPaginationStatusText=${tableGetPaginationStatusText}\n ...=${attrs}></cds-aichat-table>\n </div>`;\n\n if (slotName !== undefined) {\n // For the override path we pass the raw extracted cell data (not the\n // Lit-wrapped TableCellContent) so consumers can render however they\n // like. Extract once even when loading so the consumer always gets\n // the data — they can read `isLoading` to choose a skeleton state.\n const { headers: dataHeaders, rows: dataRows } = extractTableData(node);\n options.recordCustomRender?.({\n slotName,\n kind: 'table',\n token,\n data: {\n headers: dataHeaders,\n rows: dataRows,\n isStreaming: !!streaming,\n isLoading,\n },\n });\n return html`<slot name=${slotName}>${defaultTableTemplate}</slot>`;\n }\n\n return defaultTableTemplate;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AA8BH;;;;;;AAMG;AACH,SAAS,gBAAgB,CAAC,SAAoB,EAAA;IAI5C,MAAM,OAAO,GAAoB,EAAE;IACnC,MAAM,IAAI,GAAsB,EAAE;AAElC,IAAA,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtC,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;;AAE/B,YAAA,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;gBACvC,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;AACjC,oBAAA,KAAK,MAAM,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE;wBACzC,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE;4BAC9B,OAAO,CAAC,IAAI,C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AS,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM;AAC3C,YAAA,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAClD,SAAA,CAAC,CAAC;IACL;;;;;IAMA,MAAM,oBAAoB,GAAG,IAAI,CAAA,CAAA;;;iBAGlB,OAAO;cACV,SAAS;iBACN,SAAS;+BACK,0BAA0B;0BAC/B,qBAAqB;sBACzB,iBAAiB;0BACb,qBAAqB;2BACpB,sBAAsB;gBACjC,WAAW;uCACY,kCAAkC;iCACxC,4BAA4B;YACjD,KAAK,CAAA;SACR;AAEP,IAAA,IAAI,QAAQ,KAAK,SAAS,EAAE;;;;;AAK1B,QAAA,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACvE,OAAO,CAAC,kBAAkB,GAAG;YAC3B,QAAQ;AACR,YAAA,IAAI,EAAE,OAAO;YACb,KAAK;AACL,YAAA,IAAI,EAAE;AACJ,gBAAA,OAAO,EAAE,WAAW;AACpB,gBAAA,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,CAAC,CAAC,SAAS;gBACxB,SAAS;AACV,aAAA;AACF,SAAA,CAAC;AACF,QAAA,OAAO,IAAI,CAAA,CAAA,WAAA,EAAc,QAAQ,CAAA,CAAA,EAAI,oBAAoB,SAAS;IACpE;AAEA,IAAA,OAAO,oBAAoB;AAC7B;;"}
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { css } from 'lit';
9
9
 
10
- var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-aichat-autocomplete__live-region{clip:rect(0,0,0,0);block-size:1px;border:0;inline-size:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap}:host .cds-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-aichat-autocomplete-item--active,:host .cds-aichat-autocomplete-item--active:hover{background:var(--cds-background-selected,hsla(0,0%,55%,.2))}:host .cds-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__label-remainder,:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__description{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,hsla(0,0%,9%,.4))}:host .cds-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-aichat-autocomplete-item__description{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-aichat-autocomplete-item--active .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:focus .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:focus-within .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:hover .cds-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-aichat-autocomplete-item:focus:after,:host .cds-aichat-autocomplete-item:hover:after{display:none}:host .cds-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
10
+ var styles = css([":host :host([data-rounded=\"\"]),:host [data-rounded=\"\"]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=\"\"])::part(button),:host :host([data-rounded=\"\"])::part(link),:host [data-rounded=\"\"]::part(button),:host [data-rounded=\"\"]::part(link){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem);outline-offset:-.0625rem}:host :host([data-rounded=\"\"])>:only-child,:host [data-rounded=\"\"]>:only-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem);border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]),:host [data-rounded=top]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]),:host [data-rounded=top-left]{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]),:host [data-rounded=top-right]{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]),:host [data-rounded=bottom]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]),:host [data-rounded=bottom-left]{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]),:host [data-rounded=bottom-right]{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child,:host [data-rounded=top]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child,:host [data-rounded=top]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child,:host [data-rounded=top-left]:not([data-stacked])>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=top-left]:not([data-stacked])>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child,:host [data-rounded=top-right]:not([data-stacked])>:last-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=top-right]:not([data-stacked])>:last-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child,:host [data-rounded=bottom]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child,:host [data-rounded=bottom]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child,:host [data-rounded=bottom-left]:not([data-stacked])>:first-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left]:not([data-stacked]))>:first-child::part(button),:host [data-rounded=bottom-left]:not([data-stacked])>:first-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child,:host [data-rounded=bottom-right]:not([data-stacked])>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right]:not([data-stacked]))>:last-child::part(button),:host [data-rounded=bottom-right]:not([data-stacked])>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child,:host [data-rounded=top][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top][data-stacked])>:first-child::part(button),:host [data-rounded=top][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem);border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child,:host [data-rounded=top-right][data-stacked]>:first-child{border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-right][data-stacked])>:first-child::part(button),:host [data-rounded=top-right][data-stacked]>:first-child::part(button){border-start-end-radius:calc(var(--cds-aichat-border-radius-start-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child,:host [data-rounded=top-left][data-stacked]>:first-child{border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=top-left][data-stacked])>:first-child::part(button),:host [data-rounded=top-left][data-stacked]>:first-child::part(button){border-start-start-radius:calc(var(--cds-aichat-border-radius-start-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child,:host [data-rounded=bottom][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom][data-stacked])>:last-child::part(button),:host [data-rounded=bottom][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem);border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child,:host [data-rounded=bottom-right][data-stacked]>:last-child{border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-right][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-right][data-stacked]>:last-child::part(button){border-end-end-radius:calc(var(--cds-aichat-border-radius-end-end, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child,:host [data-rounded=bottom-left][data-stacked]>:last-child{border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host :host([data-rounded=bottom-left][data-stacked])>:last-child::part(button),:host [data-rounded=bottom-left][data-stacked]>:last-child::part(button){border-end-start-radius:calc(var(--cds-aichat-border-radius-end-start, var(--cds-aichat-border-radius)) - .0625rem)}:host{--cds-aichat-border-radius-start-start:0.5rem;--cds-aichat-border-radius-start-end:0.5rem;--cds-aichat-border-radius-end-start:0.5rem;--cds-aichat-border-radius-end-end:0.5rem;--cds-aichat-autocomplete-max-height:none}:host .cds-aichat-autocomplete{background:var(--cds-chat-prompt-background,#fff);border:1px solid var(--cds-chat-prompt-border-start,#f4f4f4);border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0);border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0);display:flex;flex-direction:column;max-block-size:var(--cds-aichat-autocomplete-max-height)}:host .cds-aichat-autocomplete__header{align-items:center;border-block-end:1px solid var(--cds-border-subtle-00,#e0e0e0);display:flex;flex-shrink:0;gap:1rem;justify-content:space-between;min-block-size:2.5rem;padding-block:0;padding-inline:1rem}:host .cds-aichat-autocomplete__title{color:var(--cds-text-primary,#161616);font-size:var(--cds-heading-compact-01-font-size,.875rem);font-weight:var(--cds-heading-compact-01-font-weight,600);letter-spacing:var(--cds-heading-compact-01-letter-spacing,.16px);line-height:var(--cds-heading-compact-01-line-height,1.28572)}:host .cds-aichat-autocomplete__items{display:flex;flex:1 1 auto;flex-direction:column;margin:0;min-block-size:0;overflow-y:auto;padding:0}:host .cds-aichat-autocomplete__live-region{clip:rect(0,0,0,0);block-size:1px;border:0;inline-size:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap}:host .cds-aichat-autocomplete-item-group__title{color:var(--cds-text-helper,#6f6f6f);font-size:var(--cds-label-01-font-size,.75rem);font-weight:var(--cds-label-01-font-weight,400);letter-spacing:var(--cds-label-01-letter-spacing,.32px);line-height:var(--cds-label-01-line-height,1.33333);padding-block-end:.25rem;padding-block-start:1rem;padding-inline:1rem}:host .cds-aichat-autocomplete-item-group__items{display:flex;flex-direction:column;margin:0;padding:0}:host .cds-aichat-autocomplete-item{align-items:start;background:none;border:none;cursor:pointer;display:flex;font:inherit;inline-size:100%;min-block-size:2.5rem;padding-block:0;padding-inline:0;position:relative;text-align:start}:host .cds-aichat-autocomplete-item:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-aichat-autocomplete-item:focus{outline:2px solid var(--cds-focus,#0f62fe);outline-offset:-2px}@media screen and (prefers-contrast){:host .cds-aichat-autocomplete-item:focus{outline-style:dotted}}:host .cds-aichat-autocomplete-item--active,:host .cds-aichat-autocomplete-item--active:hover{background:var(--cds-background-hover,hsla(0,0%,55%,.12))}:host .cds-aichat-autocomplete-item--disabled{cursor:default;pointer-events:none}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__label-remainder,:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__label-typed{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__description{color:var(--cds-text-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item--disabled .cds-aichat-autocomplete-item__send-icon svg{fill:var(--cds-icon-disabled,hsla(0,0%,9%,.25))}:host .cds-aichat-autocomplete-item__content{align-items:start;display:flex;flex:1;gap:.5rem;padding-block:11px;padding-inline:1rem}:host .cds-aichat-autocomplete-item__text{display:flex;flex-direction:column;gap:.125rem}:host .cds-aichat-autocomplete-item__label{font-size:var(--cds-body-compact-01-font-size,.875rem);font-weight:var(--cds-body-compact-01-font-weight,400);letter-spacing:var(--cds-body-compact-01-letter-spacing,.16px);line-height:var(--cds-body-compact-01-line-height,1.28572)}:host .cds-aichat-autocomplete-item__label-typed{color:var(--cds-text-placeholder,hsla(0,0%,9%,.4))}:host .cds-aichat-autocomplete-item__label-remainder{color:var(--cds-text-primary,#161616)}:host .cds-aichat-autocomplete-item__description{color:var(--cds-text-secondary,#525252);font-size:var(--cds-helper-text-01-font-size,.75rem);letter-spacing:var(--cds-helper-text-01-letter-spacing,.32px);line-height:var(--cds-helper-text-01-line-height,1.33333)}:host .cds-aichat-autocomplete-item__send-icon{align-self:start;display:flex;padding-block:.75rem;padding-inline:.75rem;pointer-events:none;visibility:hidden;z-index:1}:host .cds-aichat-autocomplete-item__send-icon svg{fill:var(--cds-interactive,#0f62fe)}:host .cds-aichat-autocomplete-item--active .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:focus .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:focus-within .cds-aichat-autocomplete-item__send-icon,:host .cds-aichat-autocomplete-item:hover .cds-aichat-autocomplete-item__send-icon{visibility:visible}:host .cds-aichat-autocomplete-item:after{background:var(--cds-border-subtle-00,#e0e0e0);block-size:1px;content:\"\";display:block;inset-block-end:0;inset-inline:1rem;position:absolute}:host .cds-aichat-autocomplete-item:focus:after,:host .cds-aichat-autocomplete-item:hover:after{display:none}:host .cds-aichat-autocomplete-item[first-item]{border-start-end-radius:var(--cds-aichat-border-radius-start-end,0);border-start-start-radius:var(--cds-aichat-border-radius-start-start,0)}:host .cds-aichat-autocomplete-item[last-item]{border-end-end-radius:var(--cds-aichat-border-radius-end-end,0);border-end-start-radius:var(--cds-aichat-border-radius-end-start,0)}:host .cds-aichat-autocomplete-item[last-item]:after{display:none}:host([attached]){--cds-aichat-border-radius-end-start:0;--cds-aichat-border-radius-end-end:0}"]);
11
11
 
12
12
  export { styles as default };
13
13
  //# sourceMappingURL=autocomplete.scss.js.map
@@ -9,7 +9,7 @@
9
9
  /**
10
10
  * Max block size the prompt line grows to before it caps and shows a vertical
11
11
  * scrollbar. Shared by both editing surfaces — the lite `<textarea>`
12
- * ([./prompt-line-controller.ts]) and the rich Tiptap content node
12
+ * ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node
13
13
  * ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and
14
14
  * the textarea→rich swap stays imperceptible. Keep them reading this one
15
15
  * constant so they can't drift.
@@ -25,3 +25,11 @@ export declare const HISTORY_DEFAULTS: {
25
25
  readonly depth: 100;
26
26
  readonly newGroupDelay: 500;
27
27
  };
28
+ /**
29
+ * How long (in milliseconds) to wait after the last keystroke before the
30
+ * `cds-aichat-prompt-typing` event fires with `isTyping = false`. Shared by
31
+ * the textarea controller ([./prompt-line-textarea-runtime.ts]) and the
32
+ * Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the
33
+ * two surfaces can't drift.
34
+ */
35
+ export declare const TYPING_TIMEOUT_MS = 5000;
@@ -16,7 +16,7 @@
16
16
  /**
17
17
  * Max block size the prompt line grows to before it caps and shows a vertical
18
18
  * scrollbar. Shared by both editing surfaces — the lite `<textarea>`
19
- * ([./prompt-line-controller.ts]) and the rich Tiptap content node
19
+ * ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node
20
20
  * ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and
21
21
  * the textarea→rich swap stays imperceptible. Keep them reading this one
22
22
  * constant so they can't drift.
@@ -29,6 +29,14 @@ const PROMPT_LINE_MAX_BLOCK_SIZE = '157px';
29
29
  * the lazily-imported Tiptap chunk. Re-exported from [./tiptap/index.ts].
30
30
  */
31
31
  const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 };
32
+ /**
33
+ * How long (in milliseconds) to wait after the last keystroke before the
34
+ * `cds-aichat-prompt-typing` event fires with `isTyping = false`. Shared by
35
+ * the textarea controller ([./prompt-line-textarea-runtime.ts]) and the
36
+ * Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the
37
+ * two surfaces can't drift.
38
+ */
39
+ const TYPING_TIMEOUT_MS = 5000;
32
40
 
33
- export { HISTORY_DEFAULTS, PROMPT_LINE_MAX_BLOCK_SIZE };
41
+ export { HISTORY_DEFAULTS, PROMPT_LINE_MAX_BLOCK_SIZE, TYPING_TIMEOUT_MS };
34
42
  //# sourceMappingURL=prompt-line-constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-line-constants.js","sources":["../../../../src/components/prompt-line/src/prompt-line-constants.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 * Max block size the prompt line grows to before it caps and shows a vertical\n * scrollbar. Shared by both editing surfaces — the lite `<textarea>`\n * ([./prompt-line-controller.ts]) and the rich Tiptap content node\n * ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and\n * the textarea→rich swap stays imperceptible. Keep them reading this one\n * constant so they can't drift.\n */\nexport const PROMPT_LINE_MAX_BLOCK_SIZE = '157px';\n\n/**\n * Undo/redo tuning for the rich editor's `UndoRedo` extension. Lives here rather\n * than in the tiptap barrel so [./prompt-line-rich-runtime.ts] can read it\n * without importing the barrel — that would pull the whole curated bundle into\n * the lazily-imported Tiptap chunk. Re-exported from [./tiptap/index.ts].\n */\nexport const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 } as const;\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;AAOG;AACI,MAAM,0BAA0B,GAAG;AAE1C;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG;;"}
1
+ {"version":3,"file":"prompt-line-constants.js","sources":["../../../../src/components/prompt-line/src/prompt-line-constants.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 * Max block size the prompt line grows to before it caps and shows a vertical\n * scrollbar. Shared by both editing surfaces — the lite `<textarea>`\n * ([./prompt-line-textarea-runtime.ts]) and the rich Tiptap content node\n * ([./tiptap/editor-styles.ts]) — so the two modes cap at the same height and\n * the textarea→rich swap stays imperceptible. Keep them reading this one\n * constant so they can't drift.\n */\nexport const PROMPT_LINE_MAX_BLOCK_SIZE = '157px';\n\n/**\n * Undo/redo tuning for the rich editor's `UndoRedo` extension. Lives here rather\n * than in the tiptap barrel so [./prompt-line-rich-runtime.ts] can read it\n * without importing the barrel — that would pull the whole curated bundle into\n * the lazily-imported Tiptap chunk. Re-exported from [./tiptap/index.ts].\n */\nexport const HISTORY_DEFAULTS = { depth: 100, newGroupDelay: 500 } as const;\n\n/**\n * How long (in milliseconds) to wait after the last keystroke before the\n * `cds-aichat-prompt-typing` event fires with `isTyping = false`. Shared by\n * the textarea controller ([./prompt-line-textarea-runtime.ts]) and the\n * Tiptap typing-indicator extension ([./tiptap/typing-indicator.ts]) so the\n * two surfaces can't drift.\n */\nexport const TYPING_TIMEOUT_MS = 5000;\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;AAOG;AACI,MAAM,0BAA0B,GAAG;AAE1C;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG;AAEhE;;;;;;AAMG;AACI,MAAM,iBAAiB,GAAG;;"}
@@ -7,25 +7,10 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
  /**
10
- * Editing-surface controller abstraction for `<cds-aichat-prompt-line>`.
10
+ * Shared types for the prompt-line controller abstraction.
11
11
  *
12
- * The prompt-line shell ([./prompt-line.ts]) delegates all editing behavior to
13
- * a `PromptLineController`. Two implementations exist:
14
- *
15
- * - `TextareaController` (this file) — a Tiptap-free `<textarea>`. It is the
16
- * default and keeps the shell's static import graph free of `@tiptap/*`.
17
- * - The rich controller ([./prompt-line-rich-runtime.ts]) — a Tiptap `Editor`,
18
- * reached only through a dynamic `import()` so Tiptap lands in its own lazy
19
- * chunk.
20
- *
21
- * Both controllers emit the **same** `cds-aichat-prompt-*` events with the
22
- * same detail shapes, so the React wrapper and `@carbon/ai-chat`'s `Input`
23
- * handlers are identical regardless of mode. The shell can swap a
24
- * `TextareaController` for the rich controller in place (text, caret, and
25
- * focus transfer losslessly because the textarea holds plain text).
26
- *
27
- * `Editor` / `JSONContent` are **type-only** imports here — erased at compile,
28
- * so this module carries no Tiptap runtime.
12
+ * `Editor` / `JSONContent` / `Extension` are **type-only** imports here —
13
+ * erased at compile, so this module carries no Tiptap runtime.
29
14
  */
30
15
  import type { Editor, Extension, JSONContent } from '@tiptap/core';
31
16
  /** Updater shape accepted by `setContent` for reduce-style edits. */
@@ -55,8 +40,24 @@ export interface PromptLineControllerInit {
55
40
  extensions?: Extension[];
56
41
  }
57
42
  /**
58
- * The surface the shell drives. Both the textarea and the rich editor satisfy
59
- * it, so the shell never branches on mode beyond construction.
43
+ * The editing-surface controller abstraction for `<cds-aichat-prompt-line>`.
44
+ *
45
+ * The prompt-line shell ([./prompt-line.ts]) delegates all editing behavior to
46
+ * a `PromptLineController`. Two implementations exist:
47
+ *
48
+ * - `TextareaController` (./prompt-line-textarea-runtime.ts) — a Tiptap-free
49
+ * `<textarea>`. It is the default and keeps the shell's static import graph
50
+ * free of `@tiptap/*`.
51
+ * - The rich controller ([./prompt-line-rich-runtime.ts]) — a Tiptap `Editor`,
52
+ * reached only through a dynamic `import()` so Tiptap lands in its own lazy
53
+ * chunk.
54
+ *
55
+ * Both controllers emit the **same** `cds-aichat-prompt-*` events with the
56
+ * same detail shapes, so the React wrapper and `@carbon/ai-chat`'s `Input`
57
+ * handlers are identical regardless of mode. The shell can swap a
58
+ * `TextareaController` for the rich controller in place (text, caret, focus,
59
+ * and keyboard-focus state transfer losslessly because the textarea holds plain
60
+ * text and both controllers share the same focus-tracking contract).
60
61
  */
61
62
  export interface PromptLineController {
62
63
  /** Mount the editing surface into the (already-slotted) light-DOM host. */
@@ -72,7 +73,8 @@ export interface PromptLineController {
72
73
  clearContent(): void;
73
74
  /** Live Tiptap editor, or `null` in textarea mode. */
74
75
  getEditor(): Editor | null;
75
- focus(): void;
76
+ /** Accepts `keyboardFocus`, which when true specifies that a focus ring should be visible around the prompt line text area */
77
+ focus(keyboardFocus: boolean): void;
76
78
  blur(): void;
77
79
  hasFocus(): boolean;
78
80
  /** Selection as plain-text offsets (used for seamless transfer). */
@@ -108,61 +110,6 @@ export interface PromptLineController {
108
110
  setComposing(composing: boolean): void;
109
111
  undo(): boolean;
110
112
  redo(): boolean;
111
- }
112
- /**
113
- * `<textarea>`-backed controller. Tiptap-free; emits the same prompt events as
114
- * the rich editor. Auto-grows via a hidden mirror, capped at
115
- * `PROMPT_LINE_MAX_BLOCK_SIZE` with the field scrolling past it — the same cap
116
- * the rich contenteditable applies (see ./tiptap/editor-styles.ts), so the
117
- * textarea→rich swap is imperceptible.
118
- */
119
- export declare class TextareaController implements PromptLineController {
120
- private _wrap;
121
- private _textarea;
122
- private _mirror;
123
- private _host;
124
- private _focusFromMouse;
125
- private _isTyping;
126
- private _typingTimer;
127
- mount(host: HTMLElement, init: PromptLineControllerInit): void;
128
- destroy(): void;
129
- getValue(): string;
130
- setContent(next: JSONContent | string | SetContentUpdater): void;
131
- insertContent(content: JSONContent | string, opts?: {
132
- at?: number;
133
- }): void;
134
- clearContent(): void;
135
- getEditor(): Editor | null;
136
- focus(): void;
137
- blur(): void;
138
- hasFocus(): boolean;
139
- getSelection(): {
140
- from: number;
141
- to: number;
142
- };
143
- setTextSelection(pos: number | {
144
- from: number;
145
- to: number;
146
- }): void;
147
- selectAll(): void;
148
- setEditable(editable: boolean): void;
149
- setPlaceholder(placeholder: string): void;
150
- setAriaLabel(ariaLabel: string): void;
151
- setTestId(testId: string): void;
152
- setExtensions(_extensions: Extension[]): void;
153
- setComposing(_composing: boolean): void;
154
- undo(): boolean;
155
- redo(): boolean;
156
- private _onInput;
157
- private _onKeydown;
158
- private _setMouseFlag;
159
- private _onFocus;
160
- private _onBlur;
161
- /** Programmatic value write: updates the field, mirror, and emits change. */
162
- private _setValue;
163
- private _emitChange;
164
- private _syncMirror;
165
- private _markTyping;
166
- private _clearTypingTimer;
167
- private _dispatch;
113
+ /** Whether the most recent focus event was driven by keyboard (not pointer/touch-driven). */
114
+ getKeyboardFocus(): boolean;
168
115
  }